Package org.springframework.ws

Examples of org.springframework.ws.MockWebServiceMessage


        Assert.assertFalse("Invalid response from interceptor", result);
    }

    @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


    @Test
    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

    @Test
    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

    @Test
    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

    @Test
    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

        schema.afterPropertiesSet();
        interceptor.setXsdSchema(schema);
        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

    @Before
    public void setUp() throws Exception {
        exceptionResolver = new SimpleSoapExceptionResolver();
        factoryMock = createMock(WebServiceMessageFactory.class);
        messageContext = new DefaultMessageContext(new MockWebServiceMessage(), factoryMock);
        messageMock = createMock(SoapMessage.class);
        bodyMock = createMock(Soap11Body.class);
    }
View Full Code Here

            processor.supportsReturnType(rootElementReturnType));
    }

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

        Object result = processor.resolveArgument(messageContext, rootElementParameter);
        assertTrue("result not a MyRootElement", result instanceof MyRootElement);
        MyRootElement rootElement = (MyRootElement) result;
View Full Code Here

        assertEquals("invalid result", "Foo", rootElement.getString());
    }

    @Test
    public void resolveArgumentType() throws JAXBException {
        WebServiceMessage request = new MockWebServiceMessage("<type xmlns='http://springframework.org'><string>Foo</string></type>");
        MessageContext messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());

        Object result = processor.resolveArgument(messageContext, typeParameter);
        assertTrue("result not a MyType", result instanceof MyType);
        MyType type = (MyType) result;
View Full Code Here

        MyRootElement rootElement = new MyRootElement();
        rootElement.setString("Foo");
        processor.handleReturnValue(messageContext, rootElementReturnType, rootElement);
        assertTrue("context has no response", messageContext.hasResponse());
        MockWebServiceMessage response = (MockWebServiceMessage) messageContext.getResponse();
        assertXMLEqual("<root xmlns='http://springframework.org'><string>Foo</string></root>", response.getPayloadAsString());
    }
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.