From d1bc9e9b393be64c81211a372a6004b3ea1fc094 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 23 Sep 2010 18:55:58 +0200 Subject: [PATCH] INT-1263: fix broken test --- .../springframework/integration/test/util/TestUtils.java | 6 ++++++ .../jdbc/config/JdbcPollingChannelAdapterParserTests.java | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/spring-integration-core/src/test/java/org/springframework/integration/test/util/TestUtils.java b/spring-integration-core/src/test/java/org/springframework/integration/test/util/TestUtils.java index fb4a1c3be0..64ba517942 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/test/util/TestUtils.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/test/util/TestUtils.java @@ -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"); diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcPollingChannelAdapterParserTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcPollingChannelAdapterParserTests.java index b791bff600..7c87ab9b53 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcPollingChannelAdapterParserTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcPollingChannelAdapterParserTests.java @@ -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); }