Package org.springframework.xml.transform

Examples of org.springframework.xml.transform.StringSource


        verify(requestMatcher1, requestMatcher2, responseCreator);
    }

    @Test
    public void payloadMatch() throws Exception {
        Source request = new StringSource("<request xmlns='http://example.com'/>");
        Source response = new StringSource("<response xmlns='http://example.com'/>");

        server.expect(payload(request)).andRespond(withPayload(response));

        StringResult result = new StringResult();
        template.sendSourceAndReceiveToResult(request, result);
        assertXMLEqual(result.toString(), response.toString());
    }
View Full Code Here


        assertXMLEqual(result.toString(), response.toString());
    }

    @Test(expected = AssertionError.class)
    public void payloadNonMatch() throws Exception {
        Source expected = new StringSource("<request xmlns='http://example.com'/>");

        server.expect(payload(expected));

        StringResult result = new StringResult();
        String actual = "<request xmlns='http://other.com'/>";
        template.sendSourceAndReceiveToResult(new StringSource(actual), result);
    }
View Full Code Here

    public void soapHeaderMatch() throws Exception {
        final QName soapHeaderName = new QName("http://example.com", "mySoapHeader");

        server.expect(soapHeader(soapHeaderName));

        template.sendSourceAndReceiveToResult(new StringSource("<request xmlns='http://example.com'/>"),
                new WebServiceMessageCallback() {
                    public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException {
                        SoapMessage soapMessage = (SoapMessage) message;
                        soapMessage.getSoapHeader().addHeaderElement(soapHeaderName);
                    }
View Full Code Here

    public void soapHeaderNonMatch() throws Exception {
        QName soapHeaderName = new QName("http://example.com", "mySoapHeader");

        server.expect(soapHeader(soapHeaderName));

        template.sendSourceAndReceiveToResult(new StringSource("<request xmlns='http://example.com'/>"),
                new StringResult());
    }
View Full Code Here

    @Test
    public void connectionMatch() throws Exception {
        String uri = "http://example.com";
        server.expect(connectionTo(uri));

        template.sendSourceAndReceiveToResult(uri, new StringSource("<request xmlns='http://example.com'/>"),
                new StringResult());
    }
View Full Code Here

    public void connectionNonMatch() throws Exception {
        String expected = "http://expected.com";
        server.expect(connectionTo(expected));

        String actual = "http://actual.com";
        template.sendSourceAndReceiveToResult(actual, new StringSource("<request xmlns='http://example.com'/>"),
                new StringResult());
    }
View Full Code Here

                new StringResult());
    }

    @Test(expected = AssertionError.class)
    public void unexpectedConnection() throws Exception {
        Source request = new StringSource("<request xmlns='http://example.com'/>");
        Source response = new StringSource("<response xmlns='http://example.com'/>");

        server.expect(payload(request)).andRespond(withPayload(response));

        template.sendSourceAndReceiveToResult(request, new StringResult());
        template.sendSourceAndReceiveToResult(request, new StringResult());
View Full Code Here

        server.expect(validPayload(schema));

        StringResult result = new StringResult();
        String actual = "<request xmlns='http://example.com'/>";
        template.sendSourceAndReceiveToResult(new StringSource(actual), result);
    }
View Full Code Here

        server.expect(validPayload(schema));

        StringResult result = new StringResult();
        String actual = "<request2 xmlns='http://example.com'/>";
        template.sendSourceAndReceiveToResult(new StringSource(actual), result);
    }
View Full Code Here

    public void xpathExistsMatch() throws Exception {
        final Map<String, String> ns = Collections.singletonMap("ns", "http://example.com");

        server.expect(xpath("/ns:request", ns).exists());

        template.sendSourceAndReceiveToResult(new StringSource("<request xmlns='http://example.com'/>"),
                new StringResult());
    }
View Full Code Here

TOP

Related Classes of org.springframework.xml.transform.StringSource

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.