diff --git a/abbot/.cvsignore b/abbot/.cvsignore new file mode 100644 index 00000000..8693c560 --- /dev/null +++ b/abbot/.cvsignore @@ -0,0 +1,4 @@ +target +build.properties +.classpath +.project diff --git a/abbot/plugin.jelly b/abbot/plugin.jelly new file mode 100644 index 00000000..1a56977b --- /dev/null +++ b/abbot/plugin.jelly @@ -0,0 +1,365 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${maven.abbot.sysproperties} + + + + + + ${maven.abbot.jvmargs} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${dep.id} is uptodate ? ${context.getVariable(varname) == true} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Mandatory environment variable JAVAWS_HOME must be set + + + + In the current version the Abbot plugin only works when signing jars + + + + Mandatory variable maven.abbot.remotejnlp is missing." + + + + Mandatory variable maven.abbot.javaws.systemhome is missing" + + + + Mandatory variable maven.abbot.javaws.userhome is missing + + + + + + + + + + + + diff --git a/abbot/plugin.properties b/abbot/plugin.properties new file mode 100644 index 00000000..7207067d --- /dev/null +++ b/abbot/plugin.properties @@ -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 diff --git a/abbot/project.properties b/abbot/project.properties new file mode 100644 index 00000000..a01ecdc8 --- /dev/null +++ b/abbot/project.properties @@ -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 + + diff --git a/abbot/project.xml b/abbot/project.xml new file mode 100644 index 00000000..f01ce4fb --- /dev/null +++ b/abbot/project.xml @@ -0,0 +1,166 @@ + + + + + + ../project.xml + 3 + maven-abbot-plugin + Maven Abbot plugin + 1.0-SNAPSHOT + Run Abbot tests + Abbot Tests + http://maven.apache.org/reference/plugins/abbot/ + http://jira.codehaus.org/secure/BrowseProject.jspa?id=10550 + /www/maven.apache.org/reference/plugins/abbot/ + + scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-plugins/abbot/ + http://cvs.apache.org/viewcvs/maven-plugins/abbot/ + + + + 1.0 + 1.0 + HEAD + + + + + Christian Blavier + cblavier + christian.blavier@bnpparibas.fr + BNP Paribas + + Creator + Java Developer + + + + Vincent Massol + vmassol + vmassol@pivolis.com + Pivolis + + Creator + Java Developer + Release Manager + + + + + + + + abbot + abbot + 0.12.3 + + true + true + + + + + jdom + jdom + 1.0b8 + + true + true + + + + + + mrj + MRJToolkitStubs + unknown + + true + + + + + gnu-regexp + gnu-regexp + 1.1.4 + + true + + + + + junit + junit + 3.8.1 + + true + true + + + + + xerces + xerces + 2.4.0 + + true + true + + + + + xerces + xmlParserAPIs + 2.2.1 + + true + true + + + + + ant + ant + 1.5.3-1 + + true + + + + + ant + ant-optional + 1.5.3-1 + + true + + + + + + maven-changes-plugin + maven-changelog-plugin + maven-file-activity-plugin + maven-developer-activity-plugin + maven-file-activity-plugin + maven-license-plugin + maven-linkcheck-plugin + + \ No newline at end of file diff --git a/abbot/src/main/org/apache/maven/abbot/AbbotTestAll.java b/abbot/src/main/org/apache/maven/abbot/AbbotTestAll.java new file mode 100644 index 00000000..4840c085 --- /dev/null +++ b/abbot/src/main/org/apache/maven/abbot/AbbotTestAll.java @@ -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 + * maven.abbot.src.files Maven property or null + * if the property is not defined. Also returns null if there + * are no files defined in the maven.abbot.src.files + * 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; + } + +} diff --git a/abbot/src/main/org/apache/maven/abbot/AbbotWebstartTestRunner.java b/abbot/src/main/org/apache/maven/abbot/AbbotWebstartTestRunner.java new file mode 100644 index 00000000..eec2ccad --- /dev/null +++ b/abbot/src/main/org/apache/maven/abbot/AbbotWebstartTestRunner.java @@ -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; + } +} diff --git a/abbot/src/plugin-resources/jnlp.jsl b/abbot/src/plugin-resources/jnlp.jsl new file mode 100644 index 00000000..a456d6f0 --- /dev/null +++ b/abbot/src/plugin-resources/jnlp.jsl @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + file:${maven.abbot.dest.dir}/${filename}.jar + + + + + ${dep.getDependancyPath()} + + + + + + + + true + file:${maven.abbot.dest.dir}/${maven.abbot.webstart.main.jar} + + + + + + + + maven.abbot.src.dir + ${maven.abbot.src.dir} + + + + maven.abbot.src.files + ${maven.abbot.src.files} + + + + maven.abbot.reports.dir + ${maven.abbot.reports.dir} + + + + maven.abbot.suite.name + ${maven.abbot.suite.name} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/abbot/src/plugin-test/maven.xml b/abbot/src/plugin-test/maven.xml new file mode 100644 index 00000000..8e803bf3 --- /dev/null +++ b/abbot/src/plugin-test/maven.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/abbot/src/plugin-test/project.properties b/abbot/src/plugin-test/project.properties new file mode 100644 index 00000000..370b1f24 --- /dev/null +++ b/abbot/src/plugin-test/project.properties @@ -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= diff --git a/abbot/src/plugin-test/project.xml b/abbot/src/plugin-test/project.xml new file mode 100644 index 00000000..0eb9277f --- /dev/null +++ b/abbot/src/plugin-test/project.xml @@ -0,0 +1,41 @@ + + + 3 + maven + 1.0 + http://maven.apache.org/reference/plugins/abbot/ + http://jira.codehaus.org/BrowseProject.jspa?id=xxxxx + /www/maven.apache.org/reference/plugins/abbot/ + + scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-plugins/abbot/ + http://cvs.apache.org/viewcvs/maven-plugins/abbot/ + + + + Christian Blavier + cblavier + christian.blavier@bnpparibas.fr + BNP Paribas + + Creator + Java Developer + Lead Developer + + + + Vincent Massol + vmassol + vmassol@pivolis.com + Pivolis + + Creator + Java Developer + Release Manager + Lead Developer + + + + + ${basedir}/src/java + + diff --git a/abbot/src/plugin-test/sample-local/.cvsignore b/abbot/src/plugin-test/sample-local/.cvsignore new file mode 100644 index 00000000..eb5a316c --- /dev/null +++ b/abbot/src/plugin-test/sample-local/.cvsignore @@ -0,0 +1 @@ +target diff --git a/abbot/src/plugin-test/sample-local/conf/keys b/abbot/src/plugin-test/sample-local/conf/keys new file mode 100644 index 00000000..f0ef3106 Binary files /dev/null and b/abbot/src/plugin-test/sample-local/conf/keys differ diff --git a/abbot/src/plugin-test/sample-local/maven.xml b/abbot/src/plugin-test/sample-local/maven.xml new file mode 100644 index 00000000..f0d66f50 --- /dev/null +++ b/abbot/src/plugin-test/sample-local/maven.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/abbot/src/plugin-test/sample-local/project.properties b/abbot/src/plugin-test/sample-local/project.properties new file mode 100644 index 00000000..ee4a5973 --- /dev/null +++ b/abbot/src/plugin-test/sample-local/project.properties @@ -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 diff --git a/abbot/src/plugin-test/sample-local/project.xml b/abbot/src/plugin-test/sample-local/project.xml new file mode 100644 index 00000000..60f42c5e --- /dev/null +++ b/abbot/src/plugin-test/sample-local/project.xml @@ -0,0 +1,9 @@ + + + ${basedir}/../project.xml + maven-abbot-plugin-test-sample-local + Maven Abbot plugin Local Sample Test + Run Abbot tests on local sample + Run Abbot tests on local sample + + diff --git a/abbot/src/plugin-test/sample-local/src/abbot/TestLocalSample.xml b/abbot/src/plugin-test/sample-local/src/abbot/TestLocalSample.xml new file mode 100644 index 00000000..77c14ee0 --- /dev/null +++ b/abbot/src/plugin-test/sample-local/src/abbot/TestLocalSample.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/abbot/src/plugin-test/sample-local/src/java/org/apache/maven/abbot/sample/Main.java b/abbot/src/plugin-test/sample-local/src/java/org/apache/maven/abbot/sample/Main.java new file mode 100644 index 00000000..54d95055 --- /dev/null +++ b/abbot/src/plugin-test/sample-local/src/java/org/apache/maven/abbot/sample/Main.java @@ -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(); + } + +} \ No newline at end of file diff --git a/abbot/src/plugin-test/sample-webstart/.cvsignore b/abbot/src/plugin-test/sample-webstart/.cvsignore new file mode 100644 index 00000000..74078983 --- /dev/null +++ b/abbot/src/plugin-test/sample-webstart/.cvsignore @@ -0,0 +1,2 @@ +target +build.properties diff --git a/abbot/src/plugin-test/sample-webstart/build.properties.sample b/abbot/src/plugin-test/sample-webstart/build.properties.sample new file mode 100644 index 00000000..6e4f8319 --- /dev/null +++ b/abbot/src/plugin-test/sample-webstart/build.properties.sample @@ -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 + + diff --git a/abbot/src/plugin-test/sample-webstart/conf/keys b/abbot/src/plugin-test/sample-webstart/conf/keys new file mode 100644 index 00000000..f0ef3106 Binary files /dev/null and b/abbot/src/plugin-test/sample-webstart/conf/keys differ diff --git a/abbot/src/plugin-test/sample-webstart/maven.xml b/abbot/src/plugin-test/sample-webstart/maven.xml new file mode 100644 index 00000000..d7665a8f --- /dev/null +++ b/abbot/src/plugin-test/sample-webstart/maven.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/abbot/src/plugin-test/sample-webstart/project.properties b/abbot/src/plugin-test/sample-webstart/project.properties new file mode 100644 index 00000000..2cd674e5 --- /dev/null +++ b/abbot/src/plugin-test/sample-webstart/project.properties @@ -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 diff --git a/abbot/src/plugin-test/sample-webstart/project.xml b/abbot/src/plugin-test/sample-webstart/project.xml new file mode 100644 index 00000000..106fb2c9 --- /dev/null +++ b/abbot/src/plugin-test/sample-webstart/project.xml @@ -0,0 +1,24 @@ + + + ${basedir}/../project.xml + maven-abbot-plugin-test-sample-webstart + Maven Abbot plugin Webstart Sample Test + Run Abbot tests on webstart sample + Run Abbot tests on webstart sample + + + maven + maven-abbot-plugin-test-sample-local + 1.0 + + .> + + + + maven + maven-jetty-plugin + 1.0 + plugin + + + diff --git a/abbot/src/plugin-test/sample-webstart/src/abbot/TestWebstartSample.xml b/abbot/src/plugin-test/sample-webstart/src/abbot/TestWebstartSample.xml new file mode 100644 index 00000000..f3499b67 --- /dev/null +++ b/abbot/src/plugin-test/sample-webstart/src/abbot/TestWebstartSample.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/abbot/src/plugin-test/sample-webstart/src/webapp/WEB-INF/web.xml b/abbot/src/plugin-test/sample-webstart/src/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..3338168c --- /dev/null +++ b/abbot/src/plugin-test/sample-webstart/src/webapp/WEB-INF/web.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/abbot/src/plugin-test/sample-webstart/src/webapp/sample.jnlp b/abbot/src/plugin-test/sample-webstart/src/webapp/sample.jnlp new file mode 100644 index 00000000..c1ba9c65 --- /dev/null +++ b/abbot/src/plugin-test/sample-webstart/src/webapp/sample.jnlp @@ -0,0 +1,19 @@ + + + + + Sample webstart application + Apache Software Foundation + + Sample webstart application + Sample webstart application + + + + + + + + + + \ No newline at end of file diff --git a/abbot/src/test/org/apache/maven/abbot/AbbotTestAllTest.java b/abbot/src/test/org/apache/maven/abbot/AbbotTestAllTest.java new file mode 100644 index 00000000..befa9934 --- /dev/null +++ b/abbot/src/test/org/apache/maven/abbot/AbbotTestAllTest.java @@ -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()); + } + +} diff --git a/abbot/src/test/org/apache/maven/abbot/AbbotTestRunnerMainTest.java b/abbot/src/test/org/apache/maven/abbot/AbbotTestRunnerMainTest.java new file mode 100644 index 00000000..5de6f4e7 --- /dev/null +++ b/abbot/src/test/org/apache/maven/abbot/AbbotTestRunnerMainTest.java @@ -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", "")); + } +} diff --git a/abbot/src/test/org/apache/maven/abbot/SampleTest.java b/abbot/src/test/org/apache/maven/abbot/SampleTest.java new file mode 100644 index 00000000..578a3a9b --- /dev/null +++ b/abbot/src/test/org/apache/maven/abbot/SampleTest.java @@ -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); + } +} diff --git a/abbot/xdocs/changes.xml b/abbot/xdocs/changes.xml new file mode 100644 index 00000000..922223ce --- /dev/null +++ b/abbot/xdocs/changes.xml @@ -0,0 +1,20 @@ + + + + Changes + Vincent Massol + + + + + + + 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. + + + + + + diff --git a/abbot/xdocs/goals.xml b/abbot/xdocs/goals.xml new file mode 100644 index 00000000..849e5feb --- /dev/null +++ b/abbot/xdocs/goals.xml @@ -0,0 +1,44 @@ + + + + + Maven Abbot plugin goals + Vincent Massol + + + + + abbot + + Default goal. Does the same as abbot:test. + + + + abbot:test + + Runs Abbot tests (Costello XML scripts). + + + + abbot:test-webstart + + Runs Abbot tests (Costello XML scripts) against an already + installed WebStart application. + + + + abbot:editor + + Start the Abbot Costello editor. + + + + abbot:editor-webstart + + Start the Abbot Costello editor, using the jars from an already + installed WebStart application. + + + + + \ No newline at end of file diff --git a/abbot/xdocs/index.xml b/abbot/xdocs/index.xml new file mode 100644 index 00000000..6f769594 --- /dev/null +++ b/abbot/xdocs/index.xml @@ -0,0 +1,38 @@ + + + + + Maven Abbot plugin + Vincent Massol + + + +
+

+ Provides the following features: +

+ +
+
+

+ See the usage tutorial. +

+
+ + + +
diff --git a/abbot/xdocs/navigation.xml b/abbot/xdocs/navigation.xml new file mode 100644 index 00000000..9cc8b138 --- /dev/null +++ b/abbot/xdocs/navigation.xml @@ -0,0 +1,17 @@ + + + + Maven Abbot plugin + + + + + + + + + + + + + diff --git a/abbot/xdocs/properties.xml b/abbot/xdocs/properties.xml new file mode 100644 index 00000000..9bd49971 --- /dev/null +++ b/abbot/xdocs/properties.xml @@ -0,0 +1,88 @@ + + + + + Maven Abbot plugin properties + Vincent Massol + + +
+ +
+ +
\ No newline at end of file diff --git a/abbot/xdocs/using.xml b/abbot/xdocs/using.xml new file mode 100644 index 00000000..f18f3100 --- /dev/null +++ b/abbot/xdocs/using.xml @@ -0,0 +1,89 @@ + + + + + Using the Abbot plugin + Vincent Massol + + + + +
+

+ There are 2 possible ways to use the plugin: +

+ +
+ +
+
+

+ The following environmental dependencies need to be present before + executing the Abbot plugin: +

+
    +
  • + The MRJToolkitStubs jar has to be installed in your + local Maven repository under the apple groupId. It + is required for the Costello editor. +
  • +
+
+
+ +
+
+

+ The following environmental dependencies need to be present before + executing the Abbot plugin: +

+
    +
  • + The MRJToolkitStubs jar has to be installed in your + local Maven repository under the apple groupId. It + is required for the Costello editor. +
  • +
  • + The JAVAWS_HOME environment variable has to be set and + it must point to the location where webstart is installed on your + machine. +
  • +
  • + Some mandatory environment-dependent properties need to be + defined. See the Properties + page for the details. +
  • +
+
+
+

+ The following limitations are known for the + abbot:test-webstart goal: +

+
    +
  • + 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). +
  • +
+
+
+ + + +