Search in sources :

Example 6 with MongoDbMessageSource

use of org.springframework.integration.mongodb.inbound.MongoDbMessageSource in project spring-integration by spring-projects.

the class MongoDbInboundChannelAdapterParserTests method fullConfigWithQueryExpression.

@Test
public void fullConfigWithQueryExpression() {
    MongoDbMessageSource source = assertMongoDbMessageSource(this.fullConfigWithQueryExpressionAdapter);
    assertTrue(TestUtils.getPropertyValue(source, "queryExpression") instanceof SpelExpression);
    assertEquals("new BasicQuery('{''address.state'' : ''PA''}').limit(2)", TestUtils.getPropertyValue(source, "queryExpression.expression"));
}
Also used : SpelExpression(org.springframework.expression.spel.standard.SpelExpression) MongoDbMessageSource(org.springframework.integration.mongodb.inbound.MongoDbMessageSource) Test(org.junit.Test)

Example 7 with MongoDbMessageSource

use of org.springframework.integration.mongodb.inbound.MongoDbMessageSource in project spring-integration by spring-projects.

the class MongoDbInboundChannelAdapterParserTests method fullConfigWithCollectionExpression.

@Test
public void fullConfigWithCollectionExpression() {
    MongoDbMessageSource source = assertMongoDbMessageSource(this.fullConfigWithCollectionExpressionAdapter);
    assertTrue(TestUtils.getPropertyValue(source, "collectionNameExpression") instanceof SpelExpression);
    assertEquals("'foo'", TestUtils.getPropertyValue(source, "collectionNameExpression.expression"));
}
Also used : SpelExpression(org.springframework.expression.spel.standard.SpelExpression) MongoDbMessageSource(org.springframework.integration.mongodb.inbound.MongoDbMessageSource) Test(org.junit.Test)

Example 8 with MongoDbMessageSource

use of org.springframework.integration.mongodb.inbound.MongoDbMessageSource in project spring-integration by spring-projects.

the class MongoDbInboundChannelAdapterParserTests method fullConfigWithQuery.

@Test
public void fullConfigWithQuery() {
    MongoDbMessageSource source = assertMongoDbMessageSource(this.fullConfigWithQueryAdapter);
    assertTrue(TestUtils.getPropertyValue(source, "queryExpression") instanceof LiteralExpression);
    assertEquals("{'address.state' : 'PA'}", TestUtils.getPropertyValue(source, "queryExpression.literalValue"));
}
Also used : LiteralExpression(org.springframework.expression.common.LiteralExpression) MongoDbMessageSource(org.springframework.integration.mongodb.inbound.MongoDbMessageSource) Test(org.junit.Test)

Aggregations

MongoDbMessageSource (org.springframework.integration.mongodb.inbound.MongoDbMessageSource)8 Test (org.junit.Test)7 LiteralExpression (org.springframework.expression.common.LiteralExpression)5 SpelExpression (org.springframework.expression.spel.standard.SpelExpression)2