From 69efbd3585dc9576e653c276ee83fb9b2c5dcb21 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Fri, 18 Mar 2022 12:44:31 -0400 Subject: [PATCH] More Redis fixes for latest Spring Data --- ...QueueInboundChannelAdapterParserTests.java | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisQueueInboundChannelAdapterParserTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisQueueInboundChannelAdapterParserTests.java index fdf0990f99..fa40ab02b0 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisQueueInboundChannelAdapterParserTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisQueueInboundChannelAdapterParserTests.java @@ -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 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 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);