From 01c5d59c5245068b0d005ccbb64f8d0aa5165f12 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 1 Oct 2013 22:41:55 +0200 Subject: 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. --- test/TestOneJar_InJar/jogamp01/build.xml | 123 +++++++++++++++++++++ .../jogamp01/ide/eclipse/jogamp01-suite.launch | 26 +++++ .../eclipse/test-jogamp01 (JarLaunch build).launch | 12 ++ .../jogamp01/junit/jogamp/test/Jogamp01Suite.java | 73 ++++++++++++ test/TestOneJar_InJar/jogamp01/lib/README.txt | 1 + .../jogamp01/one-jar/build.onejar.xml | 54 +++++++++ .../one-jar/dist/one-jar-ant-task-0.97.jar | Bin 0 -> 92003 bytes .../jogamp01/one-jar/dist/one-jar-ant-task.xml | 10 ++ .../jogamp01/one-jar/dist/one-jar-boot-0.97.jar | Bin 0 -> 69299 bytes .../jogamp01/one-jar/lib/junit-3.8.1.jar | Bin 0 -> 121070 bytes .../jogamp01/src/jogamp/main/Jogamp01Main.java | 31 ++++++ .../jogamp01/test/jogamp/test/Test.java | 32 ++++++ test/TestOneJar_InJar/make-one_jar.sh | 18 +++ test/TestOneJar_InJar/one-jar-license.txt | 33 ++++++ test/TestOneJar_InJar/run-one.sh | 9 ++ 15 files changed, 422 insertions(+) create mode 100644 test/TestOneJar_InJar/jogamp01/build.xml create mode 100644 test/TestOneJar_InJar/jogamp01/ide/eclipse/jogamp01-suite.launch create mode 100644 test/TestOneJar_InJar/jogamp01/ide/eclipse/test-jogamp01 (JarLaunch build).launch create mode 100644 test/TestOneJar_InJar/jogamp01/junit/jogamp/test/Jogamp01Suite.java create mode 100644 test/TestOneJar_InJar/jogamp01/lib/README.txt create mode 100644 test/TestOneJar_InJar/jogamp01/one-jar/build.onejar.xml create mode 100644 test/TestOneJar_InJar/jogamp01/one-jar/dist/one-jar-ant-task-0.97.jar create mode 100644 test/TestOneJar_InJar/jogamp01/one-jar/dist/one-jar-ant-task.xml create mode 100644 test/TestOneJar_InJar/jogamp01/one-jar/dist/one-jar-boot-0.97.jar create mode 100644 test/TestOneJar_InJar/jogamp01/one-jar/lib/junit-3.8.1.jar create mode 100644 test/TestOneJar_InJar/jogamp01/src/jogamp/main/Jogamp01Main.java create mode 100644 test/TestOneJar_InJar/jogamp01/test/jogamp/test/Test.java create mode 100644 test/TestOneJar_InJar/make-one_jar.sh create mode 100644 test/TestOneJar_InJar/one-jar-license.txt create mode 100644 test/TestOneJar_InJar/run-one.sh (limited to 'test/TestOneJar_InJar') diff --git a/test/TestOneJar_InJar/jogamp01/build.xml b/test/TestOneJar_InJar/jogamp01/build.xml new file mode 100644 index 0000000..e1a4b24 --- /dev/null +++ b/test/TestOneJar_InJar/jogamp01/build.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + + + +
+ +
+ + + +
+ +
+ + + + + + + + + + + ********** junit-jogamp01.jar + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/test/TestOneJar_InJar/jogamp01/ide/eclipse/jogamp01-suite.launch b/test/TestOneJar_InJar/jogamp01/ide/eclipse/jogamp01-suite.launch new file mode 100644 index 0000000..b3e5c70 --- /dev/null +++ b/test/TestOneJar_InJar/jogamp01/ide/eclipse/jogamp01-suite.launch @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/TestOneJar_InJar/jogamp01/ide/eclipse/test-jogamp01 (JarLaunch build).launch b/test/TestOneJar_InJar/jogamp01/ide/eclipse/test-jogamp01 (JarLaunch build).launch new file mode 100644 index 0000000..e532dd3 --- /dev/null +++ b/test/TestOneJar_InJar/jogamp01/ide/eclipse/test-jogamp01 (JarLaunch build).launch @@ -0,0 +1,12 @@ + + + + + + + + + + + + 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 (simon@simontuffs.com) + * 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; + } + +} diff --git a/test/TestOneJar_InJar/jogamp01/lib/README.txt b/test/TestOneJar_InJar/jogamp01/lib/README.txt new file mode 100644 index 0000000..3c862b9 --- /dev/null +++ b/test/TestOneJar_InJar/jogamp01/lib/README.txt @@ -0,0 +1 @@ +Place your libraries to be included in the One-Jar archive here. diff --git a/test/TestOneJar_InJar/jogamp01/one-jar/build.onejar.xml b/test/TestOneJar_InJar/jogamp01/one-jar/build.onejar.xml new file mode 100644 index 0000000..8c41ade --- /dev/null +++ b/test/TestOneJar_InJar/jogamp01/one-jar/build.onejar.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + *********************************************** + * Report is in ${test.reports.dir}/junit_noframes.html + *********************************************** + + + + + diff --git a/test/TestOneJar_InJar/jogamp01/one-jar/dist/one-jar-ant-task-0.97.jar b/test/TestOneJar_InJar/jogamp01/one-jar/dist/one-jar-ant-task-0.97.jar new file mode 100644 index 0000000..15dbbb2 Binary files /dev/null and b/test/TestOneJar_InJar/jogamp01/one-jar/dist/one-jar-ant-task-0.97.jar differ diff --git a/test/TestOneJar_InJar/jogamp01/one-jar/dist/one-jar-ant-task.xml b/test/TestOneJar_InJar/jogamp01/one-jar/dist/one-jar-ant-task.xml new file mode 100644 index 0000000..007b5ad --- /dev/null +++ b/test/TestOneJar_InJar/jogamp01/one-jar/dist/one-jar-ant-task.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/test/TestOneJar_InJar/jogamp01/one-jar/dist/one-jar-boot-0.97.jar b/test/TestOneJar_InJar/jogamp01/one-jar/dist/one-jar-boot-0.97.jar new file mode 100644 index 0000000..26e0ec6 Binary files /dev/null and b/test/TestOneJar_InJar/jogamp01/one-jar/dist/one-jar-boot-0.97.jar differ diff --git a/test/TestOneJar_InJar/jogamp01/one-jar/lib/junit-3.8.1.jar b/test/TestOneJar_InJar/jogamp01/one-jar/lib/junit-3.8.1.jar new file mode 100644 index 0000000..674d71e Binary files /dev/null and b/test/TestOneJar_InJar/jogamp01/one-jar/lib/junit-3.8.1.jar differ diff --git a/test/TestOneJar_InJar/jogamp01/src/jogamp/main/Jogamp01Main.java b/test/TestOneJar_InJar/jogamp01/src/jogamp/main/Jogamp01Main.java new file mode 100644 index 0000000..b8ee4e1 --- /dev/null +++ b/test/TestOneJar_InJar/jogamp01/src/jogamp/main/Jogamp01Main.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2004-2010, P. Simon Tuffs (simon@simontuffs.com) + * 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.main; + +import java.util.Arrays; + +public class Jogamp01Main { + + public static void main(String args[]) { + if (args == null) + args = new String[0]; + System.out.println("jogamp01 main entry point, args=" + Arrays.asList(args)); + new Jogamp01Main().run(); + } + + // Bring up the application: only expected to exit when user interaction + // indicates so. + public void run() { + System.out.println("jogamp01 main is running"); + // Implement the functionality of the application. + System.out.println("jogamp01 OK."); + } + + +} diff --git a/test/TestOneJar_InJar/jogamp01/test/jogamp/test/Test.java b/test/TestOneJar_InJar/jogamp01/test/jogamp/test/Test.java new file mode 100644 index 0000000..87e987f --- /dev/null +++ b/test/TestOneJar_InJar/jogamp01/test/jogamp/test/Test.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2004-2010, P. Simon Tuffs (simon@simontuffs.com) + * 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 com.simontuffs.onejar.test.Testable; + +public class Test extends Testable { + + public static void main(String args[]) throws Exception { + Test test = new Test(); + test.runTests(); + } + + // Test other aspects of the application at unit level (e.g. library + // methods). + public void testJogamp011() { + System.out.println("testJogamp011: OK"); + } + public void testJogamp012() { + System.out.println("testJogamp012: OK"); + } + public void testJogamp013() { + System.out.println("testJogamp013: OK"); + } + +} diff --git a/test/TestOneJar_InJar/make-one_jar.sh b/test/TestOneJar_InJar/make-one_jar.sh new file mode 100644 index 0000000..7ba3a83 --- /dev/null +++ b/test/TestOneJar_InJar/make-one_jar.sh @@ -0,0 +1,18 @@ +THISDIR=`pwd` +GLUEGEN=$THISDIR/../../../gluegen +JOGL=$THISDIR/../../../jogl + +DEST=jogamp01/lib/ + +bdir=build-x86_64 + +cp -av $GLUEGEN/$bdir/gluegen-rt.jar $DEST +cp -av $GLUEGEN/$bdir/gluegen-rt-natives-linux-amd64.jar $DEST +cp -av $JOGL/$bdir/jar/jogl-all.jar $DEST +cp -av $JOGL/$bdir/jar/jogl-all-natives-linux-amd64.jar $DEST + +rm -f jogamp01/build/* + +cd jogamp01 +ant +cd .. diff --git a/test/TestOneJar_InJar/one-jar-license.txt b/test/TestOneJar_InJar/one-jar-license.txt new file mode 100644 index 0000000..8336075 --- /dev/null +++ b/test/TestOneJar_InJar/one-jar-license.txt @@ -0,0 +1,33 @@ +/* + * One-JAR(TM) (http://www.simontuffs.com/one-jar). Copyright (c) 2004-2010, + * P. Simon Tuffs (simon@simontuffs.com). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 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. + * + * Neither the name of P. Simon Tuffs, nor the names of any contributors, + * nor the name One-JAR may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS 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 COPYRIGHT OWNER OR 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. + * + * Including this file inside the built One-JAR file conforms with these terms. + */ + diff --git a/test/TestOneJar_InJar/run-one.sh b/test/TestOneJar_InJar/run-one.sh new file mode 100644 index 0000000..b1d6542 --- /dev/null +++ b/test/TestOneJar_InJar/run-one.sh @@ -0,0 +1,9 @@ + +THIS_DIR=`pwd` + +D_ARGS="-Djogamp.debug.JNILibLoader -Djogamp.debug.TempFileCache -Djogamp.debug.JarUtil -Djogamp.debug.TempJarCache -Djogamp.debug.IOUtil" +#D_ARGS="-Djogamp.debug.ProcAddressHelper -Djogamp.debug.NativeLibrary -Djogamp.debug.NativeLibrary.Lookup" +#D_ARGS="-Djogamp.debug.JNILibLoader -Djogamp.debug.TempFileCache -Djogamp.debug.JarUtil -Djogamp.debug.TempJarCache -Djogamp.debug.NativeLibrary -Djogamp.debug.NativeLibrary.Lookup -Djogl.debug=all" + +#java $D_ARGS -jar jogamp01/build/jogamp01.jar 2>&1 | tee run-one.log +java $D_ARGS -jar $THIS_DIR/jogamp01/build/jogamp01.jar 2>&1 | tee run-one.log -- cgit v1.2.3