Browse Source
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-1736pull/2081/head
20 changed files with 921 additions and 0 deletions
@ -0,0 +1,27 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
<parent> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-parent</artifactId> |
||||||
|
<version>1.2.0.BUILD-SNAPSHOT</version> |
||||||
|
<relativePath>../spring-boot-parent</relativePath> |
||||||
|
</parent> |
||||||
|
<artifactId>spring-boot-deployment-tests</artifactId> |
||||||
|
<packaging>pom</packaging> |
||||||
|
<name>Spring Boot Deployment Tests</name> |
||||||
|
<description>Spring Boot Deployment Tests</description> |
||||||
|
<url>http://projects.spring.io/spring-boot/</url> |
||||||
|
<organization> |
||||||
|
<name>Pivotal Software, Inc.</name> |
||||||
|
<url>http://www.spring.io</url> |
||||||
|
</organization> |
||||||
|
<properties> |
||||||
|
<main.basedir>${basedir}/..</main.basedir> |
||||||
|
</properties> |
||||||
|
<modules> |
||||||
|
<module>spring-boot-deployment-test-tomee</module> |
||||||
|
<module>spring-boot-deployment-test-tomcat</module> |
||||||
|
<module>spring-boot-deployment-test-wildfly</module> |
||||||
|
</modules> |
||||||
|
</project> |
||||||
@ -0,0 +1,113 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
<parent> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-deployment-tests</artifactId> |
||||||
|
<version>1.2.0.BUILD-SNAPSHOT</version> |
||||||
|
</parent> |
||||||
|
<artifactId>spring-boot-deployment-test-tomcat</artifactId> |
||||||
|
<packaging>war</packaging> |
||||||
|
<name>Spring Boot Tomcat Deployment Test</name> |
||||||
|
<description>Spring Boot Tomcat Deployment Test</description> |
||||||
|
<url>http://projects.spring.io/spring-boot/</url> |
||||||
|
<organization> |
||||||
|
<name>Pivotal Software, Inc.</name> |
||||||
|
<url>http://www.spring.io</url> |
||||||
|
</organization> |
||||||
|
<properties> |
||||||
|
<main.basedir>${basedir}/../..</main.basedir> |
||||||
|
</properties> |
||||||
|
<dependencies> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||||
|
<exclusions> |
||||||
|
<exclusion> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId> |
||||||
|
</exclusion> |
||||||
|
</exclusions> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>javax.servlet</groupId> |
||||||
|
<artifactId>javax.servlet-api</artifactId> |
||||||
|
<scope>provided</scope> |
||||||
|
</dependency> |
||||||
|
</dependencies> |
||||||
|
<build> |
||||||
|
<plugins> |
||||||
|
<plugin> |
||||||
|
<groupId>org.codehaus.mojo</groupId> |
||||||
|
<artifactId>build-helper-maven-plugin</artifactId> |
||||||
|
<executions> |
||||||
|
<execution> |
||||||
|
<id>reserve-network-port</id> |
||||||
|
<goals> |
||||||
|
<goal>reserve-network-port</goal> |
||||||
|
</goals> |
||||||
|
<phase>process-resources</phase> |
||||||
|
<configuration> |
||||||
|
<portNames> |
||||||
|
<portName>appserver.port</portName> |
||||||
|
</portNames> |
||||||
|
</configuration> |
||||||
|
</execution> |
||||||
|
</executions> |
||||||
|
</plugin> |
||||||
|
<plugin> |
||||||
|
<groupId>org.codehaus.cargo</groupId> |
||||||
|
<artifactId>cargo-maven2-plugin</artifactId> |
||||||
|
<version>1.4.11</version> |
||||||
|
<configuration> |
||||||
|
<container> |
||||||
|
<containerId>tomcat8x</containerId> |
||||||
|
<zipUrlInstaller> |
||||||
|
<url>http://mirrors.ibiblio.org/apache/tomcat/tomcat-8/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip</url> |
||||||
|
</zipUrlInstaller> |
||||||
|
</container> |
||||||
|
<configuration> |
||||||
|
<properties> |
||||||
|
<cargo.servlet.port>${appserver.port}</cargo.servlet.port> |
||||||
|
</properties> |
||||||
|
</configuration> |
||||||
|
<deployables> |
||||||
|
<deployable> |
||||||
|
<properties> |
||||||
|
<context>/bootapp</context> |
||||||
|
</properties> |
||||||
|
<pingURL>http://localhost:${appserver.port}/bootapp</pingURL> |
||||||
|
<pingTimeout>30000</pingTimeout> |
||||||
|
</deployable> |
||||||
|
</deployables> |
||||||
|
</configuration> |
||||||
|
<executions> |
||||||
|
<execution> |
||||||
|
<id>start-cargo</id> |
||||||
|
<phase>pre-integration-test</phase> |
||||||
|
<goals> |
||||||
|
<goal>start</goal> |
||||||
|
</goals> |
||||||
|
</execution> |
||||||
|
<execution> |
||||||
|
<id>stop-cargo</id> |
||||||
|
<phase>post-integration-test</phase> |
||||||
|
<goals> |
||||||
|
<goal>stop</goal> |
||||||
|
</goals> |
||||||
|
</execution> |
||||||
|
</executions> |
||||||
|
</plugin> |
||||||
|
<plugin> |
||||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||||
|
<artifactId>maven-failsafe-plugin</artifactId> |
||||||
|
<configuration> |
||||||
|
<systemPropertyVariables> |
||||||
|
<port>${appserver.port}</port> |
||||||
|
</systemPropertyVariables> |
||||||
|
</configuration> |
||||||
|
</plugin> |
||||||
|
</plugins> |
||||||
|
</build> |
||||||
|
</project> |
||||||
@ -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"; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -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 { |
||||||
|
|
||||||
|
} |
||||||
@ -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<String> entity = new TestRestTemplate().getForEntity(url, |
||||||
|
String.class); |
||||||
|
assertEquals(HttpStatus.OK, entity.getStatusCode()); |
||||||
|
assertEquals("Hello World", entity.getBody()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,118 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
<parent> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-deployment-tests</artifactId> |
||||||
|
<version>1.2.0.BUILD-SNAPSHOT</version> |
||||||
|
</parent> |
||||||
|
<artifactId>spring-boot-deployment-test-tomee</artifactId> |
||||||
|
<packaging>war</packaging> |
||||||
|
<name>Spring Boot TomEE Deployment Test</name> |
||||||
|
<description>Spring Boot TomEE Deployment Test</description> |
||||||
|
<url>http://projects.spring.io/spring-boot/</url> |
||||||
|
<organization> |
||||||
|
<name>Pivotal Software, Inc.</name> |
||||||
|
<url>http://www.spring.io</url> |
||||||
|
</organization> |
||||||
|
<properties> |
||||||
|
<main.basedir>${basedir}/../..</main.basedir> |
||||||
|
<tomee.version>1.7.1</tomee.version> |
||||||
|
</properties> |
||||||
|
<dependencies> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||||
|
<exclusions> |
||||||
|
<exclusion> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId> |
||||||
|
</exclusion> |
||||||
|
<exclusion> |
||||||
|
<groupId>org.hibernate</groupId> |
||||||
|
<artifactId>hibernate-validator</artifactId> |
||||||
|
</exclusion> |
||||||
|
</exclusions> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>javax.servlet</groupId> |
||||||
|
<artifactId>javax.servlet-api</artifactId> |
||||||
|
<scope>provided</scope> |
||||||
|
</dependency> |
||||||
|
</dependencies> |
||||||
|
<build> |
||||||
|
<plugins> |
||||||
|
<plugin> |
||||||
|
<groupId>org.codehaus.mojo</groupId> |
||||||
|
<artifactId>build-helper-maven-plugin</artifactId> |
||||||
|
<executions> |
||||||
|
<execution> |
||||||
|
<id>reserve-network-port</id> |
||||||
|
<goals> |
||||||
|
<goal>reserve-network-port</goal> |
||||||
|
</goals> |
||||||
|
<phase>process-resources</phase> |
||||||
|
<configuration> |
||||||
|
<portNames> |
||||||
|
<portName>appserver.port</portName> |
||||||
|
</portNames> |
||||||
|
</configuration> |
||||||
|
</execution> |
||||||
|
</executions> |
||||||
|
</plugin> |
||||||
|
<plugin> |
||||||
|
<groupId>org.codehaus.cargo</groupId> |
||||||
|
<artifactId>cargo-maven2-plugin</artifactId> |
||||||
|
<version>1.4.11</version> |
||||||
|
<configuration> |
||||||
|
<container> |
||||||
|
<containerId>tomee1x</containerId> |
||||||
|
<zipUrlInstaller> |
||||||
|
<url>http://mirrors.ibiblio.org/apache/tomee/tomee-${tomee.version}/apache-tomee-${tomee.version}-webprofile.zip</url> |
||||||
|
</zipUrlInstaller> |
||||||
|
</container> |
||||||
|
<configuration> |
||||||
|
<properties> |
||||||
|
<cargo.servlet.port>${appserver.port}</cargo.servlet.port> |
||||||
|
</properties> |
||||||
|
</configuration> |
||||||
|
<deployables> |
||||||
|
<deployable> |
||||||
|
<properties> |
||||||
|
<context>/bootapp</context> |
||||||
|
</properties> |
||||||
|
<pingURL>http://localhost:${appserver.port}/bootapp</pingURL> |
||||||
|
<pingTimeout>30000</pingTimeout> |
||||||
|
</deployable> |
||||||
|
</deployables> |
||||||
|
</configuration> |
||||||
|
<executions> |
||||||
|
<execution> |
||||||
|
<id>start-cargo</id> |
||||||
|
<phase>pre-integration-test</phase> |
||||||
|
<goals> |
||||||
|
<goal>start</goal> |
||||||
|
</goals> |
||||||
|
</execution> |
||||||
|
<execution> |
||||||
|
<id>stop-cargo</id> |
||||||
|
<phase>post-integration-test</phase> |
||||||
|
<goals> |
||||||
|
<goal>stop</goal> |
||||||
|
</goals> |
||||||
|
</execution> |
||||||
|
</executions> |
||||||
|
</plugin> |
||||||
|
<plugin> |
||||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||||
|
<artifactId>maven-failsafe-plugin</artifactId> |
||||||
|
<configuration> |
||||||
|
<systemPropertyVariables> |
||||||
|
<port>${appserver.port}</port> |
||||||
|
</systemPropertyVariables> |
||||||
|
</configuration> |
||||||
|
</plugin> |
||||||
|
</plugins> |
||||||
|
</build> |
||||||
|
</project> |
||||||
@ -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"; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -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); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -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<String> entity = new TestRestTemplate().getForEntity(url, |
||||||
|
String.class); |
||||||
|
assertEquals(HttpStatus.OK, entity.getStatusCode()); |
||||||
|
assertEquals("Hello World", entity.getBody()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,115 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
<parent> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-deployment-tests</artifactId> |
||||||
|
<version>1.2.0.BUILD-SNAPSHOT</version> |
||||||
|
</parent> |
||||||
|
<artifactId>spring-boot-deployment-test-wildfly</artifactId> |
||||||
|
<packaging>war</packaging> |
||||||
|
<name>Spring Boot WildFly Deployment Test</name> |
||||||
|
<description>Spring Boot WildFly Deployment Test</description> |
||||||
|
<url>http://projects.spring.io/spring-boot/</url> |
||||||
|
<organization> |
||||||
|
<name>Pivotal Software, Inc.</name> |
||||||
|
<url>http://www.spring.io</url> |
||||||
|
</organization> |
||||||
|
<properties> |
||||||
|
<main.basedir>${basedir}/../..</main.basedir> |
||||||
|
<wildfly.version>8.2.0.Final</wildfly.version> |
||||||
|
</properties> |
||||||
|
<dependencies> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||||
|
<exclusions> |
||||||
|
<exclusion> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId> |
||||||
|
</exclusion> |
||||||
|
</exclusions> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>javax.servlet</groupId> |
||||||
|
<artifactId>javax.servlet-api</artifactId> |
||||||
|
<scope>provided</scope> |
||||||
|
</dependency> |
||||||
|
</dependencies> |
||||||
|
<build> |
||||||
|
<plugins> |
||||||
|
<plugin> |
||||||
|
<groupId>org.codehaus.mojo</groupId> |
||||||
|
<artifactId>build-helper-maven-plugin</artifactId> |
||||||
|
<executions> |
||||||
|
<execution> |
||||||
|
<id>reserve-network-port</id> |
||||||
|
<goals> |
||||||
|
<goal>reserve-network-port</goal> |
||||||
|
</goals> |
||||||
|
<phase>process-resources</phase> |
||||||
|
<configuration> |
||||||
|
<portNames> |
||||||
|
<portName>appserver.port</portName> |
||||||
|
</portNames> |
||||||
|
</configuration> |
||||||
|
</execution> |
||||||
|
</executions> |
||||||
|
</plugin> |
||||||
|
<plugin> |
||||||
|
<groupId>org.codehaus.cargo</groupId> |
||||||
|
<artifactId>cargo-maven2-plugin</artifactId> |
||||||
|
<version>1.4.11</version> |
||||||
|
<configuration> |
||||||
|
<container> |
||||||
|
<containerId>wildfly8x</containerId> |
||||||
|
<zipUrlInstaller> |
||||||
|
<url>http://download.jboss.org/wildfly/${wildfly.version}/wildfly-${wildfly.version}.zip</url> |
||||||
|
</zipUrlInstaller> |
||||||
|
</container> |
||||||
|
<configuration> |
||||||
|
<properties> |
||||||
|
<cargo.servlet.port>${appserver.port}</cargo.servlet.port> |
||||||
|
<cargo.jboss.configuration>standalone-full</cargo.jboss.configuration> |
||||||
|
</properties> |
||||||
|
</configuration> |
||||||
|
<deployables> |
||||||
|
<deployable> |
||||||
|
<properties> |
||||||
|
<context>/bootapp</context> |
||||||
|
</properties> |
||||||
|
<pingURL>http://localhost:${appserver.port}/bootapp</pingURL> |
||||||
|
<pingTimeout>30000</pingTimeout> |
||||||
|
</deployable> |
||||||
|
</deployables> |
||||||
|
</configuration> |
||||||
|
<executions> |
||||||
|
<execution> |
||||||
|
<id>start-cargo</id> |
||||||
|
<phase>pre-integration-test</phase> |
||||||
|
<goals> |
||||||
|
<goal>start</goal> |
||||||
|
</goals> |
||||||
|
</execution> |
||||||
|
<execution> |
||||||
|
<id>stop-cargo</id> |
||||||
|
<phase>post-integration-test</phase> |
||||||
|
<goals> |
||||||
|
<goal>stop</goal> |
||||||
|
</goals> |
||||||
|
</execution> |
||||||
|
</executions> |
||||||
|
</plugin> |
||||||
|
<plugin> |
||||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||||
|
<artifactId>maven-failsafe-plugin</artifactId> |
||||||
|
<configuration> |
||||||
|
<systemPropertyVariables> |
||||||
|
<port>${appserver.port}</port> |
||||||
|
</systemPropertyVariables> |
||||||
|
</configuration> |
||||||
|
</plugin> |
||||||
|
</plugins> |
||||||
|
</build> |
||||||
|
</project> |
||||||
@ -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"; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -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 { |
||||||
|
|
||||||
|
} |
||||||
@ -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<String> entity = new TestRestTemplate().getForEntity(url, |
||||||
|
String.class); |
||||||
|
assertEquals(HttpStatus.OK, entity.getStatusCode()); |
||||||
|
assertEquals("Hello World", entity.getBody()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,25 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
<parent> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-parent</artifactId> |
||||||
|
<version>1.2.0.BUILD-SNAPSHOT</version> |
||||||
|
<relativePath>../spring-boot-parent</relativePath> |
||||||
|
</parent> |
||||||
|
<artifactId>spring-boot-deployment-tests</artifactId> |
||||||
|
<packaging>pom</packaging> |
||||||
|
<name>Spring Boot Deployment Tests</name> |
||||||
|
<description>Spring Boot Deployment Tests</description> |
||||||
|
<url>http://projects.spring.io/spring-boot/</url> |
||||||
|
<organization> |
||||||
|
<name>Pivotal Software, Inc.</name> |
||||||
|
<url>http://www.spring.io</url> |
||||||
|
</organization> |
||||||
|
<properties> |
||||||
|
<main.basedir>${basedir}/..</main.basedir> |
||||||
|
</properties> |
||||||
|
<modules> |
||||||
|
<module>spring-boot-deployment-wildfly</module> |
||||||
|
</modules> |
||||||
|
</project> |
||||||
@ -0,0 +1,115 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
<parent> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-deployment-tests</artifactId> |
||||||
|
<version>1.2.0.BUILD-SNAPSHOT</version> |
||||||
|
</parent> |
||||||
|
<artifactId>spring-boot-deployment-wildfly</artifactId> |
||||||
|
<packaging>war</packaging> |
||||||
|
<name>Spring Boot WildFly Deployment</name> |
||||||
|
<description>Spring Boot WildFly Deployment</description> |
||||||
|
<url>http://projects.spring.io/spring-boot/</url> |
||||||
|
<organization> |
||||||
|
<name>Pivotal Software, Inc.</name> |
||||||
|
<url>http://www.spring.io</url> |
||||||
|
</organization> |
||||||
|
<properties> |
||||||
|
<main.basedir>${basedir}/../..</main.basedir> |
||||||
|
<wildfly.version>8.2.0.Final</wildfly.version> |
||||||
|
</properties> |
||||||
|
<dependencies> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||||
|
<exclusions> |
||||||
|
<exclusion> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId> |
||||||
|
</exclusion> |
||||||
|
</exclusions> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>javax.servlet</groupId> |
||||||
|
<artifactId>javax.servlet-api</artifactId> |
||||||
|
<scope>provided</scope> |
||||||
|
</dependency> |
||||||
|
</dependencies> |
||||||
|
<build> |
||||||
|
<plugins> |
||||||
|
<plugin> |
||||||
|
<groupId>org.codehaus.mojo</groupId> |
||||||
|
<artifactId>build-helper-maven-plugin</artifactId> |
||||||
|
<executions> |
||||||
|
<execution> |
||||||
|
<id>reserve-network-port</id> |
||||||
|
<goals> |
||||||
|
<goal>reserve-network-port</goal> |
||||||
|
</goals> |
||||||
|
<phase>process-resources</phase> |
||||||
|
<configuration> |
||||||
|
<portNames> |
||||||
|
<portName>appserver.port</portName> |
||||||
|
</portNames> |
||||||
|
</configuration> |
||||||
|
</execution> |
||||||
|
</executions> |
||||||
|
</plugin> |
||||||
|
<plugin> |
||||||
|
<groupId>org.codehaus.cargo</groupId> |
||||||
|
<artifactId>cargo-maven2-plugin</artifactId> |
||||||
|
<version>1.4.11</version> |
||||||
|
<configuration> |
||||||
|
<container> |
||||||
|
<containerId>wildfly8x</containerId> |
||||||
|
<zipUrlInstaller> |
||||||
|
<url>http://download.jboss.org/wildfly/${wildfly.version}/wildfly-${wildfly.version}.zip</url> |
||||||
|
</zipUrlInstaller> |
||||||
|
</container> |
||||||
|
<configuration> |
||||||
|
<properties> |
||||||
|
<cargo.servlet.port>${appserver.port}</cargo.servlet.port> |
||||||
|
<cargo.jboss.configuration>standalone-full</cargo.jboss.configuration> |
||||||
|
</properties> |
||||||
|
</configuration> |
||||||
|
<deployables> |
||||||
|
<deployable> |
||||||
|
<properties> |
||||||
|
<context>/bootapp</context> |
||||||
|
</properties> |
||||||
|
<pingURL>http://localhost:${appserver.port}/bootapp</pingURL> |
||||||
|
<pingTimeout>30000</pingTimeout> |
||||||
|
</deployable> |
||||||
|
</deployables> |
||||||
|
</configuration> |
||||||
|
<executions> |
||||||
|
<execution> |
||||||
|
<id>start-cargo</id> |
||||||
|
<phase>pre-integration-test</phase> |
||||||
|
<goals> |
||||||
|
<goal>start</goal> |
||||||
|
</goals> |
||||||
|
</execution> |
||||||
|
<execution> |
||||||
|
<id>stop-cargo</id> |
||||||
|
<phase>post-integration-test</phase> |
||||||
|
<goals> |
||||||
|
<goal>stop</goal> |
||||||
|
</goals> |
||||||
|
</execution> |
||||||
|
</executions> |
||||||
|
</plugin> |
||||||
|
<plugin> |
||||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||||
|
<artifactId>maven-failsafe-plugin</artifactId> |
||||||
|
<configuration> |
||||||
|
<systemPropertyVariables> |
||||||
|
<port>${appserver.port}</port> |
||||||
|
</systemPropertyVariables> |
||||||
|
</configuration> |
||||||
|
</plugin> |
||||||
|
</plugins> |
||||||
|
</build> |
||||||
|
</project> |
||||||
@ -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"; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -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 { |
||||||
|
|
||||||
|
} |
||||||
@ -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<String> entity = new TestRestTemplate().getForEntity(url, |
||||||
|
String.class); |
||||||
|
assertEquals(HttpStatus.OK, entity.getStatusCode()); |
||||||
|
assertEquals("Hello World", entity.getBody()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue