More Redis fixes for latest Spring Data

This commit is contained in:
Artem Bilan
2022-03-18 12:44:31 -04:00
parent 50cf3b1aa4
commit 69efbd3585

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2019 the original author or authors.
* Copyright 2013-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,13 +18,13 @@ package org.springframework.integration.redis.config;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.task.TaskExecutor;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.BoundListOperations;
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.integration.redis.inbound.RedisQueueMessageDrivenEndpoint;
@@ -32,8 +32,7 @@ import org.springframework.integration.test.util.TestUtils;
import org.springframework.integration.util.ErrorHandlingTaskExecutor;
import org.springframework.messaging.MessageChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
/**
@@ -44,8 +43,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
*
* @since 3.0
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@SpringJUnitConfig
@DirtiesContext
public class RedisQueueInboundChannelAdapterParserTests {
@@ -91,12 +89,11 @@ public class RedisQueueInboundChannelAdapterParserTests {
@Test
@SuppressWarnings("unchecked")
public void testInt3017DefaultConfig() {
assertThat(TestUtils
.getPropertyValue(this.defaultAdapter, "boundListOperations.ops.template.connectionFactory"))
.isSameAs(this.connectionFactory);
assertThat(TestUtils.getPropertyValue(this.defaultAdapter, "boundListOperations.key"))
.isEqualTo("si.test.Int3017.Inbound1");
BoundListOperations<String, byte[]> boundListOperations =
TestUtils.getPropertyValue(this.defaultAdapter, "boundListOperations", BoundListOperations.class);
assertThat(boundListOperations.getKey()).isEqualTo("si.test.Int3017.Inbound1");
assertThat(TestUtils.getPropertyValue(this.defaultAdapter, "expectMessage", Boolean.class)).isFalse();
assertThat(TestUtils.getPropertyValue(this.defaultAdapter, "receiveTimeout")).isEqualTo(1000L);
assertThat(TestUtils.getPropertyValue(this.defaultAdapter, "recoveryInterval")).isEqualTo(5000L);
@@ -114,12 +111,11 @@ public class RedisQueueInboundChannelAdapterParserTests {
@Test
@SuppressWarnings("unchecked")
public void testInt3017CustomConfig() {
assertThat(TestUtils.getPropertyValue(this.customAdapter, "boundListOperations.ops.template" +
".connectionFactory"))
.isSameAs(this.customRedisConnectionFactory);
assertThat(TestUtils.getPropertyValue(this.customAdapter, "boundListOperations.key"))
.isEqualTo("si.test.Int3017.Inbound2");
BoundListOperations<String, byte[]> boundListOperations =
TestUtils.getPropertyValue(this.customAdapter, "boundListOperations", BoundListOperations.class);
assertThat(boundListOperations.getKey()).isEqualTo("si.test.Int3017.Inbound2");
assertThat(TestUtils.getPropertyValue(this.customAdapter, "expectMessage", Boolean.class)).isTrue();
assertThat(TestUtils.getPropertyValue(this.customAdapter, "receiveTimeout")).isEqualTo(2000L);
assertThat(TestUtils.getPropertyValue(this.customAdapter, "recoveryInterval")).isEqualTo(3000L);