use of org.springframework.integration.transformer.ClaimCheckInTransformer in project spring-integration by spring-projects.
the class MongoDbMessageStoreClaimCheckIntegrationTests method stringPayload.
@Test
@MongoDbAvailable
public void stringPayload() throws Exception {
MongoDbFactory mongoDbFactory = new SimpleMongoDbFactory(new MongoClient(), "test");
MongoDbMessageStore messageStore = new MongoDbMessageStore(mongoDbFactory);
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);
}
use of org.springframework.integration.transformer.ClaimCheckInTransformer in project spring-integration by spring-projects.
the class MongoDbMessageStoreClaimCheckIntegrationTests method objectPayloadConfigurable.
@Test
@MongoDbAvailable
public void objectPayloadConfigurable() 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);
Beverage payload = new Beverage();
payload.setName("latte");
payload.setShots(3);
payload.setIced(false);
Message<?> originalMessage = MessageBuilder.withPayload(payload).build();
Message<?> claimCheckMessage = checkin.transform(originalMessage);
assertEquals(originalMessage.getHeaders().getId(), claimCheckMessage.getPayload());
Message<?> checkedOutMessage = checkout.transform(claimCheckMessage);
assertEquals(originalMessage.getPayload(), checkedOutMessage.getPayload());
assertEquals(claimCheckMessage.getPayload(), checkedOutMessage.getHeaders().getId());
assertEquals(originalMessage, checkedOutMessage);
}
use of org.springframework.integration.transformer.ClaimCheckInTransformer in project spring-integration by spring-projects.
the class MongoDbMessageStoreClaimCheckIntegrationTests method objectPayload.
@Test
@MongoDbAvailable
public void objectPayload() throws Exception {
MongoDbFactory mongoDbFactory = new SimpleMongoDbFactory(new MongoClient(), "test");
MongoDbMessageStore messageStore = new MongoDbMessageStore(mongoDbFactory);
messageStore.afterPropertiesSet();
ClaimCheckInTransformer checkin = new ClaimCheckInTransformer(messageStore);
ClaimCheckOutTransformer checkout = new ClaimCheckOutTransformer(messageStore);
Beverage payload = new Beverage();
payload.setName("latte");
payload.setShots(3);
payload.setIced(false);
Message<?> originalMessage = MessageBuilder.withPayload(payload).build();
Message<?> claimCheckMessage = checkin.transform(originalMessage);
assertEquals(originalMessage.getHeaders().getId(), claimCheckMessage.getPayload());
Message<?> checkedOutMessage = checkout.transform(claimCheckMessage);
assertEquals(originalMessage.getPayload(), checkedOutMessage.getPayload());
assertEquals(claimCheckMessage.getPayload(), checkedOutMessage.getHeaders().getId());
assertEquals(originalMessage, checkedOutMessage);
}
use of org.springframework.integration.transformer.ClaimCheckInTransformer 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);
}
use of org.springframework.integration.transformer.ClaimCheckInTransformer 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);
}
Aggregations