Package org.apache.tuscany.sca.assembly

Examples of org.apache.tuscany.sca.assembly.WireFormat


        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(BINDING_WITH_RESPONSE_WIRE_FORMAT));

        RESTBinding binding = (RESTBinding)staxProcessor.read(reader, context);
        Assert.assertNotNull(binding);

        WireFormat responseWireFormat = binding.getResponseWireFormat();
        Assert.assertEquals(JSONWireFormat.class, responseWireFormat.getClass().getInterfaces()[0]);
    }
View Full Code Here


       
        Composite composite = (Composite)staxProcessor.read(reader);
        JMSBinding binding = (JMSBinding)   composite.getComponents().get(0).getServices().get(0).getBindings().get(0);       
        assertNotNull(binding);
       
        WireFormat requestWireFormat = binding.getRequestWireFormat();
        assertEquals(WireFormatJMSObject.class, requestWireFormat.getClass());
       
        WireFormat responseWireFormat = binding.getResponseWireFormat();
        assertEquals(WireFormatJMSBytes.class, responseWireFormat.getClass());
    }   
View Full Code Here

        String contentType = MediaType.APPLICATION_OCTET_STREAM;
        Consumes consumes = ((JavaOperation)operation).getJavaMethod().getAnnotation(Consumes.class);
        if (consumes != null && consumes.value().length > 0) {
            contentType = consumes.value()[0];
        }
        WireFormat wf = binding.getRequestWireFormat();
        if (wf != null) {
            if (XMLWireFormat.REST_WIREFORMAT_XML_QNAME.equals(wf.getSchemaName())) {
                contentType = MediaType.APPLICATION_XML;
            } else if (JSONWireFormat.REST_WIREFORMAT_JSON_QNAME.equals(wf.getSchemaName())) {
                contentType = MediaType.APPLICATION_JSON;
            }
        }
        return contentType;
    }
View Full Code Here

        String accepts[] = {MediaType.APPLICATION_OCTET_STREAM};
        Produces produces = ((JavaOperation)operation).getJavaMethod().getAnnotation(Produces.class);
        if (produces != null) {
            accepts = produces.value();
        }
        WireFormat wf = binding.getResponseWireFormat();
        if (wf != null) {
            if (XMLWireFormat.REST_WIREFORMAT_XML_QNAME.equals(wf.getSchemaName())) {
                accepts = new String[] {MediaType.APPLICATION_XML};
            } else if (JSONWireFormat.REST_WIREFORMAT_JSON_QNAME.equals(wf.getSchemaName())) {
                accepts = new String[] {MediaType.APPLICATION_JSON};
            }
        }
        return accepts;
    }
View Full Code Here

        }
        if (model.getOperationPropertiesName() != null) {
            model.setOperationPropertiesBinding(getConnectionBinding(model, "operationProperties", model.getOperationPropertiesName(), resolver, context));
        }
       
        WireFormat requestWireFormat = model.getRequestWireFormat();
        if (requestWireFormat != null) {
            extensionProcessor.resolve(requestWireFormat, resolver, context);
        }   

        WireFormat responseWireFormat = model.getResponseWireFormat();
        if (responseWireFormat != null) {
            extensionProcessor.resolve(responseWireFormat, resolver, context);
        }   
       
        OperationSelector operationSelector = model.getOperationSelector();
View Full Code Here

       
        Composite composite = (Composite)staxProcessor.read(reader, context);
        JMSBinding binding = (JMSBinding)   composite.getComponents().get(0).getServices().get(0).getBindings().get(0);       
        assertNotNull(binding);
       
        WireFormat requestWireFormat = binding.getRequestWireFormat();
        assertEquals(WireFormatJMSObject.class, requestWireFormat.getClass());
       
        WireFormat responseWireFormat = binding.getResponseWireFormat();
        assertEquals(WireFormatJMSBytes.class, responseWireFormat.getClass());
    }   
View Full Code Here

        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(BINDING_WITH_WIRE_FORMAT));

        RESTBinding binding = (RESTBinding)staxProcessor.read(reader, context);
        Assert.assertNotNull(binding);

        WireFormat requestWireFormat = binding.getRequestWireFormat();
        Assert.assertEquals(JSONWireFormat.class, requestWireFormat.getClass().getInterfaces()[0]);
    }
View Full Code Here

        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(BINDING_WITH_RESPONSE_WIRE_FORMAT));

        RESTBinding binding = (RESTBinding)staxProcessor.read(reader, context);
        Assert.assertNotNull(binding);

        WireFormat responseWireFormat = binding.getResponseWireFormat();
        Assert.assertEquals(JSONWireFormat.class, responseWireFormat.getClass().getInterfaces()[0]);
    }
View Full Code Here

       
        Composite composite = (Composite)staxProcessor.read(reader);
        HTTPBinding binding = (HTTPBinding)   composite.getComponents().get(0).getServices().get(0).getBindings().get(0);       
        assertNotNull(binding);
       
        WireFormat requestWireFormat = binding.getRequestWireFormat();
        assertEquals(JSONRPCWireFormat.class, requestWireFormat.getClass().getInterfaces()[0]);
       
        WireFormat responseWireFormat = binding.getResponseWireFormat();
        assertEquals(JSONRPCWireFormat.class, responseWireFormat.getClass().getInterfaces()[0]);
    }
View Full Code Here

       
        Composite composite = (Composite)staxProcessor.read(reader);
        HTTPBinding binding = (HTTPBinding)   composite.getComponents().get(0).getServices().get(0).getBindings().get(0);       
        assertNotNull(binding);
       
        WireFormat requestWireFormat = binding.getRequestWireFormat();
        assertEquals(JSONRPCWireFormat.class, requestWireFormat.getClass().getInterfaces()[0]);
       
        WireFormat responseWireFormat = binding.getResponseWireFormat();
        assertEquals(JSONRPCWireFormat.class, responseWireFormat.getClass().getInterfaces()[0]);
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.assembly.WireFormat

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.