PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> sourceType =
new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
sourceType.setImplementationScope(Scope.MODULE);
JavaMappedReference reference = new JavaMappedReference();
reference.setName("targetReference");
JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
ServiceContract<?> targetContract = registry.introspect(Target.class);
targetContract.setCallbackClass(OtherTarget.class);
targetContract.setCallbackName("OtherTarget");
reference.setServiceContract(targetContract);
reference.setMember(SourceImpl.class.getMethod("setTarget", Target.class));
sourceType.add(reference);
ServiceContract<?> sourceContract = registry.introspect(Source.class);
JavaMappedService sourceServiceDefinition = new JavaMappedService();
sourceServiceDefinition.setName("Source");
sourceServiceDefinition.setServiceContract(sourceContract);