INT-896, Reverted the changes as they were unnecessary at the end

This commit is contained in:
Oleg Zhurakousky
2010-07-21 19:31:03 +00:00
parent 5c9780cd71
commit ccec33dc57
2 changed files with 4 additions and 9 deletions

View File

@@ -37,7 +37,6 @@ import org.springframework.xml.transform.StringResult;
/**
* @author Jonas Partner
* @author Mark Fisher
* @author Oleg Zhurakousky
*/
public class MarshallingTransformerParserTests {
@@ -112,7 +111,8 @@ public class MarshallingTransformerParserTests {
Message<?> result = output.receive(0);
assertTrue("Wrong payload type", result.getPayload() instanceof DOMResult);
Document doc = (Document) ((DOMResult) result.getPayload()).getNode();
assertEquals("Wrong payload", "hello", doc.getDocumentElement().getTextContent());
String expected = "[Payload=hello][Headers=";
assertEquals("Wrong payload", expected, doc.getDocumentElement().getTextContent().substring(0, expected.length()));
}
}

View File

@@ -22,7 +22,6 @@ import javax.xml.transform.Result;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import org.springframework.integration.core.Message;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.XmlMappingException;
import org.springframework.xml.transform.StringSource;
@@ -30,16 +29,12 @@ import org.springframework.xml.transform.StringSource;
/**
*
* @author Jonas Partner
* @author Oleg Zhurakousky
*
*/
public class StubMarshaller implements Marshaller {
public void marshal(Object source, Result result) throws XmlMappingException, IOException {
public void marshal(Object graph, Result result) throws XmlMappingException, IOException {
try {
Object graph = source;
if (source instanceof Message<?>) {
graph = ((Message<?>)source).getPayload();
}
Transformer transformer = TransformerFactory.newInstance().newTransformer();
StringSource stringSource = new StringSource("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><root>" + graph.toString() + "</root>");
transformer.transform(stringSource, result);