}
  
  public void testRegistrationAndListener() {
    ComponentInstance im = new FakeComponent();
    ComponentInstance im2 = new FakeComponent();
    ServiceRegistry registry = new ServiceRegistry(getContext());
    assertNotNull("Assert registry not null", registry);
    svcListener all = new svcListener();
    try {
      assertNull("Check that there is no available service", registry.getServiceReferences(null, null));
    } catch (InvalidSyntaxException e) { fail("Cannot query the registry : " + e.getMessage()); }
    registry.addServiceListener(all);
    
    ServiceRegistration reg1 = registry.registerService(im, BarService.class.getName(), new barProvider(), null);
    
    try {
      assertEquals("Check number of registred service", 1, registry.getServiceReferences(null, null).length);
    } catch (InvalidSyntaxException e) { fail("Cannot query the registry : " + e.getMessage()); 
     }
  
      ServiceRegistration reg2 = registry.registerService(im2, BarService.class.getName(), new barProvider(), null);
      
     try {
      assertEquals("Check number of registred service", 2, registry.getServiceReferences(null, null).length);
    } catch (InvalidSyntaxException e) { fail("Cannot query the registry : " + e.getMessage()); }
      
    assertEquals("Check the number of registration", 2, all.registration);
    
    Properties props = new Properties();
    props.put("foo", "bar");
    reg1.setProperties(props);
    assertEquals("Check the number of modification", 1, all.modification);
    
    reg1.unregister();
    assertEquals("Check the number of unregistration", 1, all.unregistration);
    
    reg2.setProperties(props);
    assertEquals("Check the number of modification", 2, all.modification);
    
    reg2.unregister();
    assertEquals("Check the number of unregistration", 2, all.unregistration);
    
    registry.removeServiceListener(all);
  }