You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2004/09/14 23:35:18 UTC

svn commit: rev 46041 - geronimo/trunk/modules/maven-itest-plugin

Author: djencks
Date: Tue Sep 14 14:35:18 2004
New Revision: 46041

Added:
   geronimo/trunk/modules/maven-itest-plugin/
   geronimo/trunk/modules/maven-itest-plugin/plugin.jelly
   geronimo/trunk/modules/maven-itest-plugin/plugin.properties
   geronimo/trunk/modules/maven-itest-plugin/project.xml
Log:
itest plugin adapted from openejb itests

Added: geronimo/trunk/modules/maven-itest-plugin/plugin.jelly
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/maven-itest-plugin/plugin.jelly	Tue Sep 14 14:35:18 2004
@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!-- $Rev$ $Date$ -->
+
+<project default="itest"
+    xmlns:j="jelly:core"
+    xmlns:ant="jelly:ant"
+    xmlns:maven="jelly:maven"
+    xmlns:u="jelly:util"
+    >
+
+
+    <goal name="itest"
+        description="Run Application Integration Tests"
+        prereqs="itest:itest"/>
+
+    <goal name="itest:prepare-filesystem"
+        description="Create the needed directory structure">
+        <mkdir dir="${maven.itest.dest}"/>
+        <mkdir dir="${maven.itest.reportsDirectory}"/>
+    </goal>
+
+    <goal name="itest:compile"
+        description="Compile the Integration Tests"
+        prereqs="java:compile,java:jar-resources,itest:prepare-filesystem,itest:test-resources">
+
+        <j:if test="${maven.itest.skip != 'true'}">
+
+            <javac
+                destdir="${maven.itest.dest}"
+                srcdir="${maven.itest.src}"
+                excludes="**/package.html"
+                debug="${maven.compile.debug}"
+                deprecation="${maven.compile.deprecation}"
+                optimize="${maven.compile.optimize}">
+
+                <classpath>
+                    <pathelement path="${maven.itest.dest}"/>
+                    <pathelement path="${maven.build.dest}"/>
+                    <path refid="maven.dependency.classpath"/>
+                    <!-- use this when we turn this into a plugin -->
+                    <pathelement path="${plugin.getDependencyPath('junit')}"/>
+                    <j:if test="${!context.getVariable('maven.itest.fork').toString().trim().equalsIgnoreCase('no')}">
+                        <pathelement path="${plugin.getDependencyPath('xml-apis')}"/>
+                        <pathelement path="${plugin.getDependencyPath('xerces')}"/>
+                    </j:if>
+                </classpath>
+
+                <!--
+                  |
+                  | Source Modifications
+                  |
+                 -->
+                <u:tokenize var="excludes" delim=",">${maven.itest.src.excludes}</u:tokenize>
+                <j:forEach var="exclude" items="${excludes}">
+                    <ant:exclude name="${exclude}"/>
+                </j:forEach>
+
+                <u:tokenize var="includes" delim=",">${maven.itest.src.includes}</u:tokenize>
+                <j:forEach var="include" items="${includes}">
+                    <ant:include name="${include}"/>
+                </j:forEach>
+
+
+                <!--
+                  |
+                  | Standard compile properties
+                  |
+                 -->
+                <j:if test="${context.getVariable('maven.compile.compilerargs') != null}">
+                    <compilerarg line="${maven.compile.compilerargs}"/>
+                </j:if>
+
+                <j:if test="${context.getVariable('maven.compile.encoding') != null}">
+                    <setProperty name="encoding" value="${maven.compile.encoding}"/>
+                </j:if>
+
+                <j:if test="${context.getVariable('maven.compile.executable') != null}">
+                    <setProperty name="executable" value="${maven.compile.executable}"/>
+                </j:if>
+
+                <j:if test="${context.getVariable('maven.compile.fork') != null}">
+                    <setProperty name="fork" value="${maven.compile.fork}"/>
+                </j:if>
+
+                <j:if test="${context.getVariable('maven.compile.source') != null}">
+                    <setProperty name="source" value="${maven.compile.source}"/>
+                </j:if>
+
+                <j:if test="${context.getVariable('maven.compile.verbose') != null}">
+                    <setProperty name="verbose" value="${maven.compile.verbose}"/>
+                </j:if>
+            </javac>
+        </j:if>
+
+    </goal>
+    <goal name="itest:itest"
+        description="Run Application Integration Tests"
+        prereqs="itest:compile">
+
+        <j:if test="${maven.itest.skip != 'true'}">
+
+            <!-- call our setup code -->
+            <attainGoal name="itest:setup"/>
+
+            <taskdef
+                name="junit"
+                classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
+
+            <j:catch var="exception">
+                <junit printSummary="${maven.itest.printSummary}"
+                    failureProperty="maven.itest.failure"
+                    fork="${maven.itest.fork}">
+
+                    <j:if test="${context.getVariable('maven.itest.jvm') != null}">
+                        <setProperty name="jvm" value="${maven.itest.jvm}"/>
+                    </j:if>
+                    <j:if test="${!context.getVariable('maven.itest.fork').toString().trim().equalsIgnoreCase('no')}">
+                        <setProperty name="dir" value="${maven.itest.dir}"/>
+                    </j:if>
+                    <sysproperty key="basedir" value="${basedir}"/>
+                    <u:tokenize var="listOfProperties" delim=" ">${maven.itest.sysproperties}</u:tokenize>
+                    <j:forEach var="someProperty" items="${listOfProperties}">
+                        <sysproperty key="${someProperty}" value="${context.getVariable(someProperty)}"/>
+                    </j:forEach>
+                    <u:tokenize var="listOfEnv" delim=" ">${maven.itest.envvars}</u:tokenize>
+                    <j:forEach var="someEnv" items="${listOfEnv}">
+                        <env key="${someEnv}" value="${context.getVariable(someEnv)}"/>
+                    </j:forEach>
+                    <u:tokenize var="listOfJvmArgs" delim=" ">${maven.itest.jvmargs}</u:tokenize>
+                    <j:forEach var="somejvmarg" items="${listOfJvmArgs}">
+                        <jvmarg value="${somejvmarg}"/>
+                    </j:forEach>
+                    <formatter type="xml"/>
+                    <formatter type="${maven.itest.format}" usefile="${maven.itest.usefile}"/>
+                    <classpath>
+                        <pathelement location="${maven.itest.dest}"/>
+                        <pathelement location="${maven.build.dest}"/>
+                        <path refid="maven.dependency.classpath"/>
+                        <pathelement path="${plugin.getDependencyPath('junit')}"/>
+                        <j:if test="${!context.getVariable('maven.itest.fork').toString().trim().equalsIgnoreCase('no')}">
+                            <pathelement path="${plugin.getDependencyPath('xml-apis')}"/>
+                            <pathelement path="${plugin.getDependencyPath('xerces')}"/>
+                        </j:if>
+                    </classpath>
+                    <batchtest todir="${maven.itest.reportsDirectory}">
+                        <fileset dir="${maven.itest.src}" includes="${maven.itest.includes}" excludes="{maven.itest.excludes}"/>
+                    </batchtest>
+                </junit>
+            </j:catch>
+            <j:if test="${exception != null}">
+                ${exception.printStackTrace()}
+            </j:if>
+
+            <!-- call our teardown code -->
+            <attainGoal name="itest:teardown"/>
+
+            <j:if test="${exception != null}">
+                <j:if test="${context.getVariable('maven.itest.failure.ignore') != 'true'}">
+                    <fail message="There was an exception from the tests."/>
+                </j:if>
+            </j:if>
+
+            <j:if test="${maven.itest.failure}">
+                <j:if test="${context.getVariable('maven.itest.failure.ignore') != 'true'}">
+                    <fail message="There were test failures."/>
+                </j:if>
+            </j:if>
+
+        </j:if>
+
+    </goal>
+
+    <goal name="itest:setup">
+        <!--hook, customize by including a preGoal for itest:setup-->
+    </goal>
+
+    <goal name="itest:teardown">
+        <!--hook, customize by including a preGoal for itest:teardown-->
+    </goal>
+
+    <goal name="itest:test-resources"
+        description="Copy any resources that must be present for the integration tests to run"
+        prereqs="itest:prepare-filesystem">
+
+        <j:if test="${maven.itest.skip != 'true' and context.getVariable('maven.itest.resources') != null}">
+            <ant:copy todir="${maven.itest.dest}">
+                <u:tokenize var="resources" delim=", ">${maven.itest.resources}</u:tokenize>
+                <j:forEach var="resource" items="${resources}">
+                    <j:set var="dirProperty" value="${resource}.dir"/>
+                    <j:set var="includesProperty" value="${resource}.includes"/>
+                    <j:set var="excludesProperty" value="${resource}.excludes"/>
+                    <ant:fileset
+                        dir="${context.getVariable(dirProperty)}"
+                        includes="${context.getVariable(includesProperty)}"
+                        excludes="${context.getVariable(excludesProperty)}"
+                        />
+                </j:forEach>
+            </ant:copy>
+        </j:if>
+    </goal>
+
+
+
+
+</project>

Added: geronimo/trunk/modules/maven-itest-plugin/plugin.properties
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/maven-itest-plugin/plugin.properties	Tue Sep 14 14:35:18 2004
@@ -0,0 +1,28 @@
+##
+## $Rev$ $Date$
+##
+
+
+maven.itest.dir=${basedir}
+maven.itest.fork=no
+maven.itest.format=brief
+maven.itest.jvmargs=
+maven.itest.envvars=
+maven.itest.jvm=
+maven.itest.printSummary=true
+maven.itest.usefile = true
+
+maven.itest.dest=${maven.build.dir}/itest-classes
+maven.itest.reportsDirectory = ${maven.build.dir}/itest-reports
+maven.itest.skip=false
+
+maven.itest.src=${basedir}/src/itest
+maven.itest.src.includes=
+maven.itest.src.excludes=
+
+maven.itest.includes=
+maven.itest.excludes=**/Abstract*.java
+
+maven.itest.sysproperties=
+
+maven.itest.resources=

Added: geronimo/trunk/modules/maven-itest-plugin/project.xml
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/maven-itest-plugin/project.xml	Tue Sep 14 14:35:18 2004
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright 2004 The Apache Software Foundation
+
+    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.
+-->
+
+<project>
+    <pomVersion>3</pomVersion>
+    <!--extend>${basedir}/../../etc/project.xml</extend-->
+    
+    <groupId>geronimo</groupId>
+    <id>geronimo-itest-plugin</id>
+    <name>Geronimo itest plugin</name>
+    <organization>
+        <name>Apache Software Foundation</name>
+        <url>http://www.apache.org/</url>
+        <logo></logo>
+    </organization>
+    <inceptionYear>2004</inceptionYear>
+    <package>org.apache.geronimo</package>
+    <logo></logo>
+
+    <currentVersion>1.0-SNAPSHOT</currentVersion>
+    
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <sourceDirectory>src/java</sourceDirectory>
+        <unitTestSourceDirectory></unitTestSourceDirectory>
+
+        <unitTest>
+            <includes>
+                <include>**/*Test.java</include>
+            </includes>
+        </unitTest>
+
+        <resources>
+            <resource>
+                <directory>.</directory>
+                <includes>
+                    <include>plugin.jelly</include>
+                    <include>plugin.properties</include>
+                    <include>project.properties</include>
+                    <include>project.xml</include>
+                </includes>
+            </resource>
+        </resources>
+    </build>
+</project>