refactoring

pull/5688/head
Nikita Koksharov 11 months ago
parent fa296a2025
commit 421d096839

@ -152,6 +152,12 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>

@ -13,14 +13,24 @@ import org.springframework.context.annotation.Import;
import org.springframework.data.redis.core.BoundHashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.testcontainers.containers.FixedHostPortGenericContainer;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import static org.assertj.core.api.Assertions.assertThat;
@SpringJUnitConfig
@SpringBootTest(classes = RedissonApplication.class)
@Import(RedissonAutoConfiguration2Test.RedissonConnectionDetailsConfig.class)
@Testcontainers
public class RedissonAutoConfiguration2Test {
@Container
public static final GenericContainer REDIS = new FixedHostPortGenericContainer("redis:latest")
.withFixedExposedPort(6379, 6379);
@TestConfiguration
static class RedissonConnectionDetailsConfig {

@ -9,6 +9,10 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.BoundHashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.testcontainers.containers.FixedHostPortGenericContainer;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import static org.assertj.core.api.Assertions.assertThat;
@ -19,8 +23,13 @@ import static org.assertj.core.api.Assertions.assertThat;
"spring.redis.redisson.file=classpath:redisson.yaml",
"spring.redis.timeout=10000"
})
@Testcontainers
public class RedissonAutoConfigurationTest {
@Container
public static final GenericContainer REDIS = new FixedHostPortGenericContainer("redis:latest")
.withFixedExposedPort(6379, 6379);
@Autowired
private RedissonClient redisson;

@ -7,6 +7,10 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.testcontainers.containers.FixedHostPortGenericContainer;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
@SpringJUnitConfig
@SpringBootTest(
@ -16,8 +20,13 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
"spring.redis.timeout=10000",
"spring.cache.type=redis",
})
@Testcontainers
public class RedissonCacheManagerAutoConfigurationTest {
@Container
public static final GenericContainer REDIS = new FixedHostPortGenericContainer("redis:latest")
.withFixedExposedPort(6379, 6379);
@Autowired
private CacheManager cacheManager;

@ -11,6 +11,10 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.testcontainers.containers.FixedHostPortGenericContainer;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import java.util.List;
@ -23,9 +27,15 @@ import java.util.List;
"spring.session.store-type=redis",
// "spring.session.timeout.seconds=900",
})
@Testcontainers
public class RedissonSessionManagerAutoConfigurationTest {
@LocalServerPort
@Container
public static final GenericContainer REDIS = new FixedHostPortGenericContainer("redis:latest")
.withFixedExposedPort(6379, 6379);
@LocalServerPort
private int port;
@Autowired

Loading…
Cancel
Save