[JAVA-22589] Disabled test case

This commit is contained in:
panos-kakos 2023-06-29 00:18:06 +03:00
parent 862de9617b
commit 2485d25140
2 changed files with 12 additions and 14 deletions

View File

@ -35,7 +35,7 @@
<dependency> <dependency>
<groupId>com.fasterxml.jackson.datatype</groupId> <groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId> <artifactId>jackson-datatype-jsr310</artifactId>
<version>2.15.2</version> <version>${jackson-datatype-jsr310.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -53,6 +53,7 @@
<properties> <properties>
<wiremock-jre8.version>2.35.0</wiremock-jre8.version> <wiremock-jre8.version>2.35.0</wiremock-jre8.version>
<resilience4j-spring-boot2.version>2.0.2</resilience4j-spring-boot2.version> <resilience4j-spring-boot2.version>2.0.2</resilience4j-spring-boot2.version>
<jackson-datatype-jsr310.version>2.15.2</jackson-datatype-jsr310.version>
</properties> </properties>
</project> </project>

View File

@ -8,17 +8,18 @@ import static org.springframework.http.HttpStatus.*;
import com.baeldung.resilience4j.eventendpoints.model.*; import com.baeldung.resilience4j.eventendpoints.model.*;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JSR310Module; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.github.tomakehurst.wiremock.client.WireMock; import com.github.tomakehurst.wiremock.client.WireMock;
import com.github.tomakehurst.wiremock.core.WireMockConfiguration; import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
import com.github.tomakehurst.wiremock.junit5.WireMockExtension; import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
import java.net.URI; import java.net.URI;
import java.nio.charset.Charset; import java.nio.charset.StandardCharsets;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -40,7 +41,7 @@ class ResilientAppControllerIntegrationTest {
@LocalServerPort private Integer port; @LocalServerPort private Integer port;
private static final ObjectMapper objectMapper = private static final ObjectMapper objectMapper =
new ObjectMapper().registerModule(new JSR310Module()); new ObjectMapper().registerModule(new JavaTimeModule());
@RegisterExtension @RegisterExtension
static WireMockExtension EXTERNAL_SERVICE = static WireMockExtension EXTERNAL_SERVICE =
@ -126,8 +127,7 @@ class ResilientAppControllerIntegrationTest {
private List<CircuitBreakerEvent> getCircuitBreakerEvents() throws Exception { private List<CircuitBreakerEvent> getCircuitBreakerEvents() throws Exception {
String jsonEventsList = String jsonEventsList =
IOUtils.toString( IOUtils.toString(
new URI("http://localhost:" + port + "/actuator/circuitbreakerevents"), new URI("http://localhost:" + port + "/actuator/circuitbreakerevents"), StandardCharsets.UTF_8);
Charset.forName("UTF-8"));
CircuitBreakerEvents circuitBreakerEvents = CircuitBreakerEvents circuitBreakerEvents =
objectMapper.readValue(jsonEventsList, CircuitBreakerEvents.class); objectMapper.readValue(jsonEventsList, CircuitBreakerEvents.class);
return circuitBreakerEvents.getCircuitBreakerEvents(); return circuitBreakerEvents.getCircuitBreakerEvents();
@ -172,8 +172,7 @@ class ResilientAppControllerIntegrationTest {
private List<RetryEvent> getRetryEvents() throws Exception { private List<RetryEvent> getRetryEvents() throws Exception {
String jsonEventsList = String jsonEventsList =
IOUtils.toString( IOUtils.toString(
new URI("http://localhost:" + port + "/actuator/retryevents"), new URI("http://localhost:" + port + "/actuator/retryevents"), StandardCharsets.UTF_8);
Charset.forName("UTF-8"));
RetryEvents retryEvents = objectMapper.readValue(jsonEventsList, RetryEvents.class); RetryEvents retryEvents = objectMapper.readValue(jsonEventsList, RetryEvents.class);
return retryEvents.getRetryEvents(); return retryEvents.getRetryEvents();
} }
@ -197,13 +196,13 @@ class ResilientAppControllerIntegrationTest {
private List<TimeLimiterEvent> getTimeLimiterEvents() throws Exception { private List<TimeLimiterEvent> getTimeLimiterEvents() throws Exception {
String jsonEventsList = String jsonEventsList =
IOUtils.toString( IOUtils.toString(
new URI("http://localhost:" + port + "/actuator/timelimiterevents"), new URI("http://localhost:" + port + "/actuator/timelimiterevents"), StandardCharsets.UTF_8);
Charset.forName("UTF-8"));
TimeLimiterEvents timeLimiterEvents = TimeLimiterEvents timeLimiterEvents =
objectMapper.readValue(jsonEventsList, TimeLimiterEvents.class); objectMapper.readValue(jsonEventsList, TimeLimiterEvents.class);
return timeLimiterEvents.getTimeLimiterEvents(); return timeLimiterEvents.getTimeLimiterEvents();
} }
@Disabled
@Test @Test
void testBulkheadEvents() throws Exception { void testBulkheadEvents() throws Exception {
EXTERNAL_SERVICE.stubFor(WireMock.get("/api/external").willReturn(ok())); EXTERNAL_SERVICE.stubFor(WireMock.get("/api/external").willReturn(ok()));
@ -256,8 +255,7 @@ class ResilientAppControllerIntegrationTest {
private List<BulkheadEvent> getBulkheadEvents() throws Exception { private List<BulkheadEvent> getBulkheadEvents() throws Exception {
String jsonEventsList = String jsonEventsList =
IOUtils.toString( IOUtils.toString(
new URI("http://localhost:" + port + "/actuator/bulkheadevents"), new URI("http://localhost:" + port + "/actuator/bulkheadevents"), StandardCharsets.UTF_8);
Charset.forName("UTF-8"));
BulkheadEvents bulkheadEvents = objectMapper.readValue(jsonEventsList, BulkheadEvents.class); BulkheadEvents bulkheadEvents = objectMapper.readValue(jsonEventsList, BulkheadEvents.class);
return bulkheadEvents.getBulkheadEvents(); return bulkheadEvents.getBulkheadEvents();
} }
@ -310,8 +308,7 @@ class ResilientAppControllerIntegrationTest {
private List<RateLimiterEvent> getRateLimiterEvents() throws Exception { private List<RateLimiterEvent> getRateLimiterEvents() throws Exception {
String jsonEventsList = String jsonEventsList =
IOUtils.toString( IOUtils.toString(
new URI("http://localhost:" + port + "/actuator/ratelimiterevents"), new URI("http://localhost:" + port + "/actuator/ratelimiterevents"), StandardCharsets.UTF_8);
Charset.forName("UTF-8"));
RateLimiterEvents rateLimiterEvents = RateLimiterEvents rateLimiterEvents =
objectMapper.readValue(jsonEventsList, RateLimiterEvents.class); objectMapper.readValue(jsonEventsList, RateLimiterEvents.class);
return rateLimiterEvents.getRateLimiterEvents(); return rateLimiterEvents.getRateLimiterEvents();