Package org.springframework.xml.transform

Examples of org.springframework.xml.transform.StringSource


        Node node = xpathTemplate.evaluateAsNode(xpathExpression, new DOMSource(document));
        Assert.assertNull(message, node);
    }

    protected void assertXpathNotExists(String message, String xpathExpression, String document) {
        Node node = xpathTemplate.evaluateAsNode(xpathExpression, new StringSource(document));
        Assert.assertNull(message, node);
    }
View Full Code Here


        return new StreamResult(new StringBufferWriter());
    }

    @Override
    public Source getPayloadSource() {
        return content != null ? new StringSource(content.toString()) : null;
    }
View Full Code Here

    }

    @Test
    public void testGetPayload() throws Exception {
        String content = "<root xmlns='http://www.springframework.org/spring-ws'>" + "<child/></root>";
        StringSource source = new StringSource(content);
        transformer.transform(source, message.getPayloadResult());
        StringResult stringResult = new StringResult();
        transformer.transform(message.getPayloadSource(), stringResult);
        assertXMLEqual(content, stringResult.toString());
    }
View Full Code Here

    }

    @Test
    public void testGetPayloadResultTwice() throws Exception {
        String content = "<element xmlns=\"http://www.springframework.org/spring-ws\" />";
        transformer.transform(new StringSource(content), message.getPayloadResult());
        transformer.transform(new StringSource(content), message.getPayloadResult());
        StringResult stringResult = new StringResult();
        transformer.transform(message.getPayloadSource(), stringResult);
        assertXMLEqual(content, stringResult.toString());
    }
View Full Code Here

    }

    @Test
    public void testWriteTo() throws Exception {
        String content = "<root xmlns='http://www.springframework.org/spring-ws'>" + "<child/></root>";
        StringSource source = new StringSource(content);
        transformer.transform(source, message.getPayloadResult());
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        message.writeTo(os);
        assertXMLEqual(content, os.toString("UTF-8"));
    }
View Full Code Here

        assertNotNull("No SoapHeaderElement returned", headerElement);
        assertEquals("Invalid qName for element", qName, headerElement.getName());
        Iterator<SoapHeaderElement> iterator = soapHeader.examineAllHeaderElements();
        assertTrue("SoapHeader has no elements", iterator.hasNext());
        String payload = "<content xmlns='http://www.springframework.org'/>";
        transformer.transform(new StringSource(payload), headerElement.getResult());
        assertHeaderElementEqual(headerElement,
                "<spring:localName xmlns:spring='http://www.springframework.org'><spring:content/></spring:localName>");
    }
View Full Code Here

        QName qName = new QName(NAMESPACE, "localName", PREFIX);
        SoapHeaderElement headerElement = soapHeader.addHeaderElement(qName);
        assertEquals("Invalid qName for element", qName, headerElement.getName());
        assertNotNull("No SoapHeaderElement returned", headerElement);
        String payload = "<content xmlns='http://www.springframework.org'/>";
        transformer.transform(new StringSource(payload), headerElement.getResult());
        Iterator<SoapHeaderElement> iterator = soapHeader.examineAllHeaderElements();
        assertNotNull("header element iterator is null", iterator);
        assertTrue("header element iterator has no elements", iterator.hasNext());
        headerElement = iterator.next();
        assertEquals("Invalid qName for element", qName, headerElement.getName());
View Full Code Here

    @Test
    public void testGetResult() throws Exception {
        String content =
                "<spring:localName xmlns:spring='http://www.springframework.org'><spring:content/></spring:localName>";
        transformer.transform(new StringSource(content), soapHeader.getResult());
        Iterator<SoapHeaderElement> iterator = soapHeader.examineAllHeaderElements();
        assertTrue("Header has no children", iterator.hasNext());
        SoapHeaderElement headerElement = iterator.next();
        assertFalse("Header has too many children", iterator.hasNext());
        assertHeaderElementEqual(headerElement, content);
View Full Code Here

        AxiomSoapMessage axiomSoapMessage = messageFactory.createWebServiceMessage();
        soapBody = axiomSoapMessage.getSoapBody();

        String payload = "<payload xmlns='http://www.springframework.org' />";
        transformer.transform(new StringSource(payload), soapBody.getPayloadResult());
        assertPayloadEqual(payload);
    }
View Full Code Here

                .andReturn(response);

        replay(requestMatcher1, requestMatcher2, responseCreator);

        server.expect(requestMatcher1).andExpect(requestMatcher2).andRespond(responseCreator);
        template.sendSourceAndReceiveToResult(uri.toString(), new StringSource("<request xmlns='http://example.com'/>"),
                new StringResult());

        verify(requestMatcher1, requestMatcher2, responseCreator);
    }
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.