assertTrue(instance.getState() == ComponentInstance.VALID);
DependencyHandlerDescription desc = (DependencyHandlerDescription) instance.getInstanceDescription().getHandlerDescription("org.apache.felix" +
".ipojo:requires");
// Only one dependency.
DependencyDescription dependency = desc.getDependencies()[0];
assertEquals("(id=2)", dependency.getFilter());
// Reconfigure the instance.
Properties newProps = new Properties();
newProps.put("instance.id", "3");
instance.reconfigure(newProps);
assertTrue(instance.getState() == ComponentInstance.INVALID);
desc = (DependencyHandlerDescription) instance.getInstanceDescription().getHandlerDescription("org.apache.felix" +
".ipojo:requires");
// Only one dependency.
dependency = desc.getDependencies()[0];
assertEquals("(id=3)", dependency.getFilter());
// Another reconfiguration (that does not affect the filters)
newProps = new Properties();
newProps.put("instance.id", "3");
newProps.put("stuff", "stuff");
instance.reconfigure(newProps);
assertTrue(instance.getState() == ComponentInstance.INVALID);
desc = (DependencyHandlerDescription) instance.getInstanceDescription().getHandlerDescription("org.apache.felix" +
".ipojo:requires");
// Only one dependency.
dependency = desc.getDependencies()[0];
assertEquals("(id=3)", dependency.getFilter());
// Yet another reconfiguration, un-setting instance.id
newProps = new Properties();
newProps.put("stuff", "stuff");
instance.reconfigure(newProps);
assertTrue(instance.getState() == ComponentInstance.INVALID);
desc = (DependencyHandlerDescription) instance.getInstanceDescription().getHandlerDescription("org.apache.felix" +
".ipojo:requires");
// Only one dependency.
dependency = desc.getDependencies()[0];
assertEquals("(id=${instance.id})", dependency.getFilter());
// Finally another reconfiguration to build a fulfilled filter
newProps = new Properties();
newProps.put("instance.id", "1");
newProps.put("stuff", "stuff");
instance.reconfigure(newProps);
assertTrue(instance.getState() == ComponentInstance.VALID);
desc = (DependencyHandlerDescription) instance.getInstanceDescription().getHandlerDescription("org.apache.felix" +
".ipojo:requires");
// Only one dependency.
dependency = desc.getDependencies()[0];
assertEquals("(id=1)", dependency.getFilter());
}