Skip to content

Commit

Permalink
More Redis fixes for latest Spring Data
Browse files Browse the repository at this point in the history
  • Loading branch information
artembilan committed Mar 18, 2022
1 parent 50cf3b1 commit 69efbd3
Showing 1 changed file with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -18,22 +18,21 @@

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;
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;


/**
Expand All @@ -44,8 +43,7 @@
*
* @since 3.0
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@SpringJUnitConfig
@DirtiesContext
public class RedisQueueInboundChannelAdapterParserTests {

Expand Down Expand Up @@ -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);
Expand All @@ -114,12 +111,11 @@ public void testInt3017DefaultConfig() {


@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);
Expand Down

0 comments on commit 69efbd3

Please sign in to comment.