deploymentContext = new RootDeploymentContext(null, null, mock, null);
}
@SuppressWarnings("unchecked")
public void testBuildConnect() throws Exception {
CompositeComponent parent = new CompositeComponentImpl(null, null, null, null);
CompositeBuilder builder = new CompositeBuilder();
WireService wireService = new JDKWireService();
builder.setWireService(wireService);
BuilderRegistryImpl builderRegistry = new BuilderRegistryImpl();
builderRegistry.setWireService(wireService);
JavaComponentBuilder jBuilder = new JavaComponentBuilder();
jBuilder.setWireService(wireService);
builderRegistry.register(JavaImplementation.class, jBuilder);
builderRegistry.register(CompositeImplementation.class, builder);
CompositeBindlessBuilder bindlessBuilder = new CompositeBindlessBuilder();
bindlessBuilder.setWireService(wireService);
builderRegistry.register(bindlessBuilder);
builder.setBuilderRegistry(builderRegistry);
CompositeComponent component =
(CompositeComponent) builder.build(parent, createTopComponentDef(), deploymentContext);
ConnectorImpl connector = new ConnectorImpl();
connector.connect(component);
deploymentContext.getModuleScope().start();
component.start();
CompositeComponent sourceComponent = (CompositeComponent) component.getChild("SourceComponent");
Source source = (Source) sourceComponent.getServiceInstance("InnerSourceService");
assertNotNull(source);
AtomicComponent innerSourceComponent = (AtomicComponent) sourceComponent.getChild("InnerSourceComponent");
Source innerSourceInstance = (Source) deploymentContext.getModuleScope().getInstance(innerSourceComponent);
assertNotNull(innerSourceInstance);
component.stop();
}