You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/08/12 17:23:08 UTC
svn commit: r232310 [44/92] - in /beehive/trunk/controls/test: common/
infra/gtlf/ infra/gtlf/xsl/ infra/mantis/ infra/tch/ infra/tch/messages/
infra/tch/runtime/ infra/tch/schema/ perf/ perf/bin/ perf/cases/
perf/ctlsrc/org/apache/beehive/controls/per...
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/AutoTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/BadArgException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/BadArgException.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/BadArgException.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/BadArgException.java Fri Aug 12 08:12:28 2005
@@ -1,13 +1,13 @@
-package org.apache.beehive.test.tools.tch.compose;
-
-/**
- */
-
-public class BadArgException extends TestException {
-
- public BadArgException() {}
- public BadArgException(String msg) { super(msg); }
- public BadArgException(Throwable th) { super(th); }
- public BadArgException(String msg, Throwable th) { super(msg, th); }
-
-}
+package org.apache.beehive.test.tools.tch.compose;
+
+/**
+ */
+
+public class BadArgException extends TestException {
+
+ public BadArgException() {}
+ public BadArgException(String msg) { super(msg); }
+ public BadArgException(Throwable th) { super(th); }
+ public BadArgException(String msg, Throwable th) { super(msg, th); }
+
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/BadArgException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/CycleDetectedException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/CycleDetectedException.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/CycleDetectedException.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/CycleDetectedException.java Fri Aug 12 08:12:28 2005
@@ -1,26 +1,26 @@
-package org.apache.beehive.test.tools.tch.compose;
-
-/**
- */
-
-public class CycleDetectedException extends PreconditionNotMetException {
-
- public CycleDetectedException(String testName) {
- super(testName);
- }
-
- public CycleDetectedException(String testName, String msg) {
- super(testName, msg);
- }
-
- public CycleDetectedException(String testName, Throwable th) {
- super(testName, th);
- }
-
- public CycleDetectedException(String testName, String msg,
- Throwable th)
- {
- super(testName, msg, th);
- }
-
-}
+package org.apache.beehive.test.tools.tch.compose;
+
+/**
+ */
+
+public class CycleDetectedException extends PreconditionNotMetException {
+
+ public CycleDetectedException(String testName) {
+ super(testName);
+ }
+
+ public CycleDetectedException(String testName, String msg) {
+ super(testName, msg);
+ }
+
+ public CycleDetectedException(String testName, Throwable th) {
+ super(testName, th);
+ }
+
+ public CycleDetectedException(String testName, String msg,
+ Throwable th)
+ {
+ super(testName, msg, th);
+ }
+
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/CycleDetectedException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/InvalidTestClassException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/InvalidTestClassException.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/InvalidTestClassException.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/InvalidTestClassException.java Fri Aug 12 08:12:28 2005
@@ -1,14 +1,14 @@
-package org.apache.beehive.test.tools.tch.compose;
-
-/**
- */
-
-public class InvalidTestClassException extends TestAbortedException {
- public InvalidTestClassException() { super(); }
- public InvalidTestClassException(String msg) { super(msg); }
- public InvalidTestClassException(Throwable th) { super(th); }
- public InvalidTestClassException(String msg, Throwable th) {
- super(msg, th);
- }
-}
-
+package org.apache.beehive.test.tools.tch.compose;
+
+/**
+ */
+
+public class InvalidTestClassException extends TestAbortedException {
+ public InvalidTestClassException() { super(); }
+ public InvalidTestClassException(String msg) { super(msg); }
+ public InvalidTestClassException(Throwable th) { super(th); }
+ public InvalidTestClassException(String msg, Throwable th) {
+ super(msg, th);
+ }
+}
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/InvalidTestClassException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/ParameterNotFoundException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/ParameterNotFoundException.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/ParameterNotFoundException.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/ParameterNotFoundException.java Fri Aug 12 08:12:28 2005
@@ -1,9 +1,9 @@
-package org.apache.beehive.test.tools.tch.compose;
-
-import org.apache.beehive.test.tools.tch.util.NestedRuntimeException;
-
-public class ParameterNotFoundException
- extends NestedRuntimeException
-{
- public ParameterNotFoundException(String msg) { super(msg); }
-}
+package org.apache.beehive.test.tools.tch.compose;
+
+import org.apache.beehive.test.tools.tch.util.NestedRuntimeException;
+
+public class ParameterNotFoundException
+ extends NestedRuntimeException
+{
+ public ParameterNotFoundException(String msg) { super(msg); }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/ParameterNotFoundException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/Parameters.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/Parameters.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/Parameters.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/Parameters.java Fri Aug 12 08:12:28 2005
@@ -1,65 +1,65 @@
-package org.apache.beehive.test.tools.tch.compose;
-
-import java.util.Properties;
-
-/**
- *
- */
-public interface Parameters {
-
- // =================================================================
- // Public methods
-
- public String[] getStringArray(String Name);
- public String[] getStringArray(String Name, String[] dflt);
-
- public double[] getDoubleArray(String name);
- public double[] getDoubleArray(String name, double[] dflt);
-
- public int[] getIntArray(String Name);
- public int[] getIntArray(String Name, int[] dflt);
-
- public boolean[] getBooleanArray(String Name);
- public boolean[] getBooleanArray(String Name, boolean[] dflt);
-
- public boolean getBoolean(String Name);
- public boolean getBoolean(String Name, boolean dflt);
-
- public byte getByte(String Name);
- public byte getByte(String Name, byte dflt);
-
- public char getChar(String Name);
- public char getChar(String Name, char dflt);
-
- public Class getClass(String Name);
- public Class getClass(String Name, Class dflt);
-
- public double getDouble(String Name);
- public double getDouble(String Name, double dflt);
-
- public float getFloat(String Name);
- public float getFloat(String Name, float dflt);
-
- public int getInt(String Name);
- public int getInt(String Name, int dflt);
-
- public long getLong(String Name);
- public long getLong(String Name, long dflt);
-
- public short getShort(String Name);
- public short getShort(String Name, short dflt);
-
- public String getString(String Name);
- public String getString(String Name, String dflt);
-
- public Properties getAll();
-
-}
-
-
-
-
-
-
-
-
+package org.apache.beehive.test.tools.tch.compose;
+
+import java.util.Properties;
+
+/**
+ *
+ */
+public interface Parameters {
+
+ // =================================================================
+ // Public methods
+
+ public String[] getStringArray(String Name);
+ public String[] getStringArray(String Name, String[] dflt);
+
+ public double[] getDoubleArray(String name);
+ public double[] getDoubleArray(String name, double[] dflt);
+
+ public int[] getIntArray(String Name);
+ public int[] getIntArray(String Name, int[] dflt);
+
+ public boolean[] getBooleanArray(String Name);
+ public boolean[] getBooleanArray(String Name, boolean[] dflt);
+
+ public boolean getBoolean(String Name);
+ public boolean getBoolean(String Name, boolean dflt);
+
+ public byte getByte(String Name);
+ public byte getByte(String Name, byte dflt);
+
+ public char getChar(String Name);
+ public char getChar(String Name, char dflt);
+
+ public Class getClass(String Name);
+ public Class getClass(String Name, Class dflt);
+
+ public double getDouble(String Name);
+ public double getDouble(String Name, double dflt);
+
+ public float getFloat(String Name);
+ public float getFloat(String Name, float dflt);
+
+ public int getInt(String Name);
+ public int getInt(String Name, int dflt);
+
+ public long getLong(String Name);
+ public long getLong(String Name, long dflt);
+
+ public short getShort(String Name);
+ public short getShort(String Name, short dflt);
+
+ public String getString(String Name);
+ public String getString(String Name, String dflt);
+
+ public Properties getAll();
+
+}
+
+
+
+
+
+
+
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/Parameters.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/PreconditionNotMetException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/PreconditionNotMetException.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/PreconditionNotMetException.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/PreconditionNotMetException.java Fri Aug 12 08:12:28 2005
@@ -1,45 +1,45 @@
-package org.apache.beehive.test.tools.tch.compose;
-
-
-/**
- * Exception thrown by the require() mechanism of AutoTest to cause a
- * test method to be skipped.
- *
- * N.B. The single string constructor is used to pass in the name of
- * the test whose precondition was not met. A default human readable
- * message is constructed using the name of the test. If you need to
- * specify a different message, use one of the constructors taking two
- * String arguments -- the second String arg is the message.
- *
- */
-public class PreconditionNotMetException extends TestException {
-
- private final static String DEFAULT_MSG =
- "Precondition violated for test: ";
-
- private String testName;
-
- public PreconditionNotMetException(String testName) {
- this(testName, DEFAULT_MSG + testName);
- }
-
- public PreconditionNotMetException(String testName, String msg) {
- super(msg);
- this.testName = testName;
- }
-
- public PreconditionNotMetException(String testName, Throwable th) {
- this(testName, DEFAULT_MSG + testName, th);
- }
-
- public PreconditionNotMetException(String testName, String msg,
- Throwable th)
- {
- super(msg, th);
- this.testName = testName;
- }
-
- /** Get the name of the test whose precondition was violated. */
- public String getTestName() { return testName; }
-
-}
+package org.apache.beehive.test.tools.tch.compose;
+
+
+/**
+ * Exception thrown by the require() mechanism of AutoTest to cause a
+ * test method to be skipped.
+ *
+ * N.B. The single string constructor is used to pass in the name of
+ * the test whose precondition was not met. A default human readable
+ * message is constructed using the name of the test. If you need to
+ * specify a different message, use one of the constructors taking two
+ * String arguments -- the second String arg is the message.
+ *
+ */
+public class PreconditionNotMetException extends TestException {
+
+ private final static String DEFAULT_MSG =
+ "Precondition violated for test: ";
+
+ private String testName;
+
+ public PreconditionNotMetException(String testName) {
+ this(testName, DEFAULT_MSG + testName);
+ }
+
+ public PreconditionNotMetException(String testName, String msg) {
+ super(msg);
+ this.testName = testName;
+ }
+
+ public PreconditionNotMetException(String testName, Throwable th) {
+ this(testName, DEFAULT_MSG + testName, th);
+ }
+
+ public PreconditionNotMetException(String testName, String msg,
+ Throwable th)
+ {
+ super(msg, th);
+ this.testName = testName;
+ }
+
+ /** Get the name of the test whose precondition was violated. */
+ public String getTestName() { return testName; }
+
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/PreconditionNotMetException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/Test.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/Test.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/Test.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/Test.java Fri Aug 12 08:12:28 2005
@@ -1,103 +1,103 @@
-package org.apache.beehive.test.tools.tch.compose;
-
-/**
- * <p>Classes that are to be run as tests in the Tch test
- * framework need to implement the Test interface. However there are
- * two other requirements of a Test. First, they need to define a
- * constructor of the form:
- *
- * <p><code>public Test(TestContext tc) {...}</code>
- *
- * <p>Second, each instance of a Test needs to have a set of uniquely
- * named (small-T) tests and in its run() method the test must report
- * the outcome of each atomic test exactly once via one of the
- * following methods -- reportSuccess(),
- * reportFailure(), reportSkipped(), reportAborted(), or
- * reportAbandoned(). The idea is that for any given test there is
- * some result reported.
- *
- * <p>Obviously, this requirement can entail a certain amount of
- * bookkeeping -- particularly in the case of aborts. (Used when the
- * state of a Test object is so compromised as to make running
- * remaining tests meaningless.) For that reason, test writers are
- * strongly encouraged to not implement the Test interface directly
- * but to use AutoTest or one of its subclasses as the base class for
- * their test class.
- *
- * A simple test would look something like this.
- *
- * <pre>
- *
- * public class SampleTest implements Test {
- *
- * private TestContext tc;
- *
- * private String foo;
- * private int bar;
- *
- * public SampleTest(TestContext tc) {
- * this.tc = tc;
- *
- * foo = tc.paramAsString("foo");
- * bar = tc.paramAsInt("x");
- *
- * openSomeExternalResource();
- * }
- *
- * public void run() { ... }
- *
- * public void cleanup() {
- * closeTheExternalResource();
- * }
- * }
- *
- * </pre>
- *
- */
-public interface Test extends Runnable, java.io.Serializable
-{
-
- /**
- * Run the test -- the Test reports results to the framework via
- * calls to the report* methods.
- */
- public void run();
-
- /**
- * Cleanup after the test is run.
- */
- public void cleanup();
-
- /**
- * Add a test method to be run. If this method is never called, the Test
- * can assume that all methods are to be run.
- */
- public void addTest(String inTestMethodName);
-
- /**
- * gets the name of the test method that is currently executing.
- */
- public String getCurrentMethod();
-
- /**
- * A test can call this method to 'manually' set the logged method name.
- * Only use if you know what you are doing.
- */
- public void setMethodNameToLog(String name);
-
- /**
- * Returns how many 'outcomes' this test class has logged
- * so far.
- */
- public int getNumOutcomesLogged();
-
- /**
- * Tell this test it has been timed out.
- */
- public void setTimedOut();
-
- /**
- * Specify whether code coverage is enabled for the test
- */
- public void setCodeCoverageEnabled(int mode);
-}
+package org.apache.beehive.test.tools.tch.compose;
+
+/**
+ * <p>Classes that are to be run as tests in the Tch test
+ * framework need to implement the Test interface. However there are
+ * two other requirements of a Test. First, they need to define a
+ * constructor of the form:
+ *
+ * <p><code>public Test(TestContext tc) {...}</code>
+ *
+ * <p>Second, each instance of a Test needs to have a set of uniquely
+ * named (small-T) tests and in its run() method the test must report
+ * the outcome of each atomic test exactly once via one of the
+ * following methods -- reportSuccess(),
+ * reportFailure(), reportSkipped(), reportAborted(), or
+ * reportAbandoned(). The idea is that for any given test there is
+ * some result reported.
+ *
+ * <p>Obviously, this requirement can entail a certain amount of
+ * bookkeeping -- particularly in the case of aborts. (Used when the
+ * state of a Test object is so compromised as to make running
+ * remaining tests meaningless.) For that reason, test writers are
+ * strongly encouraged to not implement the Test interface directly
+ * but to use AutoTest or one of its subclasses as the base class for
+ * their test class.
+ *
+ * A simple test would look something like this.
+ *
+ * <pre>
+ *
+ * public class SampleTest implements Test {
+ *
+ * private TestContext tc;
+ *
+ * private String foo;
+ * private int bar;
+ *
+ * public SampleTest(TestContext tc) {
+ * this.tc = tc;
+ *
+ * foo = tc.paramAsString("foo");
+ * bar = tc.paramAsInt("x");
+ *
+ * openSomeExternalResource();
+ * }
+ *
+ * public void run() { ... }
+ *
+ * public void cleanup() {
+ * closeTheExternalResource();
+ * }
+ * }
+ *
+ * </pre>
+ *
+ */
+public interface Test extends Runnable, java.io.Serializable
+{
+
+ /**
+ * Run the test -- the Test reports results to the framework via
+ * calls to the report* methods.
+ */
+ public void run();
+
+ /**
+ * Cleanup after the test is run.
+ */
+ public void cleanup();
+
+ /**
+ * Add a test method to be run. If this method is never called, the Test
+ * can assume that all methods are to be run.
+ */
+ public void addTest(String inTestMethodName);
+
+ /**
+ * gets the name of the test method that is currently executing.
+ */
+ public String getCurrentMethod();
+
+ /**
+ * A test can call this method to 'manually' set the logged method name.
+ * Only use if you know what you are doing.
+ */
+ public void setMethodNameToLog(String name);
+
+ /**
+ * Returns how many 'outcomes' this test class has logged
+ * so far.
+ */
+ public int getNumOutcomesLogged();
+
+ /**
+ * Tell this test it has been timed out.
+ */
+ public void setTimedOut();
+
+ /**
+ * Specify whether code coverage is enabled for the test
+ */
+ public void setCodeCoverageEnabled(int mode);
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/Test.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestAbortedException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestAbortedException.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestAbortedException.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestAbortedException.java Fri Aug 12 08:12:28 2005
@@ -1,11 +1,11 @@
-package org.apache.beehive.test.tools.tch.compose;
-
-/**
- */
-
-public class TestAbortedException extends TestException {
- public TestAbortedException() { super(); }
- public TestAbortedException(String msg) { super(msg); }
- public TestAbortedException(Throwable th) { super(th); }
- public TestAbortedException(String msg, Throwable th) { super(msg, th); }
-}
+package org.apache.beehive.test.tools.tch.compose;
+
+/**
+ */
+
+public class TestAbortedException extends TestException {
+ public TestAbortedException() { super(); }
+ public TestAbortedException(String msg) { super(msg); }
+ public TestAbortedException(Throwable th) { super(th); }
+ public TestAbortedException(String msg, Throwable th) { super(msg, th); }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestAbortedException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestCleanupException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestCleanupException.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestCleanupException.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestCleanupException.java Fri Aug 12 08:12:28 2005
@@ -1,11 +1,11 @@
-package org.apache.beehive.test.tools.tch.compose;
-
-/**
- */
-
-public class TestCleanupException extends TestException {
- public TestCleanupException() {}
- public TestCleanupException(String msg) { super(msg); }
- public TestCleanupException(Throwable th) { super(th); }
- public TestCleanupException(String msg, Throwable th) { super(msg, th); }
-}
+package org.apache.beehive.test.tools.tch.compose;
+
+/**
+ */
+
+public class TestCleanupException extends TestException {
+ public TestCleanupException() {}
+ public TestCleanupException(String msg) { super(msg); }
+ public TestCleanupException(Throwable th) { super(th); }
+ public TestCleanupException(String msg, Throwable th) { super(msg, th); }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestCleanupException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestContext.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestContext.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestContext.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestContext.java Fri Aug 12 08:12:28 2005
@@ -1,79 +1,79 @@
-package org.apache.beehive.test.tools.tch.compose;
-
-import org.apache.beehive.test.tools.tch.TestHelper;
-import org.apache.beehive.test.tools.tch.core.process.ProcessEngine;
-import org.apache.beehive.test.tools.tch.core.test.ResultHandler;
-
-/**
- * The public face of a TestNode -- Test objects are
- * constructed with a TestContext which they can use to obtain
- * parameter values, report back to the framework the results of their
- * tests, and obtain information about where in the tree they are.
- *
- */
-public interface TestContext
-{
-
- // =================================================================
- // Location methods -- These methods are only guaranteed to return
- // meaningful values during the run() method and almost certainly
- // won't return good values in the constructor.
-
- /**
- * Get the full name of this test in the test tree.
- */
- public String getFullName();
-
- public String getName();
-
- public String getRealName();
-
- public String getLogicalName();
- /**
- * Get the location of this test in the test tree -- essentially
- * the full name of the test's parent plus an index number.
- */
- public String getLocation();
-
- /**
- * Parameter object
- */
- public Parameters getParameters();
-
- /**
- * ResultHandler, takes a TestResult.
- */
- public ResultHandler getResultHandler();
-
- // =================================================================
- // Information methods
-
- public void inform(String msg);
- public void debug(int level, String msg);
- public void debugMostVisible(String msg);
- public void debugHalfVisible(String msg);
- public void debugLeastVisible(String msg);
-
- public int getDebugLevel();
-
- // ============================================================
- // Process Management
-
- public ProcessEngine getProcessEngine();
-
- // ============================================================
- // From the old test context that was in frame
- // First step in removing it is to add missing methods here
-
- // =================================================================
- // Helpers
-
- public TestHelper getHelper(Class helperClass);
- public TestHelper getHelperForAdmin(Class helperClass, String host);
- public TestHelper getSharedHelper(String name, Class helperClass);
-
- // ============================================================
- // FIXME - these methods should only be used internally. Move them
- // into TestNode?
-
-}
+package org.apache.beehive.test.tools.tch.compose;
+
+import org.apache.beehive.test.tools.tch.TestHelper;
+import org.apache.beehive.test.tools.tch.core.process.ProcessEngine;
+import org.apache.beehive.test.tools.tch.core.test.ResultHandler;
+
+/**
+ * The public face of a TestNode -- Test objects are
+ * constructed with a TestContext which they can use to obtain
+ * parameter values, report back to the framework the results of their
+ * tests, and obtain information about where in the tree they are.
+ *
+ */
+public interface TestContext
+{
+
+ // =================================================================
+ // Location methods -- These methods are only guaranteed to return
+ // meaningful values during the run() method and almost certainly
+ // won't return good values in the constructor.
+
+ /**
+ * Get the full name of this test in the test tree.
+ */
+ public String getFullName();
+
+ public String getName();
+
+ public String getRealName();
+
+ public String getLogicalName();
+ /**
+ * Get the location of this test in the test tree -- essentially
+ * the full name of the test's parent plus an index number.
+ */
+ public String getLocation();
+
+ /**
+ * Parameter object
+ */
+ public Parameters getParameters();
+
+ /**
+ * ResultHandler, takes a TestResult.
+ */
+ public ResultHandler getResultHandler();
+
+ // =================================================================
+ // Information methods
+
+ public void inform(String msg);
+ public void debug(int level, String msg);
+ public void debugMostVisible(String msg);
+ public void debugHalfVisible(String msg);
+ public void debugLeastVisible(String msg);
+
+ public int getDebugLevel();
+
+ // ============================================================
+ // Process Management
+
+ public ProcessEngine getProcessEngine();
+
+ // ============================================================
+ // From the old test context that was in frame
+ // First step in removing it is to add missing methods here
+
+ // =================================================================
+ // Helpers
+
+ public TestHelper getHelper(Class helperClass);
+ public TestHelper getHelperForAdmin(Class helperClass, String host);
+ public TestHelper getSharedHelper(String name, Class helperClass);
+
+ // ============================================================
+ // FIXME - these methods should only be used internally. Move them
+ // into TestNode?
+
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestException.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestException.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestException.java Fri Aug 12 08:12:28 2005
@@ -1,18 +1,18 @@
-package org.apache.beehive.test.tools.tch.compose;
-
-import java.io.Serializable;
-
-import org.apache.beehive.test.tools.tch.common.util.NestedRuntimeException;
-
-/**
- */
-
-public class TestException
- extends NestedRuntimeException
- implements Serializable {
- public TestException() {}
- public TestException(String msg) { super(msg); }
- public TestException(Throwable th) { super(th); }
- public TestException(String msg, Throwable th) { super(msg, th); }
-}
-
+package org.apache.beehive.test.tools.tch.compose;
+
+import java.io.Serializable;
+
+import org.apache.beehive.test.tools.tch.common.util.NestedRuntimeException;
+
+/**
+ */
+
+public class TestException
+ extends NestedRuntimeException
+ implements Serializable {
+ public TestException() {}
+ public TestException(String msg) { super(msg); }
+ public TestException(Throwable th) { super(th); }
+ public TestException(String msg, Throwable th) { super(msg, th); }
+}
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestInitializationException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestInitializationException.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestInitializationException.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestInitializationException.java Fri Aug 12 08:12:28 2005
@@ -1,13 +1,13 @@
-package org.apache.beehive.test.tools.tch.compose;
-
-/**
- */
-
-public class TestInitializationException extends TestException {
- public TestInitializationException() {}
- public TestInitializationException(String msg) { super(msg); }
- public TestInitializationException(Throwable th) { super(th); }
- public TestInitializationException(String msg, Throwable th) {
- super(msg, th);
- }
-}
+package org.apache.beehive.test.tools.tch.compose;
+
+/**
+ */
+
+public class TestInitializationException extends TestException {
+ public TestInitializationException() {}
+ public TestInitializationException(String msg) { super(msg); }
+ public TestInitializationException(Throwable th) { super(th); }
+ public TestInitializationException(String msg, Throwable th) {
+ super(msg, th);
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestInitializationException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestListener.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestListener.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestListener.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestListener.java Fri Aug 12 08:12:28 2005
@@ -1,15 +1,15 @@
-package org.apache.beehive.test.tools.tch.compose;
-
-import java.io.*;
-import java.util.*;
-
-
-/**
- */
-
-public interface TestListener {
-
- public void beforeTest(String name);
- public void afterTest(String name);
-
-}
+package org.apache.beehive.test.tools.tch.compose;
+
+import java.io.*;
+import java.util.*;
+
+
+/**
+ */
+
+public interface TestListener {
+
+ public void beforeTest(String name);
+ public void afterTest(String name);
+
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestSetupException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestSetupException.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestSetupException.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestSetupException.java Fri Aug 12 08:12:28 2005
@@ -1,16 +1,16 @@
-package org.apache.beehive.test.tools.tch.compose;
-
-/**
- *
- * Thrown from tests to indicate that a given test method couldn't do
- * some neccessary setup work that isn't part of the test proper. The
- * framework will record the test as having been skipped.
- *
- */
-
-public class TestSetupException extends TestException {
- public TestSetupException() {}
- public TestSetupException(String msg) { super(msg); }
- public TestSetupException(Throwable th) { super(th); }
- public TestSetupException(String msg, Throwable th) { super(msg, th); }
-}
+package org.apache.beehive.test.tools.tch.compose;
+
+/**
+ *
+ * Thrown from tests to indicate that a given test method couldn't do
+ * some neccessary setup work that isn't part of the test proper. The
+ * framework will record the test as having been skipped.
+ *
+ */
+
+public class TestSetupException extends TestException {
+ public TestSetupException() {}
+ public TestSetupException(String msg) { super(msg); }
+ public TestSetupException(Throwable th) { super(th); }
+ public TestSetupException(String msg, Throwable th) { super(msg, th); }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/TestSetupException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/UtilityFailureException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/UtilityFailureException.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/UtilityFailureException.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/UtilityFailureException.java Fri Aug 12 08:12:28 2005
@@ -1,11 +1,11 @@
-package org.apache.beehive.test.tools.tch.compose;
-
-/**
- */
-
-public class UtilityFailureException extends TestException {
- public UtilityFailureException() {}
- public UtilityFailureException(String msg) { super(msg); }
- public UtilityFailureException(Throwable th) { super(th); }
- public UtilityFailureException(String msg, Throwable th) { super(msg, th); }
-}
+package org.apache.beehive.test.tools.tch.compose;
+
+/**
+ */
+
+public class UtilityFailureException extends TestException {
+ public UtilityFailureException() {}
+ public UtilityFailureException(String msg) { super(msg); }
+ public UtilityFailureException(Throwable th) { super(th); }
+ public UtilityFailureException(String msg, Throwable th) { super(msg, th); }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/UtilityFailureException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/internal/CycleDetector.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/internal/CycleDetector.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/internal/CycleDetector.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/internal/CycleDetector.java Fri Aug 12 08:12:28 2005
@@ -1,53 +1,53 @@
-package org.apache.beehive.test.tools.tch.compose.internal;
-
-import java.util.Hashtable;
-import java.util.Stack;
-
-import org.apache.beehive.test.tools.tch.compose.CycleDetectedException;
-
-/**
- */
-public class CycleDetector {
-
- public final static String DEBUG_PARAM = "debugQuetzal";
-
- private boolean debug = false;
- private Hashtable lookup = new Hashtable();
- private Stack stack = new Stack();
-
- public CycleDetector() {
- debug = getDebug();
- }
-
- public void enter(Object obj) throws CycleDetectedException {
- if (lookup.put(obj, obj) == null) {
- stack.push(obj);
- } else {
- StringBuffer stk = new StringBuffer("Cycle detected entering ");
- stk.append(obj).append(": ");
- int size = stack.size();
- for (int i = 0; i < size; i++) {
- Object o = stack.elementAt(i);
- if (o == obj) {
- stk.append("*").append(o).append("*");
- } else {
- stk.append(o);
- }
- stk.append(" -> ");
- }
- stk.append(obj);
- throw new CycleDetectedException(stk.toString());
- }
- }
-
- public void exit() {
- Object obj = stack.pop();
- lookup.remove(obj);
- }
-
- private boolean getDebug() {
- String debug = System.getProperty(DEBUG_PARAM);
- if (debug != null && debug.equals("true")) return true;
- return false;
- }
-}
+package org.apache.beehive.test.tools.tch.compose.internal;
+
+import java.util.Hashtable;
+import java.util.Stack;
+
+import org.apache.beehive.test.tools.tch.compose.CycleDetectedException;
+
+/**
+ */
+public class CycleDetector {
+
+ public final static String DEBUG_PARAM = "debugQuetzal";
+
+ private boolean debug = false;
+ private Hashtable lookup = new Hashtable();
+ private Stack stack = new Stack();
+
+ public CycleDetector() {
+ debug = getDebug();
+ }
+
+ public void enter(Object obj) throws CycleDetectedException {
+ if (lookup.put(obj, obj) == null) {
+ stack.push(obj);
+ } else {
+ StringBuffer stk = new StringBuffer("Cycle detected entering ");
+ stk.append(obj).append(": ");
+ int size = stack.size();
+ for (int i = 0; i < size; i++) {
+ Object o = stack.elementAt(i);
+ if (o == obj) {
+ stk.append("*").append(o).append("*");
+ } else {
+ stk.append(o);
+ }
+ stk.append(" -> ");
+ }
+ stk.append(obj);
+ throw new CycleDetectedException(stk.toString());
+ }
+ }
+
+ public void exit() {
+ Object obj = stack.pop();
+ lookup.remove(obj);
+ }
+
+ private boolean getDebug() {
+ String debug = System.getProperty(DEBUG_PARAM);
+ if (debug != null && debug.equals("true")) return true;
+ return false;
+ }
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/internal/CycleDetector.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/internal/TestNode.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/internal/TestNode.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/internal/TestNode.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/internal/TestNode.java Fri Aug 12 08:12:28 2005
@@ -1,69 +1,69 @@
-package org.apache.beehive.test.tools.tch.compose.internal;
-
-import java.io.Serializable;
-import java.util.List;
-
-import org.apache.beehive.test.tools.tch.compose.TestContext;
-import org.apache.beehive.test.tools.tch.core.process.ProcessEngine;
-import org.apache.beehive.test.tools.tch.core.test.ResultHandler;
-
-/**
- * Like TestContext, but exposes more methods.
- *
- */
-
-public interface TestNode
- extends Runnable, Cloneable, Serializable, TestContext {
-
- /**
- * Runs the subtest(s) of this TestNode. Different types of
- * TestNode will run their subtests different ways --
- * ParallelTestContext runs them in parallel, SequentialTestConext
- * runs them sequentially, etc. */
- public void run();
-
- public void logTestsAs(int resultType, String message);
- public void logTestsAs(int resultType, String message, Exception th);
-
- public String getName();
-
- public String getFullName();
-
- public void setRealName(String name);
-
- public void setLogicalName(String name);
-
- // needed since JavatestLogicTask sets this
- public void setCodeCoverageEnabled( int mode );
-
- /**
- * returns num tests for this test node
- */
- public int getNumTests();
-
- public void setCurrentTest(TestNode t); // ???
- public TestNode getCurrentTest();
-
- // Debug Level
- public void setDebugLevel(int inDebugLevel);
-
- // result handler
- public void setResultHandler(ResultHandler in);
-
- // Process Management.
- public void setProcessEngine(ProcessEngine in);
-
- public boolean isDone();
-
- public void notifyTimeout();
- public List getTestMethods();
-
- // Make clone public.
- public Object clone();
-
-}
-
-
-
-
-
+package org.apache.beehive.test.tools.tch.compose.internal;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.beehive.test.tools.tch.compose.TestContext;
+import org.apache.beehive.test.tools.tch.core.process.ProcessEngine;
+import org.apache.beehive.test.tools.tch.core.test.ResultHandler;
+
+/**
+ * Like TestContext, but exposes more methods.
+ *
+ */
+
+public interface TestNode
+ extends Runnable, Cloneable, Serializable, TestContext {
+
+ /**
+ * Runs the subtest(s) of this TestNode. Different types of
+ * TestNode will run their subtests different ways --
+ * ParallelTestContext runs them in parallel, SequentialTestConext
+ * runs them sequentially, etc. */
+ public void run();
+
+ public void logTestsAs(int resultType, String message);
+ public void logTestsAs(int resultType, String message, Exception th);
+
+ public String getName();
+
+ public String getFullName();
+
+ public void setRealName(String name);
+
+ public void setLogicalName(String name);
+
+ // needed since JavatestLogicTask sets this
+ public void setCodeCoverageEnabled( int mode );
+
+ /**
+ * returns num tests for this test node
+ */
+ public int getNumTests();
+
+ public void setCurrentTest(TestNode t); // ???
+ public TestNode getCurrentTest();
+
+ // Debug Level
+ public void setDebugLevel(int inDebugLevel);
+
+ // result handler
+ public void setResultHandler(ResultHandler in);
+
+ // Process Management.
+ public void setProcessEngine(ProcessEngine in);
+
+ public boolean isDone();
+
+ public void notifyTimeout();
+ public List getTestMethods();
+
+ // Make clone public.
+ public Object clone();
+
+}
+
+
+
+
+
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/internal/TestNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/internal/context/AtomicTestContext.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/internal/context/AtomicTestContext.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/internal/context/AtomicTestContext.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/internal/context/AtomicTestContext.java Fri Aug 12 08:12:28 2005
@@ -1,430 +1,430 @@
-package org.apache.beehive.test.tools.tch.compose.internal.context;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.beehive.test.tools.tch.compose.AutoTest;
-import org.apache.beehive.test.tools.tch.compose.InvalidTestClassException;
-import org.apache.beehive.test.tools.tch.compose.Parameters;
-import org.apache.beehive.test.tools.tch.compose.Test;
-import org.apache.beehive.test.tools.tch.compose.TestInitializationException;
-import org.apache.beehive.test.tools.tch.util.TchConstants;
-import org.apache.beehive.test.tools.tch.util.TchUtils;
-import org.apache.beehive.test.tools.tch.util.TestResultAdapter;
-
-/**
- * A TestContext that instantiates a test class and invokes
- * its testxxx methods.
- *
- */
-
-public class AtomicTestContext
- extends BaseTestContext
- implements TchConstants
-{
-
- // ============================================================
- // Constants
-
- // After which we print warning
- private final static int MAX_CLEANUP_SECONDS = 300;
-
- private final static Class[] ARG_TYPES =
- { org.apache.beehive.test.tools.tch.compose.TestContext.class };
-
- // ============================================================
- // Variables
-
- // specific methods to run, if any
- private String[] mTestMethods = null;
-
- Test t = null;
-
- // ============================================================
- // Constructor
-
- public AtomicTestContext(
- String inClassName,
- Parameters inParams,
- Collection inTestMethods)
- {
- super(inParams);
-
- if (inTestMethods != null && !inTestMethods.isEmpty())
- {
- // FIXME - make mTestMethods a Collection
- mTestMethods = (String[])inTestMethods.toArray(new String[] { "" });
- }
-
- setRealName(inClassName);
- checkClass(inClassName);
- checkMethods(inClassName, mTestMethods);
- setName(purifyName(inClassName));
- }
-
- public AtomicTestContext(String inClassName, Parameters inParams)
- {
- this(inClassName, inParams, null);
- }
-
- public int getNumTests()
- {
- List methods = new ArrayList();
- try
- {
- methods = getTestMethods(Class.forName(getRealName()));
- }
- catch (Throwable th)
- {
- th.printStackTrace();
- }
- return methods.size();
- }
-
- public void notifyTimeout()
- {
- // test is null if we timed out in the test class constructor
- if (t != null)
- t.setTimedOut();
- }
-
- /**
- * Run the given test, either under control of a timeout or not,
- * depending on the value of timeoutSeconds.
- */
- public void run()
- {
-
- t = null;
- try
- {
- t = makeTestNoTimeout();
- logAs(INIT_LEVEL_INT, "", null, null);
- }
- catch (Exception e)
- {
- Throwable problem = e;
- if (e instanceof InvalidTestClassException)
- {
- problem = ((InvalidTestClassException)e).getNestedException();
- }
- String message = "Test Class Constructor threw " + problem.toString();
- logAs(SCRATCH_LEVEL_INT, "", message, problem);
- logTestsAs(
- SKIP_LEVEL_INT,
- getRealName()
- + " failed to construct, test not run. "
- + "Exception thrown in consructor: "
- + e);
- return;
- }
- String testcase = "<unknown>";
- try
- {
- runNoTimeout(t);
- }
- catch (Exception e)
- {
- logAs(ABORT_LEVEL_INT, testcase, "Test failed with " + e, e);
- return;
- }
-
- testcase = "cleanup";
- // see how much time we spend in cleanup method
- long startCleanup = System.currentTimeMillis();
- // if cleanup() has informs, it should have cleanup as method name
- t.setMethodNameToLog("cleanup");
- try
- {
- t.cleanup();
- logAs(CLEANUP_LEVEL_INT, testcase, null, null);
- }
- catch (Exception e)
- {
- logAs(
- CLEANUP_LEVEL_INT,
- testcase,
- "failed to cleanup after test. "
- + "Caught exception: "
- + TchUtils.throwable2StackTrace(e),
- e);
- }
- long endCleanup = System.currentTimeMillis();
- long cleanupDuration = endCleanup - startCleanup;
- //CR050878 - flag cleanup methods that take too long
- if (cleanupDuration > (MAX_CLEANUP_SECONDS * 1000))
- inform(
- "Warning: For class "
- + getRealName()
- + ", cleanup took longer than "
- + MAX_CLEANUP_SECONDS
- + "s to complete: "
- + cleanupDuration
- + "m");
-
- // temporary check to verify that the number of 'outcome'
- // results we log for this test class is equal to the number
- // of testxxx methods in the class
- // if it is not, print a message so we can decide how to fix the
- // test class
- // see related code to this change in AutoTests 'log' method
- int expectedOutcomes = getNumTests();
- int loggedOutcomes = t.getNumOutcomesLogged();
-
- if (expectedOutcomes != loggedOutcomes)
- {
- inform(
- "Warning: For class "
- + getRealName()
- + ", javatest expected to log "
- + expectedOutcomes
- + " outcomes but logged "
- + loggedOutcomes);
- }
- }
-
- // ============================================================
- // Private Methods
-
- /**
- * The non-timeout version of running a test. Always returns false
- * since the test can't have timed out.
- */
- private boolean runNoTimeout(Test t)
- {
- t.run();
- return false;
- }
-
- /**
- * Make a new instance of the Test with no timeout.
- *
- * @exception InvalidTestClassException if some thing about the class
- * prevents us from invoking the appropriate, one-arg constructor on
- * it.
- *
- * @exception TestInitializationException if an exception is thrown
- * by the constructor. The TestInitializationException contains the
- * exception thrown by the constructor.
- */
- private Test makeTestNoTimeout()
- {
- Constructor cons = checkClass(getRealName());
- try
- {
- Object[] args = { this };
- Test test = (Test)cons.newInstance(args);
- test.setCodeCoverageEnabled(getCodeCoverageEnabled());
- if (mTestMethods != null)
- for (int i = 0; i < mTestMethods.length; i++)
- test.addTest(mTestMethods[i]);
- return test;
- }
- catch (IllegalAccessException iae)
- {
- inform(
- "Exception while accessing test class - "
- + "make sure that test class and constructor are public. "
- + iae);
- throw new InvalidTestClassException(iae);
- }
- catch (InstantiationException ie)
- {
- throw new InvalidTestClassException(ie);
- }
- catch (InvocationTargetException ite)
- {
- throw new InvalidTestClassException(ite.getTargetException());
- }
- catch (Throwable ex)
- {
- throw new InvalidTestClassException(ex);
- }
- }
-
- /**
- * Used to either ABORT or SKIP (or any other result)
- * all tests in this class.
- *
- */
- public void logTestsAs(int resultType, String message)
- {
- logTestsAs(resultType, message, null);
- }
-
- public void logTestsAs(int resultType, String message, Exception th)
- {
- String className = getRealName();
- try
- {
- List methods = getTestMethods(Class.forName(className));
- for (int i = 0; i < methods.size(); i++)
- {
- logAs(resultType, (String)methods.get(i), message, th);
- }
- }
- catch (ClassNotFoundException e)
- {
- inform("The class does not exist; no test cases skipped.");
- }
- catch (Throwable e)
- {
- // We catch throwable because forName() can cause
- // Errors, and we don't want
- // javatest to just up and die
- e.printStackTrace();
- inform("An error occured while obtaining the method names.");
- inform("No methods will be logged.");
- inform(e.toString());
- }
- }
-
- private void logAs(int type, String methodName, String msg, Throwable th)
- {
- TestResultAdapter tr = new TestResultAdapter(type);
- if (methodName != null)
- {
- tr.setName(methodName);
- }
- if (msg != null)
- {
- tr.setOutputMsg(msg);
- }
- if (th != null)
- {
- tr.setThrowable(th);
- }
-
- log(tr);
- }
-
- /**
- * Checks to see if the given class exists.
- * If it does, returns the Constructor
- * which takes a TestContext.
- */
-
- private Constructor checkClass(String className)
- {
- try
- {
- Class c = Class.forName(getRealName());
- return c.getConstructor(ARG_TYPES);
- }
- catch (ClassNotFoundException cnfe)
- {
- throw new InvalidTestClassException("Can't find class " + className);
- }
- catch (NoSuchMethodException nsme)
- {
- throw new InvalidTestClassException(
- "Can't find constructor taking "
- + ARG_TYPES[0]
- + " on class "
- + className);
- }
- }
-
- private void checkMethods(String inClassName, String[] methods)
- {
- if (methods == null)
- return;
- Class c = null;
- try
- {
- c = Class.forName(inClassName);
- }
- catch (Exception ex)
- {
- // swallow, assuming (bad) that we had called checkClass before.
- }
- for (int i = 0; i < methods.length; i++)
- {
- String methodName = methods[i];
- // we have this convention that if you specify a method name without prefixing it with "test",
- // we assume it is a test method. Check for that here, and prepend "test" as necessary.
- if (!AutoTest.isUtilMethod(methodName) && !methodName.startsWith("test"))
- {
- methodName = "test" + methodName;
- }
- try
- {
- c.getMethod(methodName, null);
- }
- catch (NoSuchMethodException ex)
- {
- throw new InvalidTestClassException(
- "Can't find method " + methods[i] + ", for class " + c.getName());
- }
- catch (SecurityException ex)
- {
- throw new InvalidTestClassException(
- "Security exception for method "
- + methods[i]
- + ", for class "
- + c.getName());
- }
- }
- }
-
- public List getTestMethods()
- {
- try
- {
- return getTestMethods(Class.forName(getRealName()));
- }
- catch (ClassNotFoundException ex)
- {
- // bad design, why do I have to keep doing a Class.forName???
- }
- return new ArrayList();
- }
-
- /**
- * Returns a List of all the test methods in class.
- * Used for counting and logging SKIPS if constructor fails.
- */
- private List getTestMethods(Class inClass)
- {
- List methodsList = new ArrayList();
- if (inClass != null)
- {
- if (mTestMethods != null)
- {
- for (int i = 0; i < mTestMethods.length; i++)
- {
- String method = mTestMethods[i];
- if (!method.startsWith(AutoTest.UTIL_PREFIX))
- {
- methodsList.add(method);
- }
- }
- }
- else
- {
- Method[] methods = inClass.getMethods();
- for (int i = 0; i < methods.length; i++)
- {
- Method m = methods[i];
- if ((m.getName().indexOf(AutoTest.TEST_PREFIX) == 0)
- && (m.getParameterTypes().length == 0)
- && (m.getReturnType() == boolean.class))
- {
- methodsList.add(methods[i].getName());
- if (debug)
- {
- System.out.println("Getting: " + methods[i].getName());
- }
- }
-
- }
- }
- }
- return methodsList;
- }
-
-}
+package org.apache.beehive.test.tools.tch.compose.internal.context;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.beehive.test.tools.tch.compose.AutoTest;
+import org.apache.beehive.test.tools.tch.compose.InvalidTestClassException;
+import org.apache.beehive.test.tools.tch.compose.Parameters;
+import org.apache.beehive.test.tools.tch.compose.Test;
+import org.apache.beehive.test.tools.tch.compose.TestInitializationException;
+import org.apache.beehive.test.tools.tch.util.TchConstants;
+import org.apache.beehive.test.tools.tch.util.TchUtils;
+import org.apache.beehive.test.tools.tch.util.TestResultAdapter;
+
+/**
+ * A TestContext that instantiates a test class and invokes
+ * its testxxx methods.
+ *
+ */
+
+public class AtomicTestContext
+ extends BaseTestContext
+ implements TchConstants
+{
+
+ // ============================================================
+ // Constants
+
+ // After which we print warning
+ private final static int MAX_CLEANUP_SECONDS = 300;
+
+ private final static Class[] ARG_TYPES =
+ { org.apache.beehive.test.tools.tch.compose.TestContext.class };
+
+ // ============================================================
+ // Variables
+
+ // specific methods to run, if any
+ private String[] mTestMethods = null;
+
+ Test t = null;
+
+ // ============================================================
+ // Constructor
+
+ public AtomicTestContext(
+ String inClassName,
+ Parameters inParams,
+ Collection inTestMethods)
+ {
+ super(inParams);
+
+ if (inTestMethods != null && !inTestMethods.isEmpty())
+ {
+ // FIXME - make mTestMethods a Collection
+ mTestMethods = (String[])inTestMethods.toArray(new String[] { "" });
+ }
+
+ setRealName(inClassName);
+ checkClass(inClassName);
+ checkMethods(inClassName, mTestMethods);
+ setName(purifyName(inClassName));
+ }
+
+ public AtomicTestContext(String inClassName, Parameters inParams)
+ {
+ this(inClassName, inParams, null);
+ }
+
+ public int getNumTests()
+ {
+ List methods = new ArrayList();
+ try
+ {
+ methods = getTestMethods(Class.forName(getRealName()));
+ }
+ catch (Throwable th)
+ {
+ th.printStackTrace();
+ }
+ return methods.size();
+ }
+
+ public void notifyTimeout()
+ {
+ // test is null if we timed out in the test class constructor
+ if (t != null)
+ t.setTimedOut();
+ }
+
+ /**
+ * Run the given test, either under control of a timeout or not,
+ * depending on the value of timeoutSeconds.
+ */
+ public void run()
+ {
+
+ t = null;
+ try
+ {
+ t = makeTestNoTimeout();
+ logAs(INIT_LEVEL_INT, "", null, null);
+ }
+ catch (Exception e)
+ {
+ Throwable problem = e;
+ if (e instanceof InvalidTestClassException)
+ {
+ problem = ((InvalidTestClassException)e).getNestedException();
+ }
+ String message = "Test Class Constructor threw " + problem.toString();
+ logAs(SCRATCH_LEVEL_INT, "", message, problem);
+ logTestsAs(
+ SKIP_LEVEL_INT,
+ getRealName()
+ + " failed to construct, test not run. "
+ + "Exception thrown in consructor: "
+ + e);
+ return;
+ }
+ String testcase = "<unknown>";
+ try
+ {
+ runNoTimeout(t);
+ }
+ catch (Exception e)
+ {
+ logAs(ABORT_LEVEL_INT, testcase, "Test failed with " + e, e);
+ return;
+ }
+
+ testcase = "cleanup";
+ // see how much time we spend in cleanup method
+ long startCleanup = System.currentTimeMillis();
+ // if cleanup() has informs, it should have cleanup as method name
+ t.setMethodNameToLog("cleanup");
+ try
+ {
+ t.cleanup();
+ logAs(CLEANUP_LEVEL_INT, testcase, null, null);
+ }
+ catch (Exception e)
+ {
+ logAs(
+ CLEANUP_LEVEL_INT,
+ testcase,
+ "failed to cleanup after test. "
+ + "Caught exception: "
+ + TchUtils.throwable2StackTrace(e),
+ e);
+ }
+ long endCleanup = System.currentTimeMillis();
+ long cleanupDuration = endCleanup - startCleanup;
+ //CR050878 - flag cleanup methods that take too long
+ if (cleanupDuration > (MAX_CLEANUP_SECONDS * 1000))
+ inform(
+ "Warning: For class "
+ + getRealName()
+ + ", cleanup took longer than "
+ + MAX_CLEANUP_SECONDS
+ + "s to complete: "
+ + cleanupDuration
+ + "m");
+
+ // temporary check to verify that the number of 'outcome'
+ // results we log for this test class is equal to the number
+ // of testxxx methods in the class
+ // if it is not, print a message so we can decide how to fix the
+ // test class
+ // see related code to this change in AutoTests 'log' method
+ int expectedOutcomes = getNumTests();
+ int loggedOutcomes = t.getNumOutcomesLogged();
+
+ if (expectedOutcomes != loggedOutcomes)
+ {
+ inform(
+ "Warning: For class "
+ + getRealName()
+ + ", javatest expected to log "
+ + expectedOutcomes
+ + " outcomes but logged "
+ + loggedOutcomes);
+ }
+ }
+
+ // ============================================================
+ // Private Methods
+
+ /**
+ * The non-timeout version of running a test. Always returns false
+ * since the test can't have timed out.
+ */
+ private boolean runNoTimeout(Test t)
+ {
+ t.run();
+ return false;
+ }
+
+ /**
+ * Make a new instance of the Test with no timeout.
+ *
+ * @exception InvalidTestClassException if some thing about the class
+ * prevents us from invoking the appropriate, one-arg constructor on
+ * it.
+ *
+ * @exception TestInitializationException if an exception is thrown
+ * by the constructor. The TestInitializationException contains the
+ * exception thrown by the constructor.
+ */
+ private Test makeTestNoTimeout()
+ {
+ Constructor cons = checkClass(getRealName());
+ try
+ {
+ Object[] args = { this };
+ Test test = (Test)cons.newInstance(args);
+ test.setCodeCoverageEnabled(getCodeCoverageEnabled());
+ if (mTestMethods != null)
+ for (int i = 0; i < mTestMethods.length; i++)
+ test.addTest(mTestMethods[i]);
+ return test;
+ }
+ catch (IllegalAccessException iae)
+ {
+ inform(
+ "Exception while accessing test class - "
+ + "make sure that test class and constructor are public. "
+ + iae);
+ throw new InvalidTestClassException(iae);
+ }
+ catch (InstantiationException ie)
+ {
+ throw new InvalidTestClassException(ie);
+ }
+ catch (InvocationTargetException ite)
+ {
+ throw new InvalidTestClassException(ite.getTargetException());
+ }
+ catch (Throwable ex)
+ {
+ throw new InvalidTestClassException(ex);
+ }
+ }
+
+ /**
+ * Used to either ABORT or SKIP (or any other result)
+ * all tests in this class.
+ *
+ */
+ public void logTestsAs(int resultType, String message)
+ {
+ logTestsAs(resultType, message, null);
+ }
+
+ public void logTestsAs(int resultType, String message, Exception th)
+ {
+ String className = getRealName();
+ try
+ {
+ List methods = getTestMethods(Class.forName(className));
+ for (int i = 0; i < methods.size(); i++)
+ {
+ logAs(resultType, (String)methods.get(i), message, th);
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ inform("The class does not exist; no test cases skipped.");
+ }
+ catch (Throwable e)
+ {
+ // We catch throwable because forName() can cause
+ // Errors, and we don't want
+ // javatest to just up and die
+ e.printStackTrace();
+ inform("An error occured while obtaining the method names.");
+ inform("No methods will be logged.");
+ inform(e.toString());
+ }
+ }
+
+ private void logAs(int type, String methodName, String msg, Throwable th)
+ {
+ TestResultAdapter tr = new TestResultAdapter(type);
+ if (methodName != null)
+ {
+ tr.setName(methodName);
+ }
+ if (msg != null)
+ {
+ tr.setOutputMsg(msg);
+ }
+ if (th != null)
+ {
+ tr.setThrowable(th);
+ }
+
+ log(tr);
+ }
+
+ /**
+ * Checks to see if the given class exists.
+ * If it does, returns the Constructor
+ * which takes a TestContext.
+ */
+
+ private Constructor checkClass(String className)
+ {
+ try
+ {
+ Class c = Class.forName(getRealName());
+ return c.getConstructor(ARG_TYPES);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ throw new InvalidTestClassException("Can't find class " + className);
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ throw new InvalidTestClassException(
+ "Can't find constructor taking "
+ + ARG_TYPES[0]
+ + " on class "
+ + className);
+ }
+ }
+
+ private void checkMethods(String inClassName, String[] methods)
+ {
+ if (methods == null)
+ return;
+ Class c = null;
+ try
+ {
+ c = Class.forName(inClassName);
+ }
+ catch (Exception ex)
+ {
+ // swallow, assuming (bad) that we had called checkClass before.
+ }
+ for (int i = 0; i < methods.length; i++)
+ {
+ String methodName = methods[i];
+ // we have this convention that if you specify a method name without prefixing it with "test",
+ // we assume it is a test method. Check for that here, and prepend "test" as necessary.
+ if (!AutoTest.isUtilMethod(methodName) && !methodName.startsWith("test"))
+ {
+ methodName = "test" + methodName;
+ }
+ try
+ {
+ c.getMethod(methodName, null);
+ }
+ catch (NoSuchMethodException ex)
+ {
+ throw new InvalidTestClassException(
+ "Can't find method " + methods[i] + ", for class " + c.getName());
+ }
+ catch (SecurityException ex)
+ {
+ throw new InvalidTestClassException(
+ "Security exception for method "
+ + methods[i]
+ + ", for class "
+ + c.getName());
+ }
+ }
+ }
+
+ public List getTestMethods()
+ {
+ try
+ {
+ return getTestMethods(Class.forName(getRealName()));
+ }
+ catch (ClassNotFoundException ex)
+ {
+ // bad design, why do I have to keep doing a Class.forName???
+ }
+ return new ArrayList();
+ }
+
+ /**
+ * Returns a List of all the test methods in class.
+ * Used for counting and logging SKIPS if constructor fails.
+ */
+ private List getTestMethods(Class inClass)
+ {
+ List methodsList = new ArrayList();
+ if (inClass != null)
+ {
+ if (mTestMethods != null)
+ {
+ for (int i = 0; i < mTestMethods.length; i++)
+ {
+ String method = mTestMethods[i];
+ if (!method.startsWith(AutoTest.UTIL_PREFIX))
+ {
+ methodsList.add(method);
+ }
+ }
+ }
+ else
+ {
+ Method[] methods = inClass.getMethods();
+ for (int i = 0; i < methods.length; i++)
+ {
+ Method m = methods[i];
+ if ((m.getName().indexOf(AutoTest.TEST_PREFIX) == 0)
+ && (m.getParameterTypes().length == 0)
+ && (m.getReturnType() == boolean.class))
+ {
+ methodsList.add(methods[i].getName());
+ if (debug)
+ {
+ System.out.println("Getting: " + methods[i].getName());
+ }
+ }
+
+ }
+ }
+ }
+ return methodsList;
+ }
+
+}
Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/compose/internal/context/AtomicTestContext.java
------------------------------------------------------------------------------
svn:eol-style = native