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

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


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


    /**
     * Verifies collection generic types or array types are introspected as
     * references according to spec rules
     */
    public void testReferenceCollectionType() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<ReferenceCollectionImpl> ctor = ReferenceCollectionImpl.class.getConstructor();
        type.setConstructor(new JavaConstructorImpl<ReferenceCollectionImpl>(ctor));
        processor.visitEnd(ReferenceCollectionImpl.class, type);
        assertEquals(1, type.getProperties().size());
        assertEquals(3, type.getReferences().size());
    }
View Full Code Here

    /**
     * Verifies collection generic types or array types are introspected as
     * properties according to spec rules
     */
    public void testPropertyCollectionType() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<PropertyCollectionImpl> ctor = PropertyCollectionImpl.class.getConstructor();
        type.setConstructor(new JavaConstructorImpl<PropertyCollectionImpl>(ctor));
        processor.visitEnd(PropertyCollectionImpl.class, type);
        assertEquals(0, type.getReferences().size());
        assertEquals(4, type.getProperties().size());
    }
View Full Code Here

     * Verifies references are calculated when the type marked with is
     *
     * @Remotable
     */
    public void testRemotableRef() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<RemotableRefImpl> ctor = RemotableRefImpl.class.getConstructor();
        type.setConstructor(new JavaConstructorImpl<RemotableRefImpl>(ctor));
        processor.visitEnd(RemotableRefImpl.class, type);
        assertEquals(2, type.getReferences().size());
        assertEquals(0, type.getProperties().size());
    }
View Full Code Here

        assertEquals(2, type.getReferences().size());
        assertEquals(0, type.getProperties().size());
    }

    public void testParentInterface() throws IntrospectionException, NoSuchMethodException {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<Child> ctor = Child.class.getConstructor();
        type.setConstructor(new JavaConstructorImpl<Child>(ctor));
        processor.visitEnd(Child.class, type);
        assertNotNull(ModelHelper.getService(type, Interface1.class.getSimpleName()));
    }
View Full Code Here

    /**
     * Verifies a service inteface is calculated when only props and refs are
     * given
     */
    public void testExcludedPropertyAndReference() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        org.apache.tuscany.sca.assembly.Reference ref = factory.createReference();
        ref.setName("reference");
        type.getReferences().add(ref);
        type.getReferenceMembers().put("reference", new JavaElementImpl("reference", Ref.class, null));
        org.apache.tuscany.sca.assembly.Reference ref2 = factory.createReference();
        ref2.setName("reference2");
        type.getReferences().add(ref2);
        type.getReferenceMembers().put("reference2", new JavaElementImpl("reference2", Ref.class, null));
        org.apache.tuscany.sca.assembly.Property prop1 = factory.createProperty();
        prop1.setName("string1");
        type.getProperties().add(prop1);
        type.getPropertyMembers().put("string1", new JavaElementImpl("string1", String.class, null));
        org.apache.tuscany.sca.assembly.Property prop2 = factory.createProperty();
        prop2.setName("string2");
        type.getProperties().add(prop2);
        type.getPropertyMembers().put("string2", new JavaElementImpl("string2", String.class, null));
        visitEnd(MockService.class, type);
        assertEquals(1, type.getServices().size());
    }
View Full Code Here

        visitEnd(MockService.class, type);
        assertEquals(1, type.getServices().size());
    }

    public void testProtectedRemotableRefField() throws IntrospectionException, NoSuchMethodException {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<ProtectedRemotableRefFieldImpl> ctor = ProtectedRemotableRefFieldImpl.class.getConstructor();
        type.setConstructor(new JavaConstructorImpl<ProtectedRemotableRefFieldImpl>(ctor));
        processor.visitEnd(ProtectedRemotableRefFieldImpl.class, type);
        assertNotNull(ModelHelper.getReference(type, "otherRef"));
    }
View Full Code Here

        processor.visitEnd(ProtectedRemotableRefFieldImpl.class, type);
        assertNotNull(ModelHelper.getReference(type, "otherRef"));
    }

    public void testProtectedRemotableRefMethod() throws IntrospectionException, NoSuchMethodException {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<ProtectedRemotableRefMethodImpl> ctor = ProtectedRemotableRefMethodImpl.class.getConstructor();
        type.setConstructor(new JavaConstructorImpl<ProtectedRemotableRefMethodImpl>(ctor));
        processor.visitEnd(ProtectedRemotableRefMethodImpl.class, type);
        assertNotNull(ModelHelper.getReference(type, "otherRef"));
    }
View Full Code Here

        processor.visitEnd(ProtectedRemotableRefMethodImpl.class, type);
        assertNotNull(ModelHelper.getReference(type, "otherRef"));
    }

    public void testSetDataTypes() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<PropertyIntTypeOnConstructor> ctor = PropertyIntTypeOnConstructor.class.getConstructor();
        type.setConstructor(new JavaConstructorImpl<PropertyIntTypeOnConstructor>(ctor));
        processor.visitEnd(PropertyIntTypeOnConstructor.class, type);
        org.apache.tuscany.sca.assembly.Property foo = ModelHelper.getProperty(type, "foo");
        assertEquals(int.class, type.getPropertyMembers().get("foo").getType());
        assertEquals(new QName(JavaXMLMapper.URI_2001_SCHEMA_XSD, "int"), foo.getXSDType());
    }
View Full Code Here

public class ConstructorReferenceTestCase extends AbstractProcessorTest {
   
    private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();

    public void testReference() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
        visitConstructor(ctor, type);
        org.apache.tuscany.sca.assembly.Reference reference = getReference(type, "myRef");
        assertEquals(Multiplicity.ONE_ONE, reference.getMultiplicity());
        assertEquals("myRef", reference.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.