INT-1263, added more changes and tests related valdating MessageHistory in every module

This commit is contained in:
Oleg Zhurakousky
2010-09-22 18:44:51 -04:00
parent dee91f6871
commit b6e058c59b
46 changed files with 367 additions and 114 deletions

View File

@@ -99,5 +99,8 @@ public abstract class AbstractXPathRouter extends AbstractChannelNameResolvingMe
protected XPathExpression getXPathExpression() {
return this.xPathExpression;
}
public String getComponentType(){
return "xml:xpath-router";
}
}

View File

@@ -164,5 +164,9 @@ public class XPathMessageSplitter extends AbstractMessageSplitter {
return this.documentBuilderFactory.newDocumentBuilder();
}
}
public String getComponentType(){
return "xml:xpath-splitter";
}
}

View File

@@ -16,7 +16,6 @@
package org.springframework.integration.xml.transformer;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.xml.parsers.ParserConfigurationException;
@@ -35,8 +34,6 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.context.expression.MapAccessor;
import org.springframework.core.io.Resource;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.integration.Message;
import org.springframework.integration.MessageHeaders;
@@ -250,4 +247,7 @@ public class XsltPayloadTransformer extends AbstractTransformer {
public void setXsltParamHeaders(String[] xsltParamHeaders) {
this.xsltParamHeaders = xsltParamHeaders;
}
public String getComponentType(){
return "xml:xslt-transformer";
}
}

View File

@@ -15,6 +15,8 @@
*/
package org.springframework.integration.xml.transformer;
import java.util.Properties;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -25,12 +27,14 @@ import org.springframework.integration.MessageChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.assertFalse;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;
/**
@@ -56,7 +60,10 @@ public class XsltTransformerTests {
input.send(message);
Message<?> resultMessage = output.receive();
MessageHistory history = MessageHistory.read(resultMessage);
assertTrue(history.containsComponent("paramHeadersWithStartWildCharacter"));
assertNotNull(history);
Properties componentHistoryRecord = TestUtils.locateComponentInHistory(history, "paramHeadersWithStartWildCharacter", 0);
assertNotNull(componentHistoryRecord);
assertEquals("xml:xslt-transformer", componentHistoryRecord.get("type"));
assertEquals("Wrong payload type",String.class, resultMessage.getPayload().getClass());
assertTrue(((String) resultMessage.getPayload()).contains("testParamValue"));
assertFalse(((String) resultMessage.getPayload()).contains("FOO"));