JAVA-22180 | fixed test with simple annotations. (#14225)
This commit is contained in:
parent
38924fb9bc
commit
4c825d6311
|
@ -2,7 +2,6 @@ package com.baelding.springbootredis.config;
|
||||||
|
|
||||||
import com.baelding.springbootredis.model.Session;
|
import com.baelding.springbootredis.model.Session;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.context.ApplicationListener;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
|
|
|
@ -6,7 +6,6 @@ import com.baelding.springbootredis.service.cache.session.SessionCache;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.util.LinkedMultiValueMap;
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
|
|
|
@ -1,19 +1,25 @@
|
||||||
package com.baelding.springbootredis.model;
|
package com.baelding.springbootredis.model;
|
||||||
|
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.redis.core.RedisHash;
|
import org.springframework.data.redis.core.RedisHash;
|
||||||
import org.springframework.data.redis.core.TimeToLive;
|
import org.springframework.data.redis.core.TimeToLive;
|
||||||
|
|
||||||
@Data
|
|
||||||
@Builder
|
@Builder
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
@RedisHash(timeToLive = 60L)
|
@RedisHash(timeToLive = 60L)
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
public class Session {
|
public class Session {
|
||||||
@Id
|
@Id
|
||||||
private String id;
|
private String id;
|
||||||
@TimeToLive
|
@TimeToLive
|
||||||
private Long expirationInSeconds;
|
private Long expirationInSeconds;
|
||||||
|
public Session(String id, Long expirationInSeconds) {
|
||||||
|
this.id = id;
|
||||||
|
this.expirationInSeconds = expirationInSeconds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||||
|
@ -19,6 +20,7 @@ import java.util.stream.Collectors;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RedisTestConfiguration.class)
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RedisTestConfiguration.class)
|
||||||
|
@AutoConfigureMockMvc
|
||||||
class SpringBootRedisApplicationIntegrationTest {
|
class SpringBootRedisApplicationIntegrationTest {
|
||||||
|
|
||||||
private static final String V1_SESSIONS_ENDPOINT = "/v1/sessions";
|
private static final String V1_SESSIONS_ENDPOINT = "/v1/sessions";
|
||||||
|
|
Loading…
Reference in New Issue