Package org.springframework.ws

Examples of org.springframework.ws.MockWebServiceMessage


        verify(factoryMock);
    }

    @Test
    public void testInvokeNoRequest() throws Exception {
        MockWebServiceMessage request = new MockWebServiceMessage((StringBuilder) null);
        context = new DefaultMessageContext(request, factoryMock);
        AbstractMarshallingPayloadEndpoint endpoint = new AbstractMarshallingPayloadEndpoint() {

            @Override
            protected Object invokeInternal(Object requestObject) throws Exception {
View Full Code Here


    public void setUp() throws Exception {
        interceptor = new PayloadLoggingInterceptor();
        appender = new CountingAppender();
        BasicConfigurator.configure(appender);
        Logger.getRootLogger().setLevel(Level.DEBUG);
        MockWebServiceMessage request = new MockWebServiceMessage("<request/>");
        messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
        appender.reset();
    }
View Full Code Here

        Assert.assertTrue("PayloadLoggingInterceptor did not log", appender.getCount() > eventCount);
    }

    @Test
    public void testHandleResponseDisabled() throws Exception {
        MockWebServiceMessage response = (MockWebServiceMessage) messageContext.getResponse();
        response.setPayload("<response/>");
        interceptor.setLogResponse(false);
        int eventCount = appender.getCount();
        interceptor.handleResponse(messageContext, null);
        Assert.assertEquals("PayloadLoggingInterceptor logged when disabled", appender.getCount(), eventCount);
    }
View Full Code Here

        Assert.assertEquals("PayloadLoggingInterceptor logged when disabled", appender.getCount(), eventCount);
    }

    @Test
    public void testHandleResponseEnabled() throws Exception {
        MockWebServiceMessage response = (MockWebServiceMessage) messageContext.getResponse();
        response.setPayload("<response/>");
        int eventCount = appender.getCount();
        interceptor.handleResponse(messageContext, null);
        Assert.assertTrue("PayloadLoggingInterceptor did not log", appender.getCount() > eventCount);
    }
View Full Code Here

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

        boolean result = interceptor.handleRequest(context, null);
        Assert.assertTrue("Invalid interceptor result", result);
        StringResult expected = new StringResult();
        transformer.transform(new SAXSource(SaxUtils.createInputSource(output)), expected);
        assertXMLEqual(expected.toString(), request.getPayloadAsString());
    }
View Full Code Here

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

        boolean result = interceptor.handleRequest(context, null);
        Assert.assertTrue("Invalid interceptor result", result);
        StringResult expected = new StringResult();
        transformer.transform(new SAXSource(SaxUtils.createInputSource(input)), expected);
        assertXMLEqual(expected.toString(), request.getPayloadAsString());
    }
View Full Code Here

    @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);
        StringResult expected = new StringResult();
        transformer.transform(new SAXSource(SaxUtils.createInputSource(output)), expected);
        assertXMLEqual(expected.toString(), response.getPayloadAsString());
    }
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);
        StringResult expected = new StringResult();
        transformer.transform(new SAXSource(SaxUtils.createInputSource(input)), expected);
        assertXMLEqual(expected.toString(), response.getPayloadAsString());
    }
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

TOP

Related Classes of org.springframework.ws.MockWebServiceMessage

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.