Examples of DefaultMessageContext


Examples of org.springframework.ws.context.DefaultMessageContext

    }

    @Test
    public void testHandleValidResponse() throws Exception {
        MockWebServiceMessage request = new MockWebServiceMessage();
        context = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
        MockWebServiceMessage response = (MockWebServiceMessage) context.getResponse();
        response.setPayload(new ClassPathResource(VALID_MESSAGE, getClass()));
        boolean result = interceptor.handleResponse(context);
        Assert.assertTrue("Invalid response from interceptor", result);
    }
View Full Code Here

Examples of org.springframework.ws.context.DefaultMessageContext

            interceptor.setSchema(new ClassPathResource(SCHEMA2, PayloadValidatingInterceptorTest.class));
            interceptor.afterPropertiesSet();
            MessageFactory messageFactory = MessageFactory.newInstance();
            SOAPMessage saajMessage =
                    SaajUtils.loadMessage(new ClassPathResource(VALID_SOAP_MESSAGE, getClass()), messageFactory);
            context = new DefaultMessageContext(new SaajSoapMessage(saajMessage),
                    new SaajSoapMessageFactory(messageFactory));

            boolean result = interceptor.handleRequest(context);
            Assert.assertTrue("Invalid response from interceptor", result);
            Assert.assertFalse("Response set", context.hasResponse());
View Full Code Here

Examples of org.springframework.ws.context.DefaultMessageContext

    public void testHandlerInvalidRequestMultipleSchemas() throws Exception {
        interceptor.setSchemas(new Resource[]{new ClassPathResource(PRODUCT_SCHEMA, getClass()),
                new ClassPathResource(SIZE_SCHEMA, getClass())});
        interceptor.afterPropertiesSet();
        MockWebServiceMessage request = new MockWebServiceMessage(new ClassPathResource(INVALID_MESSAGE, getClass()));
        context = new DefaultMessageContext(request, new MockWebServiceMessageFactory());

        boolean validated;
        try {
            validated = interceptor.handleRequest(context);
        }
View Full Code Here

Examples of org.springframework.ws.context.DefaultMessageContext

    public void testHandleValidRequestMultipleSchemas() throws Exception {
        interceptor.setSchemas(new Resource[]{new ClassPathResource(PRODUCT_SCHEMA, getClass()),
                new ClassPathResource(SIZE_SCHEMA, getClass())});
        interceptor.afterPropertiesSet();
        MockWebServiceMessage request = new MockWebServiceMessage(new ClassPathResource(VALID_MESSAGE, getClass()));
        context = new DefaultMessageContext(request, new MockWebServiceMessageFactory());

        boolean result = interceptor.handleRequest(context);
        Assert.assertTrue("Invalid response from interceptor", result);
        Assert.assertFalse("Response set", context.hasResponse());
    }
View Full Code Here

Examples of org.springframework.ws.context.DefaultMessageContext

    public void testHandleInvalidResponseMultipleSchemas() throws Exception {
        interceptor.setSchemas(new Resource[]{new ClassPathResource(PRODUCT_SCHEMA, getClass()),
                new ClassPathResource(SIZE_SCHEMA, getClass())});
        interceptor.afterPropertiesSet();
        MockWebServiceMessage request = new MockWebServiceMessage();
        context = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
        MockWebServiceMessage response = (MockWebServiceMessage) context.getResponse();
        response.setPayload(new ClassPathResource(INVALID_MESSAGE, getClass()));
        boolean result = interceptor.handleResponse(context);
        Assert.assertFalse("Invalid response from interceptor", result);
    }
View Full Code Here

Examples of org.springframework.ws.context.DefaultMessageContext

    public void testHandleValidResponseMultipleSchemas() throws Exception {
        interceptor.setSchemas(new Resource[]{new ClassPathResource(PRODUCT_SCHEMA, getClass()),
                new ClassPathResource(SIZE_SCHEMA, getClass())});
        interceptor.afterPropertiesSet();
        MockWebServiceMessage request = new MockWebServiceMessage();
        context = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
        MockWebServiceMessage response = (MockWebServiceMessage) context.getResponse();
        response.setPayload(new ClassPathResource(VALID_MESSAGE, getClass()));
        boolean result = interceptor.handleResponse(context);
        Assert.assertTrue("Invalid response from interceptor", result);
    }
View Full Code Here

Examples of org.springframework.ws.context.DefaultMessageContext

        interceptor.setValidateRequest(true);
        interceptor.setValidateResponse(true);
        interceptor.afterPropertiesSet();
        MockWebServiceMessage request = new MockWebServiceMessage();
        request.setPayload(new ClassPathResource(VALID_MESSAGE, getClass()));
        context = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
        boolean result = interceptor.handleRequest(context);
        Assert.assertTrue("Invalid response from interceptor", result);
        Assert.assertFalse("Response set", context.hasResponse());
    }
View Full Code Here

Examples of org.springframework.ws.context.DefaultMessageContext

    }

    @Test
    public void testValidRequest() throws Exception {
        SaajSoapMessage valid = loadSaajMessage(getTestPath() + "/valid.xml");
        MessageContext context = new DefaultMessageContext(valid, new SaajSoapMessageFactory(messageFactory));

        replay(strategyMock);

        boolean result = interceptor.handleRequest(context, null);
        assertTrue("Valid request not handled", result);
        assertFalse("Message Context has response", context.hasResponse());

        verify(strategyMock);
    }
View Full Code Here

Examples of org.springframework.ws.context.DefaultMessageContext

    }

    @Test
    public void testNoMessageId() throws Exception {
        SaajSoapMessage valid = loadSaajMessage(getTestPath() + "/request-no-message-id.xml");
        MessageContext context = new DefaultMessageContext(valid, new SaajSoapMessageFactory(messageFactory));

        replay(strategyMock);

        boolean result = interceptor.handleRequest(context, null);
        assertFalse("Request with no MessageID handled", result);
        assertTrue("Message Context has no response", context.hasResponse());
        SaajSoapMessage expectedResponse = loadSaajMessage(getTestPath() + "/response-no-message-id.xml");
        assertXMLEqual("Invalid response for message with no MessageID", expectedResponse,
                (SaajSoapMessage) context.getResponse());

        verify(strategyMock);
    }
View Full Code Here

Examples of org.springframework.ws.context.DefaultMessageContext

    }

    @Test
    public void testNoReplyTo() throws Exception {
        SaajSoapMessage valid = loadSaajMessage(getTestPath() + "/request-no-reply-to.xml");
        MessageContext context = new DefaultMessageContext(valid, new SaajSoapMessageFactory(messageFactory));
        URI messageId = new URI("uid:1234");

        expect(strategyMock.newMessageId((SoapMessage) context.getResponse())).andReturn(messageId);
        replay(strategyMock);

        boolean result = interceptor.handleResponse(context, null);
        assertTrue("Request with no ReplyTo not handled", result);
        assertTrue("Message Context has no response", context.hasResponse());
        SaajSoapMessage expectedResponse = loadSaajMessage(getTestPath() + "/response-anonymous.xml");
        assertXMLEqual("Invalid response for message with invalid MAP", expectedResponse,
                (SaajSoapMessage) context.getResponse());

        verify(strategyMock);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.