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

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


        assertNotNull(type.getResources().get("requestContext"));
    }

    public void testComponentNameMethod() throws Exception {
        Method method = Foo.class.getMethod("setName", String.class);
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        nameProcessor.visitMethod(method, type);
        assertNotNull(type.getResources().get("name"));
    }
View Full Code Here


        assertNotNull(type.getResources().get("name"));
    }

    public void testComponentNameField() throws Exception {
        Field field = Foo.class.getDeclaredField("name");
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        nameProcessor.visitField(field, type);
        assertNotNull(type.getResources().get("name"));
    }
View Full Code Here

        assertNotNull(type.getResources().get("name"));
    }

    public void testInvalidParamType() throws Exception {
        Method method = Foo.class.getMethod("setContext", String.class);
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        try {
            processor.visitMethod(method, type);
            fail();
        } catch (UnknownContextTypeException e) {
            // expected
View Full Code Here

        }
    }

    public void testInvalidParamTypeField() throws Exception {
        Field field = Foo.class.getDeclaredField("badContext");
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        try {
            processor.visitField(field, type);
            fail();
        } catch (UnknownContextTypeException e) {
            // expected
View Full Code Here

    }


    public void testInvalidParamNum() throws Exception {
        Method method = Foo.class.getMethod("setContext", ComponentContext.class, String.class);
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        try {
            processor.visitMethod(method, type);
            fail();
        } catch (IllegalContextException e) {
            // expected
View Full Code Here

        }
    }

    public void testInvalidNoParams() throws Exception {
        Method method = Foo.class.getMethod("setContext");
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        try {
            processor.visitMethod(method, type);
            fail();
        } catch (IllegalContextException e) {
            // expected
View Full Code Here

        }
    }

    public void testNoContext() throws Exception {
        Method method = Foo.class.getMethod("noContext", ComponentContext.class);
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        processor.visitMethod(method, type);
        assertEquals(0, type.getResources().size());
    }
View Full Code Here

        assertEquals(0, type.getResources().size());
    }

    public void testNoContextField() throws Exception {
        Field field = Foo.class.getDeclaredField("noContext");
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        processor.visitField(field, type);
        assertEquals(0, type.getResources().size());
    }
View Full Code Here

    /**
     * Verifies heuristic processing can be called priot to an extension
     * annotation processors being called.
     */
    public void testBarAnnotationProcessedFirst() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
        JavaConstructorImpl<Foo> definition = new JavaConstructorImpl<Foo>(ctor);
        type.setConstructor(definition);
        Property property = factory.createProperty();
        property.setName("myBar");
        definition.getParameters()[0].setName("myBar");
        type.getProperties().add(property);
        visitEnd(Foo.class, type);
        assertEquals(2, type.getProperties().size());
    }
View Full Code Here

     * @Property can occur prior to another implementation processor evaluating
     * @Bar
     * @throws Exception
     */
    public void testBarAnnotationProcessedLast() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        visitEnd(Foo.class, type);

        // now simulate process the bar impl
        JavaConstructorImpl<?> definition = type.getConstructor();
        definition.getParameters()[0].setName("myBar");
        Property property = factory.createProperty();
        property.setName("myBar");
        type.getProperties().add(property);

        assertEquals(2, type.getProperties().size());
        assertEquals("foo", definition.getParameters()[1].getName());
    }
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.