Class IntegrationTestBase
+-
+
- java.lang.Object +
-
+
-
+
- de.juplo.httpresources.IntegrationTestBase +
+
-
+
-
+
-
+
- Direct Known Subclasses: +
HttpResourceChainAwareResourceLoaderIT
,HttpResourceProtocolResolverIT
,HttpResourcesIT
,ThymeleafWithHttpResourceProtocolResolverIT
,VersionedResourcesIT
+
+public abstract class IntegrationTestBase +extends Object
+This class starts a + {@link https://www.testcontainers.org/modules/nginx/ NginX-Webserver} + via a {@link https://www.testcontainers.org/ Testcontainer} and a + standalone {@link http://www.mock-server.com/#what-is-mockserver MockServer}, + that can be used to intercept requests for assertions / verifications. +++ We use the {@link + https://www.testcontainers.org/test_framework_integration/manual_lifecycle_control/#singleton-containers + Singleton Pattern} to start the NginX-Testcontainer and start the MockServer + programmatically via the {@link + http://www.mock-server.com/mock_server/running_mock_server.html#client_api + Client-API}.
-
+
- Author: +
- Kai Moritz +
+
-
+
-
+
+
+ + +-
+
-
+
+
+
Nested Class Summary
++
+Nested Classes ++ +Modifier and Type +Class +Description ++ + +static class
+IntegrationTestBase.Callback
+ + +static class
+IntegrationTestBase.ClockStub
+ + +static class
+IntegrationTestBase.IntegrationTestConfiguration
+
+ + +-
+
-
+
+
+
Field Summary
++
+Fields ++ +Modifier and Type +Field +Description ++ + +static IntegrationTestBase.ClockStub
+CLOCK
+ + +static DateTimeFormatter
+formatter
+ + +static org.testcontainers.containers.NginxContainer
+NGINX
+ + +org.mockserver.integration.ClientAndServer
+server
+
+ + +-
+
-
+
+
+
Constructor Summary
++
+Constructors ++ +Constructor +Description ++ + +IntegrationTestBase()
+
+ +-
+
-
+
+
+
Method Summary
++
+ +All Methods Static Methods Instance Methods Concrete Methods ++ +Modifier and Type +Method +Description ++ + +String
+address(String path)
+ + +void
+clearMockServer()
+ + +static org.mockserver.model.HttpRequest
+FETCH(String path)
+ + +int
+getMockServerPort()
+ + +String
+getMockServerUri()
+ + +static org.mockserver.model.HttpResponse
+INTERNAL_SERVER_ERROR()
+ + +static String
+NGINIX_IP()
+ + +static org.mockserver.model.HttpOverrideForwardedRequest
+NGINX()
+ + +static org.mockserver.model.HttpOverrideForwardedRequest
+NGINX(String path)
+ + +static int
+NGINX_PORT()
+ + +static String
+NGINX_URI()
+ + +static org.mockserver.model.HttpResponse
+NOT_FOUND()
+ + +void
+prepareMockServer()
+ +Prepares the mock-server to forward any request to the NginX-server, + for which no more specific expectation was specified.++ + +static org.mockserver.model.HttpResponse
+RESPONSE()
+
+ -
+
+
+
-
+
-
+
+
+ + +-
+
-
+
+
+
Field Detail
+ + + +-
+
-
+
CLOCK
+public static IntegrationTestBase.ClockStub CLOCK
+
+
-
+
-
+
formatter
+public static DateTimeFormatter formatter
+
+
-
+
-
+
NGINX
+public static final org.testcontainers.containers.NginxContainer NGINX
+
+
-
+
-
+
server
+@Autowired +public org.mockserver.integration.ClientAndServer server
+
+
+ -
+
+ + + ++ +-
+
-
+
+
+
Method Detail
+ + + +-
+
-
+
NGINIX_IP
+public static String NGINIX_IP()
+
+
-
+
-
+
NGINX_PORT
+public static int NGINX_PORT()
+
+
-
+
-
+
NGINX_URI
+public static String NGINX_URI()
+
+
-
+
-
+
FETCH
+public static org.mockserver.model.HttpRequest FETCH(String path)
+
+
-
+
-
+
RESPONSE
+public static org.mockserver.model.HttpResponse RESPONSE()
+
+
-
+
-
+
NGINX
+public static org.mockserver.model.HttpOverrideForwardedRequest NGINX()
+
+
-
+
-
+
NGINX
+public static org.mockserver.model.HttpOverrideForwardedRequest NGINX(String path)
+
+
-
+
-
+
NOT_FOUND
+public static org.mockserver.model.HttpResponse NOT_FOUND()
+
+
-
+
-
+
INTERNAL_SERVER_ERROR
+public static org.mockserver.model.HttpResponse INTERNAL_SERVER_ERROR()
+
+
-
+
-
+
prepareMockServer
+@BeforeEach +public void prepareMockServer()
+Prepares the mock-server to forward any request to the NginX-server, + for which no more specific expectation was specified.+
+
-
+
-
+
clearMockServer
+@AfterEach +public void clearMockServer()
+
+
-
+
-
+
getMockServerPort
+public int getMockServerPort()
+
+
-
+
-
+
getMockServerUri
+public String getMockServerUri()
+
+
+ -
+
+ -
+
+
+