ServiceReference[] refs = osgi.getServiceReferences(Factory.class.getName(),
"(component.providedServiceSpecifications=" + Foo.class.getName() +")");
assertThat(refs.length, is(not(0)));
CompositeComponentType type = new CompositeComponentType()
.setBundleContext(context)
.setComponentTypeName("comp2")
.addSubService(new ImportedService().setSpecification(Foo.class.getName()))
.addInstance(new Instance(cons.getFactory().getName()));
ComponentInstance ci = type.createInstance();
System.out.println(ci.getInstanceDescription().getDescription());
assertThat("ci is valid", ci.getState(), is(ComponentInstance.VALID));