Package org.springframework.ws

Examples of org.springframework.ws.MockWebServiceMessageFactory


    @Test
    public void testHandleResponse() throws Exception {
        interceptor.setResponseXslt(xslt);
        interceptor.afterPropertiesSet();
        MockWebServiceMessage request = new MockWebServiceMessage(input);
        MessageContext context = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
        MockWebServiceMessage response = (MockWebServiceMessage) context.getResponse();
        response.setPayload(input);

        boolean result = interceptor.handleResponse(context, null);
        Assert.assertTrue("Invalid interceptor result", result);
View Full Code Here


    @Test
    public void testHandleResponseNoXslt() throws Exception {
        interceptor.setRequestXslt(xslt);
        interceptor.afterPropertiesSet();
        MockWebServiceMessage request = new MockWebServiceMessage(input);
        MessageContext context = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
        MockWebServiceMessage response = (MockWebServiceMessage) context.getResponse();
        response.setPayload(input);

        boolean result = interceptor.handleResponse(context, null);
        Assert.assertTrue("Invalid interceptor result", result);
View Full Code Here

    public void testNoResponse() throws Exception {
        endpoint = createNoResponseEndpoint();
        StringSource requestSource = new StringSource(REQUEST);

        MessageContext context =
                new DefaultMessageContext(new MockWebServiceMessage(requestSource), new MockWebServiceMessageFactory());
        endpoint.invoke(context);
        assertFalse("Response message created", context.hasResponse());
    }
View Full Code Here

    @Test
    public void testNoRequestPayload() throws Exception {
        endpoint = createNoRequestPayloadEndpoint();

        MessageContext context = new DefaultMessageContext(new MockWebServiceMessage((StringBuilder) null),
                new MockWebServiceMessageFactory());
        endpoint.invoke(context);
        assertFalse("Response message created", context.hasResponse());
    }
View Full Code Here

    }

    @Override
    protected final void testSource(Source requestSource) throws Exception {
        MessageContext context =
                new DefaultMessageContext(new MockWebServiceMessage(requestSource), new MockWebServiceMessageFactory());
        endpoint.invoke(context);
        assertTrue("No response message created", context.hasResponse());
        assertXMLEqual(RESPONSE, ((MockWebServiceMessage) context.getResponse()).getPayloadAsString());
    }
View Full Code Here

    private MockWebServiceMessage request;

    @Before
    public void setUp() throws Exception {
        receiverSupport = new MyReceiverSupport();
        messageFactory = new MockWebServiceMessageFactory();
        receiverSupport.setMessageFactory(messageFactory);
        connectionMock = createStrictMock(FaultAwareWebServiceConnection.class);
        request = new MockWebServiceMessage();
    }
View Full Code Here

    }

    @Test
    public void invokeSupported() throws Exception {
        MockWebServiceMessage request = new MockWebServiceMessage("<root xmlns='http://springframework.org'/>");
        MessageContext messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());

        String value = "Foo";

        // arg 0
        expect(argumentResolver1.supportsParameter(isA(MethodParameter.class))).andReturn(true);
View Full Code Here

    }

    @Test
    public void invokeNullReturnValue() throws Exception {
        MockWebServiceMessage request = new MockWebServiceMessage("<root xmlns='http://springframework.org'/>");
        MessageContext messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());

        String value = "Foo";

        expect(argumentResolver1.supportsParameter(isA(MethodParameter.class))).andReturn(true);
        expect(argumentResolver1.resolveArgument(eq(messageContext), isA(MethodParameter.class))).andReturn(value);
View Full Code Here

    }

    @Test
    public void invokeException() throws Exception {
        MockWebServiceMessage request = new MockWebServiceMessage("<root xmlns='http://springframework.org'/>");
        MessageContext messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());

        String value = "Foo";

        expect(argumentResolver1.supportsParameter(isA(MethodParameter.class))).andReturn(true);
        expect(argumentResolver1.resolveArgument(eq(messageContext), isA(MethodParameter.class))).andReturn(value);
View Full Code Here

                assertXMLEqual("Invalid request", "<request/>", writer.toString());
                return new StreamSource(new StringReader("<response/>"));
            }
        };
        endpoint.invoke(request.getPayloadSource());
        MessageContext messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
        adapter.invoke(messageContext, endpoint);
        MockWebServiceMessage response = (MockWebServiceMessage) messageContext.getResponse();
        Assert.assertNotNull("No response created", response);
        assertXMLEqual("Invalid payload", "<response/>", response.getPayloadAsString());
    }
View Full Code Here

TOP

Related Classes of org.springframework.ws.MockWebServiceMessageFactory

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.