change test layout to allow multiple test-cases (one per sub-directory)

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116156 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
felipeal 2004-10-20 02:29:56 +00:00
parent 897ca6ad4a
commit b78f4ba691
9 changed files with 196 additions and 122 deletions

View File

@ -15,55 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
--> -->
<project xmlns:j="jelly:core" <project xmlns:util="jelly:util" xmlns:maven="jelly:maven" xmlns:j="jelly:core" xmlns:assert="assert" xmlns:ant="jelly:ant">
xmlns:u="jelly:util" <goal name="testPlugin">
xmlns:x="jelly:xml" <maven:reactor basedir="${basedir}" includes="test*/project.xml" goals="testPlugin" banner="Test" ignoreFailures="false"/>
xmlns:assert="assert"
xmlns:j2ee="j2ee">
<goal name="testPlugin" prereqs="test-ear">
<attainGoal name="clean"/>
</goal>
<goal name="test-ear">
<attainGoal name="ear"/>
<!-- tests that the ear is generated -->
<assert:assertFileExists file="${maven.build.dir}/test-maven-ear-plugin-1.0-SNAPSHOT.ear"/>
<!-- unzip the ear and look for the jars -->
<j:set var="earFile"
value="${maven.build.dir}/test-maven-ear-plugin-1.0-SNAPSHOT.ear"/>
<j:set var="unzipDir" value= "${maven.build.dir}/eartest"/>
<mkdir dir="${unzipDir}"/>
<unzip src="${earFile}" dest="${unzipDir}"/>
<!-- check for commons-logging -->
<assert:assertFileExists file="${unzipDir}/commons-logging-1.0.3.jar"
msg="commons logging was not bundled"/>
<!-- check for commons-collections -->
<assert:assertFileExists file="${unzipDir}/commons-collections-2.1.jar"
msg="commons collections was not bundled"/>
<!-- check application.xml got a java module in it -->
<u:file var="appXml" name="${unzipDir}/META-INF/application.xml"/>
<j:new var="saxReader" className="org.dom4j.io.SAXReader" />
<j2ee:resolver var="resolver" />
${saxReader.setEntityResolver(resolver)}
<x:parse var="applicationDoc" xml="${appXml.toURL()}" SAXReader="${saxReader}" />
<x:set var="firstJavaModule" select="string($applicationDoc/application/module/java)"/>
<assert:assertEquals
expected="commons-collections-2.1.jar"
value="${firstJavaModule}"
msg="commons collections was not the first java module"/>
<!-- check for resources -->
<assert:assertFileExists file="${unzipDir}/resource.txt"/>
<!-- check for the LICENSE -->
<assert:assertFileExists file="${unzipDir}/META-INF/LICENSE.txt"/>
</goal> </goal>
</project> </project>

View File

@ -21,79 +21,22 @@
<project> <project>
<pomVersion>3</pomVersion> <pomVersion>3</pomVersion>
<name>Test project for Maven Ear Plugin</name> <name>Test project for Maven Ear Plugin</name>
<id>test-maven-ear-plugin</id>
<currentVersion>1.0-SNAPSHOT</currentVersion>
<organization>
<name>Nettec</name>
<url>http://www.nettec.net</url>
</organization>
<inceptionYear>2002</inceptionYear>
<package>net.nettec.marsh.begin</package>
<shortDescription>Marsh Begin TTS Maven</shortDescription>
<description>TTS Begin</description>
<url/>
<issueTrackingUrl>http://bugzilla</issueTrackingUrl>
<siteAddress>www.nettec.net</siteAddress>
<siteDirectory/>
<distributionDirectory/>
<repository>
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven</connection>
<url>http://cvs.apache.org/viewcvs/maven/</url>
</repository>
<versions/>
<mailingLists/>
<developers>
<developer>
<name>Nathan Coast</name>
<id>nathanc</id>
<email>nathan.coast@blueyonder.co.uk</email>
<organization>Shadow Solutions</organization>
<role>Java Developer</role>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.3</version>
<url>http://jakarta.apache.org/commons/logging.html</url>
<properties>
<ear.bundle>true</ear.bundle>
</properties>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>2.1</version>
<url>http://jakarta.apache.org/commons/collections/</url>
<properties>
<ear.module>true</ear.module>
</properties>
</dependency>
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-xml</artifactId>
<version>20030211.142705</version>
</dependency>
<!-- Needed for the entity resolver -->
<dependency>
<groupId>maven</groupId> <groupId>maven</groupId>
<artifactId>maven-j2ee-plugin</artifactId> <currentVersion>1.0</currentVersion>
<version>1.4</version> <organization>
<type>plugin</type> <name>Apache Software Foundation</name>
</dependency> <url>http://www.apache.org/</url>
</dependencies> <logo>http://maven.apache.org/images/apache-maven-project.png</logo>
<build> </organization>
<nagEmailAddress>nathan.coast@nettec.net</nagEmailAddress> <inceptionYear>2001</inceptionYear>
<sourceDirectory>src</sourceDirectory> <package>org.apache.maven</package>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory> <logo>http://maven.apache.org/images/maven.gif</logo>
<!-- Resources that are packaged up inside the JAR file --> <description>Test for Maven Ear plugin</description>
<resources> <shortDescription>Test for Maven Ear plugin</shortDescription>
<resource> <url>http://maven.apache.org/reference/plugins/ear/</url>
<directory>src/resources</directory> <siteDirectory>/www/maven.apache.org/reference/plugins/ear/</siteDirectory>
<targetPath></targetPath> <repository>
<includes><include>*.txt</include></includes> <connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-plugins/ear/</connection>
</resource> <url>http://cvs.apache.org/viewcvs/maven-plugins/ear/</url>
</resources> </repository>
</build>
</project> </project>

View File

@ -0,0 +1,69 @@
<!--
/*
* Copyright 2001-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 xmlns:j="jelly:core"
xmlns:u="jelly:util"
xmlns:x="jelly:xml"
xmlns:assert="assert"
xmlns:j2ee="j2ee">
<goal name="testPlugin" prereqs="test-ear">
<attainGoal name="clean"/>
</goal>
<goal name="test-ear">
<attainGoal name="ear"/>
<!-- tests that the ear is generated -->
<assert:assertFileExists file="${maven.build.dir}/${maven.final.name}.ear"/>
<!-- unzip the ear and look for the jars -->
<j:set var="earFile"
value="${maven.build.dir}/${maven.final.name}.ear"/>
<j:set var="unzipDir" value= "${maven.build.dir}/eartest"/>
<mkdir dir="${unzipDir}"/>
<unzip src="${earFile}" dest="${unzipDir}"/>
<!-- check for commons-logging -->
<assert:assertFileExists file="${unzipDir}/commons-logging-1.0.3.jar"
msg="commons logging was not bundled"/>
<!-- check for commons-collections -->
<assert:assertFileExists file="${unzipDir}/commons-collections-2.1.jar"
msg="commons collections was not bundled"/>
<!-- check application.xml got a java module in it -->
<u:file var="appXml" name="${unzipDir}/META-INF/application.xml"/>
<j:new var="saxReader" className="org.dom4j.io.SAXReader" />
<j2ee:resolver var="resolver" />
${saxReader.setEntityResolver(resolver)}
<x:parse var="applicationDoc" xml="${appXml.toURL()}" SAXReader="${saxReader}" />
<x:set var="firstJavaModule" select="string($applicationDoc/application/module/java)"/>
<assert:assertEquals
expected="commons-collections-2.1.jar"
value="${firstJavaModule}"
msg="commons collections was not the first java module"/>
<!-- check for resources -->
<assert:assertFileExists file="${unzipDir}/resource.txt"/>
<!-- check for the LICENSE -->
<assert:assertFileExists file="${unzipDir}/META-INF/LICENSE.txt"/>
</goal>
</project>

View File

@ -0,0 +1,22 @@
# -------------------------------------------------------------------
# Copyright 2001-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.
# -------------------------------------------------------------------
maven.deployable.component=${maven.final.name}.ear
maven.j2ee.ear.appxml=${maven.conf.dir}/application.xml
maven.ear.appxml.generate=true
# note the override below is needed, as the ear plugin redefines the licenseFile in
# it's own project.properties, and running plugin:test would otherwise fail
maven.license.licenseFile=${basedir}/LICENSE.txt

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2001-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>
<name>Test project for Maven Ear Plugin 01</name>
<artifactId>test-maven-ear-plugin-01</artifactId>
<organization>
<name>Nettec</name>
<url>http://www.nettec.net</url>
</organization>
<inceptionYear>2002</inceptionYear>
<package>net.nettec.marsh.begin</package>
<shortDescription>Marsh Begin TTS Maven</shortDescription>
<description>TTS Begin</description>
<url/>
<developers>
<developer>
<name>Nathan Coast</name>
<id>nathanc</id>
<email>nathan.coast@blueyonder.co.uk</email>
<organization>Shadow Solutions</organization>
<role>Java Developer</role>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.3</version>
<url>http://jakarta.apache.org/commons/logging.html</url>
<properties>
<ear.bundle>true</ear.bundle>
</properties>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>2.1</version>
<url>http://jakarta.apache.org/commons/collections/</url>
<properties>
<ear.module>true</ear.module>
</properties>
</dependency>
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-xml</artifactId>
<version>20030211.142705</version>
</dependency>
<!-- Needed for the entity resolver -->
<dependency>
<groupId>maven</groupId>
<artifactId>maven-j2ee-plugin</artifactId>
<version>1.4</version>
<type>plugin</type>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<!-- Resources that are packaged up inside the JAR file -->
<resources>
<resource>
<directory>src/resources</directory>
<targetPath></targetPath>
<includes><include>*.txt</include></includes>
</resource>
</resources>
</build>
</project>