From dbc126e49eaab2b34ba0d78fd7bff6bc4d96abc1 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Sat, 8 Aug 2020 17:29:29 +1000 Subject: [PATCH] re-enable testcontainers --- .../cache/AbstractIntegrationTest.java | 22 +++++++++++++++++++ ...CarResourceClientCacheIntegrationTest.java | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 spring-boot/cache/src/test/java/io/reflectoring/cache/AbstractIntegrationTest.java diff --git a/spring-boot/cache/src/test/java/io/reflectoring/cache/AbstractIntegrationTest.java b/spring-boot/cache/src/test/java/io/reflectoring/cache/AbstractIntegrationTest.java new file mode 100644 index 0000000..db3e586 --- /dev/null +++ b/spring-boot/cache/src/test/java/io/reflectoring/cache/AbstractIntegrationTest.java @@ -0,0 +1,22 @@ +package io.reflectoring.cache; + +import org.junit.jupiter.api.BeforeAll; +import org.testcontainers.containers.FixedHostPortGenericContainer; +import org.testcontainers.containers.GenericContainer; + +public class AbstractIntegrationTest { + + static GenericContainer firstMember = + new FixedHostPortGenericContainer("hazelcast/hazelcast:4.0.1") + .withFixedExposedPort(5701, 5701); + + static GenericContainer secondMember = + new FixedHostPortGenericContainer("hazelcast/hazelcast:4.0.1") + .withFixedExposedPort(5702, 5701); + + @BeforeAll + public static void init() { + firstMember.start(); + secondMember.start(); + } +} diff --git a/spring-boot/cache/src/test/java/io/reflectoring/cache/rest/CarResourceClientCacheIntegrationTest.java b/spring-boot/cache/src/test/java/io/reflectoring/cache/rest/CarResourceClientCacheIntegrationTest.java index 2833f0b..a76bfe9 100644 --- a/spring-boot/cache/src/test/java/io/reflectoring/cache/rest/CarResourceClientCacheIntegrationTest.java +++ b/spring-boot/cache/src/test/java/io/reflectoring/cache/rest/CarResourceClientCacheIntegrationTest.java @@ -2,6 +2,7 @@ package io.reflectoring.cache.rest; import com.fasterxml.jackson.databind.ObjectMapper; +import io.reflectoring.cache.AbstractIntegrationTest; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; @@ -16,7 +17,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @SpringBootTest @AutoConfigureMockMvc @ActiveProfiles("client") -class CarResourceClientCacheIntegrationTest { +class CarResourceClientCacheIntegrationTest extends AbstractIntegrationTest { @Autowired private MockMvc mockMvc;