// register a service with PID
String pid = "testAfterCreation";
MockManagedService service = new MockManagedService();
Dictionary props = new Hashtable();
props.put( Constants.SERVICE_PID, pid );
ServiceRegistration sr = bundleContext.registerService( ManagedService.class.getName(), service, props );
// locales should contain MockMetaTypeProvider.LOCALES
assertNotNull( mti.getLocales() );
assertTrue( mti.getLocales().length == 1 );
assertEquals( MockMetaTypeProvider.LOCALES[0], mti.getLocales()[0] );
// pids must contain pid
assertNotNull( mti.getPids() );
assertTrue( mti.getPids().length == 1 );
assertEquals( pid, mti.getPids()[0] );
// change the service PID
String pid2 = "testAfterCreation2";
Dictionary props2 = new Hashtable();
props2.put( Constants.SERVICE_PID, pid2 );
sr.setProperties( props2 );
// pids must contain pid2
assertNotNull( mti.getPids() );
assertTrue( mti.getPids().length == 1 );
assertEquals( pid2, mti.getPids()[0] );
// factoryPids must be empty
assertTrue( mti.getFactoryPids() == null || mti.getFactoryPids().length == 0 );
// unregister the service
sr.unregister();
// ensure everything is clear now again
checkEmpty( mti );
}