diff --git a/proposal/sandbox/junit/build.bat b/proposal/sandbox/junit/build.bat
deleted file mode 100755
index ae9ffc17b..000000000
--- a/proposal/sandbox/junit/build.bat
+++ /dev/null
@@ -1,30 +0,0 @@
-@echo off
-
-set OLDCLASSPATH=%CLASSPATH%
-set REAL_ANT_HOME=%ANT_HOME%
-set ANT_HOME=bootstrap
-if exist bootstrap\lib\ant.jar if exist bootstrap\bin\ant.bat if exist bootstrap\bin\lcp.bat if exist bootstrap\bin\antRun.bat goto runAnt
-call bootstrap.bat
-if exist bootstrap\lib\ant.jar if exist bootstrap\bin\ant.bat if exist bootstrap\bin\lcp.bat if exist bootstrap\bin\antRun.bat goto runAnt
-echo Bootstrap FAILED
-goto cleanup
-
-:runAnt
-set LOCALCLASSPATH=lib\crimson.jar;bootstrap\lib\ant.jar
-for %%i in (lib\optional\*.jar) do call bootstrap\bin\lcp.bat %%i
-set CLASSPATH=lib\optional\xalanj1compat.jar;%LOCALCLASSPATH%;%CLASSPATH%
-set LOCALCLASSPATH=
-
-if not "%REAL_ANT_HOME%" == "" goto install_ant
-call bootstrap\bin\ant.bat -emacs %1 %2 %3 %4 %5 %6 %7 %8 %9
-goto cleanup
-
-:install_ant
-call bootstrap\bin\ant.bat -emacs -Dant.install="%REAL_ANT_HOME%" %1 %2 %3 %4 %5 %6 %7 %8 %9
-
-rem clean up
-:cleanup
-set ANT_HOME=%REAL_ANT_HOME%
-set REAL_ANT_HOME=
-set CLASSPATH=%OLDCLASSPATH%
-set OLDCLASSPATH=
diff --git a/proposal/sandbox/junit/build.sh b/proposal/sandbox/junit/build.sh
deleted file mode 100644
index f15a7e7af..000000000
--- a/proposal/sandbox/junit/build.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-cygwin=false;
-case "`uname`" in
- CYGWIN*) cygwin=true ;;
-esac
-
-PWD=`pwd`
-if $cygwin ; then
- PWD=`cygpath --windows "$PWD"`
-fi
-
-cd ../../..
-/bin/sh ./build.sh -buildfile $PWD/build.xml $*
-cd $PWD
-
diff --git a/proposal/sandbox/junit/build.xml b/proposal/sandbox/junit/build.xml
deleted file mode 100644
index 746178b7d..000000000
--- a/proposal/sandbox/junit/build.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/proposal/sandbox/junit/lib/excalibur-i18n-1.0.jar b/proposal/sandbox/junit/lib/excalibur-i18n-1.0.jar
deleted file mode 100644
index 5c533b54b..000000000
Binary files a/proposal/sandbox/junit/lib/excalibur-i18n-1.0.jar and /dev/null differ
diff --git a/proposal/sandbox/junit/rjunit-ant-tests.xml b/proposal/sandbox/junit/rjunit-ant-tests.xml
deleted file mode 100644
index 5d98526d5..000000000
--- a/proposal/sandbox/junit/rjunit-ant-tests.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ArrayEnumeration.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ArrayEnumeration.java
deleted file mode 100644
index 525acb263..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ArrayEnumeration.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.util.Enumeration;
-import java.util.NoSuchElementException;
-
-/**
- * Convenient enumeration over an array of objects.
- */
-class ArrayEnumeration implements Enumeration {
-
- /** convenient null enumeration */
- public final static Enumeration NULL_ENUMERATION =
- new ArrayEnumeration(new Object[0]);
-
- /** object array */
- private Object[] array;
-
- /** current index */
- private int pos;
-
- /**
- * Initialize a new enumeration that wraps an array.
- * @param array the array of object to enumerate.
- */
- public ArrayEnumeration(Object[] array) {
- this.array = array;
- this.pos = 0;
- }
-
- /**
- * Tests if this enumeration contains more elements.
- *
- * @return true if and only if this enumeration object
- * contains at least one more element to provide;
- * false otherwise.
- */
- public boolean hasMoreElements() {
- return (pos < array.length);
- }
-
- /**
- * Returns the next element of this enumeration if this enumeration
- * object has at least one more element to provide.
- *
- * @return the next element of this enumeration.
- * @throws NoSuchElementException if no more elements exist.
- */
- public Object nextElement() throws NoSuchElementException {
- if (hasMoreElements()) {
- Object o = array[pos];
- pos++;
- return o;
- }
- throw new NoSuchElementException();
- }
-}
-
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/BaseTestElement.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/BaseTestElement.java
deleted file mode 100644
index 401f9638d..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/BaseTestElement.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.util.Enumeration;
-
-import junit.runner.TestCollector;
-
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.ProjectComponent;
-
-/**
- * Base test implementation that implements the if/unless logic.
- *
- */
-public abstract class BaseTestElement
- extends ProjectComponent implements TestCollector {
-
- /** run the test only if this property is present */
- private String ifProperty;
-
- /** run the test unless this property is present */
- private String unlessProperty;
-
- public final Enumeration collectTests() {
- if (shouldRun()) {
- return getTests();
- }
- return ArrayEnumeration.NULL_ENUMERATION;
- }
-
- public final void setIf(final String value) {
- ifProperty = value;
- }
-
- public final void setUnless(final String value) {
- unlessProperty = value;
- }
-
- /**
- * Implementation of the test collection process
- * @return the enumeration of fully qualified classname representing
- * a JUnit Test.
- */
- protected abstract Enumeration getTests();
-
- /**
- * check whether this test should be run or not.
- * @return whether or not the test should run based on
- * the presence of if and unless properties.
- * @see #setIf(String)
- * @see #setUnless(String)
- */
- protected boolean shouldRun() {
- final Project project = getProject();
- if ( ifProperty != null &&
- project.getProperty(ifProperty) == null ){
- return false;
- }
- if (unlessProperty != null &&
- project.getProperty(unlessProperty) != null) {
- return false;
- }
- return true;
- }
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/BatchTestElement.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/BatchTestElement.java
deleted file mode 100644
index 26c57d0a8..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/BatchTestElement.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.util.Enumeration;
-
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.types.PatternSet;
-
-/**
- * A test element where tests files are specified by include/exclude
- * patterns. tests files location are specified by one ore multiple
- * path elements. (directory or archive).
- *
- *
- *
- *
- *
- *
- */
-public class BatchTestElement extends BaseTestElement {
-
- private ClasspathTestCollector collector = new ClasspathTestCollector();
-
-// Test collector implementation
-
- public Enumeration getTests() {
- final Project project = getProject();
- collector.setProject(project);
- return collector.collectTests();
- }
-
-// Ant bean accessors
-
- public void setPath(Path path) {
- collector.setPath(path);
- }
-
- public Path getPath() {
- return collector.getPath();
- }
-
- public PatternSet.NameEntry createInclude() {
- return collector.createInclude();
- }
-
- public PatternSet.NameEntry createExclude() {
- return collector.createExclude();
- }
-
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ClasspathTestCollector.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ClasspathTestCollector.java
deleted file mode 100644
index e1f164cb3..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ClasspathTestCollector.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import junit.runner.TestCollector;
-
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.ProjectComponent;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.types.PatternSet;
-
-/**
- * A rough implementation of a test collector that will collect tests
- * using include/exclude patterns in a set of paths. A path can either
- * be a directory or an archive. (zip or jar file)
- *
- */
-public final class ClasspathTestCollector extends ProjectComponent
- implements TestCollector {
-
- private final static int SUFFIX_LENGTH = ".class".length();
-
- private final PatternSet patterns = new PatternSet();
-
- private Path path = null;
-
- public Enumeration collectTests() {
- Hashtable collected = new Hashtable();
- // start from last, so that first elements
- // override last one in case there are duplicates.
- // ie mimic classpath behavior.
- String[] paths = path.list();
- for (int i = paths.length - 1; i >= 0; i--) {
- File f = new File(paths[i]);
- ArrayList included = null;
- if (f.isDirectory()) {
- included = gatherFromDirectory(f);
- } else if (f.getName().endsWith(".zip")
- || f.getName().endsWith(".jar")) {
- included = gatherFromArchive(f);
- } else {
- continue;
- }
- // add tests to the already collected one
- final int includedCount = included.size();
- log("Adding " + includedCount + " testcases from " + f, Project.MSG_VERBOSE);
- for (int j = 0; j < includedCount; j++) {
- String testname = (String) included.get(j);
- collected.put(testname, "");
- }
- }
- log("Collected " + collected.size() + " testcases from " + paths.length + " path(s).", Project.MSG_VERBOSE);
- return collected.keys();
- }
-
-
- /**
- * Return the list of classnames from a directory that match
- * the specified patterns.
- * @param dir the base directory (must also be the base package)
- * @return the list of classnames matching the pattern.
- */
- protected ArrayList gatherFromDirectory(File dir) {
- Project project = getProject();
- DirectoryScanner ds = new DirectoryScanner();
- ds.setBasedir(dir);
- ds.setIncludes(patterns.getIncludePatterns(project));
- ds.setExcludes(patterns.getExcludePatterns(project));
- ds.scan();
- String[] included = ds.getIncludedFiles();
- return testClassNameFromFile(included);
- }
-
- /**
- * Return the list of classnames from a zipfile that match
- * the specified patterns.
- * @param zip the zipfile (must also be the base package)
- * @return the list of classnames matching the pattern.
- */
- protected ArrayList gatherFromArchive(File zip) {
- ZipScanner zs = new ZipScanner();
- zs.setBasedir(zip);
- zs.setIncludes(patterns.getIncludePatterns(getProject()));
- zs.setExcludes(patterns.getExcludePatterns(getProject()));
- zs.scan();
- String[] included = zs.getIncludedFiles();
- return testClassNameFromFile(included);
- }
-
- /**
- * transform a set of file into their matching classname
- * @todo what about using a mapper for this ?
- */
- protected ArrayList testClassNameFromFile(String[] classFileNames) {
- ArrayList tests = new ArrayList(classFileNames.length);
- for (int i = 0; i < classFileNames.length; i++) {
- String file = classFileNames[i];
- if (isTestClass(file)) {
- String classname = classNameFromFile(file);
- tests.add(classname);
- }
- }
- return tests;
- }
-
- protected boolean isTestClass(String classFileName) {
- return classFileName.endsWith(".class");
- }
-
- protected String classNameFromFile(String classFileName) {
- // convert /a/b.class to a.b
- String s = classFileName.substring(0, classFileName.length() - SUFFIX_LENGTH);
- String s2 = s.replace(File.separatorChar, '.');
- if (s2.startsWith(".")) {
- s2 = s2.substring(1);
- }
- return s2;
- }
-
-// Ant bean accessors
-
- public void setPath(Path path) {
- this.path = path;
- }
-
- public Path getPath() {
- return this.path;
- }
-
- public PatternSet.NameEntry createInclude() {
- return patterns.createInclude();
- }
-
- public PatternSet.NameEntry createExclude() {
- return patterns.createExclude();
- }
-
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ClientElement.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ClientElement.java
deleted file mode 100644
index d9f099564..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ClientElement.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Properties;
-
-import junit.runner.TestCollector;
-
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.ProjectComponent;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-import org.apache.tools.ant.types.CommandlineJava;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.util.FileUtils;
-
-/**
- * An element representing the client configuration.
- *
- *
- *
- *
- *
- *
-
- */
-public final class ClientElement extends ProjectComponent {
- /** resources */
- private final static Resources RES =
- ResourceManager.getPackageResources(ClientElement.class);
-
- /** port to contact the server. Default to 6666 */
- private int port = 6666;
-
- /** server hostname to connect to. Default to 127.0.0.1 */
- private String host = "127.0.0.1";
-
- /** test collector elements */
- private ArrayList testCollectors = new ArrayList();
-
- /** the command line to launch the TestRunner */
- private CommandlineJava cmd = new CommandlineJava();
-
- /** the parent task */
- private RJUnitTask parent;
-
- /** help debug the TestRunner */
- private boolean debug = false;
-
- /** create a new client */
- public ClientElement(RJUnitTask value) {
- parent = value;
- cmd.setClassname("org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestRunner");
- }
-
- /** core entry point */
- public final void execute() throws BuildException {
- try {
- preExecute();
- doExecute();
- } finally {
- postExecute();
- }
- }
-
- protected void preExecute() throws BuildException {
- // must appended to classpath to avoid conflicts.
- JUnitHelper.addClasspathEntry(createClasspath(), "/junit/framework/TestCase.class");
- JUnitHelper.addClasspathEntry(createClasspath(), "/org/apache/tools/ant/Task.class");
- JUnitHelper.addClasspathEntry(createClasspath(), "/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestRunner.class");
- }
-
- protected void doExecute() throws BuildException {
- File tmp = configureTestRunner();
- Execute execute = new Execute(new LogStreamHandler(parent, Project.MSG_VERBOSE, Project.MSG_VERBOSE));
- execute.setCommandline(cmd.getCommandline());
- execute.setAntRun(project);
-
- log(RES.getString("task.process-cmdline.log", cmd.toString()), Project.MSG_VERBOSE);
- int retVal = 0;
- try {
- retVal = execute.execute();
- if (retVal != 0) {
- throw new BuildException("task.process-failed.error");
- }
- } catch (IOException e) {
- String msg = RES.getString("task.process-failed.error");
- throw new BuildException(msg, e);
- } finally {
- tmp.delete();
- }
- }
-
- protected void postExecute() {
- // nothing
- }
-
- /**
- * @return all collected tests specified with test elements.
- */
- protected Enumeration collectTests() {
- final int count = testCollectors.size();
- final Enumeration[] tests = new Enumeration[count];
- for (int i = 0; i < count; i++) {
- TestCollector te = (TestCollector) testCollectors.get(i);
- tests[i] = te.collectTests();
- }
- return new CompoundEnumeration(tests);
- }
-
- /**
- * Configure the runner with the appropriate configuration file.
- * @return the reference to the temporary configuration file
- * to be deleted once the TestRunner has ended.
- */
- protected File configureTestRunner() throws BuildException {
- Properties props = new Properties();
- props.setProperty("debug", String.valueOf(debug));
- props.setProperty("host", host);
- props.setProperty("port", String.valueOf(port));
- // get all test classes to run...
- StringBuffer buf = new StringBuffer(10240);
- Enumeration classnames = collectTests();
- while (classnames.hasMoreElements()) {
- String classname = (String) classnames.nextElement();
- buf.append(classname).append(" ");
- }
- props.setProperty("classnames", buf.toString());
-
- // dump the properties to a temporary file.
- FileUtils futils = FileUtils.newFileUtils();
- File f = futils.createTempFile("junit-antrunner", "tmp", new File("."));
- OutputStream os = null;
- try {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- os = new BufferedOutputStream(new FileOutputStream(f));
- props.store(baos, "JUnit Ant Runner configuration file");
- log(baos.toString(), Project.MSG_VERBOSE);
- os.write(baos.toByteArray());
- } catch (IOException e) {
- throw new BuildException(e);
- } finally {
- if (os != null) {
- try {
- os.close();
- } catch (IOException e) {
- }
- }
- }
-
- // configure the runner
- cmd.createArgument().setValue("-file");
- cmd.createArgument().setValue(f.getAbsolutePath());
- return f;
- }
-
-// --- Ant bean setters
-
- /** set the port to connect to */
- public void setPort(int value) {
- port = value;
- }
-
- /** set the host to contact */
- public void setHost(String value) {
- host = value;
- }
-
- /** set debug mode for the runner. it will log a file to working dir */
- public void setDebug(boolean flag) {
- debug = flag;
- }
-
- /** Create a new JVM argument. */
- public Commandline.Argument createJvmarg() {
- return cmd.createVmArgument();
- }
-
- /** classpath to be set for running tests */
- public Path createClasspath() {
- return cmd.createClasspath(getProject());
- }
-
- /** add a single test element */
- public void addConfiguredTest(TestElement value) {
- testCollectors.add(value);
- }
-
- /** add a batch test element */
- public void addConfiguredBatchTest(BatchTestElement value) {
- // add the classpath of batchtest to cmd classpath
- Path path = value.getPath();
- cmd.getClasspath().append(path);
- testCollectors.add(value);
- }
-
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/CompoundEnumeration.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/CompoundEnumeration.java
deleted file mode 100644
index 1f848915a..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/CompoundEnumeration.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.util.Enumeration;
-import java.util.NoSuchElementException;
-
-/**
- * Convenient enumeration over an array of enumeration. For example:
- *
- * Enumeration e1 = v1.elements();
- * while (e1.hasMoreElements()){
- * // do something
- * }
- * Enumeration e2 = v2.elements();
- * while (e2.hasMoreElements()){
- * // do the same thing
- * }
- *
- * can be written as:
- *
- * Enumeration[] enums = { v1.elements(), v2.elements() };
- * Enumeration e = Enumerations.fromCompound(enums);
- * while (e.hasMoreElements()){
- * // do something
- * }
- *
- * Note that the enumeration will skip null elements in the array. The following is
- * thus possible:
- *
- * Enumeration[] enums = { v1.elements(), null, v2.elements() }; // a null enumeration in the array
- * Enumeration e = Enumerations.fromCompound(enums);
- * while (e.hasMoreElements()){
- * // do something
- * }
- *
- */
-public class CompoundEnumeration implements Enumeration {
-
- /** enumeration array */
- private Enumeration[] enumArray;
-
- /** index in the enums array */
- private int index = 0;
-
- public CompoundEnumeration(Enumeration[] enumarray) {
- this.enumArray = enumarray;
- }
-
- /**
- * Tests if this enumeration contains more elements.
- *
- * @return true if and only if this enumeration object
- * contains at least one more element to provide;
- * false otherwise.
- */
- public boolean hasMoreElements() {
- while (index < enumArray.length) {
- if (enumArray[index] != null && enumArray[index].hasMoreElements()) {
- return true;
- }
- index++;
- }
- return false;
- }
-
- /**
- * Returns the next element of this enumeration if this enumeration
- * object has at least one more element to provide.
- *
- * @return the next element of this enumeration.
- * @throws NoSuchElementException if no more elements exist.
- */
- public Object nextElement() throws NoSuchElementException {
- if (hasMoreElements()) {
- return enumArray[index].nextElement();
- }
- throw new NoSuchElementException();
- }
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/FilterElement.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/FilterElement.java
deleted file mode 100644
index 632ce42aa..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/FilterElement.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.lang.reflect.Constructor;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.optional.rjunit.formatter.FilterFormatter;
-import org.apache.tools.ant.taskdefs.optional.rjunit.formatter.FilterStackFormatter;
-import org.apache.tools.ant.taskdefs.optional.rjunit.formatter.Formatter;
-import org.apache.tools.ant.types.EnumeratedAttribute;
-
-/**
- * A filter element that can be used inside a ResultFormatterElement to denote
- * a filtering. Note that the filtering order correspond to the element
- * order. The first element being the top filter, the last element
- * being the bottom filter.
- *
- *
- *
- *
- *
- *
- *
- */
-public class FilterElement {
-
- /** filter classname, is should inherit from FilterFormatter */
- private String classname;
-
- /**
- * Called by introspection on type attribute.
- * @see FilterAttribute
- */
- public void setType(FilterAttribute fa) {
- setClassName(fa.getClassName());
- }
-
- /**
- * Called by introspection on classname attribute.
- * It must inherit from FilterFormatter
- * @see FilterFormatter
- */
- public void setClassName(String name) {
- classname = name;
- }
-
- /**
- * Wrap this filter around a given formatter.
- * @throws BuildException if any error happens when creating this filter.
- */
- public Formatter createFilterFormatter(Formatter f) throws BuildException {
- try {
- Class clazz = Class.forName(classname);
- if (!FilterFormatter.class.isAssignableFrom(clazz)) {
- throw new BuildException(clazz + " must be a FilterFormatter.");
- }
- Constructor ctor = clazz.getConstructor(new Class[]{Formatter.class});
- return (Formatter) ctor.newInstance(new Object[]{f});
- } catch (BuildException e) {
- throw e;
- } catch (Exception e) {
- throw new BuildException(e);
- }
- }
-
- /** a predefined set of filters w/ their class mapping */
- public static class FilterAttribute extends EnumeratedAttribute {
- /** the predefined alias for filters */
- private final static String[] VALUES = {"stack"};
-
- /** the class corresponding to the alias (in the same order) */
- private final static String[] CLASSNAMES = {FilterStackFormatter.class.getName()};
-
- public String[] getValues() {
- return VALUES;
- }
-
- /** get the classname matching the alias */
- public String getClassName() {
- return CLASSNAMES[getIndex()];
- }
- }
-
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/JUnitHelper.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/JUnitHelper.java
deleted file mode 100644
index ff12b5cb4..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/JUnitHelper.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.net.URL;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import junit.framework.TestCase;
-
-import org.apache.tools.ant.types.Path;
-
-/**
- * A set of helpers functions to deal with JUnit.
- *
- */
-public final class JUnitHelper {
-
- private final static String SUITE_METHODNAME = "suite";
-
- /**
- * This method parse the output of the method toString()
- * from the TestCase class. The format returned is:
- * name(classname)
- * @return the string corresponding to name.
- */
- public static String getTestName(String text){
- int p1 = text.indexOf('(');
- return text.substring(0, p1);
- }
-
- /**
- * This method parse the output of the method toString()
- * from the TestCase class. The format returned is:
- * name(classname)
- * @return the string corresponding to classname.
- */
- public static String getSuiteName(String text){
- int p1 = text.indexOf('(');
- int p2 = text.indexOf(')', p1);
- return text.substring(p1 + 1, p2);
- }
-
- /**
- * Returns the Test corresponding to to the given class name
- * @param loader classloader to use when loading the class or
- * null for system classloader.
- * @param classname the classname of the test we want to extract.
- * @throws Exception a generic exception
- */
- public static Test getTest(ClassLoader loader, String classname) throws Exception {
- Class clazz = null;
- if (loader == null) {
- clazz = Class.forName(classname);
- } else {
- loader.loadClass(classname);
- }
- return getTest(clazz);
- }
-
-
- /**
- * Extract a test from a given class
- * @param clazz the class to extract a test from.
- */
- public static Test getTest(Class clazz) {
- try {
- Object obj = clazz.newInstance();
- if (obj instanceof TestSuite) {
- return (TestSuite) obj;
- }
- } catch (Exception e) {
- }
- try {
- // check if there is a suite method
- Method suiteMethod = clazz.getMethod(SUITE_METHODNAME, new Class[0]);
- return (Test) suiteMethod.invoke(null, new Class[0]);
- } catch (Exception e) {
- }
-
- // check if it is really a valid testcase
- int modifiers = clazz.getModifiers();
- if ( !Modifier.isPublic(modifiers) ||
- Modifier.isAbstract(modifiers) ||
- !TestCase.class.isAssignableFrom(clazz)) {
- return null;
- }
- // try to extract a test suite automatically
- // this will generate warnings if the class is no suitable Test
- try {
- return new TestSuite(clazz);
- } catch (Exception e) {
- }
- return null;
- }
-
- /**
- * Search for the given resource and return the directory or archive
- * that contains it.
- *
- * Doesn't work for archives in JDK 1.1 as the URL returned by
- * getResource doesn't contain the name of the archive.
- *
- * @param resource the resource to look for in the JVM classpath.
- * @return the file or directory containing the resource or
- * null if it does not know how to handle it.
- */
- public static File getResourceEntry(String resource) {
- URL url = JUnitHelper.class.getResource(resource);
- if (url == null) {
- // can't find the resource...
- return null;
- }
- String u = url.toString();
- if (u.startsWith("jar:file:")) {
- int pling = u.indexOf("!");
- String jarName = u.substring(9, pling);
- return new File((new File(jarName)).getAbsolutePath());
- } else if (u.startsWith("file:")) {
- int tail = u.indexOf(resource);
- String dirName = u.substring(5, tail);
- return new File((new File(dirName)).getAbsolutePath());
- }
- // don't know how to handle it...
- return null;
- }
-
- /**
- * Add the entry corresponding to a specific resource to the
- * specified path instance. The entry can either be a directory
- * or an archive.
- * @param path the path to add the resource entry to.
- * @param resource the resource to look for.
- * @see #getResourceEntry(String)
- */
- public static void addClasspathEntry(Path path, String resource) {
- File f = getResourceEntry(resource);
- if (f != null) {
- path.createPathElement().setLocation(f);
- }
- }
-
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/KeepAliveOutputStream.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/KeepAliveOutputStream.java
deleted file mode 100644
index d3ce70679..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/KeepAliveOutputStream.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * Class that can be used to wrap System.out and System.err
- * without getting anxious about the client closing the stream.
- *
- *
- * In code-language it means that it is not necessary to do:
- *
- * if (out != System.out && out!= System.err){
- * out.close();
- * }
- *
- *
- *
- */
-public class KeepAliveOutputStream extends FilterOutputStream {
-
- public KeepAliveOutputStream(OutputStream out) {
- super(out);
- }
-
- /** this method does nothing */
- public void close() throws IOException {
- //
- }
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/OutputAttribute.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/OutputAttribute.java
deleted file mode 100644
index f7f8bb8ad..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/OutputAttribute.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.ProjectComponent;
-
-/**
- * Attempt to create an output specific attribute.
- *
- * The possible output values are 'stdout' and 'stderr', otherwise
- * it is assumed that the value represent a file.
- *
- * Note that stdout and stderr are wrapped by a KeepAliveOutputStream
- * so that the stream cannot be closed.
- *
- * @see KeepAliveOutputStream
- */
-public class OutputAttribute extends ProjectComponent {
-
- /** keyword to represent stdout output */
- public final static String STDOUT = "stdout";
-
- /** keyword to represent stderr output */
- public final static String STDERR = "stderr";
-
- /** the selected value for output, either stdout,stderr or filepath */
- private String value;
-
- /**
- * Create a new output attribute from a value.
- */
- public OutputAttribute(String value) {
- this.value = value;
- }
-
- /**
- * @return the outputstream corresponding to the selected attribute.
- */
- public OutputStream getOutputStream() {
- if (STDOUT.equals(value)) {
- return new KeepAliveOutputStream(System.out);
- } else if (STDERR.equals(value)) {
- return new KeepAliveOutputStream(System.err);
- }
- File f = getProject().resolveFile(value);
- try {
- return new FileOutputStream(f);
- } catch (IOException e) {
- throw new BuildException(e);
- }
- }
-
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/RJUnitTask.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/RJUnitTask.java
deleted file mode 100644
index 955d5e19b..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/RJUnitTask.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-
-/**
- * The core JUnit task.
- *
- */
-public class RJUnitTask extends Task {
-
- private final static Resources RES =
- ResourceManager.getPackageResources(RJUnitTask.class);
-
- /** port to run the server on */
- private int port = -1;
-
- /** timeout period in ms */
- private long timeout = -1;
-
- /** client configuraiton element */
- private ClientElement client = null;
-
- /** server configuration element */
- private ServerElement server = null;
-
-// task implementation
-
- public void execute() throws BuildException {
- if (client == null && server == null) {
- throw new BuildException("Invalid state: need to be server, client or both");
- }
-
- // 1) server and client
- if (server != null && client != null) {
- ServerWorker worker = new ServerWorker();
- worker.start();
- client.execute();
- Exception caught = null;
- try {
- worker.join();
- caught = worker.getException();
- } catch (InterruptedException e){
- caught = e;
- }
- if (caught != null){
- throw new BuildException(caught);
- }
- return;
- }
-
- // 2) server only (waiting for client)
- if (server != null && client == null) {
- server.execute();
- return;
- }
-
- // 3) client only (connecting to server)
- if (server == null && client != null) {
- client.execute();
- return;
- }
- }
-
-// Ant bean accessors
-
- public void setPort(int port) {
- this.port = port;
- }
-
- public void setTimeout(long timeout) {
- this.timeout = timeout;
- }
-
- /**
- * create a new client in charge of running tests and sending
- * the results to the server that collect them.
- */
- public ClientElement createClient() {
- if (client == null) {
- client = new ClientElement(this);
- }
- return client;
- }
-
- /**
- * create a new client in charge of running tests and sending
- * the results to the server that collect them.
- */
- public ServerElement createServer() {
- if (server == null) {
- server = new ServerElement(this);
- }
- return server;
- }
-
-
- /** the worker to run the server on */
- class ServerWorker extends Thread {
- private Exception caught = null;
-
- public void run() {
- try {
- server.execute();
- } catch (Exception e) {
- caught = e;
- e.printStackTrace();
- }
- }
-
- public Exception getException() {
- return caught;
- }
- }
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/Resources.properties b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/Resources.properties
deleted file mode 100644
index 74a470fc6..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/Resources.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-# task
-task.process-cmdline.log = Executing {0}
-task.process-failed.error = Process failed.
\ No newline at end of file
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ResultFormatterElement.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ResultFormatterElement.java
deleted file mode 100644
index a81634d0d..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ResultFormatterElement.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.io.File;
-import java.io.OutputStream;
-import java.util.Properties;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.optional.rjunit.formatter.Formatter;
-import org.apache.tools.ant.types.EnumeratedAttribute;
-
-/**
- * An element representing a Formatter
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * @see RJUnitTask
- * @see Formatter
- */
-public class ResultFormatterElement {
-
- /** output stream for the formatter */
- private OutputStream out = new KeepAliveOutputStream(System.out);
-
- /** formatter classname */
- private String classname;
-
- /** the filters to apply to this formatter */
- private Vector filters = new Vector();
-
- /** the parameters set for configuration purposes */
- private Vector params = new Vector();
-
- /**
- * set an existing type of formatter.
- * @see TypeAttribute
- * @see #setClassname(String)
- */
- public void setType(TypeAttribute type) {
- setClassname(type.getClassName());
- }
-
- /**
- * Set name of class to be used as the formatter.
- *
- *
This class must implement Formatter
- */
- public void setClassname(String classname) {
- this.classname = classname;
- }
-
- /**
- * Setting a comma separated list of filters in the specified order.
- * @see #addFilter(FilterElement)
- */
- public void setFilters(String filters) {
- StringTokenizer st = new StringTokenizer(filters, ",");
- while (st.hasMoreTokens()) {
- FilterElement fe = new FilterElement();
- FilterElement.FilterAttribute fa = new FilterElement.FilterAttribute();
- fa.setValue(st.nextToken());
- fe.setType(fa);
- addFilter(fe);
- }
- }
-
- /**
- * Add a filter to this formatter.
- */
- public void addFilter(FilterElement fe) {
- filters.addElement(fe);
- }
-
- /**
- * Add a parameter that can be used for configuration.
- */
- public void addParam(Parameter param) {
- params.addElement(param);
- }
-
- /**
- * Set whether the formatter should log to file.
- */
- public void setOutput(OutputAttribute output) {
- this.out = output.getOutputStream();
- }
-
- /**
- * create the Formatter corresponding to this element.
- */
- protected Formatter createFormatter() throws BuildException {
- if (classname == null) {
- throw new BuildException("you must specify type or classname");
- }
- Formatter f = null;
- try {
- Class clazz = Class.forName(classname);
- if (!Formatter.class.isAssignableFrom(clazz)) {
- throw new BuildException(clazz + " is not a Formatter");
- }
- f = (Formatter) clazz.newInstance();
- } catch (BuildException e) {
- throw e;
- } catch (Exception e) {
- throw new BuildException(e);
- }
-
- // wrap filters in the reverse order: first = top, last = bottom.
- for (int i = filters.size() - 1; i >= 0; i--) {
- FilterElement fe = (FilterElement) filters.elementAt(i);
- f = fe.createFilterFormatter(f);
- }
-
- // create properties from parameters
- Properties props = new Properties();
- for (int i = 0; i < params.size(); i++) {
- Parameter param = (Parameter) params.elementAt(i);
- props.put(param.getName(), param.getValue());
- }
- // it is assumed here that the filters are chaining til the
- // wrapped formatter.
- f.init(props);
- return f;
- }
-
- /**
- *
Enumerated attribute with the values "plain", "xml" and "brief".
- *
Use to enumerate options for type attribute.
- */
- public final static class TypeAttribute extends EnumeratedAttribute {
- private final static String[] VALUES = {"plain", "xml", "brief"};
- private final static String[] CLASSNAMES = {
- "org.apache.tools.ant.taskdefs.optional.rjunit.formatter.PlainFormatter",
- "org.apache.tools.ant.taskdefs.optional.rjunit.formatter.XMLFormatter",
- "org.apache.tools.ant.taskdefs.optional.rjunit.formatter.BriefFormatter"
- };
-
- public String[] getValues() {
- return VALUES;
- }
-
- public String getClassName() {
- return CLASSNAMES[getIndex()];
- }
- }
-
- /** a parameter that be used to configure a formatter */
- public final static class Parameter {
- private String name;
- private String value;
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setLocation(File file) {
- setValue(file.getAbsolutePath());
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getName() {
- return this.name;
- }
-
- public String getValue() {
- return this.value;
- }
- }
-}
-
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ServerElement.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ServerElement.java
deleted file mode 100644
index ec455305e..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ServerElement.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.io.IOException;
-import java.util.ArrayList;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.ProjectComponent;
-import org.apache.tools.ant.taskdefs.optional.rjunit.formatter.Formatter;
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.Server;
-
-/**
- * An element representing the server configuration.
- *
- *
- *
- *
- *
- *
- *
- *
- */
-public final class ServerElement extends ProjectComponent {
-
- /** formatters that write the tests results */
- private ArrayList formatters = new ArrayList();
-
- /** port to run the server on. Default to 6666 */
- private int port = 6666;
-
- /** stop the client run if a failure occurs */
- private boolean haltOnFailure = false;
-
- /** stop the client run if an error occurs */
- private boolean haltOnError = false;
-
- /** the parent task */
- private RJUnitTask parent;
-
- private Server server;
-
- /** create a new server */
- public ServerElement(RJUnitTask value) {
- parent = value;
- }
-
- /** start the server and block until client has finished */
- public void execute() throws BuildException {
- // configure the server...
- server = new Server(port);
- final int formatterCount = formatters.size();
- for (int i = 0; i < formatterCount; i++) {
- final Formatter f = (Formatter) formatters.get(i);
- server.addListener(f);
- }
-
- // and run it. It will stop once a client has finished.
- try {
- server.start(false); // do not loop
- } catch (IOException e) {
- throw new BuildException(e);
- } finally {
- server.shutdown();
- }
- }
-
- /** set the port to listen to */
- public void setPort(int value) {
- port = value;
- }
-
-//@fixme logic problem here, should the server say to the client
-// that there it should stop or should the client do it itself ?
-
- public void setHaltOnFailure(boolean value) {
- haltOnFailure = value;
- }
-
- public void setHaltOnError(boolean value) {
- haltOnError = value;
- }
-
- /** add a new formatter element */
- public void addConfiguredFormatter(ResultFormatterElement fe) {
- Formatter formatter = fe.createFormatter();
- formatters.add(formatter);
- }
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/TestElement.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/TestElement.java
deleted file mode 100644
index 594ed397a..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/TestElement.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.util.Enumeration;
-
-/**
- * A simple test element.
- *
- */
-public class TestElement extends BaseTestElement {
-
- /** classname of JUnit test */
- private String name;
-
-//@fixme, a path is needed for a test.
-
- public Enumeration getTests() {
- return new ArrayEnumeration(new String[]{name});
- }
-
-// Ant bean setters
-
- public void setName(String value) {
- this.name = value;
- }
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/WatchdogTest.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/WatchdogTest.java
deleted file mode 100644
index 18ab9c46a..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/WatchdogTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Jakarta-Regexp", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- *
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import junit.extensions.TestDecorator;
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestResult;
-
-/**
- * A Test decorator that allows to cancel a test if it exceeds
- * a certain time. It can be used globally or individually over
- * each testcase.
- *
- */
-public class WatchdogTest extends TestDecorator {
-
- /** the time out delay in msecs */
- private long timeOut;
-
- /**
- * Create a new watchdog.
- * @param test the test to watch for
- * @param msecs the time out delay in msecs.
- */
- public WatchdogTest(Test test, long msecs) {
- super(test);
- timeOut = msecs;
- }
-
- public void run(TestResult result) {
- Thread worker = createWorker(result);
- worker.start();
-
- try {
- // wait at most the timeOut time.
- worker.join(timeOut);
-
- // if the thread is still alive, it must be killed.
- if (worker.isAlive()) {
- worker.interrupt();
- result.addFailure(getTest(),
- new AssertionFailedError("Timed out after " + timeOut + "ms"));
- }
- } catch (InterruptedException e) {
- worker.interrupt();
- result.addError(getTest(), e);
- result.stop();
- }
- }
-
- /** create a new worker thread */
- protected Thread createWorker(final TestResult result) {
- Thread worker = new Thread("JUnit Test Worker") {
- public void run() {
- getTest().run(result);
- }
- };
- return worker;
- }
-
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ZipScanner.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ZipScanner.java
deleted file mode 100644
index 4fb48364c..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/ZipScanner.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Vector;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import org.apache.tools.ant.DirectoryScanner;
-
-/**
- * Provide a way to scan entries in a zip file. Note that it extends
- * DirectoryScanner to make use of protected methods but implementation
- * may not be valid for some methods.
- *
- * the setBaseDir() must be called to set the reference to the archive
- * file (.jar or .zip).
- *
- *
- */
-public class ZipScanner extends DirectoryScanner {
- public ZipScanner() {
- }
-
- public void setExcludes(String[] excludes) {
- super.setExcludes(excludes);
- normalize(this.excludes);
- }
-
- public void setIncludes(String[] includes) {
- super.setIncludes(includes);
- normalize(this.includes);
- }
-
- /**
- * normalize a set of paths so that it uses / otherwise matching will
- * fail beautifully since archives use / to denote a path.
- */
- protected void normalize(String[] files) {
- if (files != null) {
- for (int i = 0; i < files.length; i++) {
- files[i] = files[i].replace('\\', '/');
- }
- }
- }
-
- /**
- * Scans the archive for files that match at least one include
- * pattern, and don't match any exclude patterns.
- *
- * @exception IllegalStateException when the zip file was set incorrecly
- */
- public void scan() {
- if (basedir == null) {
- throw new IllegalStateException("No zipfile set");
- }
- if (!basedir.exists()) {
- throw new IllegalStateException("zipfile " + basedir
- + " does not exist");
- }
- if (basedir.isDirectory()) {
- throw new IllegalStateException("zipfile " + basedir
- + " is not a file");
- }
-
- if (includes == null) {
- // No includes supplied, so set it to 'matches all'
- includes = new String[1];
- includes[0] = "**";
- }
- if (excludes == null) {
- excludes = new String[0];
- }
-
- filesIncluded = new Vector();
- filesNotIncluded = new Vector();
- filesExcluded = new Vector();
- dirsIncluded = new Vector();
- dirsNotIncluded = new Vector();
- dirsExcluded = new Vector();
-
- if (isIncluded("")) {
- if (!isExcluded("")) {
- dirsIncluded.addElement("");
- } else {
- dirsExcluded.addElement("");
- }
- } else {
- dirsNotIncluded.addElement("");
- }
- scandir(basedir, "", true);
- }
-
- protected void scandir(File file, String vpath, boolean fast) {
- ZipFile zip = null;
- try {
- zip = new ZipFile(file);
- } catch (IOException e) {
- throw new IllegalStateException(e.getMessage());
- }
-
- Enumeration entries = zip.entries();
- while (entries.hasMoreElements()) {
- ZipEntry entry = (ZipEntry) entries.nextElement();
- String name = entry.getName();
- // @fixme do we need to strip out entries that starts
- // with . or ./ ?
- if (entry.isDirectory()) {
- if (isIncluded(name)) {
- if (!isExcluded(name)) {
- dirsIncluded.addElement(name);
- } else {
- everythingIncluded = false;
- dirsExcluded.addElement(name);
- }
- } else {
- everythingIncluded = false;
- dirsNotIncluded.addElement(name);
- }
- } else {
- if (isIncluded(name)) {
- if (!isExcluded(name)) {
- filesIncluded.addElement(name);
- } else {
- everythingIncluded = false;
- filesExcluded.addElement(name);
- }
- } else {
- everythingIncluded = false;
- filesNotIncluded.addElement(name);
- }
- }
- }
- }
-
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/BaseFormatter.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/BaseFormatter.java
deleted file mode 100644
index c359ce500..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/BaseFormatter.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.formatter;
-
-import java.util.Properties;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestRunEvent;
-
-/**
- * Provide a common set of attributes and methods to factorize
- *
- */
-public abstract class BaseFormatter implements Formatter {
-
- public void init(Properties props) throws BuildException {
- }
-
- public void onTestStarted(TestRunEvent evt) {
- }
-
- public void onTestEnded(TestRunEvent evt) {
- }
-
- public void onTestFailure(TestRunEvent evt) {
- }
-
- public void onTestError(TestRunEvent evt) {
- }
-
- public void onSuiteStarted(TestRunEvent evt) {
- }
-
- public void onSuiteEnded(TestRunEvent evt) {
- }
-
- public void onRunStarted(TestRunEvent evt) {
- }
-
- public void onRunEnded(TestRunEvent evt) {
- }
-
- public void onRunStopped(TestRunEvent evt) {
- }
-
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/BaseStreamFormatter.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/BaseStreamFormatter.java
deleted file mode 100644
index cf08b01fa..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/BaseStreamFormatter.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.formatter;
-
-import java.io.BufferedWriter;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.util.Properties;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.optional.rjunit.KeepAliveOutputStream;
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestRunEvent;
-
-/**
- * Base formatter providing default implementation to deal with
- * either stdout or a file.
- *
- * The file is specified by initializing the formatter with
- * a filepath mapped by the key 'file'.
- *
- *
- * if no file key exists in the properties, it defaults to stdout.
- *
- *
- */
-public class BaseStreamFormatter extends BaseFormatter {
-
- /** the key used to specifiy a filepath */
- public final static String FILE_KEY = "file";
-
- /** writer to output the data to */
- private PrintWriter writer;
-
- protected void finalize() throws Throwable {
- super.finalize();
- close();
- }
-
- public void init(Properties props) throws BuildException {
- String file = props.getProperty(FILE_KEY);
- OutputStream os = null;
- if (file != null) {
- try {
- // fixme need to resolve the file !!!!
- os = new FileOutputStream(file);
- } catch (IOException e) {
- throw new BuildException(e);
- }
- } else {
- os = new KeepAliveOutputStream(System.out);
- }
- setOutput(os);
- }
-
- /**
- * Helper method to wrap the stream over an UTF8 buffered writer.
- */
- protected void setOutput(OutputStream value) {
- try {
- // do not buffer but flush each line.
- writer = new PrintWriter(new OutputStreamWriter(value, "UTF8"), true);
- } catch (IOException e) {
- // should not happen
- throw new BuildException(e);
- }
- }
-
- public void onRunEnded(TestRunEvent evt) {
- close();
- }
-
- protected void close() {
- if (writer != null) {
- writer.flush();
- writer.close();
- }
- }
-
- /**
- * @return the writer used to print data.
- */
- protected final PrintWriter getWriter() {
- return writer;
- }
-
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/BriefFormatter.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/BriefFormatter.java
deleted file mode 100644
index 00303d45d..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/BriefFormatter.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.formatter;
-
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestRunEvent;
-
-/**
- * Display additional messages from a SummaryFormatter
- * for failures and errors.
- *
- */
-public class BriefFormatter extends SummaryFormatter {
-
- private final static Resources RES =
- ResourceManager.getPackageResources(BriefFormatter.class);
-
- public void onTestFailure(TestRunEvent evt) {
- String msg = RES.getString("brief.status-failure.msg", evt.getName(),
- evt.getError().getStackTrace());
- getWriter().println(msg);
- super.onTestFailure(evt);
- }
-
- public void onTestError(TestRunEvent evt) {
- String msg = RES.getString("brief.status-error.msg", evt.getName(),
- evt.getError().getStackTrace());
- getWriter().println(msg);
- super.onTestError(evt);
- }
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/FilterFormatter.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/FilterFormatter.java
deleted file mode 100644
index bf99d70a8..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/FilterFormatter.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.formatter;
-
-import java.util.Properties;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestRunEvent;
-
-/**
- * A base class that can be used to filter data.
- *
- */
-public abstract class FilterFormatter implements Formatter {
-
- private Formatter formatter;
-
- protected FilterFormatter(Formatter formatter) {
- setFormatter(formatter);
- }
-
- /** final to enforce chaining of initialization */
- public final void init(Properties props) throws BuildException {
- formatter.init(props);
- }
-
- public void onSuiteStarted(TestRunEvent evt) {
- formatter.onSuiteStarted(evt);
- }
-
- public void onSuiteEnded(TestRunEvent evt) {
- formatter.onSuiteEnded(evt);
- }
-
- public void onTestStarted(TestRunEvent evt) {
- formatter.onTestStarted(evt);
- }
-
- public void onTestEnded(TestRunEvent evt) {
- formatter.onTestEnded(evt);
- }
-
- public void onTestFailure(TestRunEvent evt) {
- formatter.onTestFailure(evt);
- }
-
- public void onTestError(TestRunEvent evt) {
- formatter.onTestError(evt);
- }
-
- public void onRunStarted(TestRunEvent evt) {
- formatter.onRunStarted(evt);
- }
-
- public void onRunEnded(TestRunEvent evt) {
- formatter.onRunEnded(evt);
- }
-
- public void onRunStopped(TestRunEvent evt) {
- formatter.onRunEnded(evt);
- }
-
- /** set the wrapped formatter */
- protected void setFormatter(Formatter value) {
- formatter = value;
- }
-
- /** return the wrapped formatter */
- protected Formatter getFormatter() {
- return formatter;
- }
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/FilterStackFormatter.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/FilterStackFormatter.java
deleted file mode 100644
index a5cb917a1..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/FilterStackFormatter.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.formatter;
-
-import java.util.StringTokenizer;
-
-import org.apache.tools.ant.util.StringUtils;
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestRunEvent;
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.ExceptionData;
-
-/**
- * Filtered Formatter that strips out unwanted stack frames from the full
- * stack trace, for instance it will filter the lines containing the
- * following matches:
- *
- * junit.framework.TestCase
- * junit.framework.TestResult
- * junit.framework.TestSuite
- * junit.framework.Assert.
- * junit.swingui.TestRunner
- * junit.awtui.TestRunner
- * junit.textui.TestRunner
- * java.lang.reflect.Method.invoke(
- * org.apache.tools.ant.
- *
- * Removing all the above will help to make stacktrace more readable.
- *
- */
-public class FilterStackFormatter extends FilterFormatter {
-
- /** the set of matches to look for in a stack trace */
- private final static String[] DEFAULT_TRACE_FILTERS = new String[]{
- "junit.framework.TestCase",
- "junit.framework.TestResult",
- "junit.framework.TestSuite",
- "junit.framework.Assert.", // don't filter AssertionFailure
- "junit.swingui.TestRunner",
- "junit.awtui.TestRunner",
- "junit.textui.TestRunner",
- "java.lang.reflect.Method.invoke(",
- "org.apache.tools.ant."
- };
-
- private final String[] filters = getFilters();
-
- /**
- * Creates a new FilterStackFormatter
- * @param formatter the formatter to be filtered.
- */
- public FilterStackFormatter(Formatter formatter) {
- super(formatter);
- }
-
- public void onTestFailure(TestRunEvent evt) {
- filterEvent(evt);
- super.onTestFailure(evt);
- }
-
- public void onTestError(TestRunEvent evt) {
- filterEvent(evt);
- super.onTestFailure(evt);
- }
-
- protected void filterEvent(TestRunEvent evt){
- String filteredTrace = filter(evt.getError().getStackTrace());
- ExceptionData error = new ExceptionData(
- evt.getError().getType(),
- evt.getError().getMessage(),
- filteredTrace);
- evt.setError(error);
- }
-
- protected String filter(String trace){
- StringTokenizer st = new StringTokenizer(trace, "\r\n");
- StringBuffer buf = new StringBuffer(trace.length());
- while (st.hasMoreTokens()) {
- String line = st.nextToken();
- if (accept(line)) {
- buf.append(line).append(StringUtils.LINE_SEP);
- }
- }
- return buf.toString();
- }
- /**
- * Check whether or not the line should be accepted.
- * @param line the line to be check for acceptance.
- * @return true if the line is accepted, false if not.
- */
- protected boolean accept(String line) {
- for (int i = 0; i < filters.length; i++) {
- if (line.indexOf(filters[i]) > 0) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * @return the filters to use for this
- */
- protected static String[] getFilters(){
- // @fixme hack for now, need something better.
- // using configuration properties ?
- String filters = System.getProperty("ant.rjunit.stacktrace.filters");
- if (filters == null){
- return DEFAULT_TRACE_FILTERS;
- }
- StringTokenizer st = new StringTokenizer(filters, ",");
- String[] results = new String[ st.countTokens() ];
- int i = 0;
- while (st.hasMoreTokens()){
- results[i++] = st.nextToken();
- }
- return results;
- }
-
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/Formatter.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/Formatter.java
deleted file mode 100644
index 258a2ddce..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/Formatter.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.formatter;
-
-import java.util.Properties;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestRunListener;
-
-/**
- * The formatter interface.
- *
- */
-public interface Formatter extends TestRunListener {
- /**
- * Initialize the formatter with some custom properties
- * For example it could be a filename, a port and hostname,
- * a database, etc...
- */
- public void init(Properties props) throws BuildException;
-
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/PlainFormatter.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/PlainFormatter.java
deleted file mode 100644
index 97573222a..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/PlainFormatter.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.formatter;
-
-import java.util.Properties;
-
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestRunEvent;
-
-/**
- * Default formatter to text.
- *
- */
-public class PlainFormatter extends BaseStreamFormatter {
-
- public void onSuiteStarted(TestRunEvent evt) {
- getWriter().println(" suite: " + evt.getName());
- super.onSuiteStarted(evt);
- }
-
- public void onSuiteEnded(TestRunEvent evt) {
- getWriter().println(" end suite");
- super.onSuiteEnded(evt);
- }
-
- public void onTestStarted(TestRunEvent evt) {
- getWriter().println(" running test: " + evt.getName());
- }
-
- public void onTestEnded(TestRunEvent evt) {
- getWriter().println(" success: " + evt.getName());
- }
-
- public void onTestFailure(TestRunEvent evt) {
- getWriter().println(" failure: " + evt.getName());
- getWriter().println(evt.getError().getStackTrace());
- }
-
- public void onTestError(TestRunEvent evt) {
- getWriter().println(" error: " + evt.getName());
- getWriter().println(evt.getError().getStackTrace());
- }
-
- public void onRunEnded(TestRunEvent evt) {
- getWriter().println("run ended");
- }
-
- public void onRunStopped(TestRunEvent evt) {
- getWriter().println("run stopped");
- }
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/Resources.properties b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/Resources.properties
deleted file mode 100644
index 9ffd8a569..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/Resources.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-# Summary formatter
-suite.summary.msg = TestSuite: {0}\nTests run: {1, number, integer}, Failures: {2, number, integer}, Errors: {3, number, integer}, Time elapsed: {4, number, integer}s\n
-run.summary.msg=Summary Tests run: {0, number, integer}, Failures: {1, number, integer}, Errors: {2, number, integer}, Time elapsed: {3, number, integer}s
-
-# Brief formatter
-brief.status-error.msg = TestCase: {0}\tCaused an ERROR\n{1}\n
-brief.status-failure.msg = TestCase: {0}\tFAILED\n{1}\n
-
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/SummaryFormatter.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/SummaryFormatter.java
deleted file mode 100644
index 35791852b..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/SummaryFormatter.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.formatter;
-
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestRunEvent;
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestSummary;
-
-/**
- * Display a summary message at the end of a testsuite stating
- * runs, failures, errors, and elapsed time.
- *
- */
-public class SummaryFormatter extends BaseStreamFormatter {
-
- private final static Resources RES =
- ResourceManager.getPackageResources(SummaryFormatter.class);
-
- public void onSuiteEnded(TestRunEvent evt) {
- TestSummary summary = evt.getSummary();
- String msg = RES.getString("suite.summary.msg",
- evt.getName(),
- new Integer(summary.runCount()),
- new Integer(summary.failureCount()),
- new Integer(summary.errorCount()),
- new Long(summary.elapsedTime()/1000));
- getWriter().println(msg);
- }
-
- public void onRunEnded(TestRunEvent evt) {
- TestSummary summary = evt.getSummary();
- String msg = RES.getString("run.summary.msg",
- new Integer(summary.runCount()),
- new Integer(summary.failureCount()),
- new Integer(summary.errorCount()),
- new Long(summary.elapsedTime()/1000));
- getWriter().println(msg);
- }
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/XMLFormatter.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/XMLFormatter.java
deleted file mode 100644
index 90a9712ad..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/XMLFormatter.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.formatter;
-
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Properties;
-import java.util.Date;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Text;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.optional.rjunit.JUnitHelper;
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestRunEvent;
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestSummary;
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.ExceptionData;
-import org.apache.tools.ant.util.DOMElementWriter;
-import org.apache.tools.ant.util.DateUtils;
-import org.apache.tools.ant.util.StringUtils;
-
-/**
- * XML Formatter. Due to the nature of the XML we are forced to store
- * everything in memory until it is finished. It might be resource
- * intensive when running lots of testcases.
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- */
-public class XMLFormatter extends BaseStreamFormatter {
-
- /** the testsuites element for the aggregate document */
- public final static String TESTSUITES = "testsuites";
-
- /** the testsuite element */
- public final static String TESTSUITE = "testsuite";
-
- /** the testcase element */
- public final static String TESTCASE = "testcase";
-
- /** the error element */
- public final static String ERROR = "error";
-
- /** the failure element */
- public final static String FAILURE = "failure";
-
- /** the system-err element */
- public final static String SYSTEM_ERR = "system-err";
-
- /** the system-out element */
- public final static String SYSTEM_OUT = "system-out";
-
- /** package attribute for the aggregate document */
- public final static String ATTR_PACKAGE = "package";
-
- /** name attribute for property, testcase and testsuite elements */
- public final static String ATTR_NAME = "name";
-
- /** time attribute for testcase and testsuite elements */
- public final static String ATTR_TIME = "time";
-
- /** errors attribute for testsuite elements */
- public final static String ATTR_ERRORS = "errors";
-
- /** failures attribute for testsuite elements */
- public final static String ATTR_FAILURES = "failures";
-
- /** tests attribute for testsuite elements */
- public final static String ATTR_TESTS = "tests";
-
- /** type attribute for failure and error elements */
- public final static String ATTR_TYPE = "type";
-
- /** message attribute for failure elements */
- public final static String ATTR_MESSAGE = "message";
-
- /** the properties element */
- public final static String PROPERTIES = "properties";
-
- /** the property element */
- public final static String PROPERTY = "property";
-
- /** value attribute for property elements */
- public final static String ATTR_VALUE = "value";
-
- /** The XML document. */
- private Document doc = getDocumentBuilder().newDocument();
-
- /** The wrapper for the whole testsuite. */
- private Element rootElement = doc.createElement(TESTSUITES);
-
- private Element lastTestElement = null;
- private TestRunEvent lastTestEvent = null;
- private Element lastSuiteElement = null;
- private long programStart;
-
- public void onSuiteStarted(TestRunEvent evt) {
- String fullclassname = evt.getName();
- int pos = fullclassname.lastIndexOf('.');
-
- // a missing . might imply no package at all. Don't get fooled.
- String pkgName = (pos == -1) ? "" : fullclassname.substring(0, pos);
- String classname = (pos == -1) ? fullclassname : fullclassname.substring(pos + 1);
-
- Element suite = doc.createElement(TESTSUITE);
- suite.setAttribute(ATTR_NAME, classname);
- suite.setAttribute(ATTR_PACKAGE, pkgName);
- rootElement.appendChild(suite);
- lastSuiteElement = suite;
- }
-
- public void onSuiteEnded(TestRunEvent evt) {
- Element suite = lastSuiteElement;
- TestSummary summary = evt.getSummary();
- suite.setAttribute(ATTR_TIME, String.valueOf(summary.elapsedTime()/1000.0f));
- suite.setAttribute(ATTR_TESTS, String.valueOf(summary.runCount()));
- suite.setAttribute(ATTR_FAILURES, String.valueOf(summary.failureCount()));
- suite.setAttribute(ATTR_ERRORS, String.valueOf(summary.errorCount()));
- lastSuiteElement = null;
- }
-
- public void onRunEnded(TestRunEvent evt) {
- final String elapsedTime = String.valueOf(evt.getTimeStamp() - programStart);
- rootElement.setAttribute("elapsed_time", elapsedTime);
- // Output properties
- final Element propsElement = doc.createElement(PROPERTIES);
- rootElement.appendChild(propsElement);
- final Properties props = evt.getProperties();
- if (props != null) {
- Enumeration e = props.propertyNames();
- while (e.hasMoreElements()) {
- String name = (String) e.nextElement();
- Element propElement = doc.createElement(PROPERTY);
- propElement.setAttribute(ATTR_NAME, name);
- propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
- propsElement.appendChild(propElement);
- }
- }
- close();
- }
-
- public void onRunStarted(TestRunEvent evt) {
- programStart = evt.getTimeStamp();
- final String date = DateUtils.format(programStart, DateUtils.ISO8601_DATETIME_PATTERN);
- rootElement.setAttribute("program_start", date);
- }
-
- public void onRunStopped(TestRunEvent evt) {
- rootElement.setAttribute("stopped", "true");
- onRunEnded(evt);
- }
-
- public void onTestStarted(TestRunEvent evt) {
- Element test = doc.createElement(TESTCASE);
- String name = JUnitHelper.getTestName(evt.getName());
- test.setAttribute(ATTR_NAME, name);
- String suiteName = JUnitHelper.getSuiteName(evt.getName());
- String lastSuiteName = lastSuiteElement.getAttribute(ATTR_PACKAGE)
- + "." + lastSuiteElement.getAttribute(ATTR_NAME);
- if ( !suiteName.equals(lastSuiteName) ){
- throw new BuildException("Received testcase from test "
- + suiteName + " and was expecting "
- + lastSuiteElement.getAttribute("name"));
- }
- lastSuiteElement.appendChild(test);
- lastTestElement = test;
- lastTestEvent = evt;
- }
-
- public void onTestEnded(TestRunEvent evt) {
- // with a TestSetup, startTest and endTest are not called.
- if (lastTestEvent == null) {
- onTestStarted(evt);
- }
- float time = (evt.getTimeStamp() - lastTestEvent.getTimeStamp()) / 1000.0f;
- lastTestElement.setAttribute(ATTR_TIME, Float.toString(time));
- lastTestElement = null;
- lastTestEvent = null;
- }
-
- public void onTestError(TestRunEvent evt) {
- onTestFailure(evt);
- }
-
- public void onTestFailure(TestRunEvent evt) {
- String type = evt.getType() == TestRunEvent.TEST_FAILURE ? FAILURE : ERROR;
- Element nested = doc.createElement(type);
- lastTestElement.appendChild(nested);
- ExceptionData error = evt.getError();
- nested.setAttribute(ATTR_MESSAGE, error.getMessage());
- nested.setAttribute(ATTR_TYPE, error.getType());
- Text text = doc.createTextNode(error.getStackTrace());
- nested.appendChild(text);
- onTestEnded(evt);
- }
-
- protected void close() {
- // the underlying writer uses UTF8 encoding
- getWriter().println("");
- String now = DateUtils.format(new Date(), DateUtils.ISO8601_DATETIME_PATTERN);
- rootElement.setAttribute("snapshot_created", now);
- try {
- final DOMElementWriter domWriter = new DOMElementWriter();
- domWriter.write(rootElement, getWriter(), 0, " ");
- } catch (IOException e) {
- throw new BuildException(e);
- } finally {
- super.close();
- }
- }
-
- private static DocumentBuilder getDocumentBuilder() {
- try {
- return DocumentBuilderFactory.newInstance().newDocumentBuilder();
- } catch (Exception exc) {
- throw new ExceptionInInitializerError(exc);
- }
- }
-
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/EventDispatcher.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/EventDispatcher.java
deleted file mode 100644
index c3eccfca7..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/EventDispatcher.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.remote;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-/**
- * Dispatch messages to appropriate listener methode based on event id.
- *
- */
-public class EventDispatcher {
-
- private final static HashMap eventMap = new HashMap(3);
-
- static {
- registerDefaults();
- }
-
- /** the set of registered listeners */
- private ArrayList listeners = new ArrayList();
-
- /**
- * Add a new listener.
- * @param listener a listener that will receive events from the client.
- */
- public void addListener(TestRunListener listener) {
- listeners.add(listener);
- }
-
- public void removeListener(TestRunListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * Process a message from the client and dispatch the
- * appropriate message to the listeners.
- */
- public void dispatchEvent(TestRunEvent evt) {
- final Integer type = new Integer(evt.getType());
- final EventAction action = (EventAction) eventMap.get(type);
- if (action == null) {
- return;
- }
- synchronized (listeners) {
- final int count = listeners.size();
- for (int i = 0; i < count; i++) {
- TestRunListener listener = (TestRunListener) listeners.get(i);
- action.dispatch(listener, evt);
- }
- }
- }
-
- private static void registerDefaults() {
- registerAction(TestRunEvent.RUN_STARTED, new RunStartedAction());
- registerAction(TestRunEvent.RUN_ENDED, new RunEndedAction());
- registerAction(TestRunEvent.TEST_STARTED, new TestStartedAction());
- registerAction(TestRunEvent.TEST_ENDED, new TestEndedAction());
- registerAction(TestRunEvent.TEST_FAILURE, new TestFailureAction());
- registerAction(TestRunEvent.TEST_ERROR, new TestErrorAction());
- registerAction(TestRunEvent.SUITE_STARTED, new SuiteStartedAction());
- registerAction(TestRunEvent.SUITE_ENDED, new SuiteEndedAction());
- registerAction(TestRunEvent.RUN_STOPPED, new RunStoppedAction());
- }
-
- private static void registerAction(int id, EventAction action){
- eventMap.put(new Integer(id), action);
- }
-
- public interface EventAction {
- public void dispatch(TestRunListener listener, TestRunEvent evt);
- }
-
- private static class RunStartedAction implements EventAction {
- public void dispatch(TestRunListener listener, TestRunEvent evt) {
- listener.onRunStarted(evt);
- }
- }
-
- private static class RunEndedAction implements EventAction {
- public void dispatch(TestRunListener listener, TestRunEvent evt) {
- listener.onRunEnded(evt);
- }
- }
-
- private static class TestStartedAction implements EventAction {
- public void dispatch(TestRunListener listener, TestRunEvent evt) {
- listener.onTestStarted(evt);
- }
- }
-
- private static class TestEndedAction implements EventAction {
- public void dispatch(TestRunListener listener, TestRunEvent evt) {
- listener.onTestEnded(evt);
- }
- }
-
- private static class TestFailureAction implements EventAction {
- public void dispatch(TestRunListener listener, TestRunEvent evt) {
- listener.onTestFailure(evt);
- }
- }
-
- private static class TestErrorAction implements EventAction {
- public void dispatch(TestRunListener listener, TestRunEvent evt) {
- listener.onTestError(evt);
- }
- }
-
- private static class SuiteStartedAction implements EventAction {
- public void dispatch(TestRunListener listener, TestRunEvent evt) {
- listener.onSuiteStarted(evt);
- }
- }
-
- private static class SuiteEndedAction implements EventAction {
- public void dispatch(TestRunListener listener, TestRunEvent evt) {
- listener.onSuiteEnded(evt);
- }
- }
-
- private static class RunStoppedAction implements EventAction {
- public void dispatch(TestRunListener listener, TestRunEvent evt) {
- listener.onRunStopped(evt);
- }
- }
-
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/ExceptionData.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/ExceptionData.java
deleted file mode 100644
index 19b80fb2f..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/ExceptionData.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.remote;
-
-import java.io.Serializable;
-
-import org.apache.tools.ant.util.StringUtils;
-
-/**
- * A wrapper around an exception since an exception stacktrace is
- * not serializable.
- *
- */
-public class ExceptionData implements Serializable {
-
- /** the stacktrace of the exception */
- private final String stacktrace;
-
- /** the classname of an exception */
- private final String type;
-
- /** the message associated to this exception */
- private final String message;
-
- /**
- * Create a new error.
- * @param exception the exception to run as
- */
- public ExceptionData(Throwable exception) {
- this(exception.getClass().getName(),
- exception.getMessage(),
- StringUtils.getStackTrace(exception));
- }
-
- /**
- * Create a new error.
- * @param type the type of the error (ie classname).
- * @param message the message associated to this error.
- * @param stacktrace the full stacktrace of this error.
- */
- public ExceptionData(String type, String message, String stacktrace) {
- this.stacktrace = stacktrace;
- this.type = type;
- this.message = message;
- }
-
- /**
- * @return the type of the error (ie classname)
- */
- public String getType() {
- return type;
- }
-
- /**
- * @return the message associated to this error.
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * @return the stacktrace for this error.
- */
- public String getStackTrace() {
- return stacktrace;
- }
-
- public boolean equals(Object o){
- if ( o instanceof ExceptionData ){
- ExceptionData other = (ExceptionData)o;
- return ( ( type == null ? other.type == null : type.equals(other.type) ) &&
- ( message == null ? other.message == null : message.equals(other.message) ) &&
- ( stacktrace == null ? other.stacktrace == null : stacktrace.equals(other.stacktrace) ) );
- }
- return false;
- }
-
- public String toString() {
- return (message != null) ? (type + ": " + message) : type;
- }
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/Messenger.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/Messenger.java
deleted file mode 100644
index 75f68cdf6..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/Messenger.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.remote;
-
-import java.io.OutputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-/**
- * Read or write events to/from appropriate streams.
- *
- */
-public class Messenger {
-
- private InputStream in;
-
- private OutputStream out;
-
- public Messenger(InputStream in, OutputStream out) throws IOException {
- setOutputStream( new ObjectOutputStream(out) );
- setInputStream( new ObjectInputStream(in) );
- }
-
- protected void finalize() throws Throwable {
- close();
- }
-
- public void close() throws IOException {
- if (out != null) {
- out.flush();
- out.close();
- out = null;
- }
- if (in != null) {
- in.close();
- in = null;
- }
- }
-
- public TestRunEvent read() {
- try {
- return (TestRunEvent)((ObjectInputStream)in).readObject();
- } catch (Exception e){
- return null;
- }
- }
-
- public void writeEvent(TestRunEvent evt) throws IOException {
- ((ObjectOutputStream)out).writeObject(evt);
- }
-
- protected OutputStream getOutputStream(){
- return out;
- }
-
- protected InputStream getInputStream(){
- return in;
- }
-
- protected void setOutputStream(OutputStream out){
- this.out = out;
- }
-
- protected void setInputStream(InputStream in){
- this.in = in;
- }
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/Server.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/Server.java
deleted file mode 100644
index 67662f6a5..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/Server.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.remote;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.Socket;
-
-/**
- * The server that will receive events from a remote client.
- *
- *
- * This code is based on the code from Erich Gamma made for the
- * JUnit plugin for Eclipse and is
- * merged with code originating from Ant 1.4.x.
- *
- *
- * @see TestRunner
- */
-public class Server {
-
- /** the port where the server is listening */
- private int port = -1;
-
- /** the server socket */
- private ServerSocket server;
-
- /** the client that is connected to the server */
- private Socket client;
-
- /** the reader in charge of interpreting messages from the client */
- private Messenger messenger;
-
- private EventDispatcher dispatcher = new EventDispatcher();
-
- public Server(int port) {
- this.port = port;
- }
-
- protected void finalize() throws Exception {
- cancel();
- shutdown();
- }
-
- /**
- * add a new listener
- * @param listener a instance of a listener.
- */
- public void addListener(TestRunListener listener) {
- dispatcher.addListener(listener);
- }
-
- /**
- * remove an existing listener
- * @param listener a instance of a listener.
- */
- public void removeListener(TestRunListener listener) {
- dispatcher.removeListener(listener);
- }
-
- /** return whether there is a client running or not */
- public synchronized boolean isRunning() {
- return client != null && server != null && messenger != null;
- }
-
- /** start a server to the specified port */
- public void start(boolean loop) throws IOException {
- server = new ServerSocket(port);
- while (server != null) {
- client = server.accept();
- messenger = new Messenger(client.getInputStream(), client.getOutputStream());
- TestRunEvent evt = null;
- try {
- while ( (evt = messenger.read()) != null ) {
- dispatcher.dispatchEvent(evt);
- }
- } catch (Exception e){
- e.printStackTrace();
- //@fixme this stacktrace might be normal when closing
- // the socket. So decompose the above in distinct steps
- }
- if (!loop){
- break;
- }
- }
- }
-
- /** cancel the connection to the client */
- public synchronized void cancel() {
- if (isRunning()) {
- TestRunEvent evt = new TestRunEvent(new Integer(-1), TestRunEvent.RUN_STOP);
- try {
- messenger.writeEvent(evt);
- } catch (IOException e){
- }
- }
- }
-
- /** shutdown the server and any running client */
- public synchronized void shutdown() {
- try {
- if (messenger != null) {
- messenger.close();
- messenger = null;
- }
- } catch (IOException e){
- }
- try {
- if (client != null) {
- client.shutdownInput();
- client.shutdownOutput();
- client.close();
- client = null;
- }
- } catch (IOException e) {
- }
- try {
- if (server != null) {
- server.close();
- server = null;
- }
- } catch (IOException e) {
- }
- }
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestRunEvent.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestRunEvent.java
deleted file mode 100644
index d4e884bb4..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestRunEvent.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.remote;
-
-import java.util.EventObject;
-import java.util.Properties;
-
-import org.apache.tools.ant.util.StringUtils;
-
-/**
- * Provide the basic events to be used during the tests.
- * This is not very extensible but since the events should be somewhat
- * limited, for now this is better to do it like this.
- *
- */
-public class TestRunEvent extends EventObject {
-
- // received from clients
- public final static int RUN_STARTED = 0;
- public final static int RUN_ENDED = 1;
- public final static int RUN_STOPPED = 2;
- public final static int TEST_STARTED = 3;
- public final static int TEST_FAILURE = 4;
- public final static int TEST_ERROR = 5;
- public final static int TEST_ENDED = 6;
- public final static int SUITE_STARTED = 7;
- public final static int SUITE_ENDED = 8;
-
- // received from server
- public final static int RUN_STOP = 9;
-
- /** the type of event */
- private int type = -1;
-
- /** timestamp for all events */
- private long timestamp = System.currentTimeMillis();
-
- /** name of testcase(method name) or testsuite (classname) */
- private String name;
-
- /** stacktrace for error or failure */
- private ExceptionData error;
-
- /** properties for end of testrun */
- private Properties props;
-
- /** handy result for each end of sequence */
- private TestSummary result;
-
- public TestRunEvent(Integer id, int type){
- super(id);
- this.type = type;
- }
-
- public TestRunEvent(Integer id, int type, String name, TestSummary result){
- this(id, type, name);
- this.result = result;
- }
-
- public TestRunEvent(Integer id, int type, String name){
- this(id, type);
- this.name = name;
- }
-
- public TestRunEvent(Integer id, int type, Properties props, TestSummary result){
- this(id, type);
- this.props = props;
- this.result = result;
- }
-
- public TestRunEvent(Integer id, int type, String name, Throwable t){
- this(id, type, name);
- this.error = new ExceptionData(t);
- }
-
- public void setType(int type) {
- this.type = type;
- }
-
- public void setTimeStamp(long timestamp) {
- this.timestamp = timestamp;
- }
-
- public void setError(ExceptionData error) {
- this.error = error;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setProperties(Properties props) {
- this.props = props;
- }
-
- public int getType(){
- return type;
- }
-
- public long getTimeStamp(){
- return timestamp;
- }
-
- public String getName(){
- return name;
- }
-
- public TestSummary getSummary(){
- return result;
- }
-
- public ExceptionData getError(){
- return error;
- }
-
- public Properties getProperties(){
- return props;
- }
-
- public boolean equals(Object o){
- if (o instanceof TestRunEvent){
- TestRunEvent other = (TestRunEvent)o;
- return ( (type == other.type) &&
- (timestamp == other.timestamp) &&
- ( name == null ? other.name == null : name.equals(other.name) ) &&
- ( error == null ? other.error == null : error.equals(other.error) ) &&
- ( props == null ? other.props == null : props.equals(other.props) ) &&
- ( result == null ? other.result == null : result.equals(other.result) ) );
- }
- return false;
- }
-
- public String toString(){
- StringBuffer buf = new StringBuffer();
- buf.append("id: ").append(source);
- buf.append("type: ").append(type);
- return buf.toString();
- }
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestRunListener.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestRunListener.java
deleted file mode 100644
index f5ade87d5..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestRunListener.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.remote;
-
-import java.util.EventListener;
-
-
-/**
- *
- */
-public interface TestRunListener extends EventListener {
-
- void onRunStarted(TestRunEvent evt);
- void onRunEnded(TestRunEvent evt);
- void onRunStopped(TestRunEvent evt);
-
- void onSuiteStarted(TestRunEvent evt);
- void onSuiteEnded(TestRunEvent evt);
-
- void onTestStarted(TestRunEvent evt);
- void onTestError(TestRunEvent evt);
- void onTestFailure(TestRunEvent evt);
- void onTestEnded(TestRunEvent evt);
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestRunner.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestRunner.java
deleted file mode 100644
index f505ad46f..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestRunner.java
+++ /dev/null
@@ -1,486 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.remote;
-
-import java.io.BufferedReader;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.Socket;
-import java.util.Properties;
-import java.util.StringTokenizer;
-import java.util.Vector;
-import java.util.Random;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestListener;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-
-import org.apache.tools.ant.taskdefs.optional.rjunit.JUnitHelper;
-import org.apache.tools.ant.taskdefs.optional.rjunit.formatter.Formatter;
-import org.apache.tools.ant.taskdefs.optional.rjunit.formatter.PlainFormatter;
-import org.apache.tools.ant.util.StringUtils;
-
-/**
- * TestRunner for running tests and send results to a remote server.
- *
- *
- * This code is based on the code from Erich Gamma made for the
- * JUnit plugin for Eclipse and is
- * merged with code originating from Ant 1.4.x.
- *
- *
- */
-public class TestRunner implements TestListener {
-
- /** unique identifier for the runner */
- private final Integer id = new Integer( (new Random()).nextInt() );
-
- /** host to connect to */
- private String host = "127.0.0.1";
-
- /** port to connect to */
- private int port = -1;
-
- /** handy debug flag */
- private boolean debug = false;
-
- /** the list of test class names to run */
- private final ArrayList testClassNames = new ArrayList();
-
- /** result of the current test */
- private TestResult testResult;
-
- /** client socket to communicate with the server */
- private Socket clientSocket;
-
- /** writer to send message to the server */
- private Messenger messenger;
-
- /** helpful formatter to debug events directly here */
- private final Formatter debugFormatter = new PlainFormatter();
-
- /** bean constructor */
- public TestRunner() {
- Properties props = new Properties();
- props.setProperty("file", "rjunit-client-debug.log");
- debugFormatter.init(props);
- }
-
- /**
- * Set the debug mode.
- * @param debug true to set to debug mode otherwise false.
- */
- public void setDebug(boolean debug) {
- this.debug = debug;
- }
-
- /**
- * Set the port to connect to the server
- * @param port a valid port number.
- */
- public void setPort(int port) {
- this.port = port;
- }
-
- /**
- * Set the hostname of the server
- * @param host the hostname or ip of the server
- */
- public void setHost(String host) {
- this.host = host;
- }
-
- /**
- * Add a test class name to be executed by this runner.
- * @param classname the class name of the test to run.
- */
- public void addTestClassName(String classname) {
- testClassNames.add(classname);
- }
-
- /**
- * Thread listener for a shutdown from the server
- * Note that it will stop any running test.
- */
- private class StopThread extends Thread {
- public void run() {
- try {
- TestRunEvent evt = null;
- if ((evt = messenger.read()) != null) {
- if (evt.getType() == TestRunEvent.RUN_STOP) {
- TestRunner.this.stop();
- }
- }
- } catch (Exception e) {
- TestRunner.this.stop();
- }
- }
- }
-
- /**
- * Entry point for command line.
- * Usage:
- *
- * TestRunner -classnames -port -host -debug
- * -file
- * -classnames
- * -port
- * -host
- * -debug to run in debug mode
- *
- */
- public static void main(String[] args) throws Exception {
- TestRunner testRunServer = new TestRunner();
- testRunServer.init(args);
- testRunServer.run();
- }
-
- /**
- * Parses the arguments of command line.
- * testClassNames, host, port, listeners and debug mode are set
- * @see #main(String[])
- */
- protected void init(String[] args) throws Exception {
- for (int i = 0; i < args.length; i++) {
- if ("-file".equalsIgnoreCase(args[i])) {
- // @fixme if you mix file and other options it will be a mess,
- // not important right now.
- FileInputStream fis = new FileInputStream(args[++i]);
- Properties props = new Properties();
- props.load(fis);
- fis.close();
- init(props);
- }
- if ("-classnames".equalsIgnoreCase(args[i])) {
- for (int j = ++i; j < args.length; j++) {
- if (args[j].startsWith("-"))
- break;
- addTestClassName(args[j]);
- }
- }
- if ("-port".equalsIgnoreCase(args[i])) {
- setPort(Integer.parseInt(args[++i]));
- }
- if ("-host".equalsIgnoreCase(args[i])) {
- setHost(args[++i]);
- }
- if ("-debug".equalsIgnoreCase(args[i])) {
- setDebug(true);
- }
- }
- }
-
- /**
- * Initialize the TestRunner from properties.
- * @param props the properties containing configuration data.
- * @see #init(String[])
- */
- protected void init(Properties props) {
- if (props.getProperty("debug") != null) {
- setDebug(true);
- }
- String port = props.getProperty("port");
- if (port != null) {
- setPort(Integer.parseInt(port));
- }
- String host = props.getProperty("host");
- if (host != null) {
- setHost(host);
- }
- String classnames = props.getProperty("classnames");
- if (classnames != null) {
- StringTokenizer st = new StringTokenizer(classnames);
- while (st.hasMoreTokens()) {
- addTestClassName(st.nextToken());
- }
- }
- }
-
- public final void run() throws Exception {
- if (testClassNames.size() == 0) {
- throw new IllegalArgumentException("No TestCase specified");
- }
- connect();
-
- testResult = new TestResult();
- testResult.addListener(this);
- runTests();
-
- testResult.removeListener(this);
- if (testResult != null) {
- testResult.stop();
- testResult = null;
- }
- }
-
- /**
- * Transform all classnames into instantiated Test.
- * @throws Exception a generic exception that can be thrown while
- * instantiating a test case.
- */
- protected Map getSuites() throws Exception {
- final int count = testClassNames.size();
- log("Extracting testcases from " + count + " classnames...");
- final Map suites = new HashMap();
- for (int i = 0; i < count; i++) {
- String classname = (String) testClassNames.get(i);
- try {
- Test test = JUnitHelper.getTest(null, classname);
- if (test != null) {
- suites.put(classname, test);
- }
- } catch (Exception e) {
- // notify log error instead ?
- log("Could not get Test instance from " + classname);
- log(e);
- }
- }
- log("Extracted " + suites.size() + " testcases.");
- return suites;
- }
-
- private void runTests() throws Exception {
-
- Map suites = getSuites();
-
- // count all testMethods and inform TestRunListeners
- int count = countTests(suites.values());
- log("Total tests to run: " + count);
- TestRunEvent evt = new TestRunEvent(id, TestRunEvent.RUN_STARTED);
- if (debug){
- debugFormatter.onRunStarted(evt);
- }
- fireEvent(evt);
-
- TestSummary runSummary = new TestSummary();
- runSummary.start(testResult);
- for (Iterator it = suites.entrySet().iterator(); it.hasNext(); ) {
- Map.Entry entry = (Map.Entry)it.next();
- String name = (String)entry.getKey();
- Test test = (Test)entry.getValue();
- if (test instanceof TestCase) {
- test = new TestSuite(name);
- }
- runTest(test, name);
- }
- runSummary.stop(testResult);
-
- // inform TestRunListeners of test end
- int type = (testResult == null || testResult.shouldStop()) ?
- TestRunEvent.RUN_STOPPED : TestRunEvent.RUN_ENDED;
- evt = new TestRunEvent(id, type, System.getProperties(), runSummary);
- if (debug){
- debugFormatter.onRunEnded(evt);
- }
- fireEvent(evt);
- log("Finished after " + runSummary.elapsedTime() + "ms");
- shutDown();
- }
-
- /**
- * run a single suite and dispatch its results.
- * @param test the instance of the testsuite to run.
- * @param name the name of the testsuite (classname)
- */
- private void runTest(Test test, String name){
- TestRunEvent evt = new TestRunEvent(id, TestRunEvent.SUITE_STARTED, name);
- if (debug){
- debugFormatter.onSuiteStarted(evt);
- }
- fireEvent(evt);
- TestSummary suiteSummary = new TestSummary();
- suiteSummary.start(testResult);
- try {
- test.run(testResult);
- } finally {
- suiteSummary.stop(testResult);
- evt = new TestRunEvent(id, TestRunEvent.SUITE_ENDED, name, suiteSummary);
- if (debug){
- debugFormatter.onSuiteEnded(evt);
- }
- fireEvent(evt);
- }
- }
-
- /**
- * count the number of test methods in all tests
- */
- private final int countTests(Collection tests) {
- int count = 0;
- for (Iterator it = tests.iterator(); it.hasNext(); ) {
- Test test = (Test)it.next();
- count = count + test.countTestCases();
- }
- return count;
- }
-
- protected void stop() {
- if (testResult != null) {
- testResult.stop();
- }
- }
-
- /**
- * connect to the specified host and port.
- * @throws IOException if any error occurs during connection.
- */
- protected void connect() throws IOException {
- log("Connecting to " + host + " on port " + port + "...");
- clientSocket = new Socket(host, port);
- messenger = new Messenger(clientSocket.getInputStream(), clientSocket.getOutputStream());
- new StopThread().start();
- }
-
-
- protected void shutDown() {
- try {
- if (messenger != null) {
- messenger.close();
- messenger = null;
- }
- } catch (IOException e) {
- log(e);
- }
-
- try {
- if (clientSocket != null) {
- clientSocket.close();
- clientSocket = null;
- }
- } catch (IOException e) {
- log(e);
- }
- }
-
- protected void fireEvent(TestRunEvent evt){
- try {
- messenger.writeEvent(evt);
- } catch (IOException e){
- log(e);
- }
- }
-
-// -------- JUnit TestListener implementation
-
-
- public void startTest(Test test) {
- String testName = test.toString();
- TestRunEvent evt = new TestRunEvent(id, TestRunEvent.TEST_STARTED, testName);
- if (debug){
- debugFormatter.onTestStarted(evt);
- }
- fireEvent(evt);
- }
-
- public void addError(Test test, Throwable t) {
- String testName = test.toString();
- TestRunEvent evt = new TestRunEvent(id, TestRunEvent.TEST_ERROR, testName, t);
- if (debug){
- debugFormatter.onTestError(evt);
- }
- fireEvent(evt);
- }
-
- /**
- * this implementation is for JUnit < 3.4
- * @see #addFailure(Test, Throwable)
- */
- public void addFailure(Test test, AssertionFailedError afe) {
- addFailure(test, (Throwable) afe);
- }
-
- /**
- * This implementation is for JUnit <= 3.4
- * @see #addFailure(Test, AssertionFailedError)
- */
- public void addFailure(Test test, Throwable t) {
- String testName = test.toString();
- TestRunEvent evt = new TestRunEvent(id, TestRunEvent.TEST_FAILURE, testName, t);
- if (debug){
- debugFormatter.onTestFailure(evt);
- }
- fireEvent(evt);
- }
-
- public void endTest(Test test) {
- String testName = test.toString();
- TestRunEvent evt = new TestRunEvent(id, TestRunEvent.TEST_ENDED, testName);
- if (debug){
- debugFormatter.onTestEnded(evt);
- }
- fireEvent(evt);
- }
-
- public void log(String msg) {
- if (debug) {
- System.out.println(msg);
- }
- }
-
- public void log(Throwable t) {
- if (debug) {
- t.printStackTrace();
- }
- }
-}
-
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestSummary.java b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestSummary.java
deleted file mode 100644
index 686a770dd..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestSummary.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.remote;
-
-import java.io.Serializable;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestListener;
-import junit.framework.TestResult;
-
-/**
- * A helpful test summary that is somewhat similar to TestResult.
- * Here the difference is that this test summary should register to
- * the test result the time you wan to collect information.
- *
- */
-public final class TestSummary implements Serializable, TestListener {
-
- /** time elapsed during tests run in ms */
- private long elapsedTime;
-
- /** number of errors */
- private int errorCount;
-
- /** number of successes */
- private int successCount;
-
- /** number of failures */
- private int failureCount;
-
- /** number of runs */
- private int runCount;
-
- /** bean constructor */
- public TestSummary() {
- }
-
- /**
- * @return the number of errors that occurred in this test.
- */
- public int errorCount() {
- return errorCount;
- }
-
- /**
- * @return the number of successes that occurred in this test.
- */
- public int successCount() {
- return successCount;
- }
-
- /**
- * @return the number of failures that occurred in this test.
- */
- public int failureCount() {
- return failureCount;
- }
-
- /**
- * @return the number of runs that occurred in this test.
- * a run is the sum of failures + errors + successes.
- */
- public int runCount() {
- return runCount;
- }
-
- /**
- * @return the elapsed time in ms
- */
- public long elapsedTime() {
- return elapsedTime;
- }
-
-//
- /**
- * register to the TestResult and starts the time counter.
- * @param result the instance to register to.
- * @see #stop(TestResult)
- */
- public void start(TestResult result){
- elapsedTime = System.currentTimeMillis();
- result.addListener(this);
- }
-
- /**
- * unregister from the TestResult and stops the time counter.
- * @param result the instance to unregister from.
- * @see #start(TestResult)
- */
- public void stop(TestResult result){
- elapsedTime = System.currentTimeMillis() - elapsedTime;
- result.removeListener(this);
- }
-
-// test listener implementation
-
- public void addError(Test test, Throwable throwable) {
- errorCount++;
- }
-
- public void addFailure(Test test, AssertionFailedError error) {
- failureCount++;
- }
-
- public void endTest(Test test) {
- successCount++;
- }
-
- public void startTest(Test test) {
- runCount++;
- }
-
- public String toString(){
- StringBuffer buf = new StringBuffer();
- buf.append("run: ").append(runCount);
- buf.append(" success: ").append(successCount);
- buf.append(" failures: ").append(failureCount);
- buf.append(" errors: ").append(errorCount);
- buf.append(" elapsed: ").append(elapsedTime);
- return buf.toString();
- }
-}
diff --git a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/usecase.xml b/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/usecase.xml
deleted file mode 100644
index ef673c432..000000000
--- a/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/rjunit/usecase.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/RJUnitTaskTest.java b/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/RJUnitTaskTest.java
deleted file mode 100644
index bcb5894bb..000000000
--- a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/RJUnitTaskTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.io.File;
-import java.net.URL;
-
-import org.apache.tools.ant.BuildFileTest;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.ProjectHelper;
-
-/**
- *
- */
-public class RJUnitTaskTest extends BuildFileTest {
- public RJUnitTaskTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- configureProject("data/build-test.xml");
- }
-
- protected void configureProject(String resource){
- URL url = getClass().getResource(resource);
- assertNotNull("Could not find resource :" + resource, url);
- super.configureProject(url.getFile());
- }
-
- public void testServerAndClient(){
- executeTarget("server-and-client");
- System.out.println(getFullLog());
- }
- public void testServerAndClient2(){
- executeTarget("server-and-client");
- System.out.println(getFullLog());
- }
- /*
- public void testStandalone() throws Exception {
- // run server first..
- Thread thread = new Thread(){
- public void run(){
- executeTarget("server-only");
- }
- };
- thread.start();
-
- executeTarget("client-only");
- System.out.println(getFullLog());
- thread.join();
- }
-*/
-
-}
diff --git a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/TestRunRecorder.java b/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/TestRunRecorder.java
deleted file mode 100644
index 2f53d560a..000000000
--- a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/TestRunRecorder.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.util.Properties;
-import java.util.Vector;
-
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestRunEvent;
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestRunListener;
-
-/**
- * A TestRunListener that stores all events for later check.
- *
- *
- * All the events are stored chronologically in distinct vectors
- * and are made available as public instances
- *
- *
- */
-public class TestRunRecorder implements TestRunListener {
-
-// all these are public in order for testcases to have access quickly
- public Vector testStarted = new Vector();
- public Vector testEnded = new Vector();
- public Vector testFailed = new Vector();
- public Vector testError = new Vector();
- public Vector runStarted = new Vector();
- public Vector runEnded = new Vector();
- public Vector runStopped = new Vector();
-
- public void onTestStarted(TestRunEvent evt) {
- testStarted.addElement(evt);
- }
-
- public void onTestEnded(TestRunEvent evt) {
- testEnded.addElement(evt);
- }
-
- public void onTestFailure(TestRunEvent evt) {
- testFailed.addElement(evt);
- }
-
- public void onRunStarted(TestRunEvent evt) {
- runStarted.addElement(evt);
- }
-
- public void onRunEnded(TestRunEvent evt) {
- runEnded.addElement(evt);
- }
-
- public void onRunStopped(TestRunEvent evt) {
- runStopped.addElement(evt);
- }
-
- public void onSuiteStarted(TestRunEvent evt) {
- }
-
- public void onSuiteEnded(TestRunEvent evt) {
- }
-
- public void onTestError(TestRunEvent evt) {
- testError.addElement( evt );
- }
-}
diff --git a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/ZipScannerTest.java b/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/ZipScannerTest.java
deleted file mode 100644
index adba411bd..000000000
--- a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/ZipScannerTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit;
-
-import java.io.File;
-
-import junit.framework.TestCase;
-
-/**
- * Basic test to ensure that the collector is working.
- *
- */
-public class ZipScannerTest extends TestCase {
- public ZipScannerTest(String s) {
- super(s);
- }
-
- protected ZipScanner _scanner;
-
- protected void setUp() throws Exception {
- _scanner = new ZipScanner();
- String path = System.getProperty("java.home") + "/lib/rt.jar";
- _scanner.setBasedir(path);
- }
-
- public void testScan() throws Exception {
- _scanner.scan();
- String[] files = _scanner.getIncludedFiles();
- assertContains(files, "java/lang/Exception.class");
- String[] dirs = _scanner.getIncludedDirectories();
- assertContains(dirs, "java/lang/");
- }
-
- public void testIncludes() throws Exception {
- _scanner.setIncludes( new String[]{ "**/Exception.class" });
- _scanner.scan();
- String[] files = _scanner.getIncludedFiles();
- assertEquals(1, files.length);
- assertEquals(files[0], "java/lang/Exception.class");
- }
-
-
-
- public void assertContains(Object[] lists, Object o){
- for (int i = 0; i < lists.length; i++){
- if (lists[i].equals(o)){
- return;
- }
- }
- fail("Should contain " + o);
- }
-
-}
diff --git a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/data/Test1.java b/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/data/Test1.java
deleted file mode 100644
index a08cc1895..000000000
--- a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/data/Test1.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.data;
-
-import junit.framework.TestCase;
-
-/**
- * Provide a common set of test reporting.
- *
- */
-public class Test1 extends TestCase {
- public Test1(String s) {
- super(s);
- }
-
- public void testSuccess(){
- }
-
- public void testFailure(){
- fail("failure on purpose");
- }
-
- public void testError(){
- throw new RuntimeException("error on purpose");
- }
-}
diff --git a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/data/build-test.xml b/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/data/build-test.xml
deleted file mode 100644
index d2f72332c..000000000
--- a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/data/build-test.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/FilterStackFormatterTest.java b/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/FilterStackFormatterTest.java
deleted file mode 100644
index 41fc17fdd..000000000
--- a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/FilterStackFormatterTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.formatter;
-
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.util.StringUtils;
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestRunEvent;
-
-/**
- * Not exactly rocket science test.. dooh !
- *
- */
-public class FilterStackFormatterTest extends TestCase
- implements Formatter {
-
- public FilterStackFormatterTest(String s) {
- super(s);
- }
-
- protected String trace;
- protected String expected;
-
- protected void setUp() {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw, true);
- pw.println("org.apache.test.ClassName.method(ClassName.java:125)");
- pw.println("\tat org.apache.test.C1.m1(C1.java:125)");
- pw.println("\tat junit.framework.TestCase.m0(TestCase.java:999)");
- pw.println("\tat org.apache.test.C2.m1(C2.java:125)");
- pw.println("\tat junit.framework.TestResult.m1(TestResult.java:999)");
- pw.println("\tat org.apache.test.C3.m1(C3.java:125)");
- pw.println("\tat junit.framework.TestSuite.m2(TestSuite.java:999)");
- pw.println("\tat org.apache.test.C4.m1(C4.java:125)");
- pw.println("\tat junit.framework.Assert.m3(Assert.java:999)");
- pw.println("\tat junit.swingui.TestRunner.m3(TestRunner.java:999)");
- pw.println("\tat junit.awtui.TestRunner.m3(TestRunner.java:999)");
- pw.println("\tat org.apache.test.C5.m1(C5.java:125)");
- pw.println("\tat junit.textui.TestRunner.m3(TestRunner.java:999)");
- pw.println("\tat java.lang.reflect.Method.invoke(Method.java:999)");
- pw.println("\tat org.apache.tools.ant.C.m(C.java:999)");
- pw.println("\tat org.apache.test.C6.m1(C6.java:125)");
- trace = sw.toString();
- sw.getBuffer().setLength(0);
-
- pw.println("org.apache.test.ClassName.method(ClassName.java:125)");
- pw.println("\tat org.apache.test.C1.m1(C1.java:125)");
- pw.println("\tat org.apache.test.C2.m1(C2.java:125)");
- pw.println("\tat org.apache.test.C3.m1(C3.java:125)");
- pw.println("\tat org.apache.test.C4.m1(C4.java:125)");
- pw.println("\tat org.apache.test.C5.m1(C5.java:125)");
- pw.println("\tat org.apache.test.C6.m1(C6.java:125)");
- expected = sw.toString();
- }
-
- public void testFiltering() {
- /*
- FilterStackFormatter wrapper = new FilterStackFormatter(this);
- Exception e = new Exception("xx");
- e.fillInStackTrace();
- TestRunEvent evt = new TestRunEvent(new Integer(1), TestRunEvent.TEST_ERROR, "xx");
- wrapper.onTestFailure(evt);
- StringUtils.getStackTrace()
- assertEquals(expected, filteredTrace);
- */
- }
-
-
-// --- formatter implementation
- protected String filteredTrace;
-
- public void onTestStarted(TestRunEvent evt) {
- }
-
- public void onTestEnded(TestRunEvent evt) {
- }
-
- public void init(Properties props) throws BuildException {
- }
-
- public void onTestFailure(TestRunEvent evt) {
- filteredTrace = trace;
- }
-
- public void onSuiteStarted(TestRunEvent evt) {
- }
-
- public void onSuiteEnded(TestRunEvent evt) {
- }
-
- public void onTestError(TestRunEvent evt) {
- }
-
- public void onRunStarted(TestRunEvent evt) {
- }
-
- public void onRunEnded(TestRunEvent evt) {
- }
-
- public void onRunStopped(TestRunEvent evt) {
- }
-}
diff --git a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/FormatterRecorder.java b/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/FormatterRecorder.java
deleted file mode 100644
index 29da93ad3..000000000
--- a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/formatter/FormatterRecorder.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.formatter;
-
-import java.io.OutputStream;
-import java.util.Properties;
-
-import org.apache.tools.ant.taskdefs.optional.rjunit.TestRunRecorder;
-import org.apache.tools.ant.BuildException;
-
-/**
- * A formatter recorder that serves the same purpose as
- * a TestRunRecorder
- *
- *
- * @see TestRunRecorder
- */
-public class FormatterRecorder extends TestRunRecorder
- implements Formatter {
- public void init(Properties props) throws BuildException {
- }
-}
diff --git a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/remote/MessageReaderTest.java b/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/remote/MessageReaderTest.java
deleted file mode 100644
index c96621773..000000000
--- a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/remote/MessageReaderTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.remote;
-
-import java.io.PrintWriter;
-import java.io.PipedOutputStream;
-import java.io.PipedInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestRunListener;
-import org.apache.tools.ant.taskdefs.optional.rjunit.TestRunRecorder;
-
-/**
- * Ensure that the Reader/Writer works fine.
- *
- */
-public class MessageReaderTest extends TestCase {
-
- private EventDispatcher dispatcher;
-
- protected TestRunRecorder recorder;
-
- public MessageReaderTest(String s) {
- super(s);
- }
-
- protected void setUp() {
- dispatcher = new EventDispatcher();
- recorder = new TestRunRecorder();
- dispatcher.addListener( recorder );
- }
-
- public void testTestRunStarted() throws Exception {
- TestRunEvent evt = new TestRunEvent(new Integer(99), TestRunEvent.RUN_STARTED);
- dispatcher.fireRunStarted( evt );
- assertEquals(evt, recorder.runStarted.elementAt(0));
- }
-
- public void testTestStarted() throws Exception {
- TestRunEvent evt = new TestRunEvent(new Integer(99), TestRunEvent.TEST_STARTED, "xxxx");
- dispatcher.fireTestStarted( evt );
- assertEquals(evt, recorder.testStarted.elementAt(0));
- }
-
- public void testTestEnded() throws Exception {
- TestRunEvent evt = new TestRunEvent(new Integer(99), TestRunEvent.TEST_ENDED, "xxxx");
- dispatcher.fireTestEnded( evt );
- assertEquals(evt, recorder.testEnded.elementAt(0));
- }
-
- public void testTestFailedError() throws Exception {
- Exception e = new Exception("error");
- e.fillInStackTrace();
- TestRunEvent evt = new TestRunEvent(new Integer(99), TestRunEvent.TEST_ERROR, "xxxx", e);
- dispatcher.fireTestError( evt );
- assertEquals(evt, recorder.testError.elementAt(0));
- }
-
- public void testTestFailedFailure() throws Exception {
- Exception e = new Exception("error");
- e.fillInStackTrace();
- TestRunEvent evt = new TestRunEvent(new Integer(99), TestRunEvent.TEST_FAILURE, "xxxx", e);
- dispatcher.fireTestFailure( evt );
- assertEquals(evt, recorder.testFailed.elementAt(0));
- }
-
- public void testTestRunEnded() throws Exception {
- TestRunEvent evt = new TestRunEvent(new Integer(99), TestRunEvent.RUN_ENDED);
- dispatcher.fireRunEnded( evt );
- assertEquals(evt, recorder.runEnded.elementAt(0));
- }
-
- public void testTestRunStopped() throws Exception {
- TestRunEvent evt = new TestRunEvent(new Integer(99), TestRunEvent.RUN_STOPPED);
- dispatcher.fireRunStopped( evt );
- assertEquals(evt, recorder.runStopped.elementAt(0));
- }
-
-
-
-}
diff --git a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestCases.java b/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestCases.java
deleted file mode 100644
index 520b48eb5..000000000
--- a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestCases.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.remote;
-
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import junit.framework.Test;
-import junit.extensions.TestSetup;
-
-/**
- *
- */
-public class TestCases {
-
- /** null testcase w/ 3 tests */
- public static class NullTestCase extends TestCase {
- public NullTestCase(String s) {
- super(s);
- }
- public void testSuccess(){}
- public void testFailure(){ assertTrue(false); }
- public void testError(){ throw new RuntimeException("on purpose"); }
- }
-
- /** testcase w/ a static suite method */
- public static class NullTestSuite extends TestCase {
- public NullTestSuite(String s) {
- super(s);
- }
- public static Test suite(){
- return new TestSuite(NullTestCase.class);
- }
- }
-
- public static class SimpleTestCase extends TestCase {
- public SimpleTestCase(String s) {
- super(s);
- }
- public void testSuccess(){}
- }
-
- public static class FailSetupTestSuite extends TestCase {
- public FailSetupTestSuite(String s) {
- super(s);
- }
- public static Test suite(){
- return new FailTestSetup( new TestSuite(SimpleTestCase.class) );
- }
- }
-
- public static class FailTestSetup extends TestSetup {
- public FailTestSetup(Test test) {
- super(test);
- }
- protected void setUp(){
- throw new IllegalArgumentException("on purpose");
- }
- }
-}
diff --git a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestRunnerTest.java b/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestRunnerTest.java
deleted file mode 100644
index 15b01344e..000000000
--- a/proposal/sandbox/junit/src/testcases/org/apache/tools/ant/taskdefs/optional/rjunit/remote/TestRunnerTest.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-package org.apache.tools.ant.taskdefs.optional.rjunit.remote;
-
-import java.util.Vector;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import junit.framework.TestListener;
-
-import org.apache.tools.ant.taskdefs.optional.rjunit.formatter.PlainFormatter;
-import org.apache.tools.ant.taskdefs.optional.rjunit.remote.TestRunListener;
-import org.apache.tools.ant.taskdefs.optional.rjunit.TestRunRecorder;
-
-/**
- * TestCase for the test runner.
- *
- */
-public class TestRunnerTest extends TestCase
- implements TestRunListener {
-
- public final static int PORT = 1234;
-
- protected Server server;
-
- protected TestRunner runner;
-
- protected TestRunRecorder recorder;
-
- protected boolean done;
-
- public TestRunnerTest(String s) {
- super(s);
- }
-
- protected void setUp() throws Exception {
- server = createServer();
- server.start();
- runner = createClient();
- recorder = new TestRunRecorder();
- server.addListener( recorder );
- server.addListener( this );
- }
-
- protected void tearDown() throws Exception {
- server.shutdown();
- runner.stop();
- }
-
- protected Server createServer() throws Exception {
- return new Server(PORT);
- }
-
- protected TestRunner createClient() throws Exception {
- TestRunner client = new TestRunner();
- client.setDebug(true);
- client.setHost("127.0.0.1");
- client.setPort(PORT);
- return client;
- }
-
- public void testNullTestCase() throws Exception {
- runner.addTestClassName(TestCases.NullTestCase.class.getName());
-// server.addListener( new PlainFormatter() );
- runner.run();
- synchronized(this){ while (!done){ wait(); } }
- assertEquals(1, recorder.runStarted.size());
- /*
- assertTrue(recorder.runStarted.elementAt(0).toSt("testSuccess"));
- assertTrue(started.contains("testFailure"));
- assertTrue(started.contains("testError"));*/
-
- }
-
- public void testFailSetupTestCase() throws Exception {
- runner.addTestClassName(TestCases.FailSetupTestSuite.class.getName());
- runner.run();
- synchronized(this){ while (!done){ wait(); } }
-
- assertEquals(1, recorder.runStarted.size());
- assertEquals(1, recorder.runEnded.size());
- }
-
- public void testFailSetupTestSuite() throws Exception {
- runner.addTestClassName(TestCases.FailSetupTestSuite.class.getName());
- runner.run();
- synchronized(this){ while (!done){ wait(); } }
- assertEquals(1, recorder.runStarted.size());
- assertEquals(1, recorder.runEnded.size());
- }
-
- public static void main(String[] args){
- TestSuite suite = new TestSuite(TestRunnerTest.class);
- junit.textui.TestRunner.run(suite);
- }
-
-// TestRunListener implementation
- public void onTestStarted(TestRunEvent evt) {
- }
- public void onTestEnded(TestRunEvent evt) {
- }
- public void onTestFailure(TestRunEvent evt) {
- }
- public void onRunStarted(TestRunEvent count) {
- }
- public void onRunEnded(TestRunEvent evt) {
- synchronized(this){
- done = true;
- notify();
- }
- }
- public void onRunStopped(TestRunEvent evt) {
- synchronized(this){
- done = true;
- notify();
- }
- }
-
- public void onSuiteStarted(TestRunEvent evt) {
- }
-
- public void onSuiteEnded(TestRunEvent evt) {
- }
-
- public void onTestError(TestRunEvent evt) {
- }
-}