Package org.apache.tuscany.spi.idl.java

Examples of org.apache.tuscany.spi.idl.java.JavaServiceContract


        assertEquals(Scope.COMPOSITE, service.getScope());
    }

    public void testSetGetInterface() throws Exception {
        InboundWire wire = createMock(InboundWire.class);
        JavaServiceContract contract = new JavaServiceContract(getClass());
        expect(wire.getServiceContract()).andReturn(contract);
        replay(wire);
        ServiceExtension service = new ServiceExtension(null, null, null, null);
        service.setInboundWire(wire);
        service.getInterface();
View Full Code Here


    public SystemOutboundAutowire(String referenceName, Class<?> interfaze, CompositeComponent component,
                                  boolean required) {

        this.referenceName = referenceName;
        this.component = component;
        serviceContract = new JavaServiceContract(interfaze);
        this.required = required;
    }
View Full Code Here

    private Class<?> interfaze;

    public SystemOutboundWireImpl(String referenceName, QualifiedName targetName, Class<?> interfaze) {
        this.referenceName = referenceName;
        this.targetName = targetName;
        serviceContract = new JavaServiceContract(interfaze);
        this.interfaze = interfaze;
    }
View Full Code Here

     * @param target      the target context the wire is connected to
     */
    public SystemInboundWireImpl(String serviceName, Class<?> interfaze, Component target) {
        this.serviceName = serviceName;
        this.component = target;
        serviceContract = new JavaServiceContract(interfaze);
        this.interfaze = interfaze;
    }
View Full Code Here

        return introspect(type, callbackClass);
    }

    public <I, C> JavaServiceContract introspect(Class<I> type, Class<C> callback)
        throws InvalidServiceContractException {
        JavaServiceContract contract = new JavaServiceContract();
        contract.setInterfaceName(getBaseName(type));
        contract.setInterfaceClass(type);
        boolean remotable = type.isAnnotationPresent(Remotable.class);
        contract.setRemotable(remotable);
        contract.setOperations(getOperations(type, remotable));

        if (callback != null) {
            contract.setCallbackName(getBaseName(callback));
            contract.setCallbackClass(callback);
            contract.setCallbackOperations(getOperations(callback, remotable));
        }

        Scope interactionScope = type.getAnnotation(Scope.class);
        if (interactionScope == null) {
            contract.setInteractionScope(InteractionScope.NONCONVERSATIONAL);
        } else {
            if ("CONVERSATIONAL".equalsIgnoreCase(interactionScope.value())) {
                contract.setInteractionScope(InteractionScope.CONVERSATIONAL);
            } else {
                contract.setInteractionScope(InteractionScope.NONCONVERSATIONAL);
            }
        }
        for (JavaInterfaceProcessor processor : processors) {
            processor.visitInterface(type, callback, contract);
        }
View Full Code Here

                }
            } else if (event == XMLStreamConstants.END_ELEMENT && reader.getName().equals(INTERFACE_JAVA)) {
                break;
            }
        }
        JavaServiceContract serviceContract;
        try {
            serviceContract = interfaceRegsitry.introspect(interfaceClass, callbackClass);
        } catch (InvalidServiceContractException e) {
            LoaderException le = new LoaderException(e);
            le.setIdentifier(interfaceClass.getName());
            throw le;
        }

        // Set databinding from the SCDL extension <databinding>
        DataType<?> dataType = (DataType<?>) extensions.get(DataType.class);
        if (dataType != null) {
            serviceContract.setDataBinding(dataType.getDataBinding());
        }
        serviceContract.getExtensions().putAll(extensions);

        serviceContract.setInteractionScope(interactionScope);
        return serviceContract;
    }
View Full Code Here

        WebServiceBinding wsBinding = new WebServiceBinding(wsdlDef, port, "uri", "portURI", wsdlService);

        //Create mocked InboundWire, for ServiceExtension.getInterface()
        InboundWire inboundWire = EasyMock.createNiceMock(InboundWire.class);
        JavaServiceContract contract = new JavaServiceContract(Greeter.class);
        EasyMock.expect(inboundWire.getServiceContract()).andReturn(contract).anyTimes();
        EasyMock.replay(inboundWire);

        //Create mocked WireService, for ServiceExtension.getServiceInstance()
        WireService wireService = EasyMock.createNiceMock(WireService.class);
View Full Code Here

    }

    protected void setUp() throws Exception {
        super.setUp();
        connector = new ConnectorImpl();
        contract = new JavaServiceContract(String.class);
        operation = new Operation<Type>("bar", null, null, null);
        headInterceptor = EasyMock.createMock(Interceptor.class);
        EasyMock.replay(headInterceptor);
        tailInterceptor = EasyMock.createMock(Interceptor.class);
        EasyMock.replay(tailInterceptor);
View Full Code Here

    /**
     * Verifies system services in a CompositeComponentImpl are wired during the parent composite's prepare callback
     */
    public void testSystemServiceWire() {
        InboundWire inbound = EasyMock.createMock(InboundWire.class);
        EasyMock.expect(inbound.getServiceContract()).andReturn(new JavaServiceContract(Foo.class));
        inbound.getInvocationChains();
        EasyMock.expectLastCall().andReturn(Collections.emptyMap());

        List<Class<?>> services = new ArrayList<Class<?>>();
        services.add(Foo.class);
        QualifiedName qName = new QualifiedName("target/bar");
        OutboundWire outbound = EasyMock.createMock(OutboundWire.class);
        EasyMock.expect(outbound.getTargetName()).andReturn(qName).atLeastOnce();
        outbound.getInvocationChains();
        EasyMock.expectLastCall().andReturn(Collections.emptyMap());
        outbound.setTargetWire(EasyMock.eq(inbound));
        EasyMock.expect(outbound.getServiceContract()).andReturn(new JavaServiceContract(Foo.class)).atLeastOnce();
        List<OutboundWire> wires = new ArrayList<OutboundWire>();
        wires.add(outbound);
        Map<String, List<OutboundWire>> wireMap = new HashMap<String, List<OutboundWire>>();
        wireMap.put("ref", wires);
        CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, new ConnectorImpl(), null);
View Full Code Here

        JavaMappedReference reference = new JavaMappedReference();
        reference.setName("target");
        reference.setMember(SourceImpl.class.getMethod("setTarget", Target.class));
        sourceType.add(reference);

        ServiceContract<?> sourceContract = new JavaServiceContract(Source.class);
        JavaMappedService sourceServiceDefinition = new JavaMappedService();
        sourceServiceDefinition.setName("Source");
        sourceServiceDefinition.setServiceContract(sourceContract);

        sourceType.add(sourceServiceDefinition);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.idl.java.JavaServiceContract

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.