Search in sources :

Example 1 with MongoDbMessageSource

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

the class MongoDbInboundChannelAdapterParserTests method fullConfigWithMongoTemplate.

@Test
public void fullConfigWithMongoTemplate() {
    MongoDbMessageSource source = TestUtils.getPropertyValue(this.fullConfigWithMongoTemplateAdapter, "source", MongoDbMessageSource.class);
    assertEquals(false, TestUtils.getPropertyValue(this.fullConfigWithMongoTemplateAdapter, "shouldTrack"));
    assertNotNull(TestUtils.getPropertyValue(source, "mongoTemplate"));
    assertSame(this.mongoDbTemplate, TestUtils.getPropertyValue(source, "mongoTemplate"));
    assertNotNull(TestUtils.getPropertyValue(source, "evaluationContext"));
    assertTrue(TestUtils.getPropertyValue(source, "collectionNameExpression") instanceof LiteralExpression);
    assertEquals("foo", TestUtils.getPropertyValue(source, "collectionNameExpression.literalValue"));
}
Also used : LiteralExpression(org.springframework.expression.common.LiteralExpression) MongoDbMessageSource(org.springframework.integration.mongodb.inbound.MongoDbMessageSource) Test(org.junit.Test)

Example 2 with MongoDbMessageSource

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

the class MongoDbInboundChannelAdapterParserTests method fullConfigWithSpelQuery.

@Test
public void fullConfigWithSpelQuery() {
    MongoDbMessageSource source = assertMongoDbMessageSource(this.fullConfigWithSpelQueryAdapter);
    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)

Example 3 with MongoDbMessageSource

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

the class MongoDbInboundChannelAdapterParserTests method fullConfigWithCollectionName.

@Test
public void fullConfigWithCollectionName() {
    MongoDbMessageSource source = assertMongoDbMessageSource(this.fullConfigWithCollectionNameAdapter);
    assertTrue(TestUtils.getPropertyValue(source, "collectionNameExpression") instanceof LiteralExpression);
    assertEquals("foo", TestUtils.getPropertyValue(source, "collectionNameExpression.literalValue"));
}
Also used : LiteralExpression(org.springframework.expression.common.LiteralExpression) MongoDbMessageSource(org.springframework.integration.mongodb.inbound.MongoDbMessageSource) Test(org.junit.Test)

Example 4 with MongoDbMessageSource

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

the class MongoDbInboundChannelAdapterParserTests method assertMongoDbMessageSource.

private MongoDbMessageSource assertMongoDbMessageSource(Object testedBean) {
    MongoDbMessageSource source = TestUtils.getPropertyValue(testedBean, "source", MongoDbMessageSource.class);
    assertEquals(false, TestUtils.getPropertyValue(testedBean, "shouldTrack"));
    assertNotNull(TestUtils.getPropertyValue(source, "mongoTemplate"));
    assertEquals(this.mongoDbFactory, TestUtils.getPropertyValue(source, "mongoDbFactory"));
    assertEquals(this.mongoConverter, TestUtils.getPropertyValue(source, "mongoConverter"));
    assertNotNull(TestUtils.getPropertyValue(source, "evaluationContext"));
    return source;
}
Also used : MongoDbMessageSource(org.springframework.integration.mongodb.inbound.MongoDbMessageSource)

Example 5 with MongoDbMessageSource

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

the class MongoDbInboundChannelAdapterParserTests method minimalConfig.

@Test
public void minimalConfig() {
    MongoDbMessageSource source = TestUtils.getPropertyValue(this.minimalConfigAdapter, "source", MongoDbMessageSource.class);
    assertEquals(false, TestUtils.getPropertyValue(this.minimalConfigAdapter, "shouldTrack"));
    assertNotNull(TestUtils.getPropertyValue(source, "mongoTemplate"));
    assertEquals(this.mongoDbFactory, TestUtils.getPropertyValue(source, "mongoDbFactory"));
    assertNotNull(TestUtils.getPropertyValue(source, "evaluationContext"));
    assertTrue(TestUtils.getPropertyValue(source, "collectionNameExpression") instanceof LiteralExpression);
    assertEquals("data", TestUtils.getPropertyValue(source, "collectionNameExpression.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