diff options
Diffstat (limited to 'eaaf-springboot-utils/src/test/java/at')
-rw-r--r-- | eaaf-springboot-utils/src/test/java/at/gv/egiz/eaaf/utils/springboot/test/SimpleSpringBootStarterTest.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/eaaf-springboot-utils/src/test/java/at/gv/egiz/eaaf/utils/springboot/test/SimpleSpringBootStarterTest.java b/eaaf-springboot-utils/src/test/java/at/gv/egiz/eaaf/utils/springboot/test/SimpleSpringBootStarterTest.java index 611cc3aa..e0c478af 100644 --- a/eaaf-springboot-utils/src/test/java/at/gv/egiz/eaaf/utils/springboot/test/SimpleSpringBootStarterTest.java +++ b/eaaf-springboot-utils/src/test/java/at/gv/egiz/eaaf/utils/springboot/test/SimpleSpringBootStarterTest.java @@ -1,5 +1,8 @@ package at.gv.egiz.eaaf.utils.springboot.test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import java.io.IOException; import org.apache.http.client.ClientProtocolException; @@ -17,6 +20,7 @@ import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactor import org.springframework.context.ConfigurableApplicationContext; import at.gv.egiz.eaaf.utils.springboot.test.dummy.DummySpringBootApp; +import at.gv.egiz.eaaf.utils.springboot.utils.VersionHolder; public class SimpleSpringBootStarterTest { @@ -29,13 +33,15 @@ public class SimpleSpringBootStarterTest { ConfigurableApplicationContext ctx = DummySpringBootApp.getCtx(); Assert.assertNotNull("SpringBootContext", ctx); - //check if AJP Connector config was set + // check if AJP Connector config was set TomcatServletWebServerFactory ajp = ctx.getBean(TomcatServletWebServerFactory.class); Assert.assertNotNull("No AJP connector", ajp); - //check simple http calls + // check simple http calls testSimpleHttpCall(); + // check version holder + checkVersionHolder(ctx); SpringApplication.exit(ctx, new ExitCodeGenerator() { @@ -51,12 +57,17 @@ public class SimpleSpringBootStarterTest { // check if authentication works on actuator end-point final HttpClientBuilder builder = HttpClients.custom(); final CloseableHttpClient client = builder.build(); - Assert.assertNotNull("httpClient", client); + assertNotNull("httpClient", client); final HttpUriRequest httpGet1 = new HttpGet("http://localhost:8080/junit"); final CloseableHttpResponse httpResp1 = client.execute(httpGet1); - Assert.assertEquals("http statusCode", 200, httpResp1.getStatusLine().getStatusCode()); + assertEquals("http statusCode", 200, httpResp1.getStatusLine().getStatusCode()); + + } + + private void checkVersionHolder(ConfigurableApplicationContext ctx) { + VersionHolder versionHolder = ctx.getBean(VersionHolder.class); + assertEquals("can not extract version", "unknown", versionHolder.getVersion()); } - } |