Package org.apache.tuscany.spi.idl.java

Examples of org.apache.tuscany.spi.idl.java.JavaServiceContract


        JavaMappedReference reference;
        try {
            reference = new JavaMappedReference();
            reference.setName("target");
            reference.setMember(SourceImpl.class.getMethod("setTarget", Target.class));
            JavaServiceContract contract = new JavaServiceContract();
            contract.setInterfaceClass(Target.class);
            reference.setServiceContract(contract);
            componentType.add(reference);
        } catch (NoSuchMethodException e) {
            throw new AssertionError(e);
        }
View Full Code Here


        try {
            reference = new JavaMappedReference();
            reference.setName("target");
            reference.setMember(SourceImpl.class.getMethod("setTarget", Target.class));
            reference.setAutowire(true);
            ServiceContract<?> contract = new JavaServiceContract();
            contract.setInterfaceClass(Target.class);
            reference.setServiceContract(contract);
            componentType.add(reference);
        } catch (NoSuchMethodException e) {
            throw new AssertionError(e);
        }
View Full Code Here

        componentType
            .setConstructorDefinition(
                new ConstructorDefinition<TargetImpl>(TargetImpl.class.getConstructor((Class[]) null)));
        JavaMappedService targetServiceDefinition = new JavaMappedService();
        targetServiceDefinition.setName("Target");
        ServiceContract<?> contract = new JavaServiceContract();
        contract.setInterfaceClass(Target.class);
        targetServiceDefinition.setServiceContract(contract);
        componentType.add(targetServiceDefinition);
        impl.setComponentType(componentType);
        impl.setImplementationClass(TargetImpl.class);
        ComponentDefinition<SystemImplementation> targetComponentDefinition =
View Full Code Here

    public static BoundReferenceDefinition<SystemBinding> createBoundReference() {
        SystemBinding binding = new SystemBinding();
        BoundReferenceDefinition<SystemBinding> referenceDefinition = new BoundReferenceDefinition<SystemBinding>();
        referenceDefinition.setBinding(binding);
        referenceDefinition.setName("target");
        ServiceContract<?> contract = new JavaServiceContract();
        contract.setInterfaceClass(Target.class);
        referenceDefinition.setServiceContract(contract);
        return referenceDefinition;
    }
View Full Code Here

    public static BoundServiceDefinition<SystemBinding> createBoundService() {
        SystemBinding binding = new SystemBinding();
        BoundServiceDefinition<SystemBinding> serviceDefinition = new BoundServiceDefinition<SystemBinding>();
        serviceDefinition.setBinding(binding);
        serviceDefinition.setName("serviceDefinition");
        ServiceContract<?> contract = new JavaServiceContract();
        contract.setInterfaceClass(Target.class);
        serviceDefinition.setServiceContract(contract);
        try {
            serviceDefinition.setTarget(new URI("target/Target"));
        } catch (URISyntaxException e) {
            throw new AssertionError(e);
View Full Code Here

            new CompositeComponentType<ServiceDefinition, ReferenceDefinition, JavaMappedProperty<?>>();
        innerType.add(createInnerSourceComponentDef());
        ReferenceDefinition reference = new ReferenceDefinition();
        reference.setName("TargetComponentRef");
        JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
        JavaServiceContract targetContract = registry.introspect(Target.class);
        reference.setServiceContract(targetContract);
        innerType.add(reference);
        BindlessServiceDefinition service = new BindlessServiceDefinition();
        service.setName("InnerSourceService");
        JavaServiceContract sourceContract = registry.introspect(Source.class);
        service.setServiceContract(sourceContract);
        service.setTarget(new URI("InnerSourceComponent"));
        innerType.add(service);

        CompositeImplementation innerImpl = new CompositeImplementation();
View Full Code Here

    public void testSingleConstructorWithRef() throws Exception {
        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
        JavaMappedReference ref = new JavaMappedReference();
        ref.setName("foo");
        ServiceContract contract = new JavaServiceContract(String.class);
        ref.setServiceContract(contract);
        type.getReferences().put("foo", ref);
        processor.visitEnd(null, Foo1.class, type, null);
        assertNotNull(type.getConstructorDefinition().getConstructor());
        assertEquals("foo", type.getConstructorDefinition().getInjectionNames().get(0));
View Full Code Here

        prop.setJavaType(String.class);
        type.getProperties().put("foo", prop);

        JavaMappedReference ref = new JavaMappedReference();
        ref.setName("ref");
        ServiceContract contract = new JavaServiceContract(Foo1.class);
        ref.setServiceContract(contract);
        type.getReferences().put("ref", ref);
        processor.visitEnd(null, Foo2.class, type, null);
        assertNotNull(type.getConstructorDefinition().getConstructor());
        assertEquals(2, type.getConstructorDefinition().getInjectionNames().size());
View Full Code Here

    public void testSingleConstructorAmbiguousRef() throws Exception {
        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
        JavaMappedReference ref = new JavaMappedReference();
        ref.setName("ref");
        ServiceContract contract = new JavaServiceContract(Foo1.class);
        ref.setServiceContract(contract);
        type.getReferences().put("ref", ref);
        JavaMappedReference ref2 = new JavaMappedReference();
        ref2.setName("ref2");
        ref2.setServiceContract(contract);
View Full Code Here

* @version $Rev: 441106 $ $Date: 2006-09-07 07:59:22 -0700 (Thu, 07 Sep 2006) $
*/
public class CallbackWireObjectFactoryTestCase extends TestCase {

    public void testCreateInstance() throws Exception {
        JavaServiceContract contract = new JavaServiceContract();
        contract.setCallbackClass(Foo.class);
        WireService service = createMock(WireService.class);
        service.createCallbackProxy(contract, null);
        expectLastCall().andReturn(null);
        replay(service);
        CallbackWireObjectFactory factory = new CallbackWireObjectFactory(contract, service, null);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.idl.java.JavaServiceContract

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.