+ * In clusterj, test classes can use either the real junit or this mock junit. + * The mock can be used stand-alone or invoked by the maven surefire junit plugin. + * Other test runners and harnesses might not have been tested and might not work. + *
+ * There is no code copied from Junit itself. Only concepts and names of + * annotations, interfaces, classes, and methods are copied, which must exactly match + * the corresponding items from junit in order to be mocked. + */ + +package junit.framework; + +public class AssertionFailedError extends AssertionError { + + private static final long serialVersionUID= 1L; + + /** Construct an AssertionFailedError with no failure message (highly unusual). + */ + public AssertionFailedError() { + } + + /** Construct an AssertionFailedError with the failure message. + * @param message the message + */ + public AssertionFailedError(String message) { + super(message); + } +} === added file 'storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/Test.java' --- a/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/Test.java 1970-01-01 00:00:00 +0000 +++ b/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/Test.java 2012-04-14 21:37:35 +0000 @@ -0,0 +1,39 @@ +/* + Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * This assortment of classes is a mock http://en.wikipedia.org/wiki/Mock_object + * implementation of junit http://en.wikipedia.org/wiki/Junit. It contains annotations, + * classes, and interfaces that mock junit for use with test classes + * that use a subset of junit functionality. + *
+ * In clusterj, test classes can use either the real junit or this mock junit. + * The mock can be used stand-alone or invoked by the maven surefire junit plugin. + * Other test runners and harnesses might not have been tested and might not work. + *
+ * There is no code copied from Junit itself. Only concepts and names of + * annotations, interfaces, classes, and methods are copied, which must exactly match + * the corresponding items from junit in order to be mocked. + */ + +package junit.framework; + +/** This interface is implemented by a TestCase class. + */ +public interface Test { + void run(TestResult result); +} === added file 'storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestCase.java' --- a/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestCase.java 1970-01-01 00:00:00 +0000 +++ b/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestCase.java 2012-04-14 21:37:35 +0000 @@ -0,0 +1,92 @@ +/* + Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * This assortment of classes is a mock http://en.wikipedia.org/wiki/Mock_object + * implementation of junit http://en.wikipedia.org/wiki/Junit. It contains annotations, + * classes, and interfaces that mock junit for use with test classes + * that use a subset of junit functionality. + *
+ * In clusterj, test classes can use either the real junit or this mock junit. + * The mock can be used stand-alone or invoked by the maven surefire junit plugin. + * Other test runners and harnesses might not have been tested and might not work. + *
+ * There is no code copied from Junit itself. Only concepts and names of + * annotations, interfaces, classes, and methods are copied, which must exactly match + * the corresponding items from junit in order to be mocked. + */ + +package junit.framework; + +import java.lang.reflect.Method; +import java.lang.reflect.InvocationTargetException; + +public abstract class TestCase implements Test { + public String name; + public Method method; + + /** Run a single test case (method). If the test case fails an assertion + * via the fail(String) method, add the test to result.failures. + * If the test case fails by throwing an exception, or + * if the test case fails in setUp or tearDown, add the test case + * to result.errors. + */ + public void run(TestResult result) { +// System.out.println("--> TestCase.run(TestResult): " + name); + TestListener listener = result.listener; + listener.startTest(this); + try { + setUp(); + try { + method.invoke(this); + result.successes.add(name); + } catch (InvocationTargetException e) { + Throwable t = e.getCause(); + if (t instanceof AssertionFailedError) { + result.failures.add(name); + listener.addFailure(this, (AssertionFailedError)t); + } else { + result.throwables.add(t); + listener.addError(this, t); + } + } finally { + tearDown(); + } + } catch (Throwable t) { + result.throwables.add(t); + listener.addError(this, t); + } + listener.endTest(this); +// System.out.println("<-- TestCase.run(TestResult): " + name); + } + + /** The test case failed due to a failed assertion. + * @param message the failure message + */ + static public void fail(String message) { + throw new AssertionFailedError(message); + } + + protected void setUp() throws Exception {} + + protected void tearDown() throws Exception {} + + public int countTestCases() { + return 0; + } + +} === added file 'storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestListener.java' --- a/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestListener.java 1970-01-01 00:00:00 +0000 +++ b/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestListener.java 2012-04-14 21:37:35 +0000 @@ -0,0 +1,55 @@ +/* + Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * This assortment of classes is a mock http://en.wikipedia.org/wiki/Mock_object + * implementation of junit http://en.wikipedia.org/wiki/Junit. It contains annotations, + * classes, and interfaces that mock junit for use with test classes + * that use a subset of junit functionality. + *
+ * In clusterj, test classes can use either the real junit or this mock junit. + * The mock can be used stand-alone or invoked by the maven surefire junit plugin. + * Other test runners and harnesses might not have been tested and might not work. + *
+ * There is no code copied from Junit itself. Only concepts and names of + * annotations, interfaces, classes, and methods are copied, which must exactly match + * the corresponding items from junit in order to be mocked. + */ + +package junit.framework; + +/** This interface is used to monitor the execution of tests and track errors and failures. + * It is implemented as part of the test runner framework. + */ +public interface TestListener { + + /** An error (exception) occurred during the execution of the test. + */ + public void addError(Test test, Throwable t); + + /** A failure (assertion) occurred during the execution of the test. + */ + public void addFailure(Test test, AssertionFailedError t); + + /** A test ended. + */ + public void endTest(Test test); + + /** A test started. + */ + public void startTest(Test test); +} === added file 'storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestResult.java' --- a/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestResult.java 1970-01-01 00:00:00 +0000 +++ b/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestResult.java 2012-04-14 21:37:35 +0000 @@ -0,0 +1,54 @@ +/* + Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * This assortment of classes is a mock http://en.wikipedia.org/wiki/Mock_object + * implementation of junit http://en.wikipedia.org/wiki/Junit. It contains annotations, + * classes, and interfaces that mock junit for use with test classes + * that use a subset of junit functionality. + *
+ * In clusterj, test classes can use either the real junit or this mock junit. + * The mock can be used stand-alone or invoked by the maven surefire junit plugin. + * Other test runners and harnesses might not have been tested and might not work. + *
+ * There is no code copied from Junit itself. Only concepts and names of
+ * annotations, interfaces, classes, and methods are copied, which must exactly match
+ * the corresponding items from junit in order to be mocked.
+ */
+
+package junit.framework;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/** This class maintains the results of running a series of tests. It is the primary
+ * way for a test class to return results of tests.
+ */
+public class TestResult {
+ public final List
+ * In clusterj, test classes can use either the real junit or this mock junit.
+ * The mock can be used stand-alone or invoked by the maven surefire junit plugin.
+ * Other test runners and harnesses might not have been tested and might not work.
+ *
+ * There is no code copied from Junit itself. Only concepts and names of
+ * annotations, interfaces, classes, and methods are copied, which must exactly match
+ * the corresponding items from junit in order to be mocked.
+ */
+
+package junit.framework;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import org.junit.Ignore;
+
+public class TestSuite implements Test {
+ public final String name;
+ public final List
+ * In clusterj, test classes can use either the real junit or this mock junit.
+ * The mock can be used stand-alone or invoked by the maven surefire junit plugin.
+ * Other test runners and harnesses might not have been tested and might not work.
+ *
+ * There is no code copied from Junit itself. Only concepts and names of
+ * annotations, interfaces, classes, and methods are copied, which must exactly match
+ * the corresponding items from junit in order to be mocked.
+ */
+
+package junit.textui;
+
+import junit.framework.Test;
+import junit.framework.TestResult;
+
+/** Run a single test and return the result. Construct an instance of TestResult,
+ * pass it to the Test, and return it when the test completes.
+ */
+public class TestRunner {
+ static public TestResult run(Test test) {
+ final TestResult result = new TestResult();
+ test.run(result);
+ return result;
+ }
+}
=== added directory 'storage/ndb/clusterj/clusterj-unit/src/main/java/org'
=== added directory 'storage/ndb/clusterj/clusterj-unit/src/main/java/org/junit'
=== added file 'storage/ndb/clusterj/clusterj-unit/src/main/java/org/junit/Ignore.java'
--- a/storage/ndb/clusterj/clusterj-unit/src/main/java/org/junit/Ignore.java 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/clusterj/clusterj-unit/src/main/java/org/junit/Ignore.java 2012-04-14 21:37:35 +0000
@@ -0,0 +1,50 @@
+/*
+ Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * This assortment of classes is a mock http://en.wikipedia.org/wiki/Mock_object
+ * implementation of junit http://en.wikipedia.org/wiki/Junit. It contains annotations,
+ * classes, and interfaces that mock junit for use with test classes
+ * that use a subset of junit functionality.
+ *
+ * In clusterj, test classes can use either the real junit or this mock junit.
+ * The mock can be used stand-alone or invoked by the maven surefire junit plugin.
+ * Other test runners and harnesses might not have been tested and might not work.
+ *
+ * There is no code copied from Junit itself. Only concepts and names of
+ * annotations, interfaces, classes, and methods are copied, which must exactly match
+ * the corresponding items from junit in order to be mocked.
+ */
+
+package org.junit;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/** This annotation can be used either on a test class to skip all tests contained
+ * within, or on a test method to skip a specific test method. The optional value()
+ * can be used to document why a test class or test method should not be run.
+ *
+ * For example: @Ignore("test uses excessive cpu")
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.TYPE})
+public @interface Ignore {
+ String value() default "";
+}
=== modified file 'storage/ndb/clusterj/pom.xml'
--- a/storage/ndb/clusterj/pom.xml 2012-03-29 17:42:19 +0000
+++ b/storage/ndb/clusterj/pom.xml 2012-04-15 03:45:31 +0000
@@ -35,6 +35,7 @@