Moving abbot plugin from plugins sandbox to plugins proper

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115464 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
vmassol committed 2004-06-12 14:10:26 +00:00
1 parent 4c58c8316a
commit 794de3e6e0
36 files changed
+1875

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
target
build.properties
.classpath
.project
+365
View File
@@ -0,0 +1,365 @@
<?xml version="1.0"?>
<!--
/* ====================================================================
* 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.
* ====================================================================
*/
-->
<!--
========================================================================
Abbot plugin. Abbot is a GUI testing framework for AWT/Swing
applications.
========================================================================
-->
<project
xmlns:j="jelly:core"
xmlns:m="jelly:maven"
xmlns:x="jelly:xml"
xmlns:u="jelly:util"
xmlns:ant="jelly:ant"
xmlns:doc="doc"
xmlns:define="jelly:define"
xmlns:jsl="jelly:jsl">
<!--
========================================================================
Default goal. Execute the Abbot tests.
========================================================================
-->
<goal name="abbot" prereqs="abbot:test" description="Run the abbot tests"/>
<!--
========================================================================
Execute the Abbot tests by running the application locally.
========================================================================
-->
<goal name="abbot:test"
prereqs="abbot:check-env,abbot:prepare-filesystem,abbot:prepare-resources,java:compile,java:jar-resources"
description="Run the abbot tests">
<!-- Needed to define junit task -->
<taskdef name="junit"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
<classpath>
<pathelement location="${plugin.getDependencyPath('junit:junit')}"/>
</classpath>
</taskdef>
<!-- Just let JUnit execute the tests -->
<!-- IMPORTANT: We must fork the JUnit tests. Otherwise there are classpath
problems (the version of xerces in the Maven root CL seems to be the
cause). -->
<junit printSummary="${maven.abbot.printSummary}"
failureProperty="maven.test.failure" fork="true">
<!-- Sys properties -->
<setProperty name="dir" value="${maven.abbot.dir}" />
<sysproperty key="maven.abbot.src.dir" value="${maven.abbot.src.dir}"/>
<sysproperty key="basedir" value="${basedir}"/>
<u:tokenize var="listOfProperties" delim=" ">${maven.abbot.sysproperties}</u:tokenize>
<j:forEach var="someProperty" items="${listOfProperties}">
<sysproperty key="${someProperty}" value="${context.getVariable(someProperty)}"/>
</j:forEach>
<!-- JVM args -->
<u:tokenize var="listOfJvmArgs" delim=" ">${maven.abbot.jvmargs}</u:tokenize>
<j:forEach var="somejvmarg" items="${listOfJvmArgs}">
<jvmarg value="${somejvmarg}"/>
</j:forEach>
<!-- File format of test reports are defined here -->
<formatter type="xml"/>
<formatter type="${maven.abbot.format}" usefile="${maven.abbot.usefile}"/>
<!-- Classpath -->
<classpath>
<pathelement location="${plugin.dir}"/>
<pathelement location="${maven.build.dest}"/>
<pathelement location="${maven.test.dest}"/>
<j:forEach var="dep" items="${plugin.getDependencies()}">
<j:if test="${dep.getProperty('abbot.webstart')}">
<pathelement path="${plugin.getDependencyPath(dep.Id)}"/>
</j:if>
</j:forEach>
<j:forEach var="lib" items="${pom.dependencies}">
<j:set var="libFullName" value="${lib.getId()}" />
<j:set var="jarPath" value="${maven.repo.local}/${lib.artifactDirectory}/${lib.getType()}s/${lib.getArtifact()}" />
<pathelement path="${jarPath}"/>
</j:forEach>
</classpath>
<test name="${maven.abbot.include}" todir="${maven.abbot.reports.dir}"/>
</junit>
<!-- Junit exit status is stored in maven.test.failure. Whenever it is true
(and ignore flag is not) we must stop the build process -->
<j:if test="${maven.test.failure}">
<j:if test="${context.getVariable('maven.test.failure.ignore') != null}">
<fail message="There were test failures"/>
</j:if>
</j:if>
</goal>
<!--
========================================================================
Launch tests on a webstart application
========================================================================
-->
<goal name="abbot:test-webstart" prereqs="abbot:check-webstart-env,abbot:prepare-filesystem"
description="Launch tests on a webstart application">
<!-- First we get the remote jnlp -->
<get src="${maven.abbot.remotejnlp}"
dest="${maven.abbot.dest.dir}/${maven.abbot.webstart.jnlp.original}"/>
<!-- We make a jar with compiled main class -->
<!-- TODO: create this as part of the plugin creation and not as part of
its execution -->
<jar destfile="${maven.abbot.dest.dir}/${maven.abbot.webstart.main.jar}"
basedir="${plugin.dir}" includes="**/*.class"/>
<!-- Iterating through dependencies, and signing them if they're not up-to-date -->
<j:if test="${context.getVariable('maven.abbot.sign')}">
<j:forEach var="dep" items="${plugin.getDependencies()}">
<j:if test="${dep.getProperty('abbot.webstart')}">
<j:set var="filename" value="${dep.GroupId}-${dep.ArtifactId}"/>
<j:set var="varname" value="abbot.signing.notrequired.${dep.id}"/>
<!-- Checking whether or not the dependency has to be signed -->
<uptodate property="${varname}"
srcfile="${plugin.getDependencyPath(dep.Id)}"
targetfile="${maven.abbot.dest.dir}/${filename}.jar"/>
<!-- Keeping this debug trace a while to ensure that the up-to-date feature is working properly -->
<echo level="debug">${dep.id} is uptodate ? ${context.getVariable(varname) == true}</echo>
<!-- Signing the dependancy only if it is not up-to-date or forced-->
<j:if test="${(context.getVariable(varname) != true)}">
<!-- Unsigning -->
<zip destfile="${maven.abbot.dest.dir}/${filename}.jar">
<zipfileset src="${plugin.getDependencyPath(dep.id)}"
excludes="**/*.SF **/*.RSA **/*.DSA"/>
</zip>
<!-- Signing -->
<signjar jar="${maven.abbot.dest.dir}/${filename}.jar"
keystore="${maven.abbot.sign.keystore}"
alias="${maven.abbot.sign.alias}"
storepass="${maven.abbot.sign.storepass}"/>
</j:if>
</j:if>
</j:forEach>
<!-- Jar containing abbot main class is signed -->
<signjar jar="${maven.abbot.dest.dir}/${maven.abbot.webstart.main.jar}"
keystore="${maven.abbot.sign.keystore}"
alias="${maven.abbot.sign.alias}"
storepass="${maven.abbot.sign.storepass}"/>
</j:if>
<!-- Jnlp is modified so that local abbot libraries are referenced -->
<doc:jsl
input="${maven.abbot.dest.dir}/${maven.abbot.webstart.jnlp.original}"
output="${maven.abbot.webstart.jnlp.modified}"
outputDirectory="${maven.abbot.dest.dir}"
stylesheet="${plugin.resources}/jnlp.jsl"
outputMode="xml"
prettyPrint="true"/>
<!-- Java webstart is launched on local modified jnlp -->
<java classname="com.sun.javaws.Main" fork="true" failonerror="true">
<classpath>
<pathelement location="${env.JAVAWS_HOME}/javaws-l10n.jar"/>
<pathelement location="${env.JAVAWS_HOME}/javaws.jar"/>
</classpath>
<jvmarg value="-Djnlpx.home=${env.JAVAWS_HOME}"/>
<jvmarg value="-Djnlpx.heapsize=NULL,NULL"/>
<jvmarg value="-Djnlpx.jvm=${env.JAVA_HOME}/bin/javaw.exe"/>
<jvmarg value="-Djnlpx.deployment.system.home=${maven.abbot.javaws.systemhome}"/>
<jvmarg value="-Djnlpx.deployment.user.home=${maven.abbot.javaws.userhome}"/>
<jvmarg value="-Djava.security.policy=${env.JAVAWS_HOME}/javaws.policy"/>
<jvmarg value="-DtrustProxy=true"/>
<arg value="${maven.abbot.dest.dir}/${maven.abbot.webstart.jnlp.modified}"/>
</java>
</goal>
<!--
========================================================================
Launch Abbot costello editor
========================================================================
-->
<goal name="abbot:editor" prereqs="abbot:check-env,abbot:prepare-filesystem"
description="Launch Abbot costello editor">
<!-- Launching abbot editor with abbot and jnlp dependencies as classpath -->
<java classname="abbot.editor.ScriptEditor" fork="true">
<classpath>
<!-- Abbot editor dependencies -->
<j:forEach var="dep" items="${plugin.getDependencies()}">
<j:if test="${dep.getProperty('abbot.editor')}">
<pathelement path="${plugin.getDependencyPath(dep.Id)}"/>
</j:if>
</j:forEach>
<path refid="maven.dependency.classpath"/>
</classpath>
</java>
</goal>
<!--
========================================================================
Launch Abbot costello editor on a webstart application
========================================================================
-->
<goal name="abbot:editor-webstart"
prereqs="abbot:check-webstart-env,abbot:prepare-filesystem"
description="Launch Abbot costello editor on a webstart application">
<!-- First we get the remote jnlp -->
<get src="${maven.abbot.remotejnlp}"
dest="${maven.abbot.dest.dir}/${maven.abbot.webstart.jnlp.original}"/>
<!-- Parsing jnlp file in order to copy all dependencies into local directory -->
<u:file var="inputFile" name="${maven.abbot.dest.dir}/${maven.abbot.webstart.jnlp.original}"/>
<x:parse var="parsedfile" xml="${inputFile}"/>
<x:set var="codebasename" select="string($parsedfile/jnlp/@codebase)"/>
<x:forEach var="jar" select="$parsedfile/jnlp/resources/jar">
<x:set var="jarname" select="string($jar/@href)"/>
<get src="${codebasename}/${jarname}" usetimestamp="true"
dest="${maven.abbot.dest.dir}/${jarname}"/>
</x:forEach>
<!-- Launching abbot editor with abbot and jnlp dependencies as classpath -->
<java classname="abbot.editor.ScriptEditor" fork="true">
<classpath>
<!-- Abbot editor dependencies -->
<j:forEach var="dep" items="${plugin.getDependencies()}">
<j:if test="${dep.getProperty('abbot.editor')}">
<pathelement path="${plugin.getDependencyPath(dep.Id)}"/>
</j:if>
</j:forEach>
<!-- Remote application dependencies -->
<x:forEach var="jar" select="$parsedfile/jnlp/resources/jar">
<x:set var="jarname" select="string($jar/@href)"/>
<pathelement path="${maven.abbot.dest.dir}/${jarname}"/>
</x:forEach>
</classpath>
</java>
</goal>
<!--
========================================================================
Copy test resources to test directory (internal goal)
========================================================================
-->
<goal name="abbot:prepare-resources" prereqs="abbot:prepare-filesystem">
<j:if test="${pom.build.unitTest != null}">
<j:if test="${!pom.build.unitTest.resources.isEmpty()}">
<m:copy-resources
resources="${pom.build.unitTest.resources}"
todir="${maven.test.dest}"/>
</j:if>
</j:if>
</goal>
<!--
========================================================================
Create needed directories (internal goal)
========================================================================
-->
<goal name="abbot:prepare-filesystem">
<mkdir dir="${maven.test.dest}"/>
<mkdir dir="${maven.abbot.reports.dir}"/>
<mkdir dir="${maven.abbot.dest.dir}"/>
</goal>
<!--
========================================================================
Checking environment (internal goal)
========================================================================
-->
<goal name="abbot:check-env">
<j:if test="${context.getVariable('java.awt.headless') == true}">
<fail message="Abbot plugin cannot be used in awt headless environment"/>
</j:if>
</goal>
<!--
========================================================================
Checking webstart environment (internal goal)
========================================================================
-->
<goal name="abbot:check-webstart-env" prereqs="abbot:check-env">
<property environment="env"/>
<j:if test="${context.getVariable('env.JAVAWS_HOME') == null}">
<fail>Mandatory environment variable JAVAWS_HOME must be set</fail>
</j:if>
<j:if test="${context.getVariable('maven.abbot.sign') == false}">
<fail>In the current version the Abbot plugin only works when signing jars</fail>
</j:if>
<j:if test="${context.getVariable('maven.abbot.remotejnlp') == null}">
<fail>Mandatory variable maven.abbot.remotejnlp is missing."</fail>
</j:if>
<j:if test="${context.getVariable('maven.abbot.javaws.systemhome') == null}">
<fail>Mandatory variable maven.abbot.javaws.systemhome is missing"</fail>
</j:if>
<j:if test="${context.getVariable('maven.abbot.javaws.userhome') == null}">
<fail>Mandatory variable maven.abbot.javaws.userhome is missing</fail>
</j:if>
</goal>
<!--
========================================================================
Dependency handle so that other plugins can load this plugin and its
properties. This is especially useful if another plugin needs to
modify one property of the Abbot plugin.
========================================================================
-->
<define:taglib uri="abbot">
<define:tag name="dependency-handle">
<!-- Use this tag to allow this plugin to be loaded into another -->
</define:tag>
</define:taglib>
</project>
+90
View File
@@ -0,0 +1,90 @@
# -------------------------------------------------------------------
# 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.
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# Properties required for all the abbot plugin goals
# -------------------------------------------------------------------
# Location of abbot source scripts
maven.abbot.src.dir = ${maven.src.dir}/abbot
# (optional) Explicit comma-separated list of Abbot source scripts
# to execute. If not defined, the plugin will execute all .xml files
# located in maven.abbot.src.dir
# maven.abbot.src.files =
# Decide whether or not to recurse in maven.abbot.src.dir to find
# Abbot .xml source scripts.
maven.abbot.recurse = true
# Location where the abbot plugin puts build files related to abbot
maven.abbot.dest.dir = ${maven.build.dir}/abbot
# Location where abbot junit test results will be located
maven.abbot.reports.dir = ${maven.build.dir}/abbot-reports
maven.abbot.printSummary = ${maven.junit.printSummary}
maven.abbot.dir = ${maven.junit.dir}
maven.abbot.sysproperties = ${maven.junit.sysproperties}
maven.abbot.jvmargs = ${maven.junit.jvmargs}
maven.abbot.format = ${maven.junit.format}
maven.abbot.usefile = ${maven.junit.usefile}
# (optional) Name of the test suite beeing executed. This name will be used
# to name the generated JUnit test report. If not specified the report name
# will be TEST-org.apache.maven.abbot.AbbotTestAll. This is useful when
# you're calling the Abbot plugin several times in a row as otherwise the
# reports will overwrite each other.
#maven.abbot.suite.name = MyTestSuite
# Decide whether to turn on webstart debugging.
maven.abbot.debug = false
# -------------------------------------------------------------------
# Properties required only for the abbot:test goal
# -------------------------------------------------------------------
# Name of the JUnit test to execute that will trigger the execution
# of the Abbot scripts. This name should not be changed unless you
# want to provide your own Abbot script wrapper.
maven.abbot.include = org.apache.maven.abbot.AbbotTestAll
# -------------------------------------------------------------------
# Properties required only for the abbot:test-webstart goal
# -------------------------------------------------------------------
# The following properties are mandatories. They depend on your
# execution environment and must be set in your build.properties file
# or equivalent:
#
# - JAVAWS_HOME: You MUST define this environment variable and have it
# point to where Java Webstart is installed on your machine.
# For example: c:\apps\j2sdk1.4.2_01\jre\javaws
# - maven.abbot.remotejnlp: This property points to the JNLP file of
# the application you're testing.
# - maven.abbot.javaws.systemhome: Java webstart system cache location
# - maven.abbot.javaws.userhome: Java webstart user cache location
maven.abbot.webstart.jnlp.original = original.jnlp
maven.abbot.webstart.jnlp.modified = modified.jnlp
maven.abbot.webstart.main.jar = abbot-main.jar
maven.abbot.webstart.main.class = org.apache.maven.abbot.AbbotWebstartTestRunner
# Note: For now we only support signing jars. The reason is that we need
# to add the Abbot jars to the JNLP file and as we're taking these jars
# from the local file system we need to have the permissions and thus we
# need signed jars to get these permissions.
maven.abbot.sign = true
+30
View File
@@ -0,0 +1,30 @@
# -------------------------------------------------------------------
# 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.
# -------------------------------------------------------------------
maven.xdoc.date=left
maven.xdoc.version=${pom.currentVersion}
maven.license.licenseFile=${basedir}/../LICENSE.txt
maven.checkstyle.header.file = ${basedir}/../LICENSE.txt
maven.abbot.reports.dir = ${maven.build.dir}
# Have the abbot test reports appear in ${maven.abbot.reports.dir}
maven.junit.sysproperties = maven.abbot.reports.dir
# Fork so that the plugin unit tests are run with the correct classpath
maven.junit.fork = true
+166
View File
@@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* 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>
<extend>../project.xml</extend>
<pomVersion>3</pomVersion>
<id>maven-abbot-plugin</id>
<name>Maven Abbot plugin</name>
<currentVersion>1.0-SNAPSHOT</currentVersion>
<description>Run Abbot tests</description>
<shortDescription>Abbot Tests</shortDescription>
<url>http://maven.apache.org/reference/plugins/abbot/</url>
<issueTrackingUrl>http://jira.codehaus.org/secure/BrowseProject.jspa?id=10550</issueTrackingUrl>
<siteDirectory>/www/maven.apache.org/reference/plugins/abbot/</siteDirectory>
<repository>
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-plugins/abbot/</connection>
<url>http://cvs.apache.org/viewcvs/maven-plugins/abbot/</url>
</repository>
<versions>
<version>
<id>1.0</id>
<name>1.0</name>
<tag>HEAD</tag>
</version>
</versions>
<developers>
<developer>
<name>Christian Blavier</name>
<id>cblavier</id>
<email>christian.blavier@bnpparibas.fr</email>
<organization>BNP Paribas</organization>
<roles>
<role>Creator</role>
<role>Java Developer</role>
</roles>
</developer>
<developer>
<name>Vincent Massol</name>
<id>vmassol</id>
<email>vmassol@pivolis.com</email>
<organization>Pivolis</organization>
<roles>
<role>Creator</role>
<role>Java Developer</role>
<role>Release Manager</role>
</roles>
</developer>
</developers>
<contributors/>
<dependencies>
<dependency>
<groupId>abbot</groupId>
<artifactId>abbot</artifactId>
<version>0.12.3</version>
<properties>
<abbot.editor>true</abbot.editor>
<abbot.webstart>true</abbot.webstart>
</properties>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.0b8</version>
<properties>
<abbot.editor>true</abbot.editor>
<abbot.webstart>true</abbot.webstart>
</properties>
</dependency>
<!-- Required for the Costello editor -->
<dependency>
<groupId>mrj</groupId>
<artifactId>MRJToolkitStubs</artifactId>
<version>unknown</version>
<properties>
<abbot.editor>true</abbot.editor>
</properties>
</dependency>
<dependency>
<groupId>gnu-regexp</groupId>
<artifactId>gnu-regexp</artifactId>
<version>1.1.4</version>
<properties>
<abbot.editor>true</abbot.editor>
</properties>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<properties>
<abbot.editor>true</abbot.editor>
<abbot.webstart>true</abbot.webstart>
</properties>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
<version>2.4.0</version>
<properties>
<abbot.editor>true</abbot.editor>
<abbot.webstart>true</abbot.webstart>
</properties>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xmlParserAPIs</artifactId>
<version>2.2.1</version>
<properties>
<abbot.editor>true</abbot.editor>
<abbot.webstart>true</abbot.webstart>
</properties>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>1.5.3-1</version>
<properties>
<abbot.webstart>true</abbot.webstart>
</properties>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-optional</artifactId>
<version>1.5.3-1</version>
<properties>
<abbot.webstart>true</abbot.webstart>
</properties>
</dependency>
</dependencies>
<reports>
<report>maven-changes-plugin</report>
<report>maven-changelog-plugin</report>
<report>maven-file-activity-plugin</report>
<report>maven-developer-activity-plugin</report>
<report>maven-file-activity-plugin</report>
<report>maven-license-plugin</report>
<report>maven-linkcheck-plugin</report>
</reports>
</project>
@@ -0,0 +1,127 @@
package org.apache.maven.abbot;
/* ====================================================================
* 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.
* ====================================================================
*/
import junit.extensions.abbot.ScriptFixture;
import junit.extensions.abbot.ScriptTestSuite;
import junit.framework.Test;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
/**
* TestAll is the entry point for all Abbot functional tests.
* It executes all xml files located in the passed src/abbot/ dir.
*/
public class AbbotTestAll extends ScriptFixture
{
/**
* Location of Abbot scripts
*/
private static final String TESTPATH =
System.getProperty("maven.abbot.src.dir");
/**
* Should we recurse in the directory where Abbot scripts are located?
*/
private static final boolean RECURSE =
Boolean.getBoolean("maven.abbot.recurse");
/**
* Custom ScriptTestSuite to only accept xml files.
*/
public static class MavenScriptTestSuite extends ScriptTestSuite
{
public MavenScriptTestSuite(Class fixtureClass, String dirName,
boolean recurse)
{
super(fixtureClass, dirName, recurse);
}
public MavenScriptTestSuite(Class fixtureClass, String[] filenames)
{
super(fixtureClass, filenames);
}
public boolean accept(File file)
{
return file.getName().endsWith(".xml");
}
}
/**
* Return test suite containing all scripts.
*/
public static Test suite()
{
MavenScriptTestSuite suite;
String[] files = getScriptFileNames();
if (files == null)
{
suite = new MavenScriptTestSuite(ScriptFixture.class, TESTPATH,
RECURSE);
}
else
{
suite = new MavenScriptTestSuite(ScriptFixture.class, files);
}
return suite;
}
/**
* @see ScriptFixture#ScriptFixture(java.lang.String)
*/
public AbbotTestAll(String name)
{
super(name);
}
/**
* @return the file list (as a String array) specified by the optional
* <code>maven.abbot.src.files</code> Maven property or null
* if the property is not defined. Also returns null if there
* are no files defined in the <code>maven.abbot.src.files</code>
* property.
*/
protected static String[] getScriptFileNames()
{
String files = System.getProperty("maven.abbot.src.files");
String[] result = null;
if (files != null)
{
List fileList = new ArrayList();
StringTokenizer st = new StringTokenizer(files, ",");
while (st.hasMoreTokens())
{
fileList.add(st.nextToken());
}
if (!fileList.isEmpty())
{
result = (String[]) fileList.toArray(new String[0]);
}
}
return result;
}
}
@@ -0,0 +1,158 @@
package org.apache.maven.abbot;
/* ====================================================================
* 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.
* ====================================================================
*/
import java.io.File;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.optional.junit.FormatterElement;
import org.apache.tools.ant.taskdefs.optional.junit.JUnitTask;
import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest;
/**
* Proxy for testing webstart application with Abbot. It replaces the main
* class of the application to test and uses the JUnit Ant task test runner
* to execute the Abbot tests. In order to use this class, it must be
* referenced as the main class in the JNLP file.
*
* @version $Id: AbbotWebstartTestRunner.java,v 1.1 2004/06/12 14:10:25 vmassol Exp $
*/
public class AbbotWebstartTestRunner
{
/**
* Name of the generic TestCase to execute. That test will execute all the
* XML Abbot scripts.
*/
private static final String GENERIC_TEST = AbbotTestAll.class.getName();
/**
* Directory where junit reports are to be generated.
*/
private static final String REPORT_DIR =
System.getProperty("maven.abbot.reports.dir", "");
/**
* Name given by the user to the suite of tests being executed. The Abbot
* test report will be name after the content of this property. This is
* useful when you're calling the Abbot plugin several times in a row as
* otherwise the reports will overwrite each other.
*/
private static final String TESTSUITE_NAME =
System.getProperty("maven.abbot.suite.name");
/**
* Entry point for starting the Ant JUnit test runner which will start
* all our Abbot script tests.
*
* @param args the parameters that we need to use to start the Ant test
* runner
* @throws Exception in case of unanticipated error
*/
public static void main(String[] args) throws Exception
{
AbbotWebstartTestRunner main = new AbbotWebstartTestRunner();
main.execute(GENERIC_TEST, REPORT_DIR);
}
/**
* Execute the JUnit test runner using the Ant JUnitTask task.
*
* Note: We absolutely need to call System.exit() as all webstart
* applications are required to do so. This is required for the
* application to close at the end of the tests
* (see http://www.vamphq.com/jwsfaq.html#linger).
*
* @param testName the name of the generic test that will in turn run all
* the Abbot XML scripts
* @param reportdir directory where junit reports are to be generated
* @throws Exception in case of unanticipated error
*/
public void execute(String testName, String reportDir)
{
try
{
executeAntJunitTestRunner(testName, reportDir);
System.exit(0);
}
catch (Throwable t)
{
System.exit(1);
}
}
/**
* Execute the JUnit test runner using the Ant JUnitTask task.
*
* @param testName the name of the generic test that will in turn run all
* the Abbot XML scripts
* @param reportdir directory where junit reports are to be generated
* @throws Exception in case of unanticipated error
*/
private void executeAntJunitTestRunner(String testName, String reportDir)
throws Exception
{
Project project = new Project();
project.init();
JUnitTask junit = new JUnitTask();
junit.setProject(project);
// Do not fork so that we use the same classpath that was used to
// start this class.
junit.setFork(false);
// Set properties of the JUnit Ant task
// Set formatter
junit.addFormatter(createFormatterElement("xml"));
junit.addFormatter(createFormatterElement("plain"));
// Add tests to run
JUnitTest test = new JUnitTest(testName);
test.setTodir(new File(reportDir));
// Sets the name of the report file is the user has specified a name.
// Otherwise the name of the AbbotTestAll class will be used.
if (TESTSUITE_NAME != null)
{
test.setOutfile(TESTSUITE_NAME);
}
junit.addTest(test);
// Other settings
junit.setHaltonerror(true);
junit.setHaltonfailure(true);
// Execute the task...
junit.execute();
}
/**
* @param type the formatter type ("xml", "plain" or "brief")
* @return a properly set {@link FormatterElement} object
*/
private FormatterElement createFormatterElement(String type)
{
FormatterElement formatterElement = new FormatterElement();
FormatterElement.TypeAttribute typeAttribute =
new FormatterElement.TypeAttribute();
typeAttribute.setValue(type);
formatterElement.setType(typeAttribute);
return formatterElement;
}
}
+143
View File
@@ -0,0 +1,143 @@
<?xml version="1.0"?>
<!--
/* ====================================================================
* 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.
* ====================================================================
*/
-->
<jsl:stylesheet
select="$doc"
xmlns:j="jelly:core"
xmlns:jsl="jelly:jsl"
xmlns:x="jelly:xml"
xmlns:u="jelly:util"
xmlns:ant="jelly:ant"
xmlns:doc="doc"
xmlns="dummy"
trim="true">
<!-- Entry point (first matching template) -->
<jsl:template match="/jnlp">
<x:element name="jnlp">
<x:attribute name="spec"> <x:expr select="@spec"/> </x:attribute>
<x:attribute name="codebase"> <x:expr select="@codebase"/> </x:attribute>
<jsl:applyTemplates select="//information"/>
<jsl:applyTemplates select="//security"/>
<jsl:applyTemplates select="//resources"/>
<jsl:applyTemplates select="//application-desc"/>
</x:element>
</jsl:template>
<!-- Copy information data "as-is" -->
<jsl:template match="information">
<x:copyOf select="."/>
</jsl:template>
<!-- Copy security data "as-is" -->
<jsl:template match="security">
<x:copyOf select="."/>
</jsl:template>
<!-- Transform jnlp resources -->
<jsl:template match="resources">
<resources>
<!-- Copy j2se anchor -->
<x:copyOf select="j2se"/>
<!-- Copy the former "main jar" reference, without main attribute -->
<jsl:applyTemplates select="jar[@main]"/>
<!-- Copy all the other jars references -->
<x:copyOf select="jar[not(@main)]"/>
<!-- Add references to all jar in ${maven.abbot.webstart.dependencies} -->
<j:forEach var="dep" items="${plugin.getDependencies()}">
<j:if test="${dep.getProperty('abbot.webstart')}">
<j:set var="filename" value="${dep.GroupId}-${dep.ArtifactId}"/>
<j:if test="${maven.abbot.sign}">
<x:element name="jar">
<x:attribute name="href">file:${maven.abbot.dest.dir}/${filename}.jar</x:attribute>
</x:element>
</j:if>
<j:if test="${maven.abbot.sign == false}">
<x:element name="jar">
<x:attribute name="href">${dep.getDependancyPath()}</x:attribute>
</x:element>
</j:if>
</j:if>
</j:forEach>
<!-- Add reference to the new "main jar" -->
<x:element name="jar">
<x:attribute name="main">true</x:attribute>
<x:attribute name="href">file:${maven.abbot.dest.dir}/${maven.abbot.webstart.main.jar}</x:attribute>
</x:element>
<!-- Copy all existing sys properties -->
<x:copyOf select="property"/>
<!-- Add some other properties -->
<x:element name="property">
<x:attribute name="name">maven.abbot.src.dir</x:attribute>
<x:attribute name="value">${maven.abbot.src.dir}</x:attribute>
</x:element>
<j:if test="${context.getVariable('maven.abbot.src.files') != null}">
<x:element name="property">
<x:attribute name="name">maven.abbot.src.files</x:attribute>
<x:attribute name="value">${maven.abbot.src.files}</x:attribute>
</x:element>
</j:if>
<x:element name="property">
<x:attribute name="name">maven.abbot.reports.dir</x:attribute>
<x:attribute name="value">${maven.abbot.reports.dir}</x:attribute>
</x:element>
<j:if test="${context.getVariable('maven.abbot.suite.name') != null}">
<x:element name="property">
<x:attribute name="name">maven.abbot.suite.name</x:attribute>
<x:attribute name="value">${maven.abbot.suite.name}</x:attribute>
</x:element>
</j:if>
<!-- Add debug properties if debug mode is turned on -->
<j:if test="${maven.abbot.debug}">
<!-- Note: For some unknown reason, adding the "+TraceSecurity" option
hangs Java Web Start (at least on 1.4.2_01) -->
<property name="javaws.debug.0" value="+TraceCache"/>
<property name="javaws.debug.1" value="+TraceDiskCache"/>
<property name="javaws.debug.2" value="+TraceDownload"/>
<property name="javaws.debug.3" value="+TraceXMLParsing"/>
</j:if>
</resources>
</jsl:template>
<!-- Copy jar anchor without its main attribute -->
<jsl:template match="jar[@main]">
<x:element name="jar">
<x:attribute name="href"> <x:expr select="@href"/> </x:attribute>
</x:element>
</jsl:template>
<!-- Change the main class -->
<jsl:template match="application-desc">
<application-desc main-class="${maven.abbot.webstart.main.class}">
</application-desc>
</jsl:template>
</jsl:stylesheet>
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<project xmlns:j="jelly:core">
<!-- Note: We're not naming this goal testPlugin voluntarily. The
reason is that in order for the test to run fine, the user must
create a build.properties file in sample-webstart. The test also
runs only on windows for now, WebStart must be installed and some
environment varibale must be set. -->
<goal name="testPlugin-manual">
<j:set var="goal" value="dist"/>
<attainGoal name="multiproject:goal"/>
</goal>
</project>
+25
View File
@@ -0,0 +1,25 @@
# -------------------------------------------------------------------
# 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.
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# P R O J E C T P R O P E R T I E S
# -------------------------------------------------------------------
# MUST specify these, even though they are the defaults, so we can run inside
# reactor where they were already set.
maven.multiproject.basedir=${basedir}
maven.multiproject.includes=*/project.xml
maven.multiproject.excludes=
+41
View File
@@ -0,0 +1,41 @@
<?xml version="1.0"?>
<project>
<pomVersion>3</pomVersion>
<groupId>maven</groupId>
<currentVersion>1.0</currentVersion>
<url>http://maven.apache.org/reference/plugins/abbot/</url>
<issueTrackingUrl>http://jira.codehaus.org/BrowseProject.jspa?id=xxxxx</issueTrackingUrl>
<siteDirectory>/www/maven.apache.org/reference/plugins/abbot/</siteDirectory>
<repository>
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-plugins/abbot/</connection>
<url>http://cvs.apache.org/viewcvs/maven-plugins/abbot/</url>
</repository>
<developers>
<developer>
<name>Christian Blavier</name>
<id>cblavier</id>
<email>christian.blavier@bnpparibas.fr</email>
<organization>BNP Paribas</organization>
<roles>
<role>Creator</role>
<role>Java Developer</role>
<role>Lead Developer</role>
</roles>
</developer>
<developer>
<name>Vincent Massol</name>
<id>vmassol</id>
<email>vmassol@pivolis.com</email>
<organization>Pivolis</organization>
<roles>
<role>Creator</role>
<role>Java Developer</role>
<role>Release Manager</role>
<role>Lead Developer</role>
</roles>
</developer>
</developers>
<build>
<sourceDirectory>${basedir}/src/java</sourceDirectory>
</build>
</project>
@@ -0,0 +1 @@
target
Binary file not shown.
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<project xmlns:ant="jelly:ant">
<postGoal name="jar:jar">
<ant:signjar jar="${maven.build.dir}/${maven.final.name}.jar"
keystore="${maven.abbot.sign.keystore}"
storepass="${maven.abbot.sign.storepass}"
alias="${maven.abbot.sign.alias}"/>
</postGoal>
<goal name="dist" prereqs="jar:install,abbot:test"/>
</project>
@@ -0,0 +1,23 @@
# -------------------------------------------------------------------
# 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.
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# P R O J E C T P R O P E R T I E S
# -------------------------------------------------------------------
maven.abbot.sign.keystore = file:${basedir}/conf/keys
maven.abbot.sign.storepass = abbot-plugin
maven.abbot.sign.alias = abbot-plugin
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<project>
<extend>${basedir}/../project.xml</extend>
<id>maven-abbot-plugin-test-sample-local</id>
<name>Maven Abbot plugin Local Sample Test</name>
<description>Run Abbot tests on local sample</description>
<shortDescription>Run Abbot tests on local sample</shortDescription>
</project>
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<AWTTestScript>
<component class="javax.swing.JButton" id="Click Here" index="0" parent="JPanel Instance" text="Click Here" window="TestFrame Instance" />
<component class="javax.swing.JLayeredPane" id="JLayeredPane Instance" index="1" parent="JRootPane Instance" window="TestFrame Instance" />
<component class="javax.swing.JPanel" id="JPanel Instance" index="0" parent="JLayeredPane Instance" window="TestFrame Instance" />
<component class="javax.swing.JRootPane" id="JRootPane Instance" index="0" parent="TestFrame Instance" />
<component class="javax.swing.JTextField" id="JTextField Instance" index="1" parent="JPanel Instance" window="TestFrame Instance" />
<component class="org.apache.maven.abbot.sample.Main" id="TestFrame Instance" root="true" title="" />
<launch args="[]" class="org.apache.maven.abbot.sample.Main" classpath="." desc="Sample test" method="main" />
<assert component="JTextField Instance" method="getText" value="initial" />
<sequence>
<action args="Click Here" class="javax.swing.AbstractButton" method="actionClick" />
<action args="TestFrame Instance" class="java.awt.Window" method="actionClose" />
</sequence>
<assert component="JTextField Instance" method="getText" value="modified" />
<terminate/>
</AWTTestScript>
@@ -0,0 +1,56 @@
package org.apache.maven.abbot.sample;
/* ====================================================================
* 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.
* ====================================================================
*/
import javax.swing.JFrame;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JTextField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Main extends JFrame
{
public JButton button;
public JTextField textField;
public Main()
{
getContentPane().setLayout(new FlowLayout());
textField = new JTextField("initial");
button = new JButton("Click Here");
button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
textField.setText("modified");
}
}
);
getContentPane().add(button);
getContentPane().add(textField);
this.pack();
}
public static void main(String[] argv)
{
Main frame = new Main();
frame.show();
}
}
@@ -0,0 +1,2 @@
target
build.properties
@@ -0,0 +1,29 @@
# -------------------------------------------------------------------
# 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.
# -------------------------------------------------------------------
# Copy this file to a build.properties file and edit to match your local
# environment.
#
# Note: You MUST also define the JAVAWS_HOME environment variable and have it
# point to where Java Webstart is installed on your machine.
# For example: c:\apps\j2sdk1.4.2_01\jre\javaws
# Locations where your Java web start caches are located.
# For example on Windows XP:
maven.abbot.javaws.systemhome = C:/WINDOWS/Sun/Java/Deployment
maven.abbot.javaws.userhome = C:/Documents and Settings/[replace with user name]/Application Data/Sun/Java/Deployment
Binary file not shown.
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<project xmlns:j="jelly:core" xmlns:ant="jelly:ant">
<goal name="dist">
<!-- Start Jetty -->
<j:thread>
<attainGoal name="jetty:run-war"/>
</j:thread>
<ant:waitfor>
<ant:http url="http://localhost:8081/maven-abbot-plugin-test-sample-webstart/sample.jnlp"/>
</ant:waitfor>
<!-- Start Abbot webstart tests -->
<attainGoal name="abbot:test-webstart"/>
</goal>
</project>
@@ -0,0 +1,24 @@
# -------------------------------------------------------------------
# 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.jetty.port = 8081
maven.abbot.sign = true
maven.abbot.sign.force = false
maven.abbot.remotejnlp = http://localhost:8081/maven-abbot-plugin-test-sample-webstart/sample.jnlp
maven.abbot.sign.keystore = file:${basedir}/conf/keys
maven.abbot.sign.storepass = abbot-plugin
maven.abbot.sign.alias = abbot-plugin
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<project>
<extend>${basedir}/../project.xml</extend>
<id>maven-abbot-plugin-test-sample-webstart</id>
<name>Maven Abbot plugin Webstart Sample Test</name>
<description>Run Abbot tests on webstart sample</description>
<shortDescription>Run Abbot tests on webstart sample</shortDescription>
<dependencies>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-abbot-plugin-test-sample-local</artifactId>
<version>1.0</version>
<properties>
<war.target.path>.</war.target.path>>
</properties>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>1.0</version>
<type>plugin</type>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<AWTTestScript>
<component class="javax.swing.JButton" id="Click Here" index="0" parent="JPanel Instance" text="Click Here" window="TestFrame Instance" />
<component class="javax.swing.JLayeredPane" id="JLayeredPane Instance" index="1" parent="JRootPane Instance" window="TestFrame Instance" />
<component class="javax.swing.JPanel" id="JPanel Instance" index="0" parent="JLayeredPane Instance" window="TestFrame Instance" />
<component class="javax.swing.JRootPane" id="JRootPane Instance" index="0" parent="TestFrame Instance" />
<component class="javax.swing.JTextField" id="JTextField Instance" index="1" parent="JPanel Instance" window="TestFrame Instance" />
<component class="org.apache.maven.abbot.sample.Main" id="TestFrame Instance" root="true" title="" />
<launch args="[]" class="org.apache.maven.abbot.sample.Main" classpath="." desc="Sample test" method="main" />
<assert component="JTextField Instance" method="getText" value="initial" />
<sequence>
<action args="Click Here" class="javax.swing.AbstractButton" method="actionClick" />
<action args="TestFrame Instance" class="java.awt.Window" method="actionClose" />
</sequence>
<assert component="JTextField Instance" method="getText" value="modified" />
<terminate/>
</AWTTestScript>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
</web-app>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<jnlp href="sample.jnlp" spec="1.0+" codebase="http://localhost:8081/maven-abbot-plugin-test-sample-webstart/">
<information>
<title>Sample webstart application</title>
<vendor>Apache Software Foundation</vendor>
<homepage href="index.html"/>
<description>Sample webstart application</description>
<description kind="short">Sample webstart application</description>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.3+"/>
<jar href="maven-abbot-plugin-test-sample-local-1.0.jar"/>
</resources>
<application-desc main-class="org.apache.maven.abbot.sample.Main"/>
</jnlp>
@@ -0,0 +1,85 @@
package org.apache.maven.abbot;
/* ====================================================================
* 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.
* ====================================================================
*/
import junit.extensions.abbot.ScriptFixture;
import junit.framework.Test;
import junit.framework.TestCase;
/**
* Unit tests for {@link AbbotTestAll}.
*/
public class AbbotTestAllTest extends TestCase
{
public void testGetScriptFileNamesNoPropertyDefined()
{
assertNull("The maven.abbot.src.files property must not be set for "
+ "this test", System.getProperty("maven.abbot.src.files"));
String[] result = AbbotTestAll.getScriptFileNames();
assertNull(result);
}
public void testGetScriptFileNamesEmptyFileList()
{
System.setProperty("maven.abbot.src.files", "");
String[] result = AbbotTestAll.getScriptFileNames();
assertNull(result);
}
public void testGetScriptFileNamesSingleFile()
{
System.setProperty("maven.abbot.src.files", "c:/some/file");
String[] result = AbbotTestAll.getScriptFileNames();
assertEquals(1, result.length);
assertEquals("c:/some/file", result[0]);
}
public void testGetScriptFileNamesTwoFiles()
{
System.setProperty("maven.abbot.src.files",
"c:/some/file,c:/other/file");
String[] result = AbbotTestAll.getScriptFileNames();
assertEquals(2, result.length);
assertEquals("c:/some/file", result[0]);
assertEquals("c:/other/file", result[1]);
}
/**
* Verify we can construct a valid
* {@link junit.extensions.abbot.ScriptTestSuite} object when
* executing a single script.
*/
public void testConstructionOfScriptTestSuiteWithUniqueScript()
{
System.setProperty("maven.abbot.src.files", "c:/some/file.xml");
Test suite = AbbotTestAll.suite();
assertNotNull(suite);
assertEquals(AbbotTestAll.MavenScriptTestSuite.class.getName(),
suite.getClass().getName());
AbbotTestAll.MavenScriptTestSuite mavenSuite =
(AbbotTestAll.MavenScriptTestSuite) suite;
assertEquals(1, mavenSuite.testCount());
Test test = (Test) mavenSuite.tests().nextElement();
assertEquals(ScriptFixture.class.getName(), test.getClass().getName());
}
}
@@ -0,0 +1,33 @@
package org.apache.maven.abbot;
/* ====================================================================
* 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.
* ====================================================================
*/
import junit.framework.TestCase;
/**
* Unit tests for {@link AbbotWebstartTestRunner}.
*/
public class AbbotTestRunnerMainTest extends TestCase
{
public void testExecuteOk() throws Exception
{
AbbotWebstartTestRunner runner = new AbbotWebstartTestRunner();
runner.execute(SampleTest.class.getName(),
System.getProperty("maven.abbot.reports.dir", ""));
}
}
@@ -0,0 +1,32 @@
package org.apache.maven.abbot;
/* ====================================================================
* 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.
* ====================================================================
*/
import junit.framework.TestCase;
/**
* Dummy test to verify that {@link AbbotWebstartTestRunner#execute}
* can execute it properly.
*/
public class SampleTest extends TestCase
{
public void testXXX()
{
assertTrue("Should have been true...", true);
}
}
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<document>
<properties>
<title>Changes</title>
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<release version="1.0" date="in CVS">
<action dev="vmassol" type="add">
Initial creation by Christian Blavier and Vincent Massol.
See the feature list on the Abbot plugin web site
for a full list of what the plugin does.
</action>
</release>
</body>
</document>
+44
View File
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<document>
<properties>
<title>Maven Abbot plugin goals</title>
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<goals>
<goal>
<name>abbot</name>
<description>
Default goal. Does the same as <code>abbot:test</code>.
</description>
</goal>
<goal>
<name>abbot:test</name>
<description>
Runs Abbot tests (Costello XML scripts).
</description>
</goal>
<goal>
<name>abbot:test-webstart</name>
<description>
Runs Abbot tests (Costello XML scripts) against an already
installed WebStart application.
</description>
</goal>
<goal>
<name>abbot:editor</name>
<description>
Start the Abbot Costello editor.
</description>
</goal>
<goal>
<name>abbot:editor-webstart</name>
<description>
Start the Abbot Costello editor, using the jars from an already
installed WebStart application.
</description>
</goal>
</goals>
</body>
</document>
+38
View File
@@ -0,0 +1,38 @@
<?xml version="1.0"?>
<document>
<properties>
<title>Maven Abbot plugin</title>
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<section name="What is the Abbot plugin?">
<p>
Provides the following features:
</p>
<ul>
<li>
Ability to start the Abbot Costello editor using either jars
defined in the POM or the jars from an already installed
WebStart application.
</li>
<li>
Ability to execute Abbot XML scripts through the Ant &lt;junit&gt;
task
</li>
<li>
Ability to execute Abbot XML scripts on an already installed
WebStart application (end-to-end functional testing)
</li>
</ul>
</section>
<section name="Using the plugin">
<p>
See the <a href="using.html">usage tutorial</a>.
</p>
</section>
</body>
</document>
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Maven Abbot plugin">
<title>Maven Abbot plugin</title>
<body>
<links>
<item name="Maven" href="http://maven.apache.org/"/>
<item name="Abbot" href="http://abbot.sourceforge.net/"/>
</links>
<menu name="Overview">
<item name="Using" href="/using.html"/>
<item name="Goals" href="/goals.html"/>
<item name="Properties" href="/properties.html"/>
</menu>
</body>
</project>
+88
View File
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<document>
<properties>
<title>Maven Abbot plugin properties</title>
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<section name="Abbot plugin properties">
<source><![CDATA[
# -------------------------------------------------------------------
# Properties required for all the abbot plugin goals
# -------------------------------------------------------------------
# Location of abbot source scripts
maven.abbot.src.dir = ${maven.src.dir}/abbot
# (optional) Explicit comma-separated list of Abbot source scripts
# to execute. If not defined, the plugin will execute all .xml files
# located in maven.abbot.src.dir
# maven.abbot.src.files =
# Decide whether or not to recurse in maven.abbot.src.dir to find
# Abbot .xml source scripts.
maven.abbot.recurse = true
# Location where the abbot plugin puts build files related to abbot
maven.abbot.dest.dir = ${maven.build.dir}/abbot
# Location where abbot junit test results will be located
maven.abbot.reports.dir = ${maven.build.dir}/abbot-reports
maven.abbot.printSummary = ${maven.junit.printSummary}
maven.abbot.dir = ${maven.junit.dir}
maven.abbot.sysproperties = ${maven.junit.sysproperties}
maven.abbot.jvmargs = ${maven.junit.jvmargs}
maven.abbot.format = ${maven.junit.format}
maven.abbot.usefile = ${maven.junit.usefile}
# (optional) Name of the test suite beeing executed. This name will be used
# to name the generated JUnit test report. If not specified the report name
# will be TEST-org.apache.maven.abbot.AbbotTestAll. This is useful when
# you're calling the Abbot plugin several times in a row as otherwise the
# reports will overwrite each other.
#maven.abbot.suite.name = MyTestSuite
# Decide whether to turn on webstart debugging.
maven.abbot.debug = false
# -------------------------------------------------------------------
# Properties required only for the abbot:test goal
# -------------------------------------------------------------------
# Name of the JUnit test to execute that will trigger the execution
# of the Abbot scripts. This name should not be changed unless you
# want to provide your own Abbot script wrapper.
maven.abbot.include = org.apache.maven.abbot.AbbotTestAll
# -------------------------------------------------------------------
# Properties required only for the abbot:test-webstart goal
# -------------------------------------------------------------------
# The following properties are mandatories. They depend on your
# execution environment and must be set in your build.properties file
# or equivalent:
#
# - JAVAWS_HOME: You MUST define this environment variable and have it
# point to where Java Webstart is installed on your machine.
# For example: c:\apps\j2sdk1.4.2_01\jre\javaws
# - maven.abbot.remotejnlp: This property points to the JNLP file of
# the application you're testing.
# - maven.abbot.javaws.systemhome: Java webstart system cache location
# - maven.abbot.javaws.userhome: Java webstart user cache location
maven.abbot.webstart.jnlp.original = original.jnlp
maven.abbot.webstart.jnlp.modified = modified.jnlp
maven.abbot.webstart.main.jar = abbot-main.jar
maven.abbot.webstart.main.class = org.apache.maven.abbot.AbbotWebstartTestRunner
# Note: For now we only support signing jars. The reason is that we need
# to add the Abbot jars to the JNLP file and as we're taking these jars
# from the local file system we need to have the permissions and thus we
# need signed jars to get these permissions.
maven.abbot.sign = true
]]></source>
</section>
</body>
</document>
+89
View File
@@ -0,0 +1,89 @@
<?xml version="1.0"?>
<document>
<properties>
<title>Using the Abbot plugin</title>
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<section name="Using the Abbot plugin">
<p>
There are 2 possible ways to use the plugin:
</p>
<ul>
<li>
Using the <code>abbot:test</code> goal. You would call this goal
from inside your application project. This project needs to
define all your application required dependencies in its
<code>project.xml</code>.
</li>
<li>
Using the <code>abbot:test-webstart</code> goal. You would call
this goal if you wish to test a WebStart application that is
already installed on some server. In this mode your project does
not require to define any dependency.
</li>
</ul>
</section>
<section name="Using the abbot:test goal">
<section name="Pre-requisites">
<p>
The following environmental dependencies need to be present before
executing the Abbot plugin:
</p>
<ul>
<li>
The <code>MRJToolkitStubs</code> jar has to be installed in your
local Maven repository under the <code>apple</code> groupId. It
is required for the Costello editor.
</li>
</ul>
</section>
</section>
<section name="Using the abbot:test-webapp goal">
<section name="Pre-requisites">
<p>
The following environmental dependencies need to be present before
executing the Abbot plugin:
</p>
<ul>
<li>
The <code>MRJToolkitStubs</code> jar has to be installed in your
local Maven repository under the <code>apple</code> groupId. It
is required for the Costello editor.
</li>
<li>
The <code>JAVAWS_HOME</code> environment variable has to be set and
it must point to the location where webstart is installed on your
machine.
</li>
<li>
Some mandatory environment-dependent properties need to be
defined. See the <a href="properties.html">Properties</a>
page for the details.
</li>
</ul>
</section>
<section name="Limitations">
<p>
The following limitations are known for the
<code>abbot:test-webstart</code> goal:
</p>
<ul>
<li>
You need to provide a key to sign your webstart jars. This is
required as we're packaging local filesystem jars
into the application's JNLP and we need to have the permissions
to do so (granted if the jar are signed).
</li>
</ul>
</section>
</section>
</body>
</document>