// Check object graph
//id_dep = ((Architecture) osgiHelper.getRawServiceObject(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
//id_ps1 = ((Architecture) osgiHelper.getRawServiceObject(arch_ps1)).getInstanceDescription();
ProvidedServiceHandlerDescription psh = getPSDesc(id_ps1);
assertEquals("Check POJO creation", id_ps1.getCreatedObjects().length, 1);
// Start a second foo service provider
fooProvider2.start();
arch_ps1 = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), fooProvider1.getInstanceName());
ServiceReference arch_ps2 = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check architecture availability", arch_ps1);
assertNotNull("Check architecture 2 availability", arch_ps2);
//id_ps1 = ((Architecture) osgiHelper.getRawServiceObject(arch_ps1)).getInstanceDescription();
PrimitiveInstanceDescription id_ps2 = (PrimitiveInstanceDescription) ((Architecture) osgiHelper.getRawServiceObject(arch_ps2)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_ps1.getState() == ComponentInstance.VALID);
assertTrue("Check instance 2 invalidity - 1", id_ps2.getState() == ComponentInstance.VALID);
//id_dep = ((Architecture) osgiHelper.getRawServiceObject(arch_dep)).getInstanceDescription();
assertTrue("Check instance validity", id_dep.getState() == ComponentInstance.VALID);
dhd = getDependencyDesc(id_dep);
assertTrue("Check dependency handler validity", dhd.isValid());
assertEquals("Check dependency ref - 3 ", dhd.getDependencies()[0].getServiceReferences().size(), 2);
assertEquals("Check used ref - 2 ", dhd.getDependencies()[0].getUsedServices().size(), 1); // provider 2 not already used
cs_ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
cs = (CheckService) osgiHelper.getRawServiceObject(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check object graph
//id_dep = ((Architecture) osgiHelper.getRawServiceObject(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
//id_ps1 = ((Architecture) osgiHelper.getRawServiceObject(arch_ps1)).getInstanceDescription();
//id_ps2 = ((Architecture) osgiHelper.getRawServiceObject(arch_ps1)).getInstanceDescription();
ProvidedServiceHandlerDescription psh1 = getPSDesc(id_ps1);
ProvidedServiceHandlerDescription psh2 = getPSDesc(id_ps2);
assertEquals("Check POJO creation", id_ps1.getCreatedObjects().length, 1);
assertEquals("Check POJO creation", id_ps2.getCreatedObjects().length, 1);
assertEquals("Check used ref - 3 (" + dhd.getDependencies()[0].getUsedServices().size() + ")", dhd.getDependencies()[0].getUsedServices().size(), 2);
fooProvider2.stop();