Package org.springframework.ws

Examples of org.springframework.ws.MockWebServiceMessageFactory


    }

    @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;
        assertEquals("invalid result", "Foo", rootElement.getString());
View Full Code Here


    }

    @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;
        assertEquals("invalid result", "Foo", type.getString());
View Full Code Here

                throw new UnsupportedOperationException();
            }
        };
        // Create a message context with that request. Note that the message factory doesn't matter here:
        // it is required but not used.
        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;
        assertEquals("invalid result", "Foo", rootElement.getString());
View Full Code Here

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

    @Test
    public void handleReturnValue() throws Exception {
        MessageContext messageContext = new DefaultMessageContext(new MockWebServiceMessageFactory());

        MyRootElement rootElement = new MyRootElement();
        rootElement.setString("Foo");
        processor.handleReturnValue(messageContext, rootElementReturnType, rootElement);
        assertTrue("context has no response", messageContext.hasResponse());
View Full Code Here

        assertXMLEqual("<root xmlns='http://springframework.org'><string>Foo</string></root>", response.getPayloadAsString());
    }

    @Test
    public void handleNullReturnValue() throws Exception {
        MessageContext messageContext = new DefaultMessageContext(new MockWebServiceMessageFactory());

        MyRootElement rootElement = null;
        processor.handleReturnValue(messageContext, rootElementReturnType, rootElement);
        assertFalse("context has response", messageContext.hasResponse());
    }
View Full Code Here

    }

    @Test
    public void testGetLookupKeyForMessageNoNamespace() throws Exception {
        MockWebServiceMessage request = new MockWebServiceMessage("<MyRequest/>");
        MessageContext messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
        String result = mapping.getLookupKeyForMessage(messageContext);
        Assert.assertEquals("Invalid lookup key", "MyRequest", result);
    }
View Full Code Here

    @Test
    public void testGetLookupKeyForMessageNamespace() throws Exception {
        MockWebServiceMessage request =
                new MockWebServiceMessage("<MyRequest xmlns='http://springframework.org/spring-ws/' />");
        MessageContext messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
        String result = mapping.getLookupKeyForMessage(messageContext);
        Assert.assertEquals("Invalid lookup key", "MyRequest", result);
    }
View Full Code Here

    public void testGetLookupKeyForMessage() throws Exception {
        mapping.setExpression("/root/text()");
        mapping.afterPropertiesSet();

        MockWebServiceMessage request = new MockWebServiceMessage("<root>value</root>");
        MessageContext context = new DefaultMessageContext(request, new MockWebServiceMessageFactory());

        String result = mapping.getLookupKeyForMessage(context);
        Assert.assertNotNull("mapping returns null", result);
        Assert.assertEquals("mapping returns invalid result", "value", result);
    }
View Full Code Here

    private MessageContext context;

    @Before
    public void setUp() throws Exception {
        mapping = new UriEndpointMapping();
        context = new DefaultMessageContext(new MockWebServiceMessageFactory());
    }
View Full Code Here

    }

    @Test
    public void testResolveQNames() throws Exception {
        MockWebServiceMessage request = new MockWebServiceMessage("<root/>");
        MessageContext context = new DefaultMessageContext(request, new MockWebServiceMessageFactory());

        QName qName = mapping.resolveQName(context);
        Assert.assertNotNull("mapping returns null", qName);
        Assert.assertEquals("mapping returns invalid qualified name", new QName("root"), qName);
    }
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.