Search in sources :

Example 11 with MessageStore

use of org.springframework.integration.store.MessageStore in project spring-integration by spring-projects.

the class ClaimCheckParserTests method checkMessageStoreReferenceOnCheckIn.

@Test
public void checkMessageStoreReferenceOnCheckIn() {
    ClaimCheckInTransformer transformer = (ClaimCheckInTransformer) new DirectFieldAccessor(new DirectFieldAccessor(checkin).getPropertyValue("handler")).getPropertyValue("transformer");
    MessageStore messageStore = (MessageStore) new DirectFieldAccessor(transformer).getPropertyValue("messageStore");
    assertEquals(context.getBean("testMessageStore"), messageStore);
}
Also used : MessageStore(org.springframework.integration.store.MessageStore) ClaimCheckInTransformer(org.springframework.integration.transformer.ClaimCheckInTransformer) DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) Test(org.junit.Test)

Example 12 with MessageStore

use of org.springframework.integration.store.MessageStore in project spring-integration by spring-projects.

the class ClaimCheckTransformerTests method store.

@Test
public void store() {
    MessageStore store = new SimpleMessageStore(10);
    ClaimCheckInTransformer transformer = new ClaimCheckInTransformer(store);
    Message<?> input = MessageBuilder.withPayload("test").build();
    Message<?> output = transformer.transform(input);
    assertEquals(input.getHeaders().getId(), output.getPayload());
}
Also used : MessageStore(org.springframework.integration.store.MessageStore) SimpleMessageStore(org.springframework.integration.store.SimpleMessageStore) SimpleMessageStore(org.springframework.integration.store.SimpleMessageStore) Test(org.junit.Test)

Example 13 with MessageStore

use of org.springframework.integration.store.MessageStore in project spring-integration by spring-projects.

the class ClaimCheckTransformerTests method retrieve.

@Test
public void retrieve() {
    MessageStore store = new SimpleMessageStore(10);
    Message<?> message = MessageBuilder.withPayload("test").build();
    UUID storedId = message.getHeaders().getId();
    store.addMessage(message);
    ClaimCheckOutTransformer transformer = new ClaimCheckOutTransformer(store);
    Message<?> input = MessageBuilder.withPayload(storedId).build();
    Message<?> output = transformer.transform(input);
    assertEquals("test", output.getPayload());
}
Also used : MessageStore(org.springframework.integration.store.MessageStore) SimpleMessageStore(org.springframework.integration.store.SimpleMessageStore) SimpleMessageStore(org.springframework.integration.store.SimpleMessageStore) UUID(java.util.UUID) Test(org.junit.Test)

Example 14 with MessageStore

use of org.springframework.integration.store.MessageStore in project spring-integration by spring-projects.

the class JdbcMessageStoreParserTests method testSimpleMessageStoreWithTemplate.

@Test
public void testSimpleMessageStoreWithTemplate() {
    setUp("jdbcOperationsJdbcMessageStore.xml", getClass());
    MessageStore store = context.getBean("messageStore", MessageStore.class);
    assertTrue(store instanceof JdbcMessageStore);
}
Also used : JdbcMessageStore(org.springframework.integration.jdbc.store.JdbcMessageStore) MessageStore(org.springframework.integration.store.MessageStore) JdbcMessageStore(org.springframework.integration.jdbc.store.JdbcMessageStore) Test(org.junit.Test)

Example 15 with MessageStore

use of org.springframework.integration.store.MessageStore in project spring-integration by spring-projects.

the class JdbcMessageStoreParserTests method testMessageStoreWithAttributes.

@Test
public void testMessageStoreWithAttributes() {
    setUp("soupedUpJdbcMessageStore.xml", getClass());
    MessageStore store = context.getBean("messageStore", MessageStore.class);
    assertEquals("FOO", ReflectionTestUtils.getField(store, "region"));
    assertEquals("BAR_", ReflectionTestUtils.getField(store, "tablePrefix"));
    assertEquals(context.getBean(LobHandler.class), ReflectionTestUtils.getField(store, "lobHandler"));
}
Also used : JdbcMessageStore(org.springframework.integration.jdbc.store.JdbcMessageStore) MessageStore(org.springframework.integration.store.MessageStore) LobHandler(org.springframework.jdbc.support.lob.LobHandler) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)23 MessageStore (org.springframework.integration.store.MessageStore)23 MongoDbAvailable (org.springframework.integration.mongodb.rules.MongoDbAvailable)14 MongoClient (com.mongodb.MongoClient)8 SimpleMongoDbFactory (org.springframework.data.mongodb.core.SimpleMongoDbFactory)8 GenericMessage (org.springframework.messaging.support.GenericMessage)5 JdbcMessageStore (org.springframework.integration.jdbc.store.JdbcMessageStore)4 UUID (java.util.UUID)3 AbstractBatchingMessageGroupStore (org.springframework.integration.store.AbstractBatchingMessageGroupStore)3 MessageGroup (org.springframework.integration.store.MessageGroup)3 MessageGroupStore (org.springframework.integration.store.MessageGroupStore)3 SimpleMessageStore (org.springframework.integration.store.SimpleMessageStore)3 Matchers.containsString (org.hamcrest.Matchers.containsString)2 DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)2 AdviceMessage (org.springframework.integration.message.AdviceMessage)2 Properties (java.util.Properties)1 DirectChannel (org.springframework.integration.channel.DirectChannel)1 MessageHistory (org.springframework.integration.history.MessageHistory)1 MutableMessage (org.springframework.integration.support.MutableMessage)1 ClaimCheckInTransformer (org.springframework.integration.transformer.ClaimCheckInTransformer)1