Package org.apache.tuscany.spi.implementation.java

Examples of org.apache.tuscany.spi.implementation.java.JavaMappedService


    private ImplementationProcessorService implService =
        new ImplementationProcessorServiceImpl(new JavaInterfaceProcessorRegistryImpl());

    public void testCreateConversationalService() throws Exception {
        JavaMappedService service = implService.createService(Foo.class);
        assertTrue(Foo.class.equals(service.getServiceContract().getInterfaceClass()));
        assertTrue(service.isRemotable());
        assertEquals(InteractionScope.CONVERSATIONAL, service.getServiceContract().getInteractionScope());
        ServiceContract serviceContract = service.getServiceContract();
        assertTrue(Bar.class.equals(serviceContract.getCallbackClass()));
        assertTrue("ImplementationProcessorServiceTestCase$Bar".equals(serviceContract.getCallbackName()));
    }
View Full Code Here


        assertTrue(Bar.class.equals(serviceContract.getCallbackClass()));
        assertTrue("ImplementationProcessorServiceTestCase$Bar".equals(serviceContract.getCallbackName()));
    }

    public void testCreateDefaultService() throws Exception {
        JavaMappedService service = implService.createService(Baz.class);
        assertTrue(Baz.class.equals(service.getServiceContract().getInterfaceClass()));
        assertTrue(!service.isRemotable());
        assertEquals(InteractionScope.NONCONVERSATIONAL, service.getServiceContract().getInteractionScope());
    }
View Full Code Here

            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
        componentType.setImplementationScope(Scope.MODULE);
        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 =
            new ComponentDefinition<SystemImplementation>(impl);
View Full Code Here

        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);

        sourceType.add(sourceServiceDefinition);
        sourceType.setConstructorDefinition(new ConstructorDefinition<SourceImpl>(SourceImpl.class.getConstructor()));
        JavaImplementation sourceImpl = new JavaImplementation();
        sourceImpl.setComponentType(sourceType);
View Full Code Here

        JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
        ServiceContract<?> targetContract = registry.introspect(Target.class);
        targetContract.setCallbackClass(OtherTarget.class);
        targetContract.setCallbackName("OtherTarget");

        JavaMappedService serviceDefinition = new JavaMappedService();
        serviceDefinition.setName("Target");
        serviceDefinition.setServiceContract(targetContract);
        serviceDefinition.setCallbackReferenceName("otherTarget");

        targetType.add(serviceDefinition);
        targetType.setConstructorDefinition(new ConstructorDefinition<TargetImpl>(TargetImpl.class.getConstructor()));
        JavaImplementation targetImpl = new JavaImplementation();
        targetImpl.setComponentType(targetType);
View Full Code Here

        Method method = FooImpl.class.getMethod("setCallback", FooCallback.class);
        JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
        ServiceContract<?> contract = registry.introspect(Foo.class);
        contract.setCallbackClass(FooCallback.class);
        contract.setCallbackName("callback");
        JavaMappedService mappedService = new JavaMappedService("Foo", contract, false, "callback", method);
        type.getServices().put("Foo", mappedService);

        JavaImplementation impl = new JavaImplementation();
        impl.setComponentType(type);
        impl.setImplementationClass(FooImpl.class);
View Full Code Here

        reference.setName("target");
        reference.setMember(SourceImpl.class.getMethod("setTarget", Target.class));
        sourceType.add(reference);

        ServiceContract<?> sourceContract = new JavaServiceContract(Source.class);
        JavaMappedService sourceServiceDefinition = new JavaMappedService();
        sourceServiceDefinition.setName("Source");
        sourceServiceDefinition.setServiceContract(sourceContract);

        sourceType.add(sourceServiceDefinition);
        Constructor<SourceImpl> constructor = SourceImpl.class.getConstructor((Class[]) null);
        sourceType.setConstructorDefinition(new ConstructorDefinition<SourceImpl>(constructor));
        JavaImplementation sourceImpl = new JavaImplementation();
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.implementation.java.JavaMappedService

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.