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;