Package org.apache.tuscany.spi.model

Examples of org.apache.tuscany.spi.model.ServiceContract


        ComponentType comonentType = introspector.introspectScript(scaConfig, rs.getClassLoader());
        assertNotNull(comonentType);
        Map services = comonentType.getServices();
        assertEquals(1, services.size());
        ServiceDefinition serviceDefinition = (ServiceDefinition) services.values().iterator().next();
        ServiceContract serviceContract = serviceDefinition.getServiceContract();
        assertTrue(serviceContract instanceof JavaServiceContract);
        JavaServiceContract javaServiceContract = (JavaServiceContract) serviceContract;
        assertEquals(HelloWorldService.class, javaServiceContract.getInterfaceClass());
    }
View Full Code Here


        ComponentType comonentType = introspector.introspectScript(scaConfig, rs.getClassLoader());
        assertNotNull(comonentType);
        Map services = comonentType.getServices();
        assertEquals(1, services.size());
        ServiceDefinition serviceDefinition = (ServiceDefinition) services.values().iterator().next();
        ServiceContract serviceContract = serviceDefinition.getServiceContract();
        assertTrue(serviceContract instanceof WSDLServiceContract);
        WSDLServiceContract wsdlServiceContract = (WSDLServiceContract) serviceContract;
        assertEquals(new QName("http://helloworld", "HelloWorld"), wsdlServiceContract.getPortType().getQName());
    }
View Full Code Here

        JavaMappedReference mappedReference = new JavaMappedReference();
        mappedReference.setName("ref");
        Method refMethod = FooImpl.class.getMethod("setRef", Foo.class);
        refMethod.setAccessible(true);
        mappedReference.setMember(refMethod);
        ServiceContract contract = new JavaServiceContract(Foo.class);
        mappedReference.setServiceContract(contract);
        type.add(mappedReference);
        ConstructorDefinition<FooImpl> ctorDef = new ConstructorDefinition<FooImpl>(FooImpl.class.getConstructor());
        type.setConstructorDefinition(ctorDef);
        SystemImplementation impl = new SystemImplementation();
View Full Code Here

        mappedReference.setName("ref");
        mappedReference.setAutowire(true);
        Method refMethod = FooImpl.class.getMethod("setRef", Foo.class);
        refMethod.setAccessible(true);
        mappedReference.setMember(refMethod);
        ServiceContract contract = new JavaServiceContract(Foo.class);
        mappedReference.setServiceContract(contract);
        type.add(mappedReference);
        ConstructorDefinition<FooImpl> ctorDef = new ConstructorDefinition<FooImpl>(FooImpl.class.getConstructor());
        type.setConstructorDefinition(ctorDef);
        SystemImplementation impl = new SystemImplementation();
View Full Code Here

        impl.setComponentType(type);
        impl.setImplementationClass(FooImpl2.class);
        JavaMappedReference mappedReference = new JavaMappedReference();
        mappedReference.setName("ref");
        mappedReference.setAutowire(true);
        ServiceContract contract = new JavaServiceContract(Foo.class);
        mappedReference.setServiceContract(contract);
        type.add(mappedReference);
        ComponentDefinition<SystemImplementation> definition = new ComponentDefinition<SystemImplementation>(impl);
        CompositeComponent parent = EasyMock.createNiceMock(CompositeComponent.class);
        FooImpl targetFoo = new FooImpl();
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

        expect(def.getName()).andReturn("petra");
        RMIBinding binding = new RMIBinding();
        expect(def.getBinding()).andReturn(binding );
        expect(def.getBinding()).andReturn(binding );
        expect(def.getBinding()).andReturn(binding );
        ServiceContract sc = createMock(ServiceContract.class);
        expect(def.getServiceContract()).andReturn(sc);
        replay(def);
        Object ref = builder.build(null, def, null);
        assertTrue(ref instanceof RMIReference);
    }
View Full Code Here

    }

    public void testWithInterface() throws LoaderException, XMLStreamException {
        String name = "serviceDefinition";
        String target = "target";
        ServiceContract sc = new ServiceContract() {
        };
        expect(mockReader.getName()).andReturn(SERVICE).anyTimes();
        expect(mockReader.getAttributeValue(null, "name")).andReturn(name);
        expect(mockReader.next()).andReturn(START_ELEMENT);
        expect(mockReader.getName()).andReturn(INTERFACE_JAVA);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.model.ServiceContract

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.