ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), conf.getPid());
assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) arch.getInstanceDescription()).getCreatedObjects().length);
assertNotNull("FS availability", ref);
// arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) arch.getInstanceDescription()).getCreatedObjects().length);
assertEquals("Check message", "message", mes);
assertEquals("Check count", 1, count);
//Update
Configuration configuration;
try {
configuration = admin.getConfiguration(msp);
Dictionary prc = configuration.getProperties();
if (prc == null) {
prc = new Properties();
}
prc.put("message", "message2");
configuration.update(prc);
//Thread.sleep(ConfigurationTestSuite.UPDATE_WAIT_TIME);
listener.waitForEvent(configuration.getPid(), "1");
} catch (Exception e) {
fail(e.getMessage());
}
// arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), conf.getPid());
assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) arch.getInstanceDescription()).getCreatedObjects().length);
assertNotNull("FS availability", ref);
// arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) arch.getInstanceDescription()).getCreatedObjects().length);
if (mes.equals("message")) {
System.out.println("Warning, configuration not yet applied");