JAVA-22180 | fixed test with simple annotations. (#14225)

This commit is contained in:
Gaetano Piazzolla 2023-06-15 06:09:55 +02:00 committed by GitHub
parent 38924fb9bc
commit 4c825d6311
4 changed files with 10 additions and 4 deletions

View File

@ -2,7 +2,6 @@ package com.baelding.springbootredis.config;
import com.baelding.springbootredis.model.Session;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener;

View File

@ -6,7 +6,6 @@ import com.baelding.springbootredis.service.cache.session.SessionCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

View File

@ -1,19 +1,25 @@
package com.baelding.springbootredis.model;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.TimeToLive;
@Data
@Builder
@EqualsAndHashCode
@RedisHash(timeToLive = 60L)
@Data
@NoArgsConstructor
public class Session {
@Id
private String id;
@TimeToLive
private Long expirationInSeconds;
public Session(String id, Long expirationInSeconds) {
this.id = id;
this.expirationInSeconds = expirationInSeconds;
}
}

View File

@ -8,6 +8,7 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
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.http.HttpHeaders;
import org.springframework.test.web.reactive.server.WebTestClient;
@ -19,6 +20,7 @@ import java.util.stream.Collectors;
import java.util.stream.IntStream;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RedisTestConfiguration.class)
@AutoConfigureMockMvc
class SpringBootRedisApplicationIntegrationTest {
private static final String V1_SESSIONS_ENDPOINT = "/v1/sessions";