Examples of JavaImplementation


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

    /**
     * Verifies the property and heuristic processors don't collide
     */
    @SuppressWarnings("unchecked")
    public void testPropertyProcessorWithHeuristicProcessor() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor ctor = Foo.class.getConstructor(String.class);
        type.setConstructor(new JavaConstructorImpl(ctor));
        propertyProcessor.visitConstructorParameter(type.getConstructor().getParameters()[0], type);
        heuristicProcessor.visitEnd(Foo.class, type);
        assertEquals(1, type.getProperties().size());
        assertEquals("foo", type.getProperties().get(0).getName());
    }
View Full Code Here

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

    private ConstructorProcessor processor = new ConstructorProcessor(new DefaultAssemblyFactory());
   
    private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();

    public void testDuplicateConstructor() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        try {
            processor.visitClass(BadFoo.class, type);
            fail();
        } catch (DuplicateConstructorException e) {
            // expected
View Full Code Here

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

            // expected
        }
    }

    public void testConstructorAnnotation() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<Foo> ctor1 = Foo.class.getConstructor(String.class);
        processor.visitConstructor(ctor1, type);
        assertEquals("foo", type.getConstructor().getParameters()[0].getName());
    }
View Full Code Here

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

        processor.visitConstructor(ctor1, type);
        assertEquals("foo", type.getConstructor().getParameters()[0].getName());
    }

    public void testNoAnnotation() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<NoAnnotation> ctor1 = NoAnnotation.class.getConstructor();
        processor.visitConstructor(ctor1, type);
        assertNull(type.getConstructor());
    }
View Full Code Here

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

        processor.visitConstructor(ctor1, type);
        assertNull(type.getConstructor());
    }

    public void testBadAnnotation() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<BadAnnotation> ctor1 = BadAnnotation.class.getConstructor(String.class, Foo.class);
        try {
            processor.visitConstructor(ctor1, type);
            fail();
        } catch (InvalidConstructorException e) {
View Full Code Here

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

            // expected
        }
    }

    public void testMixedParameters() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<Mixed> ctor1 = Mixed.class.getConstructor(String.class, String.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

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

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

    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

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

        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

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

        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
TOP
Copyright © 2018 www.massapi.com. 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.