INT-1263: fix broken test

This commit is contained in:
Dave Syer
2010-09-23 18:55:58 +02:00
parent 39a887df48
commit d1bc9e9b39
2 changed files with 8 additions and 1 deletions

View File

@@ -164,6 +164,12 @@ public abstract class TestUtils {
};
}
/**
* @param history a message history
* @param componentName the name of a component to scan for
* @param startingIndex the index to start scanning
* @return the properties provided by the named component or null if none available
*/
public static Properties locateComponentInHistory(MessageHistory history, String componentName, int startingIndex){
Assert.notNull(history, "'history' must not be null");
Assert.isTrue(StringUtils.hasText(componentName), "'componentName' must be provided");

View File

@@ -34,6 +34,7 @@ import org.springframework.integration.Message;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.integration.core.PollableChannel;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.transaction.PlatformTransactionManager;
@@ -61,7 +62,7 @@ public class JdbcPollingChannelAdapterParserTests {
this.jdbcTemplate.update("insert into item values(1,'',2)");
Message<?> message = messagingTemplate.receive();
MessageHistory history = MessageHistory.read(message);
assertTrue(history.containsComponent("jdbcAdapter"));
assertNotNull(TestUtils.locateComponentInHistory(history, "jdbcAdapter", 0));
assertNotNull("No message found ", message);
assertTrue("Wrong payload type expected instance of List", message.getPayload() instanceof List<?>);
}