use of org.springframework.data.mongodb.core.SimpleMongoDbFactory 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.data.mongodb.core.SimpleMongoDbFactory in project spring-integration by spring-projects.
the class ConfigurableMongoDbMessageStoreTests method getMessageStore.
@Override
protected MessageStore getMessageStore() throws Exception {
MongoDbFactory mongoDbFactory = new SimpleMongoDbFactory(new MongoClient(), "test");
ConfigurableMongoDbMessageStore mongoDbMessageStore = new ConfigurableMongoDbMessageStore(mongoDbFactory);
GenericApplicationContext testApplicationContext = TestUtils.createTestApplicationContext();
testApplicationContext.refresh();
mongoDbMessageStore.setApplicationContext(testApplicationContext);
mongoDbMessageStore.afterPropertiesSet();
return mongoDbMessageStore;
}
use of org.springframework.data.mongodb.core.SimpleMongoDbFactory in project spring-integration by spring-projects.
the class MongoDbMessageGroupStoreTests method getMessageGroupStore.
@Override
protected MongoDbMessageStore getMessageGroupStore() throws Exception {
MongoDbMessageStore mongoDbMessageStore = new MongoDbMessageStore(new SimpleMongoDbFactory(new MongoClient(), "test"));
mongoDbMessageStore.afterPropertiesSet();
return mongoDbMessageStore;
}
use of org.springframework.data.mongodb.core.SimpleMongoDbFactory in project spring-integration by spring-projects.
the class MongoDbMessageStoreTests method getMessageStore.
@Override
protected MessageStore getMessageStore() throws Exception {
MongoDbMessageStore mongoDbMessageStore = new MongoDbMessageStore(new SimpleMongoDbFactory(new MongoClient(), "test"));
mongoDbMessageStore.afterPropertiesSet();
return mongoDbMessageStore;
}
use of org.springframework.data.mongodb.core.SimpleMongoDbFactory in project spring-integration by spring-projects.
the class AbstractMongoDbMessageStoreTests method testInt3153SequenceDetails.
@Test
@MongoDbAvailable
public void testInt3153SequenceDetails() throws Exception {
cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
MessageStore store = getMessageStore();
Message<?> messageToStore = MessageBuilder.withPayload("test").pushSequenceDetails(UUID.randomUUID(), 1, 1).pushSequenceDetails(UUID.randomUUID(), 1, 1).build();
store.addMessage(messageToStore);
Message<?> retrievedMessage = store.getMessage(messageToStore.getHeaders().getId());
assertNotNull(retrievedMessage);
assertEquals(messageToStore.getPayload(), retrievedMessage.getPayload());
assertEquals(messageToStore.getHeaders(), retrievedMessage.getHeaders());
assertEquals(messageToStore, retrievedMessage);
}
Aggregations