Search in sources :

Example 6 with ClaimCheckOutTransformer

use of org.springframework.integration.transformer.ClaimCheckOutTransformer in project spring-integration by spring-projects.

the class MongoDbMessageStoreClaimCheckIntegrationTests method stringPayloadConfigurable.

@Test
@MongoDbAvailable
public void stringPayloadConfigurable() throws Exception {
    MongoDbFactory mongoDbFactory = new SimpleMongoDbFactory(new MongoClient(), "test");
    ConfigurableMongoDbMessageStore messageStore = new ConfigurableMongoDbMessageStore(mongoDbFactory);
    GenericApplicationContext testApplicationContext = TestUtils.createTestApplicationContext();
    testApplicationContext.refresh();
    messageStore.setApplicationContext(testApplicationContext);
    messageStore.afterPropertiesSet();
    ClaimCheckInTransformer checkin = new ClaimCheckInTransformer(messageStore);
    ClaimCheckOutTransformer checkout = new ClaimCheckOutTransformer(messageStore);
    Message<?> originalMessage = MessageBuilder.withPayload("test1").build();
    Message<?> claimCheckMessage = checkin.transform(originalMessage);
    assertEquals(originalMessage.getHeaders().getId(), claimCheckMessage.getPayload());
    Message<?> checkedOutMessage = checkout.transform(claimCheckMessage);
    assertEquals(claimCheckMessage.getPayload(), checkedOutMessage.getHeaders().getId());
    assertEquals(originalMessage.getPayload(), checkedOutMessage.getPayload());
    assertEquals(originalMessage, checkedOutMessage);
}
Also used : MongoClient(com.mongodb.MongoClient) SimpleMongoDbFactory(org.springframework.data.mongodb.core.SimpleMongoDbFactory) MongoDbFactory(org.springframework.data.mongodb.MongoDbFactory) GenericApplicationContext(org.springframework.context.support.GenericApplicationContext) SimpleMongoDbFactory(org.springframework.data.mongodb.core.SimpleMongoDbFactory) ClaimCheckInTransformer(org.springframework.integration.transformer.ClaimCheckInTransformer) ClaimCheckOutTransformer(org.springframework.integration.transformer.ClaimCheckOutTransformer) Test(org.junit.Test) MongoDbAvailable(org.springframework.integration.mongodb.rules.MongoDbAvailable)

Aggregations

ClaimCheckOutTransformer (org.springframework.integration.transformer.ClaimCheckOutTransformer)6 Test (org.junit.Test)5 MongoClient (com.mongodb.MongoClient)4 MongoDbFactory (org.springframework.data.mongodb.MongoDbFactory)4 SimpleMongoDbFactory (org.springframework.data.mongodb.core.SimpleMongoDbFactory)4 MongoDbAvailable (org.springframework.integration.mongodb.rules.MongoDbAvailable)4 ClaimCheckInTransformer (org.springframework.integration.transformer.ClaimCheckInTransformer)4 GenericApplicationContext (org.springframework.context.support.GenericApplicationContext)2 DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)1 MessageStore (org.springframework.integration.store.MessageStore)1