From fc9036a3d9398f7539569f6b436dd827413ff125 Mon Sep 17 00:00:00 2001 From: Vedran Pavic Date: Fri, 2 Feb 2018 12:05:51 +0100 Subject: [PATCH] Update deployment tests to include Actuator See gh-11886 --- .../spring-boot-deployment-test-glassfish/pom.xml | 4 ++++ .../sample/SampleGlassfishDeployApplicationIT.java | 12 +++++++++++- .../spring-boot-deployment-test-tomcat/pom.xml | 4 ++++ .../java/sample/SampleTomcatDeployApplicationIT.java | 12 +++++++++++- .../spring-boot-deployment-test-tomee/pom.xml | 4 ++++ .../java/sample/SampleTomEEDeployApplicationIT.java | 12 +++++++++++- .../spring-boot-deployment-test-wildfly/pom.xml | 4 ++++ .../webapp/WEB-INF/jboss-deployment-structure.xml | 10 +++++++++- .../sample/SampleWildFlyDeployApplicationIT.java | 12 +++++++++++- .../spring-boot-deployment-test-wlp/pom.xml | 4 ++++ .../java/sample/SampleWlpDeployApplicationIT.java | 12 +++++++++++- 11 files changed, 84 insertions(+), 6 deletions(-) diff --git a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/pom.xml b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/pom.xml index a5de60cd35..580b984ca5 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/pom.xml +++ b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/pom.xml @@ -31,6 +31,10 @@ + + org.springframework.boot + spring-boot-starter-actuator + javax.servlet javax.servlet-api diff --git a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/test/java/sample/SampleGlassfishDeployApplicationIT.java b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/test/java/sample/SampleGlassfishDeployApplicationIT.java index bcf53c1a0c..7d3cdeeb1e 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/test/java/sample/SampleGlassfishDeployApplicationIT.java +++ b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/test/java/sample/SampleGlassfishDeployApplicationIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,4 +41,14 @@ public class SampleGlassfishDeployApplicationIT { assertThat(entity.getBody()).isEqualTo("Hello World"); } + @Test + public void testHealth() throws Exception { + String url = "http://localhost:" + this.port + "/bootapp/actuator/health"; + System.out.println(url); + ResponseEntity entity = new TestRestTemplate().getForEntity(url, + String.class); + assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\"}"); + } + } diff --git a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/pom.xml b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/pom.xml index 542c46dfac..e3242b6f5b 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/pom.xml +++ b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/pom.xml @@ -28,6 +28,10 @@ + + org.springframework.boot + spring-boot-starter-actuator + javax.servlet javax.servlet-api diff --git a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java index 4ce5e8da78..db0b2bf005 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java +++ b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,4 +40,14 @@ public class SampleTomcatDeployApplicationIT { assertThat(entity.getBody()).isEqualTo("Hello World"); } + @Test + public void testHealth() throws Exception { + String url = "http://localhost:" + this.port + "/bootapp/actuator/health"; + System.out.println(url); + ResponseEntity entity = new TestRestTemplate().getForEntity(url, + String.class); + assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\"}"); + } + } diff --git a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/pom.xml b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/pom.xml index 38c6d27c44..0d1eca846b 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/pom.xml +++ b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/pom.xml @@ -33,6 +33,10 @@ + + org.springframework.boot + spring-boot-starter-actuator + javax.servlet javax.servlet-api diff --git a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java index 7334f35967..a13ad33d3a 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java +++ b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,4 +40,14 @@ public class SampleTomEEDeployApplicationIT { assertThat(entity.getBody()).isEqualTo("Hello World"); } + @Test + public void testHealth() throws Exception { + String url = "http://localhost:" + this.port + "/bootapp/actuator/health"; + System.out.println(url); + ResponseEntity entity = new TestRestTemplate().getForEntity(url, + String.class); + assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\"}"); + } + } diff --git a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/pom.xml b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/pom.xml index e6f474967b..6b0aace3dc 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/pom.xml +++ b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/pom.xml @@ -28,6 +28,10 @@ + + org.springframework.boot + spring-boot-starter-actuator + javax.servlet javax.servlet-api diff --git a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/main/webapp/WEB-INF/jboss-deployment-structure.xml index 4bffbedfb1..84261cd62b 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/main/webapp/WEB-INF/jboss-deployment-structure.xml +++ b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -7,6 +7,14 @@ + + + + + + + + - \ No newline at end of file + diff --git a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyDeployApplicationIT.java b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyDeployApplicationIT.java index d2ee095407..06d2971c1e 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyDeployApplicationIT.java +++ b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyDeployApplicationIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,4 +40,14 @@ public class SampleWildFlyDeployApplicationIT { assertThat(entity.getBody()).isEqualTo("Hello World"); } + @Test + public void testHealth() throws Exception { + String url = "http://localhost:" + this.port + "/bootapp/actuator/health"; + System.out.println(url); + ResponseEntity entity = new TestRestTemplate().getForEntity(url, + String.class); + assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\"}"); + } + } diff --git a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wlp/pom.xml b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wlp/pom.xml index 9ded0e07b6..6824f8c37e 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wlp/pom.xml +++ b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wlp/pom.xml @@ -27,6 +27,10 @@ + + org.springframework.boot + spring-boot-starter-actuator + javax.servlet javax.servlet-api diff --git a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wlp/src/test/java/sample/SampleWlpDeployApplicationIT.java b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wlp/src/test/java/sample/SampleWlpDeployApplicationIT.java index 91ad8553f2..e95dd77c29 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wlp/src/test/java/sample/SampleWlpDeployApplicationIT.java +++ b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wlp/src/test/java/sample/SampleWlpDeployApplicationIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,4 +40,14 @@ public class SampleWlpDeployApplicationIT { assertThat(entity.getBody()).isEqualTo("Hello World"); } + @Test + public void testHealth() throws Exception { + String url = "http://localhost:" + this.port + "/bootapp/actuator/health"; + System.out.println(url); + ResponseEntity entity = new TestRestTemplate().getForEntity(url, + String.class); + assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\"}"); + } + }