Search in sources :

Example 1 with RedisStoreWritingMessageHandler

use of org.springframework.integration.redis.outbound.RedisStoreWritingMessageHandler in project spring-integration by spring-projects.

the class RedisStoreOutboundChannelAdapterParserTests method validateWithStringObjectTemplate.

@Test
public void validateWithStringObjectTemplate() {
    RedisStoreWritingMessageHandler withStringObjectTemplate = TestUtils.getPropertyValue(context.getBean("withStringObjectTemplate.adapter"), "handler", RedisStoreWritingMessageHandler.class);
    assertEquals("pepboys", ((LiteralExpression) TestUtils.getPropertyValue(withStringObjectTemplate, "keyExpression")).getExpressionString());
    assertEquals("PROPERTIES", (TestUtils.getPropertyValue(withStringObjectTemplate, "collectionType")).toString());
    assertFalse(TestUtils.getPropertyValue(withStringObjectTemplate, "redisTemplate") instanceof StringRedisTemplate);
    assertTrue(TestUtils.getPropertyValue(withStringObjectTemplate, "redisTemplate.keySerializer") instanceof StringRedisSerializer);
    assertTrue(TestUtils.getPropertyValue(withStringObjectTemplate, "redisTemplate.hashKeySerializer") instanceof StringRedisSerializer);
    assertTrue(TestUtils.getPropertyValue(withStringObjectTemplate, "redisTemplate.valueSerializer") instanceof JdkSerializationRedisSerializer);
    assertTrue(TestUtils.getPropertyValue(withStringObjectTemplate, "redisTemplate.hashValueSerializer") instanceof JdkSerializationRedisSerializer);
}
Also used : StringRedisSerializer(org.springframework.data.redis.serializer.StringRedisSerializer) RedisStoreWritingMessageHandler(org.springframework.integration.redis.outbound.RedisStoreWritingMessageHandler) JdkSerializationRedisSerializer(org.springframework.data.redis.serializer.JdkSerializationRedisSerializer) StringRedisTemplate(org.springframework.data.redis.core.StringRedisTemplate) Test(org.junit.Test)

Example 2 with RedisStoreWritingMessageHandler

use of org.springframework.integration.redis.outbound.RedisStoreWritingMessageHandler in project spring-integration by spring-projects.

the class RedisStoreOutboundChannelAdapterParserTests method validateWithStringTemplate.

@Test
public void validateWithStringTemplate() throws Exception {
    RedisStoreWritingMessageHandler withStringTemplate = context.getBean("withStringTemplate.handler", RedisStoreWritingMessageHandler.class);
    assertEquals("pepboys", ((LiteralExpression) TestUtils.getPropertyValue(withStringTemplate, "keyExpression")).getExpressionString());
    assertEquals("PROPERTIES", (TestUtils.getPropertyValue(withStringTemplate, "collectionType")).toString());
    assertTrue(TestUtils.getPropertyValue(withStringTemplate, "redisTemplate") instanceof StringRedisTemplate);
    Object handler = TestUtils.getPropertyValue(context.getBean("withStringTemplate.adapter"), "handler");
    assertTrue(AopUtils.isAopProxy(handler));
    assertSame(((Advised) handler).getTargetSource().getTarget(), withStringTemplate);
    assertThat(TestUtils.getPropertyValue(handler, "h.advised.advisors.first.item.advice"), Matchers.instanceOf(RequestHandlerRetryAdvice.class));
    assertEquals("true", TestUtils.getPropertyValue(withStringTemplate, "zsetIncrementScoreExpression", Expression.class).getExpressionString());
}
Also used : RequestHandlerRetryAdvice(org.springframework.integration.handler.advice.RequestHandlerRetryAdvice) RedisStoreWritingMessageHandler(org.springframework.integration.redis.outbound.RedisStoreWritingMessageHandler) Advised(org.springframework.aop.framework.Advised) StringRedisTemplate(org.springframework.data.redis.core.StringRedisTemplate) Test(org.junit.Test)

Example 3 with RedisStoreWritingMessageHandler

use of org.springframework.integration.redis.outbound.RedisStoreWritingMessageHandler in project spring-integration by spring-projects.

the class RedisStoreOutboundChannelAdapterParserTests method validateWithExternalTemplate.

@Test
public void validateWithExternalTemplate() {
    RedisStoreWritingMessageHandler withExternalTemplate = TestUtils.getPropertyValue(context.getBean("withExternalTemplate.adapter"), "handler", RedisStoreWritingMessageHandler.class);
    assertEquals("pepboys", ((LiteralExpression) TestUtils.getPropertyValue(withExternalTemplate, "keyExpression")).getExpressionString());
    assertEquals("PROPERTIES", (TestUtils.getPropertyValue(withExternalTemplate, "collectionType")).toString());
    assertSame(redisTemplate, TestUtils.getPropertyValue(withExternalTemplate, "redisTemplate"));
}
Also used : RedisStoreWritingMessageHandler(org.springframework.integration.redis.outbound.RedisStoreWritingMessageHandler) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 RedisStoreWritingMessageHandler (org.springframework.integration.redis.outbound.RedisStoreWritingMessageHandler)3 StringRedisTemplate (org.springframework.data.redis.core.StringRedisTemplate)2 Advised (org.springframework.aop.framework.Advised)1 JdkSerializationRedisSerializer (org.springframework.data.redis.serializer.JdkSerializationRedisSerializer)1 StringRedisSerializer (org.springframework.data.redis.serializer.StringRedisSerializer)1 RequestHandlerRetryAdvice (org.springframework.integration.handler.advice.RequestHandlerRetryAdvice)1