CompositeComponent grandParent = new CompositeComponentImpl("grandparent", null, null, null);
CompositeComponent parent = new CompositeComponentImpl("parent", grandParent, null, null);
// create a context in the grandparent that the reference will be autowired to
ComponentDefinition<SystemImplementation> targetComponentDefinition = MockComponentFactory.createTarget();
AtomicComponent targetComponentComponent = builder.build(parent, targetComponentDefinition, deploymentContext);
grandParent.register(targetComponentComponent);
BoundReferenceDefinition<SystemBinding> targetReferenceDefinition = MockComponentFactory.createBoundReference();
ComponentDefinition<SystemImplementation> sourceComponentDefinition =
MockComponentFactory.createSourceWithTargetReference();
AtomicComponent sourceComponent = builder.build(parent, sourceComponentDefinition, deploymentContext);
Reference reference = bindingBuilder.build(parent, targetReferenceDefinition, deploymentContext);
parent.register(sourceComponent);
parent.register(reference);
connector.connect(reference.getInboundWire(), reference.getOutboundWire(), true);