RESOLVED - issue INT-1010, INT-1050, INT-1100

This commit is contained in:
David Syer
2010-04-26 16:30:22 +00:00
parent dd4afd8cb5
commit 193d9b6002
4 changed files with 38 additions and 66 deletions

View File

@@ -49,8 +49,6 @@ public class JdbcMessageStore implements MessageStore {
private static final String LIST_MESSAGES_BY_CORRELATION_KEY = "SELECT STORE_ID, MESSAGE_ID, CORRELATION_KEY, MESSAGE_BYTES, VERSION from %PREFIX%MESSAGE where CORRELATION_KEY=?";
private static final String LIST_ALL_MESSAGES = "SELECT STORE_ID, MESSAGE_ID, CORRELATION_KEY, MESSAGE_BYTES, VERSION from %PREFIX%MESSAGE";
private static final String GET_MESSAGE = "SELECT STORE_ID, MESSAGE_ID, CORRELATION_KEY, MESSAGE_BYTES, VERSION from %PREFIX%MESSAGE where MESSAGE_ID=?";
private static final String DELETE_MESSAGE = "DELETE from %PREFIX%MESSAGE where MESSAGE_ID=?";
@@ -205,10 +203,6 @@ public class JdbcMessageStore implements MessageStore {
return list.get(0);
}
public List<Message<?>> list() {
return jdbcTemplate.query(getQuery(LIST_ALL_MESSAGES), new MessageMapper());
}
public List<Message<?>> list(Object correlationId) {
return jdbcTemplate.query(getQuery(LIST_MESSAGES_BY_CORRELATION_KEY), new Object[] { getKey(correlationId) },
new MessageMapper());

View File

@@ -15,11 +15,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.integration.core.Message;
import org.springframework.integration.message.MessageBuilder;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.jdbc.SimpleJdbcTestUtils;
import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration
@@ -36,12 +34,9 @@ public class JdbcMessageStoreTests {
private JdbcMessageStore messageStore;
private SimpleJdbcTemplate jdbcTemplate;
@Before
public void init() {
messageStore = new JdbcMessageStore(dataSource, messageIncrementer);
jdbcTemplate = new SimpleJdbcTemplate(dataSource);
}
@Test
@@ -71,15 +66,6 @@ public class JdbcMessageStoreTests {
assertEquals("Y", messageStore.get(message.getHeaders().getId()).getHeaders().getCorrelationId());
}
@Test
@Transactional
public void testAddAndList() throws Exception {
Message<String> message = MessageBuilder.withPayload("foo").build();
messageStore.put(message);
assertEquals(1, SimpleJdbcTestUtils.countRowsInTable(jdbcTemplate, "INT_MESSAGE"));
assertEquals(1, messageStore.list().size());
}
@Test
@Transactional
public void testAddAndListByCorrelationId() throws Exception {