THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
1) Developed a maven plugin to trigger the web-based junit tests and analyze the results
2) Configure the pom.xml with cargo plugin to start an embedded Jetty server, deploy the WAR, trigger the web-based junit tests, and stop the server.
Appendix
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca</artifactId>
<version>1.2-incubating-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>sample-calculator-webapp</artifactId>
<packaging>war</packaging>
<name>Apache Tuscany SCA Calculator Sample in a WebApp</name>
<repositories>
<repository>
<id>apache.incubator</id>
<url>http://people.apache.org/repo/m2-incubating-repository</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-webapp</artifactId>
<version>1.2-incubating-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>1.2-incubating-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<!-- marking dependency as provided to exclude from war file -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<finalName>${artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<configuration>
<finalName>web</finalName>
</configuration>
<phase>test</phase>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>target</directory>
<includes>
<include>*-tests.jar</include>
</includes>
<targetPath>WEB-INF/test-lib</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<container>
<containerId>jetty6x</containerId>
<type>embedded</type>
<systemProperties>
<org.apache.commons.logging.Log>
org.apache.commons.logging.impl.SimpleLog
</org.apache.commons.logging.Log>
</systemProperties>
</container>
<wait>false</wait>
<configuration>
<properties>
<cargo.servlet.port>8080</cargo.servlet.port>
</properties>
<deployables>
<deployable>
<location>
${project.build.directory}/${project.build.finalName}.${project.packaging}
</location>
<pingURL>http://localhost:8080/${project.build.finalName}/junit</pingURL>
</deployable>
</deployables>
</configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-maven-web-unittest</artifactId>
<version>1.2-incubating-SNAPSHOT</version>
<executions>
<execution>
<configuration></configuration>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-maven-ant-generator</artifactId>
<version>1.2-incubating-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
|