Package org.springframework.oxm

Examples of org.springframework.oxm.Unmarshaller


    public void testSendAndReceiveMarshalResponse() throws Exception {
        Marshaller marshallerMock = createMock(Marshaller.class);
        template.setMarshaller(marshallerMock);
        marshallerMock.marshal(isA(Object.class), isA(Result.class));

        Unmarshaller unmarshallerMock = createMock(Unmarshaller.class);
        template.setUnmarshaller(unmarshallerMock);
        Object unmarshalled = new Object();
        expect(unmarshallerMock.unmarshal(isA(Source.class))).andReturn(unmarshalled);

        connectionMock.send(isA(WebServiceMessage.class));
        expect(connectionMock.hasError()).andReturn(false);
        expect(connectionMock.receive(messageFactory)).andReturn(new MockWebServiceMessage("<response/>"));
        expect(connectionMock.hasFault()).andReturn(false);
View Full Code Here


                Assert.assertEquals("Invalid class", Object.class, clazz);
                return true;
            }
        };
        final Object responseObject = new Object();
        Unmarshaller unmarshaller = new Unmarshaller() {

            @Override
            public Object unmarshal(Source source) throws XmlMappingException, IOException {
                return responseObject;
            }
View Full Code Here

                Assert.assertEquals("Invalid class", Object.class, clazz);
                return true;
            }
        };
        final Object responseObject = new Object();
        Unmarshaller unmarshaller = new Unmarshaller() {

            @Override
            public Object unmarshal(Source source) throws XmlMappingException, IOException {
                return responseObject;
            }
View Full Code Here

        context = new DefaultMessageContext(request, factoryMock);
    }

    @Test
    public void testInvoke() throws Exception {
        Unmarshaller unmarshaller = new SimpleMarshaller() {
            @Override
            public Object unmarshal(Source source) throws XmlMappingException {
                try {
                    StringWriter writer = new StringWriter();
                    transformer.transform(source, new StreamResult(writer));
View Full Code Here

        verify(factoryMock);
    }

    @Test
    public void testInvokeNullResponse() throws Exception {
        Unmarshaller unmarshaller = new SimpleMarshaller() {
            @Override
            public Object unmarshal(Source source) throws XmlMappingException {
                try {
                    StringWriter writer = new StringWriter();
                    transformer.transform(source, new StreamResult(writer));
View Full Code Here

        this.unmarshaller = unmarshaller;
    }

    @Override
    protected boolean supportsRequestPayloadParameter(MethodParameter parameter) {
        Unmarshaller unmarshaller = getUnmarshaller();
        if (unmarshaller == null) {
            return false;
        }
        else if (unmarshaller instanceof GenericUnmarshaller) {
            return ((GenericUnmarshaller) unmarshaller).supports(parameter.getGenericParameterType());
        }
        else {
            return unmarshaller.supports(parameter.getParameterType());
        }
    }
View Full Code Here

        }
    }

    @Override
    public Object resolveArgument(MessageContext messageContext, MethodParameter parameter) throws Exception {
        Unmarshaller unmarshaller = getUnmarshaller();
        Assert.state(unmarshaller != null, "unmarshaller must not be null");

        WebServiceMessage request = messageContext.getRequest();
        Object argument = MarshallingUtils.unmarshal(unmarshaller, request);
        if (logger.isDebugEnabled()) {
View Full Code Here

            }
        }
    }

    private Object unmarshalRequest(WebServiceMessage request) throws IOException {
        Unmarshaller unmarshaller = getUnmarshaller();
        Assert.notNull(unmarshaller, "No unmarshaller registered. Check configuration of endpoint.");
        Object requestObject = MarshallingUtils.unmarshal(unmarshaller, request);
        if (logger.isDebugEnabled()) {
            logger.debug("Unmarshalled payload request to [" + requestObject + "]");
        }
View Full Code Here

                }
            }
        }, new WebServiceMessageExtractor<Object>() {

            public Object extractData(WebServiceMessage response) throws IOException {
                Unmarshaller unmarshaller = getUnmarshaller();
                if (unmarshaller == null) {
                    throw new IllegalStateException(
                            "No unmarshaller registered. Check configuration of WebServiceTemplate.");
                }
                return MarshallingUtils.unmarshal(unmarshaller, response);
View Full Code Here

public class MarshallingUtilsTest {

    @Test
    public void testUnmarshal() throws Exception {
        Unmarshaller unmarshallerMock = createMock(Unmarshaller.class);
        WebServiceMessage messageMock = createMock(WebServiceMessage.class);

        Source source = new StringSource("");
        Object unmarshalled = new Object();
        expect(messageMock.getPayloadSource()).andReturn(source);
        expect(unmarshallerMock.unmarshal(source)).andReturn(unmarshalled);

        replay(unmarshallerMock, messageMock);

        Object result = MarshallingUtils.unmarshal(unmarshallerMock, messageMock);
        Assert.assertEquals("Invalid unmarshalled object", unmarshalled, result);
View Full Code Here

TOP

Related Classes of org.springframework.oxm.Unmarshaller

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.