From 44dde9fc1247e3640dbefe952f3dd6746e579eac Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 5 Dec 2014 23:04:22 -0800 Subject: [PATCH] Add deployment integration tests Add deployment tests for Tomcat, TomEE and WildFly to ensure that a basic Spring Boot application can be deployed to a traditional Application server. Since the deployment tests can be quite slow, they currently only run in the "full" build profile. Fixes gh-1736 --- spring-boot-deployment-tests/pom.xml | 27 ++++ .../pom.xml | 113 +++++++++++++++++ .../main/java/sample/SampleController.java | 30 +++++ .../sample/SampleTomcatDeployApplication.java | 25 ++++ .../SampleWildFlyApplicationTestIT.java | 40 ++++++ .../spring-boot-deployment-test-tomee/pom.xml | 118 ++++++++++++++++++ .../main/java/sample/SampleController.java | 30 +++++ .../sample/SampleTomEEDeployApplication.java | 31 +++++ .../SampleWildFlyApplicationTestIT.java | 40 ++++++ .../pom.xml | 115 +++++++++++++++++ .../main/java/sample/SampleController.java | 30 +++++ .../SampleWildFlyDeployApplication.java | 25 ++++ .../SampleWildFlyApplicationTestIT.java | 40 ++++++ spring-boot-full-build/pom.xml | 1 + .../spring-boot-deployment-tests/pom.xml | 25 ++++ .../spring-boot-deployment-wildfly/pom.xml | 115 +++++++++++++++++ .../main/java/sample/SampleController.java | 30 +++++ .../java/sample/SampleWildFlyApplication.java | 25 ++++ .../SampleWildFlyApplicationTestIT.java | 40 ++++++ spring-boot-parent/pom.xml | 21 ++++ 20 files changed, 921 insertions(+) create mode 100644 spring-boot-deployment-tests/pom.xml create mode 100644 spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/pom.xml create mode 100644 spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/main/java/sample/SampleController.java create mode 100644 spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/main/java/sample/SampleTomcatDeployApplication.java create mode 100644 spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleWildFlyApplicationTestIT.java create mode 100644 spring-boot-deployment-tests/spring-boot-deployment-test-tomee/pom.xml create mode 100644 spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/main/java/sample/SampleController.java create mode 100644 spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/main/java/sample/SampleTomEEDeployApplication.java create mode 100644 spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleWildFlyApplicationTestIT.java create mode 100644 spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/pom.xml create mode 100644 spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/main/java/sample/SampleController.java create mode 100644 spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/main/java/sample/SampleWildFlyDeployApplication.java create mode 100644 spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyApplicationTestIT.java create mode 100644 spring-boot-integration-tests/spring-boot-deployment-tests/pom.xml create mode 100644 spring-boot-integration-tests/spring-boot-deployment-tests/spring-boot-deployment-wildfly/pom.xml create mode 100644 spring-boot-integration-tests/spring-boot-deployment-tests/spring-boot-deployment-wildfly/src/main/java/sample/SampleController.java create mode 100644 spring-boot-integration-tests/spring-boot-deployment-tests/spring-boot-deployment-wildfly/src/main/java/sample/SampleWildFlyApplication.java create mode 100644 spring-boot-integration-tests/spring-boot-deployment-tests/spring-boot-deployment-wildfly/src/test/java/sample/SampleWildFlyApplicationTestIT.java diff --git a/spring-boot-deployment-tests/pom.xml b/spring-boot-deployment-tests/pom.xml new file mode 100644 index 00000000000..e0b43bf82f7 --- /dev/null +++ b/spring-boot-deployment-tests/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-parent + 1.2.0.BUILD-SNAPSHOT + ../spring-boot-parent + + spring-boot-deployment-tests + pom + Spring Boot Deployment Tests + Spring Boot Deployment Tests + http://projects.spring.io/spring-boot/ + + Pivotal Software, Inc. + http://www.spring.io + + + ${basedir}/.. + + + spring-boot-deployment-test-tomee + spring-boot-deployment-test-tomcat + spring-boot-deployment-test-wildfly + + diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/pom.xml b/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/pom.xml new file mode 100644 index 00000000000..6ed51d4520d --- /dev/null +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/pom.xml @@ -0,0 +1,113 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-deployment-tests + 1.2.0.BUILD-SNAPSHOT + + spring-boot-deployment-test-tomcat + war + Spring Boot Tomcat Deployment Test + Spring Boot Tomcat Deployment Test + http://projects.spring.io/spring-boot/ + + Pivotal Software, Inc. + http://www.spring.io + + + ${basedir}/../.. + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + javax.servlet + javax.servlet-api + provided + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + reserve-network-port + + reserve-network-port + + process-resources + + + appserver.port + + + + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.4.11 + + + tomcat8x + + http://mirrors.ibiblio.org/apache/tomcat/tomcat-8/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip + + + + + ${appserver.port} + + + + + + /bootapp + + http://localhost:${appserver.port}/bootapp + 30000 + + + + + + start-cargo + pre-integration-test + + start + + + + stop-cargo + post-integration-test + + stop + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + ${appserver.port} + + + + + + diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/main/java/sample/SampleController.java b/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/main/java/sample/SampleController.java new file mode 100644 index 00000000000..e671d503b33 --- /dev/null +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/main/java/sample/SampleController.java @@ -0,0 +1,30 @@ +/* + * Copyright 2012-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class SampleController { + + @RequestMapping("/") + public String hello() { + return "Hello World"; + } + +} diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/main/java/sample/SampleTomcatDeployApplication.java b/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/main/java/sample/SampleTomcatDeployApplication.java new file mode 100644 index 00000000000..a68a489b241 --- /dev/null +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/main/java/sample/SampleTomcatDeployApplication.java @@ -0,0 +1,25 @@ +/* + * Copyright 2012-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.web.SpringBootServletInitializer; + +@SpringBootApplication +public class SampleTomcatDeployApplication extends SpringBootServletInitializer { + +} diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleWildFlyApplicationTestIT.java b/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleWildFlyApplicationTestIT.java new file mode 100644 index 00000000000..bf17b5f1a1e --- /dev/null +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleWildFlyApplicationTestIT.java @@ -0,0 +1,40 @@ +/* + * Copyright 2012-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample; + +import org.junit.Test; +import org.springframework.boot.test.TestRestTemplate; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +import static org.junit.Assert.assertEquals; + +public class SampleWildFlyApplicationTestIT { + + private int port = Integer.valueOf(System.getProperty("port")); + + @Test + public void testHome() throws Exception { + String url = "http://localhost:" + this.port + "/bootapp/"; + System.out.println(url); + ResponseEntity entity = new TestRestTemplate().getForEntity(url, + String.class); + assertEquals(HttpStatus.OK, entity.getStatusCode()); + assertEquals("Hello World", entity.getBody()); + } + +} diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/pom.xml b/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/pom.xml new file mode 100644 index 00000000000..9561eeb8712 --- /dev/null +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/pom.xml @@ -0,0 +1,118 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-deployment-tests + 1.2.0.BUILD-SNAPSHOT + + spring-boot-deployment-test-tomee + war + Spring Boot TomEE Deployment Test + Spring Boot TomEE Deployment Test + http://projects.spring.io/spring-boot/ + + Pivotal Software, Inc. + http://www.spring.io + + + ${basedir}/../.. + 1.7.1 + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + org.hibernate + hibernate-validator + + + + + javax.servlet + javax.servlet-api + provided + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + reserve-network-port + + reserve-network-port + + process-resources + + + appserver.port + + + + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.4.11 + + + tomee1x + + http://mirrors.ibiblio.org/apache/tomee/tomee-${tomee.version}/apache-tomee-${tomee.version}-webprofile.zip + + + + + ${appserver.port} + + + + + + /bootapp + + http://localhost:${appserver.port}/bootapp + 30000 + + + + + + start-cargo + pre-integration-test + + start + + + + stop-cargo + post-integration-test + + stop + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + ${appserver.port} + + + + + + diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/main/java/sample/SampleController.java b/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/main/java/sample/SampleController.java new file mode 100644 index 00000000000..e671d503b33 --- /dev/null +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/main/java/sample/SampleController.java @@ -0,0 +1,30 @@ +/* + * Copyright 2012-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class SampleController { + + @RequestMapping("/") + public String hello() { + return "Hello World"; + } + +} diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/main/java/sample/SampleTomEEDeployApplication.java b/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/main/java/sample/SampleTomEEDeployApplication.java new file mode 100644 index 00000000000..4134b71a511 --- /dev/null +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/main/java/sample/SampleTomEEDeployApplication.java @@ -0,0 +1,31 @@ +/* + * Copyright 2012-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.context.web.SpringBootServletInitializer; + +@SpringBootApplication +public class SampleTomEEDeployApplication extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(SampleTomEEDeployApplication.class); + } + +} diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleWildFlyApplicationTestIT.java b/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleWildFlyApplicationTestIT.java new file mode 100644 index 00000000000..bf17b5f1a1e --- /dev/null +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleWildFlyApplicationTestIT.java @@ -0,0 +1,40 @@ +/* + * Copyright 2012-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample; + +import org.junit.Test; +import org.springframework.boot.test.TestRestTemplate; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +import static org.junit.Assert.assertEquals; + +public class SampleWildFlyApplicationTestIT { + + private int port = Integer.valueOf(System.getProperty("port")); + + @Test + public void testHome() throws Exception { + String url = "http://localhost:" + this.port + "/bootapp/"; + System.out.println(url); + ResponseEntity entity = new TestRestTemplate().getForEntity(url, + String.class); + assertEquals(HttpStatus.OK, entity.getStatusCode()); + assertEquals("Hello World", entity.getBody()); + } + +} diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/pom.xml b/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/pom.xml new file mode 100644 index 00000000000..f9c05c4f77a --- /dev/null +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/pom.xml @@ -0,0 +1,115 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-deployment-tests + 1.2.0.BUILD-SNAPSHOT + + spring-boot-deployment-test-wildfly + war + Spring Boot WildFly Deployment Test + Spring Boot WildFly Deployment Test + http://projects.spring.io/spring-boot/ + + Pivotal Software, Inc. + http://www.spring.io + + + ${basedir}/../.. + 8.2.0.Final + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + javax.servlet + javax.servlet-api + provided + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + reserve-network-port + + reserve-network-port + + process-resources + + + appserver.port + + + + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.4.11 + + + wildfly8x + + http://download.jboss.org/wildfly/${wildfly.version}/wildfly-${wildfly.version}.zip + + + + + ${appserver.port} + standalone-full + + + + + + /bootapp + + http://localhost:${appserver.port}/bootapp + 30000 + + + + + + start-cargo + pre-integration-test + + start + + + + stop-cargo + post-integration-test + + stop + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + ${appserver.port} + + + + + + diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/main/java/sample/SampleController.java b/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/main/java/sample/SampleController.java new file mode 100644 index 00000000000..e671d503b33 --- /dev/null +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/main/java/sample/SampleController.java @@ -0,0 +1,30 @@ +/* + * Copyright 2012-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class SampleController { + + @RequestMapping("/") + public String hello() { + return "Hello World"; + } + +} diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/main/java/sample/SampleWildFlyDeployApplication.java b/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/main/java/sample/SampleWildFlyDeployApplication.java new file mode 100644 index 00000000000..90085f9144a --- /dev/null +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/main/java/sample/SampleWildFlyDeployApplication.java @@ -0,0 +1,25 @@ +/* + * Copyright 2012-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.web.SpringBootServletInitializer; + +@SpringBootApplication +public class SampleWildFlyDeployApplication extends SpringBootServletInitializer { + +} diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyApplicationTestIT.java b/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyApplicationTestIT.java new file mode 100644 index 00000000000..bf17b5f1a1e --- /dev/null +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyApplicationTestIT.java @@ -0,0 +1,40 @@ +/* + * Copyright 2012-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample; + +import org.junit.Test; +import org.springframework.boot.test.TestRestTemplate; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +import static org.junit.Assert.assertEquals; + +public class SampleWildFlyApplicationTestIT { + + private int port = Integer.valueOf(System.getProperty("port")); + + @Test + public void testHome() throws Exception { + String url = "http://localhost:" + this.port + "/bootapp/"; + System.out.println(url); + ResponseEntity entity = new TestRestTemplate().getForEntity(url, + String.class); + assertEquals(HttpStatus.OK, entity.getStatusCode()); + assertEquals("Hello World", entity.getBody()); + } + +} diff --git a/spring-boot-full-build/pom.xml b/spring-boot-full-build/pom.xml index 6f8d5c9ced7..66236ebbadc 100644 --- a/spring-boot-full-build/pom.xml +++ b/spring-boot-full-build/pom.xml @@ -55,6 +55,7 @@ ../spring-boot-starters ../spring-boot-cli ../spring-boot-samples + ../spring-boot-deployment-tests ../spring-boot-integration-tests ../spring-boot-docs diff --git a/spring-boot-integration-tests/spring-boot-deployment-tests/pom.xml b/spring-boot-integration-tests/spring-boot-deployment-tests/pom.xml new file mode 100644 index 00000000000..3ba1171ec68 --- /dev/null +++ b/spring-boot-integration-tests/spring-boot-deployment-tests/pom.xml @@ -0,0 +1,25 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-parent + 1.2.0.BUILD-SNAPSHOT + ../spring-boot-parent + + spring-boot-deployment-tests + pom + Spring Boot Deployment Tests + Spring Boot Deployment Tests + http://projects.spring.io/spring-boot/ + + Pivotal Software, Inc. + http://www.spring.io + + + ${basedir}/.. + + + spring-boot-deployment-wildfly + + diff --git a/spring-boot-integration-tests/spring-boot-deployment-tests/spring-boot-deployment-wildfly/pom.xml b/spring-boot-integration-tests/spring-boot-deployment-tests/spring-boot-deployment-wildfly/pom.xml new file mode 100644 index 00000000000..b623f2d0086 --- /dev/null +++ b/spring-boot-integration-tests/spring-boot-deployment-tests/spring-boot-deployment-wildfly/pom.xml @@ -0,0 +1,115 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-deployment-tests + 1.2.0.BUILD-SNAPSHOT + + spring-boot-deployment-wildfly + war + Spring Boot WildFly Deployment + Spring Boot WildFly Deployment + http://projects.spring.io/spring-boot/ + + Pivotal Software, Inc. + http://www.spring.io + + + ${basedir}/../.. + 8.2.0.Final + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + javax.servlet + javax.servlet-api + provided + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + reserve-network-port + + reserve-network-port + + process-resources + + + appserver.port + + + + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.4.11 + + + wildfly8x + + http://download.jboss.org/wildfly/${wildfly.version}/wildfly-${wildfly.version}.zip + + + + + ${appserver.port} + standalone-full + + + + + + /bootapp + + http://localhost:${appserver.port}/bootapp + 30000 + + + + + + start-cargo + pre-integration-test + + start + + + + stop-cargo + post-integration-test + + stop + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + ${appserver.port} + + + + + + diff --git a/spring-boot-integration-tests/spring-boot-deployment-tests/spring-boot-deployment-wildfly/src/main/java/sample/SampleController.java b/spring-boot-integration-tests/spring-boot-deployment-tests/spring-boot-deployment-wildfly/src/main/java/sample/SampleController.java new file mode 100644 index 00000000000..e671d503b33 --- /dev/null +++ b/spring-boot-integration-tests/spring-boot-deployment-tests/spring-boot-deployment-wildfly/src/main/java/sample/SampleController.java @@ -0,0 +1,30 @@ +/* + * Copyright 2012-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class SampleController { + + @RequestMapping("/") + public String hello() { + return "Hello World"; + } + +} diff --git a/spring-boot-integration-tests/spring-boot-deployment-tests/spring-boot-deployment-wildfly/src/main/java/sample/SampleWildFlyApplication.java b/spring-boot-integration-tests/spring-boot-deployment-tests/spring-boot-deployment-wildfly/src/main/java/sample/SampleWildFlyApplication.java new file mode 100644 index 00000000000..e357aa87064 --- /dev/null +++ b/spring-boot-integration-tests/spring-boot-deployment-tests/spring-boot-deployment-wildfly/src/main/java/sample/SampleWildFlyApplication.java @@ -0,0 +1,25 @@ +/* + * Copyright 2012-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.web.SpringBootServletInitializer; + +@SpringBootApplication +public class SampleWildFlyApplication extends SpringBootServletInitializer { + +} diff --git a/spring-boot-integration-tests/spring-boot-deployment-tests/spring-boot-deployment-wildfly/src/test/java/sample/SampleWildFlyApplicationTestIT.java b/spring-boot-integration-tests/spring-boot-deployment-tests/spring-boot-deployment-wildfly/src/test/java/sample/SampleWildFlyApplicationTestIT.java new file mode 100644 index 00000000000..bf17b5f1a1e --- /dev/null +++ b/spring-boot-integration-tests/spring-boot-deployment-tests/spring-boot-deployment-wildfly/src/test/java/sample/SampleWildFlyApplicationTestIT.java @@ -0,0 +1,40 @@ +/* + * Copyright 2012-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample; + +import org.junit.Test; +import org.springframework.boot.test.TestRestTemplate; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +import static org.junit.Assert.assertEquals; + +public class SampleWildFlyApplicationTestIT { + + private int port = Integer.valueOf(System.getProperty("port")); + + @Test + public void testHome() throws Exception { + String url = "http://localhost:" + this.port + "/bootapp/"; + System.out.println(url); + ResponseEntity entity = new TestRestTemplate().getForEntity(url, + String.class); + assertEquals(HttpStatus.OK, entity.getStatusCode()); + assertEquals("Hello World", entity.getBody()); + } + +} diff --git a/spring-boot-parent/pom.xml b/spring-boot-parent/pom.xml index 43365ffd497..48ccb01a76a 100644 --- a/spring-boot-parent/pom.xml +++ b/spring-boot-parent/pom.xml @@ -344,6 +344,27 @@ + + + + org.codehaus.mojo + + + build-helper-maven-plugin + + + [1.9.1,) + + + + reserve-network-port + + + + + + +