diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/XsltPayloadTransformerTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/XsltPayloadTransformerTests.java
index 460db25ea7..7bee4335b5 100644
--- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/XsltPayloadTransformerTests.java
+++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/XsltPayloadTransformerTests.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -49,176 +49,176 @@ import org.springframework.xml.transform.StringSource;
*/
public class XsltPayloadTransformerTests {
- private XsltPayloadTransformer transformer;
+ private XsltPayloadTransformer transformer;
- private String docAsString = "test";
+ private final String docAsString = "test";
- private String outputAsString = "test";
+ private final String outputAsString = "test";
- @Before
- public void setUp() throws Exception {
- transformer = new XsltPayloadTransformer(getXslResource());
+ @Before
+ public void setUp() throws Exception {
+ transformer = new XsltPayloadTransformer(getXslResource());
transformer.afterPropertiesSet();
- }
+ }
- @Test
- public void testDocumentAsPayload() throws Exception {
- Object transformed = transformer.doTransform(buildMessage(XmlTestUtil
- .getDocumentForString(docAsString)));
- assertTrue("Wrong return type for document payload", Document.class
- .isAssignableFrom(transformed.getClass()));
- Document transformedDocument = (Document) transformed;
- assertXMLEqual(outputAsString, XmlTestUtil
- .docToString(transformedDocument));
- }
+ @Test
+ public void testDocumentAsPayload() throws Exception {
+ Object transformed = transformer.doTransform(buildMessage(XmlTestUtil
+ .getDocumentForString(docAsString)));
+ assertTrue("Wrong return type for document payload", Document.class
+ .isAssignableFrom(transformed.getClass()));
+ Document transformedDocument = (Document) transformed;
+ assertXMLEqual(outputAsString, XmlTestUtil
+ .docToString(transformedDocument));
+ }
- @Test
- public void testSourceAsPayload() throws Exception {
- Object transformed = transformer
- .doTransform(buildMessage(new StringSource(docAsString)));
- assertEquals("Wrong return type for source payload", DOMResult.class,
- transformed.getClass());
- DOMResult result = (DOMResult) transformed;
- assertXMLEqual("Document incorrect after transformation", XmlTestUtil
- .getDocumentForString(outputAsString), (Document) result
- .getNode());
- }
+ @Test
+ public void testSourceAsPayload() throws Exception {
+ Object transformed = transformer
+ .doTransform(buildMessage(new StringSource(docAsString)));
+ assertEquals("Wrong return type for source payload", DOMResult.class,
+ transformed.getClass());
+ DOMResult result = (DOMResult) transformed;
+ assertXMLEqual("Document incorrect after transformation", XmlTestUtil
+ .getDocumentForString(outputAsString), (Document) result
+ .getNode());
+ }
- @Test
- public void testStringAsPayload() throws Exception {
- Object transformed = transformer.doTransform(buildMessage(docAsString));
- assertEquals("Wrong return type for string payload", String.class,
- transformed.getClass());
- String transformedString = (String) transformed;
- assertXMLEqual("String incorrect after transform", outputAsString,
- transformedString);
- }
+ @Test
+ public void testStringAsPayload() throws Exception {
+ Object transformed = transformer.doTransform(buildMessage(docAsString));
+ assertEquals("Wrong return type for string payload", String.class,
+ transformed.getClass());
+ String transformedString = (String) transformed;
+ assertXMLEqual("String incorrect after transform", outputAsString,
+ transformedString);
+ }
- @Test
- public void testStringAsPayloadUseResultFactoryTrue() throws Exception {
- transformer.setAlwaysUseResultFactory(true);
- Object transformed = transformer.doTransform(buildMessage(docAsString));
- assertEquals("Wrong return type for useFactories true",
- DOMResult.class, transformed.getClass());
- DOMResult result = (DOMResult) transformed;
- assertXMLEqual("Document incorrect after transformation", XmlTestUtil
- .getDocumentForString(outputAsString), (Document) result
- .getNode());
- }
+ @Test
+ public void testStringAsPayloadUseResultFactoryTrue() throws Exception {
+ transformer.setAlwaysUseResultFactory(true);
+ Object transformed = transformer.doTransform(buildMessage(docAsString));
+ assertEquals("Wrong return type for useFactories true",
+ DOMResult.class, transformed.getClass());
+ DOMResult result = (DOMResult) transformed;
+ assertXMLEqual("Document incorrect after transformation", XmlTestUtil
+ .getDocumentForString(outputAsString), (Document) result
+ .getNode());
+ }
- @Test
- public void testSourceWithResultTransformer() throws Exception {
- Integer returnValue = new Integer(13);
- transformer = new XsltPayloadTransformer(getXslResource(),
- new StubResultTransformer(returnValue));
+ @Test
+ public void testSourceWithResultTransformer() throws Exception {
+ Integer returnValue = new Integer(13);
+ transformer = new XsltPayloadTransformer(getXslResource(),
+ new StubResultTransformer(returnValue));
transformer.afterPropertiesSet();
- Object transformed = transformer
- .doTransform(buildMessage(new StringSource(docAsString)));
- assertEquals("Wrong value from result conversion", returnValue,
- transformed);
- }
+ Object transformed = transformer
+ .doTransform(buildMessage(new StringSource(docAsString)));
+ assertEquals("Wrong value from result conversion", returnValue,
+ transformed);
+ }
- @Test
- public void testXsltPayloadWithTransformerFactoryClassname() throws Exception {
- Integer returnValue = new Integer(13);
- transformer = new XsltPayloadTransformer(getXslResource(), new StubResultTransformer(returnValue),
- "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
+ @Test
+ public void testXsltPayloadWithTransformerFactoryClassname() throws Exception {
+ Integer returnValue = new Integer(13);
+ transformer = new XsltPayloadTransformer(getXslResource(), new StubResultTransformer(returnValue),
+ "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
transformer.afterPropertiesSet();
- Object transformed = transformer
- .doTransform(buildMessage(new StringSource(docAsString)));
- assertEquals("Wrong value from result conversion", returnValue,
- transformed);
- }
+ Object transformed = transformer
+ .doTransform(buildMessage(new StringSource(docAsString)));
+ assertEquals("Wrong value from result conversion", returnValue,
+ transformed);
+ }
- @Test(expected = TransformerFactoryConfigurationError.class)
- public void testXsltPayloadWithBadTransformerFactoryClassname() throws Exception {
- transformer = new XsltPayloadTransformer(getXslResource(), "foo.bar.Baz");
+ @Test(expected = TransformerFactoryConfigurationError.class)
+ public void testXsltPayloadWithBadTransformerFactoryClassname() throws Exception {
+ transformer = new XsltPayloadTransformer(getXslResource(), "foo.bar.Baz");
transformer.afterPropertiesSet();
- transformer.doTransform(buildMessage(new StringSource(docAsString)));
- }
+ transformer.doTransform(buildMessage(new StringSource(docAsString)));
+ }
- @Test(expected = TransformerException.class)
- public void testNonXmlString() throws Exception {
- transformer.doTransform(buildMessage("test"));
- }
+ @Test(expected = TransformerException.class)
+ public void testNonXmlString() throws Exception {
+ transformer.doTransform(buildMessage("test"));
+ }
- @Test(expected = MessagingException.class)
- public void testUnsupportedPayloadType() throws Exception {
- transformer.doTransform(buildMessage(new Long(12)));
- }
+ @Test(expected = MessagingException.class)
+ public void testUnsupportedPayloadType() throws Exception {
+ transformer.doTransform(buildMessage(new Long(12)));
+ }
- @Test
- public void testXsltWithImports() throws Exception {
- Resource resource = new ClassPathResource("transform-with-import.xsl",
- this.getClass());
- transformer = new XsltPayloadTransformer(resource);
+ @Test
+ public void testXsltWithImports() throws Exception {
+ Resource resource = new ClassPathResource("transform-with-import.xsl",
+ this.getClass());
+ transformer = new XsltPayloadTransformer(resource);
transformer.afterPropertiesSet();
- assertEquals(transformer.doTransform(buildMessage(docAsString)),
+ assertEquals(transformer.doTransform(buildMessage(docAsString)),
outputAsString);
- }
+ }
- @Test
- public void documentInStringResultOut() throws Exception {
- Resource resource = new ClassPathResource("transform-with-import.xsl",
- this.getClass());
- transformer = new XsltPayloadTransformer(resource);
- transformer.setResultFactory(new StringResultFactory());
- transformer.setAlwaysUseResultFactory(true);
+ @Test
+ public void documentInStringResultOut() throws Exception {
+ Resource resource = new ClassPathResource("transform-with-import.xsl",
+ this.getClass());
+ transformer = new XsltPayloadTransformer(resource);
+ transformer.setResultFactory(new StringResultFactory());
+ transformer.setAlwaysUseResultFactory(true);
transformer.afterPropertiesSet();
- Object returned = transformer.doTransform(buildMessage(XmlTestUtil.getDocumentForString(docAsString)));
- assertEquals("Wrong type of return ", StringResult.class, returned.getClass());
- }
+ Object returned = transformer.doTransform(buildMessage(XmlTestUtil.getDocumentForString(docAsString)));
+ assertEquals("Wrong type of return ", StringResult.class, returned.getClass());
+ }
- @Test
- public void stringInDomResultOut() throws Exception {
- Resource resource = new ClassPathResource("transform-with-import.xsl",
- this.getClass());
- transformer = new XsltPayloadTransformer(resource);
- transformer.setResultFactory(new StringResultFactory());
- transformer.setAlwaysUseResultFactory(true);
+ @Test
+ public void stringInDomResultOut() throws Exception {
+ Resource resource = new ClassPathResource("transform-with-import.xsl",
+ this.getClass());
+ transformer = new XsltPayloadTransformer(resource);
+ transformer.setResultFactory(new StringResultFactory());
+ transformer.setAlwaysUseResultFactory(true);
transformer.afterPropertiesSet();
- Object returned = transformer.doTransform(buildMessage(XmlTestUtil.getDocumentForString(docAsString)));
- assertEquals("Wrong type of return ", StringResult.class, returned.getClass());
- }
+ Object returned = transformer.doTransform(buildMessage(XmlTestUtil.getDocumentForString(docAsString)));
+ assertEquals("Wrong type of return ", StringResult.class, returned.getClass());
+ }
- @Test
- public void docInStringOut() throws Exception {
- transformer = new XsltPayloadTransformer(getXslResourceThatOutputsText());
- transformer.setResultFactory(new StringResultFactory());
- transformer.setAlwaysUseResultFactory(true);
+ @Test
+ public void docInStringOut() throws Exception {
+ transformer = new XsltPayloadTransformer(getXslResourceThatOutputsText());
+ transformer.setResultFactory(new StringResultFactory());
+ transformer.setAlwaysUseResultFactory(true);
transformer.afterPropertiesSet();
- Object returned = transformer.doTransform(buildMessage(XmlTestUtil.getDocumentForString(docAsString)));
- assertEquals("Wrong type of return ", StringResult.class, returned.getClass());
- assertEquals("Wrong content in string", "hello world", returned.toString());
- }
+ Object returned = transformer.doTransform(buildMessage(XmlTestUtil.getDocumentForString(docAsString)));
+ assertEquals("Wrong type of return ", StringResult.class, returned.getClass());
+ assertEquals("Wrong content in string", "hello world", returned.toString());
+ }
- protected Message> buildMessage(Object payload) {
- return MessageBuilder.withPayload(payload).build();
- }
+ protected Message> buildMessage(Object payload) {
+ return MessageBuilder.withPayload(payload).build();
+ }
- private Resource getXslResource() throws Exception {
- String xsl = "test";
- return new ByteArrayResource(xsl.getBytes("UTF-8"));
- }
+ private Resource getXslResource() throws Exception {
+ String xsl = "test";
+ return new ByteArrayResource(xsl.getBytes("UTF-8"));
+ }
- private Resource getXslResourceThatOutputsText() throws Exception {
- String xsl = "hello world";
- return new ByteArrayResource(xsl.getBytes("UTF-8"));
- }
+ private Resource getXslResourceThatOutputsText() throws Exception {
+ String xsl = "hello world";
+ return new ByteArrayResource(xsl.getBytes("UTF-8"));
+ }
- public static class StubResultTransformer implements ResultTransformer {
+ public static class StubResultTransformer implements ResultTransformer {
- private Object objectToReturn;
+ private final Object objectToReturn;
- public StubResultTransformer(Object objectToReturn) {
- this.objectToReturn = objectToReturn;
- }
+ public StubResultTransformer(Object objectToReturn) {
+ this.objectToReturn = objectToReturn;
+ }
- public Object transformResult(Result result) {
- return objectToReturn;
- }
- }
+ public Object transformResult(Result result) {
+ return objectToReturn;
+ }
+ }
}
diff --git a/src/reference/docbook/whats-new.xml b/src/reference/docbook/whats-new.xml
index 444a45bcde..c3e1a0eee4 100644
--- a/src/reference/docbook/whats-new.xml
+++ b/src/reference/docbook/whats-new.xml
@@ -372,6 +372,13 @@
For more information see .
+