Package org.springframework.ws

Examples of org.springframework.ws.MockWebServiceMessage$StringBufferWriter


        Assert.assertNull("Endpoint registered", mapping.lookupEndpoint("request"));
    }

    @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


        Assert.assertEquals("Invalid lookup key", "MyRequest", result);
    }

    @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

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

        mapping = new PayloadRootQNameEndpointMapping();
    }

    @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

        Assert.assertEquals("mapping returns invalid qualified name", new QName("root"), qName);
    }

    @Test
    public void testGetQNameNameNamespace() throws Exception {
        MockWebServiceMessage request = new MockWebServiceMessage("<prefix:localname xmlns:prefix=\"namespace\"/>");
        MessageContext context = new DefaultMessageContext(request, new MockWebServiceMessageFactory());

        QName qName = mapping.resolveQName(context);
        Assert.assertNotNull("mapping returns null", qName);
        Assert.assertEquals("mapping returns invalid method name", new QName("namespace", "localname", "prefix"), qName);
View Full Code Here

                processor.supportsReturnType(supportedReturnType));
    }

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

        JAXBElement<?> result = processor.resolveArgument(messageContext, supportedParameter);
        assertTrue("result not a MyType", result.getValue() instanceof MyType);
        MyType type = (MyType) result.getValue();
View Full Code Here

        MyType type = new MyType();
        type.setString("Foo");
        JAXBElement<MyType> element = new JAXBElement<MyType>(new QName("http://springframework.org", "type"), MyType.class, type);
        processor.handleReturnValue(messageContext, supportedReturnType, element);
        assertTrue("context has no response", messageContext.hasResponse());
        MockWebServiceMessage response = (MockWebServiceMessage) messageContext.getResponse();
        assertXMLEqual("<type xmlns='http://springframework.org'><string>Foo</string></type>", response.getPayloadAsString());
    }
View Full Code Here

        String s = "Foo";
        JAXBElement<String> element = new JAXBElement<String>(new QName("http://springframework.org", "string"), String.class, s);
        processor.handleReturnValue(messageContext, stringReturnType, element);
        assertTrue("context has no response", messageContext.hasResponse());
        MockWebServiceMessage response = (MockWebServiceMessage) messageContext.getResponse();
        assertXMLEqual("<string xmlns='http://springframework.org'>Foo</string>", response.getPayloadAsString());
    }
View Full Code Here

    private WebServiceMessageFactory factoryMock;

    @Before
    public void setUp() throws Exception {
        MockWebServiceMessage request = new MockWebServiceMessage("<request/>");
        transformer = TransformerFactory.newInstance().newTransformer();
        factoryMock = createMock(WebServiceMessageFactory.class);

        context = new DefaultMessageContext(request, factoryMock);
    }
View Full Code Here

        };
        endpoint.setMarshaller(marshaller);
        endpoint.setUnmarshaller(unmarshaller);
        endpoint.afterPropertiesSet();

        expect(factoryMock.createWebServiceMessage()).andReturn(new MockWebServiceMessage());

        replay(factoryMock);

        endpoint.invoke(context);
        MockWebServiceMessage response = (MockWebServiceMessage) context.getResponse();
        Assert.assertNotNull("Invalid result", response);
        assertXMLEqual("Invalid response", "<result/>", response.getPayloadAsString());

        verify(factoryMock);
    }
View Full Code Here

TOP

Related Classes of org.springframework.ws.MockWebServiceMessage$StringBufferWriter

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.