summaryrefslogtreecommitdiffstats
path: root/test/TestOneJar_InJar/jogamp01/junit
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-10-01 22:41:55 +0200
committerSven Gothel <[email protected]>2013-10-01 22:41:55 +0200
commit01c5d59c5245068b0d005ccbb64f8d0aa5165f12 (patch)
tree75b61bd2c6ac9e927eb1ad412bf2fe4819a262b5 /test/TestOneJar_InJar/jogamp01/junit
parentb05f716cbcbc379588050c8f3d91579b3a14ec88 (diff)
Bug 846: Add manual test case for One-Jar (using 0.97.1)
Note: One-Jar lacks support of a URL handler for it's jar-in-jar files and hence we would need to extract the jar-in-jar resources w/ our TempJarCache from one one-jar file .. too bad. Looks like it's incomplete.
Diffstat (limited to 'test/TestOneJar_InJar/jogamp01/junit')
-rw-r--r--test/TestOneJar_InJar/jogamp01/junit/jogamp/test/Jogamp01Suite.java73
1 files changed, 73 insertions, 0 deletions
diff --git a/test/TestOneJar_InJar/jogamp01/junit/jogamp/test/Jogamp01Suite.java b/test/TestOneJar_InJar/jogamp01/junit/jogamp/test/Jogamp01Suite.java
new file mode 100644
index 0000000..85ac9c0
--- /dev/null
+++ b/test/TestOneJar_InJar/jogamp01/junit/jogamp/test/Jogamp01Suite.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2004-2010, P. Simon Tuffs ([email protected])
+ * All rights reserved.
+ *
+ * See the full license at http://one-jar.sourceforge.net/one-jar-license.html
+ * This license is also included in the distributions of this software
+ * under doc/one-jar-license.txt
+ */
+package jogamp.test;
+
+import java.lang.reflect.Method;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+
+import com.simontuffs.onejar.Boot;
+import com.simontuffs.onejar.JarClassLoader;
+import com.simontuffs.onejar.test.Invoker;
+
+public class Jogamp01Suite {
+
+ protected static Object test;
+ protected static int failures = 0;
+
+ public static final String MAIN_CLASS = "jogamp.test.Test";
+
+ public static void main(String args[]) {
+ new TestSuite(Jogamp01Suite.class).run(new TestResult());
+ }
+
+ public static Test suite() throws Exception {
+ if (test == null) {
+ // Load Test object from the jar.
+ JarClassLoader loader = new JarClassLoader("");
+ Boot.setClassLoader(loader);
+ // loader.setVerbose(true);
+ loader.load(null);
+ test = loader.loadClass(MAIN_CLASS).newInstance();
+ }
+ TestSuite top = new TestSuite();
+ TestSuite suite = new TestSuite(MAIN_CLASS);
+ top.addTest(suite);
+ Method methods[] = test.getClass().getMethods();
+ for (final Method method: methods) {
+ if (method.getName().startsWith("test")) {
+ System.out.println("" + method);
+ suite.addTest(new TestCase() {
+ {
+ setName(method.getName());
+ }
+ @Override
+ public void run(TestResult result) {
+ // TODO Auto-generated method stub
+ result.startTest(this);
+ try {
+ Invoker.invoke(test, method.getName());
+ } catch (Exception x) {
+ x.printStackTrace();
+ result.addFailure(this, new AssertionFailedError(x.toString()));
+ }
+ result.endTest(this);
+ }
+ });
+ }
+ }
+
+ return suite;
+ }
+
+}