Package org.apache.tuscany.sca.implementation.java

Examples of org.apache.tuscany.sca.implementation.java.JavaImplementation


        String[] param5) {
        }
    }

    public void testMultiplicity() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<Multiple> ctor1 = Multiple.class.getConstructor(Collection.class,
                                                                    String[].class,
                                                                    List.class,
                                                                    Set.class,
                                                                    String[].class);
        processor.visitConstructor(ctor1, type);
        AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
        JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
        ReferenceProcessor referenceProcessor = new ReferenceProcessor(assemblyFactory, javaFactory);
        PropertyProcessor propertyProcessor = new PropertyProcessor(assemblyFactory);
        JavaParameterImpl[] parameters = type.getConstructor().getParameters();
        for (int i = 0; i < parameters.length; i++) {
            referenceProcessor.visitConstructorParameter(parameters[i], type);
            propertyProcessor.visitConstructorParameter(parameters[i], type);
        }
View Full Code Here


    Component parent;
    private JavaImplementationFactory javaImplementationFactory;

    public void testCompositeScope() throws IntrospectionException {
        ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();

        processor.visitClass(Composite.class, type);
        assertEquals(JavaScopeImpl.COMPOSITE, type.getJavaScope());
    }
View Full Code Here

        assertEquals(JavaScopeImpl.COMPOSITE, type.getJavaScope());
    }

    public void testSessionScope() throws IntrospectionException {
        ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        processor.visitClass(Session.class, type);
        assertEquals(JavaScopeImpl.SESSION, type.getJavaScope());
    }
View Full Code Here

        assertEquals(JavaScopeImpl.SESSION, type.getJavaScope());
    }

    public void testConversationalScope() throws IntrospectionException {
        ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        processor.visitClass(Conversation.class, type);
        assertEquals(JavaScopeImpl.CONVERSATION, type.getJavaScope());
    }
View Full Code Here

        assertEquals(JavaScopeImpl.CONVERSATION, type.getJavaScope());
    }

    public void testRequestScope() throws IntrospectionException {
        ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        processor.visitClass(Request.class, type);
        assertEquals(JavaScopeImpl.REQUEST, type.getJavaScope());
    }
View Full Code Here

        assertEquals(JavaScopeImpl.REQUEST, type.getJavaScope());
    }

    public void testStatelessScope() throws IntrospectionException {
        ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        processor.visitClass(Stateless.class, type);
        assertEquals(JavaScopeImpl.STATELESS, type.getJavaScope());
    }
View Full Code Here

        assertEquals(JavaScopeImpl.STATELESS, type.getJavaScope());
    }

    public void testNoScope() throws IntrospectionException {
        ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        processor.visitClass(None.class, type);
        assertEquals(JavaScopeImpl.STATELESS, type.getJavaScope());
    }
View Full Code Here

    /**
     * Verifies a single service interface is computed when only one interface
     * is implemented
     */
    public void testSingleInterface() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<SingleInterfaceImpl> ctor = SingleInterfaceImpl.class.getConstructor();
        type.setConstructor(new JavaConstructorImpl<SingleInterfaceImpl>(ctor));
        processor.visitEnd(SingleInterfaceImpl.class, type);
        assertEquals(1, type.getServices().size());
        assertTrue(ModelHelper.matches(ModelHelper.getService(type, PropertyInterface.class.getSimpleName()),
                                       PropertyInterface.class));
        assertTrue(type.getProperties().isEmpty());
        assertTrue(type.getReferences().isEmpty());
    }
View Full Code Here

    /**
     * Verifies property and reference setters are computed
     */
    public void testPropertyReference() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<SingleInterfaceWithPropertyReferenceImpl> ctor = SingleInterfaceWithPropertyReferenceImpl.class
            .getConstructor();
        type.setConstructor(new JavaConstructorImpl<SingleInterfaceWithPropertyReferenceImpl>(ctor));
        processor.visitEnd(SingleInterfaceWithPropertyReferenceImpl.class, type);
        assertEquals(1, type.getServices().size());
        assertTrue(ModelHelper
            .matches(ModelHelper.getService(type, Interface1.class.getSimpleName()), Interface1.class));
        assertEquals(1, type.getProperties().size());
        org.apache.tuscany.sca.assembly.Property prop = ModelHelper.getProperty(type, "property");
        assertNotNull(prop);
        assertEquals(ComplexProperty.class, type.getPropertyMembers().get("property").getType());
        assertEquals(1, type.getReferences().size());
        assertTrue(ModelHelper.matches(ModelHelper.getReference(type, "reference"), Ref.class));
    }
View Full Code Here

    /**
     * Verifies that a property setter is not introspected if an analogous
     * operation is in the service interface
     */
    public void testPropertySetterInInterface() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<SingleInterfaceImpl> ctor = SingleInterfaceImpl.class.getConstructor();
        type.setConstructor(new JavaConstructorImpl<SingleInterfaceImpl>(ctor));
        processor.visitEnd(SingleInterfaceImpl.class, type);
        assertEquals(0, type.getProperties().size());
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.implementation.java.JavaImplementation

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.