Examples of JavaImplementation


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

     * references of an unannotated POJO (section 1.2.7).  This test makes sure that the earlier implementation
     * is corrected as per the errata.  A notable difference is that the interfaces annotated with @Service
     * no longer result in references.
     */
    public void testUpdatedRule() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        visitEnd(SomeServiceImpl.class, type);
        assertEquals(12, type.getReferenceMembers().size());
        assertTrue(type.getReferenceMembers().containsKey("rri1"));
        assertTrue(type.getReferenceMembers().containsKey("rri2"));
        assertTrue(type.getReferenceMembers().containsKey("rri3"));
        assertTrue(type.getReferenceMembers().containsKey("rri4"));

        assertTrue(type.getReferenceMembers().containsKey("rria1"));
        assertTrue(type.getReferenceMembers().containsKey("rria2"));
        assertTrue(type.getReferenceMembers().containsKey("rria3"));
        assertTrue(type.getReferenceMembers().containsKey("rria4"));

        assertTrue(type.getReferenceMembers().containsKey("rric1"));
        assertTrue(type.getReferenceMembers().containsKey("rric2"));
        assertTrue(type.getReferenceMembers().containsKey("rric3"));
        assertTrue(type.getReferenceMembers().containsKey("rric4"));
       
        assertEquals(16, type.getPropertyMembers().size());
        assertTrue(type.getPropertyMembers().containsKey("pnri1"));
        assertTrue(type.getPropertyMembers().containsKey("pnri2"));
        assertTrue(type.getPropertyMembers().containsKey("pnri3"));
        assertTrue(type.getPropertyMembers().containsKey("pnri4"));

        assertTrue(type.getPropertyMembers().containsKey("pnria1"));
        assertTrue(type.getPropertyMembers().containsKey("pnria2"));
        assertTrue(type.getPropertyMembers().containsKey("pnria3"));
        assertTrue(type.getPropertyMembers().containsKey("pnria4"));

        assertTrue(type.getPropertyMembers().containsKey("pnric1"));
        assertTrue(type.getPropertyMembers().containsKey("pnric2"));
        assertTrue(type.getPropertyMembers().containsKey("pnric3"));
        assertTrue(type.getPropertyMembers().containsKey("pnric4"));
       
        assertTrue(type.getPropertyMembers().containsKey("gen1"));
        assertTrue(type.getPropertyMembers().containsKey("gen2"));
        assertTrue(type.getPropertyMembers().containsKey("gen3"));
        assertTrue(type.getPropertyMembers().containsKey("gen4"));
    }
View Full Code Here

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

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

    public void testProperty() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
        visitConstructor(ctor, type);
        org.apache.tuscany.sca.assembly.Property property = getProperty(type, "myProp");
        assertTrue(property.isMustSupply());
        assertEquals("myProp", property.getName());
View Full Code Here

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

        assertTrue(property.isMustSupply());
        assertEquals("myProp", property.getName());
    }

    public void testTwoPropertiesSameType() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
        visitConstructor(ctor, type);
        assertNotNull(getProperty(type, "myProp1"));
        assertNotNull(getProperty(type, "myProp2"));
    }
View Full Code Here

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

        assertNotNull(getProperty(type, "myProp1"));
        assertNotNull(getProperty(type, "myProp2"));
    }

    public void testDuplicateProperty() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class, String.class);
        try {
            visitConstructor(ctor, type);
            fail();
        } catch (DuplicatePropertyException e) {
View Full Code Here

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

            // expected
        }
    }

    public void testNoName() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class);
        try {
            visitConstructor(ctor, type);
            fail();
        } catch (InvalidPropertyException e) {
View Full Code Here

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

            // expected
        }
    }

    public void testNamesOnConstructor() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<Foo> ctor = Foo.class.getConstructor(Integer.class);
        visitConstructor(ctor, type);
        assertNotNull(getProperty(type, "myProp"));
    }
View Full Code Here

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

        visitConstructor(ctor, type);
        assertNotNull(getProperty(type, "myProp"));
    }

    public void testInvalidNumberOfNames() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<BadFoo> ctor = BadFoo.class.getConstructor(Integer.class, Integer.class);
        try {
            visitConstructor(ctor, type);
            fail();
        } catch (InvalidConstructorException e) {
View Full Code Here

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

            // expected
        }
    }

    public void testNoMatchingNames() throws Exception {
        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
        Constructor<BadFoo> ctor = BadFoo.class.getConstructor(List.class, List.class);
        try {
            visitConstructor(ctor, type);
            fail();
        } catch (InvalidConstructorException e) {
View Full Code Here

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

            return;
        }*/

        RuntimeComponent component = wire.getTarget().getComponent();
        if (component != null && component.getImplementation() instanceof JavaImplementation) {
            JavaImplementation javaImpl = (JavaImplementation)component.getImplementation();
            if (javaImpl instanceof PolicySetAttachPoint) {
                PolicyHandler policyHandler = null;
                List<PolicyHandler> implPolicyHandlers = new ArrayList<PolicyHandler>();
                PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)javaImpl;

                try {
                    //for ( PolicySet policySet : policiedImpl.getPolicySets() ) {
                    for (PolicySet policySet : component.getPolicySets()) {
                        policyHandler =
                            PolicyHandlerUtils.findPolicyHandler(policySet, javaImpl.getPolicyHandlerClassNames());
                        if (policyHandler != null) {
                            policyHandler.setUp(javaImpl);
                            implPolicyHandlers.add(policyHandler);
                        } else {
                            //FIXME: to be removed after the PolicyHandler story has crystalized..
                            //maybe replace with exception then...
                            logger.warning("No PolicyHandler registered for PolicySet - " + policySet.getName());
                        }
                    }

                    List<PolicyHandler> applicablePolicyHandlers = null;
                    for (InvocationChain chain : wire.getInvocationChains()) {
                        applicablePolicyHandlers = new ArrayList<PolicyHandler>();
                        if (javaImpl instanceof OperationsConfigurator) {
                            String operationName = chain.getTargetOperation().getName();
                            OperationsConfigurator opConfigurator = (OperationsConfigurator)component;
                            for (ConfiguredOperation confOp : opConfigurator.getConfiguredOperations()) {
                                if (confOp.getName().equals(operationName)) {
                                    for (PolicySet policySet : confOp.getPolicySets()) {
                                        policyHandler =
                                            PolicyHandlerUtils.findPolicyHandler(policySet, javaImpl
                                                .getPolicyHandlerClassNames());
                                        if (policyHandler != null) {
                                            policyHandler.setUp(javaImpl);
                                            applicablePolicyHandlers.add(policyHandler);
                                        } else {
View Full Code Here

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

        RuntimeComponent component = wire.getSource().getComponent();
        Implementation implementation = component.getImplementation();
        if (!(implementation instanceof JavaImplementation)) {
            return;
        }
        JavaImplementation javaImpl = (JavaImplementation)implementation;
        EndpointReference callbackEndpoint = wire.getSource().getCallbackEndpoint();
        if (callbackEndpoint != null) {
            Interface iface = callbackEndpoint.getContract().getInterfaceContract().getInterface();
            if (!supportsCallbackInterface(iface, javaImpl)) {
                // callback to this impl is not possible, so ensure a callback object is set
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.