diff options
author | Sven Gothel <[email protected]> | 2014-10-03 04:43:51 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-10-03 04:43:51 +0200 |
commit | fb60db3a633d82a0323f066a98a8a9fadf3ecff5 (patch) | |
tree | 17ff9cb71b0652f4086880c5b0aedf54084ceb74 /src/junit/com | |
parent | bd240ebfe09b7c7a21689dee8be0cc673eb7f340 (diff) |
SingletonTestCase: Move singleton test impl. from JOGL's UITestCase, inherit from JunitTracer and use it for all tests.
- Certain performance tests don't make sense utilizing several jenkins unit tests on one machine,
hence singleton test execution is desired.
- JOGL's UITestCase also will derive from this SingletonTestCase
Diffstat (limited to 'src/junit/com')
45 files changed, 179 insertions, 92 deletions
diff --git a/src/junit/com/jogamp/common/net/AssetURLConnectionBase.java b/src/junit/com/jogamp/common/net/AssetURLConnectionBase.java index 40acec9..c6b90b5 100644 --- a/src/junit/com/jogamp/common/net/AssetURLConnectionBase.java +++ b/src/junit/com/jogamp/common/net/AssetURLConnectionBase.java @@ -10,9 +10,9 @@ import org.junit.Assert; import com.jogamp.common.os.AndroidVersion; import com.jogamp.common.util.IOUtil; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; -public abstract class AssetURLConnectionBase extends JunitTracer { +public abstract class AssetURLConnectionBase extends SingletonTestCase { /** In gluegen-rt.jar */ protected static final String test_asset_rt_url = "asset:gluegen/info.txt"; diff --git a/src/junit/com/jogamp/common/net/TestUri01.java b/src/junit/com/jogamp/common/net/TestUri01.java index a59409f..0ec5bfe 100644 --- a/src/junit/com/jogamp/common/net/TestUri01.java +++ b/src/junit/com/jogamp/common/net/TestUri01.java @@ -10,13 +10,13 @@ import org.junit.Test; import com.jogamp.common.net.URIDumpUtil; import com.jogamp.common.util.IOUtil; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestUri01 extends JunitTracer { +public class TestUri01 extends SingletonTestCase { @Test public void test00BasicCoding() throws IOException, URISyntaxException { diff --git a/src/junit/com/jogamp/common/net/TestUri02Composing.java b/src/junit/com/jogamp/common/net/TestUri02Composing.java index 50e8e07..ff7e9bb 100644 --- a/src/junit/com/jogamp/common/net/TestUri02Composing.java +++ b/src/junit/com/jogamp/common/net/TestUri02Composing.java @@ -9,13 +9,13 @@ import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestUri02Composing extends JunitTracer { +public class TestUri02Composing extends SingletonTestCase { @BeforeClass public static void assetRegistration() throws Exception { diff --git a/src/junit/com/jogamp/common/net/TestUri03Resolving.java b/src/junit/com/jogamp/common/net/TestUri03Resolving.java index 54e2976..f7fe842 100644 --- a/src/junit/com/jogamp/common/net/TestUri03Resolving.java +++ b/src/junit/com/jogamp/common/net/TestUri03Resolving.java @@ -14,13 +14,13 @@ import org.junit.Test; import com.jogamp.common.net.Uri; import com.jogamp.common.os.Platform; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestUri03Resolving extends JunitTracer { +public class TestUri03Resolving extends SingletonTestCase { // Bug 908, issues w/ windows file path char: $ ^ ~ # [ ] diff --git a/src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java b/src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java index 09748a1..78ecb93 100644 --- a/src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java +++ b/src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java @@ -44,7 +44,7 @@ import com.jogamp.common.os.AndroidVersion; import com.jogamp.common.os.Platform; import com.jogamp.common.util.JarUtil; import com.jogamp.common.util.ReflectionUtil; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import com.jogamp.junit.util.MiscUtils; /** @@ -70,7 +70,7 @@ import com.jogamp.junit.util.MiscUtils; * </p> */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestUri99LaunchOnReservedCharPathBug908 extends JunitTracer { +public class TestUri99LaunchOnReservedCharPathBug908 extends SingletonTestCase { static class TestClassLoader extends URLClassLoader { public TestClassLoader(final URL[] urls) { super(urls); diff --git a/src/junit/com/jogamp/common/net/TestUriQueryProps.java b/src/junit/com/jogamp/common/net/TestUriQueryProps.java index 471cae2..847c6e3 100644 --- a/src/junit/com/jogamp/common/net/TestUriQueryProps.java +++ b/src/junit/com/jogamp/common/net/TestUriQueryProps.java @@ -8,13 +8,13 @@ import java.net.URISyntaxException; import org.junit.Assert; import org.junit.Test; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestUriQueryProps extends JunitTracer { +public class TestUriQueryProps extends SingletonTestCase { @Test public void test() throws IOException, URISyntaxException { diff --git a/src/junit/com/jogamp/common/net/TestUrisWithAssetHandler.java b/src/junit/com/jogamp/common/net/TestUrisWithAssetHandler.java index d2bfaf7..55b81a3 100644 --- a/src/junit/com/jogamp/common/net/TestUrisWithAssetHandler.java +++ b/src/junit/com/jogamp/common/net/TestUrisWithAssetHandler.java @@ -11,10 +11,10 @@ import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestUrisWithAssetHandler extends JunitTracer { +public class TestUrisWithAssetHandler extends SingletonTestCase { @BeforeClass public static void assetRegistration() throws Exception { diff --git a/src/junit/com/jogamp/common/nio/BuffersTest.java b/src/junit/com/jogamp/common/nio/BuffersTest.java index 68bd71f..c6a98c4 100644 --- a/src/junit/com/jogamp/common/nio/BuffersTest.java +++ b/src/junit/com/jogamp/common/nio/BuffersTest.java @@ -34,7 +34,7 @@ package com.jogamp.common.nio; import java.nio.IntBuffer; import org.junit.Test; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import static org.junit.Assert.*; @@ -45,7 +45,7 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class BuffersTest extends JunitTracer { +public class BuffersTest extends SingletonTestCase { @Test public void slice() { diff --git a/src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java b/src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java index b0f3cfb..0bdac52 100644 --- a/src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java +++ b/src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java @@ -42,7 +42,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import static java.lang.System.*; import static org.junit.Assert.*; @@ -55,7 +55,7 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class CachedBufferFactoryTest extends JunitTracer { +public class CachedBufferFactoryTest extends SingletonTestCase { private final int BUFFERCOUNT = 120; diff --git a/src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java b/src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java index 61bbafa..3fdaa13 100644 --- a/src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java +++ b/src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java @@ -33,13 +33,13 @@ import org.junit.Assert; import org.junit.Test; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestBuffersFloatDoubleConversion extends JunitTracer { +public class TestBuffersFloatDoubleConversion extends SingletonTestCase { public static boolean cmpFloatArray(final float[] d1, final int d1_offset, final float[] d2, final int d2_offset, final int len) { if( d1.length - d1_offset < len) { diff --git a/src/junit/com/jogamp/common/nio/TestByteBufferCopyStream.java b/src/junit/com/jogamp/common/nio/TestByteBufferCopyStream.java index fff2c6f..926ea49 100644 --- a/src/junit/com/jogamp/common/nio/TestByteBufferCopyStream.java +++ b/src/junit/com/jogamp/common/nio/TestByteBufferCopyStream.java @@ -35,7 +35,7 @@ import java.nio.channels.FileChannel; import org.junit.Assert; import org.junit.Test; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @@ -45,7 +45,7 @@ import org.junit.runners.MethodSorters; * direct stream to stream copy via mapped buffers. */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestByteBufferCopyStream extends JunitTracer { +public class TestByteBufferCopyStream extends SingletonTestCase { static void testImpl(final String srcFileName, final long size, final MappedByteBufferInputStream.CacheMode srcCacheMode, final int srcSliceShift, diff --git a/src/junit/com/jogamp/common/nio/TestByteBufferInputStream.java b/src/junit/com/jogamp/common/nio/TestByteBufferInputStream.java index 408b417..39b463c 100644 --- a/src/junit/com/jogamp/common/nio/TestByteBufferInputStream.java +++ b/src/junit/com/jogamp/common/nio/TestByteBufferInputStream.java @@ -42,7 +42,7 @@ import org.junit.BeforeClass; import org.junit.Test; import com.jogamp.common.util.IOUtil; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @@ -56,7 +56,7 @@ import org.junit.runners.MethodSorters; * </p> */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestByteBufferInputStream extends JunitTracer { +public class TestByteBufferInputStream extends SingletonTestCase { /** {@value} */ static final int buffer__8KiB = 1 << 13; diff --git a/src/junit/com/jogamp/common/nio/TestByteBufferOutputStream.java b/src/junit/com/jogamp/common/nio/TestByteBufferOutputStream.java index f57101e..8dfc91f 100644 --- a/src/junit/com/jogamp/common/nio/TestByteBufferOutputStream.java +++ b/src/junit/com/jogamp/common/nio/TestByteBufferOutputStream.java @@ -35,7 +35,7 @@ import java.nio.channels.FileChannel; import org.junit.Assert; import org.junit.Test; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @@ -44,7 +44,7 @@ import org.junit.runners.MethodSorters; * Testing {@link MappedByteBufferInputStream} and {@link MappedByteBufferOutputStream} editing functionality. */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestByteBufferOutputStream extends JunitTracer { +public class TestByteBufferOutputStream extends SingletonTestCase { static void testImpl(final String fname, final byte[] payLoad, final long payLoadOffset, final long postPayLoadFiller, diff --git a/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java b/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java index 49a470f..9c9f3ae 100644 --- a/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java +++ b/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java @@ -6,7 +6,7 @@ import java.io.IOException; import jogamp.common.os.PlatformPropsImpl; import com.jogamp.common.os.*; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.Assert; import org.junit.Test; @@ -17,7 +17,7 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestPointerBufferEndian extends JunitTracer { +public class TestPointerBufferEndian extends SingletonTestCase { protected void testImpl (final boolean direct) { final MachineDescription machine = Platform.getMachineDescription(); diff --git a/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java b/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java index 967122e..951fc5a 100644 --- a/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java +++ b/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java @@ -12,13 +12,13 @@ import org.junit.Test; import com.jogamp.common.os.MachineDescription; import com.jogamp.common.os.Platform; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestStructAccessorEndian extends JunitTracer { +public class TestStructAccessorEndian extends SingletonTestCase { @Test public void testStructAccessorEndian1 () { diff --git a/src/junit/com/jogamp/common/os/TestElfReader01.java b/src/junit/com/jogamp/common/os/TestElfReader01.java index bc6aef1..c7324aa 100644 --- a/src/junit/com/jogamp/common/os/TestElfReader01.java +++ b/src/junit/com/jogamp/common/os/TestElfReader01.java @@ -16,13 +16,13 @@ import jogamp.common.os.elf.SectionHeader; import org.junit.Test; import com.jogamp.common.os.Platform.OSType; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestElfReader01 extends JunitTracer { +public class TestElfReader01 extends SingletonTestCase { public static String GNU_LINUX_SELF_EXE = "/proc/self/exe"; public static String ARM_HF_EXE = "tst-exe-armhf"; public static String ARM_SF_EXE = "tst-exe-arm"; diff --git a/src/junit/com/jogamp/common/util/IntIntHashMapTest.java b/src/junit/com/jogamp/common/util/IntIntHashMapTest.java index 75524ac..2de0c38 100644 --- a/src/junit/com/jogamp/common/util/IntIntHashMapTest.java +++ b/src/junit/com/jogamp/common/util/IntIntHashMapTest.java @@ -40,7 +40,7 @@ import org.junit.BeforeClass; import org.junit.Test; import com.jogamp.common.os.Platform; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import static org.junit.Assert.*; import static java.lang.System.*; @@ -54,7 +54,7 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class IntIntHashMapTest extends JunitTracer { +public class IntIntHashMapTest extends SingletonTestCase { private static int iterations; private static IntIntUniqueRndValues pairs; diff --git a/src/junit/com/jogamp/common/util/IntObjectHashMapTest.java b/src/junit/com/jogamp/common/util/IntObjectHashMapTest.java index 3207683..9e5618b 100644 --- a/src/junit/com/jogamp/common/util/IntObjectHashMapTest.java +++ b/src/junit/com/jogamp/common/util/IntObjectHashMapTest.java @@ -40,7 +40,7 @@ import org.junit.BeforeClass; import org.junit.Test; import com.jogamp.common.os.Platform; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import static org.junit.Assert.*; @@ -53,7 +53,7 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class IntObjectHashMapTest extends JunitTracer { +public class IntObjectHashMapTest extends SingletonTestCase { private static int iterations; private static IntIntObjUniqueRndValues pairs; diff --git a/src/junit/com/jogamp/common/util/LongIntHashMapTest.java b/src/junit/com/jogamp/common/util/LongIntHashMapTest.java index 90e54b9..9f868ba 100644 --- a/src/junit/com/jogamp/common/util/LongIntHashMapTest.java +++ b/src/junit/com/jogamp/common/util/LongIntHashMapTest.java @@ -40,7 +40,7 @@ import org.junit.BeforeClass; import org.junit.Test; import com.jogamp.common.os.Platform; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import static org.junit.Assert.*; import static java.lang.System.*; @@ -54,7 +54,7 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class LongIntHashMapTest extends JunitTracer { +public class LongIntHashMapTest extends SingletonTestCase { private static int iterations; private static LongIntUniqueRndValues pairs; diff --git a/src/junit/com/jogamp/common/util/TestArrayHashSet01.java b/src/junit/com/jogamp/common/util/TestArrayHashSet01.java index 4f63fbe..f8e2c22 100644 --- a/src/junit/com/jogamp/common/util/TestArrayHashSet01.java +++ b/src/junit/com/jogamp/common/util/TestArrayHashSet01.java @@ -34,13 +34,13 @@ import java.io.IOException; import org.junit.Assert; import org.junit.Test; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestArrayHashSet01 extends JunitTracer { +public class TestArrayHashSet01 extends SingletonTestCase { public static class Dummy { int i1, i2, i3; diff --git a/src/junit/com/jogamp/common/util/TestBitstream00.java b/src/junit/com/jogamp/common/util/TestBitstream00.java index 7bf4167..02d8c78 100644 --- a/src/junit/com/jogamp/common/util/TestBitstream00.java +++ b/src/junit/com/jogamp/common/util/TestBitstream00.java @@ -42,7 +42,7 @@ import com.jogamp.common.os.Platform; import static com.jogamp.common.util.BitstreamData.*; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @@ -51,7 +51,7 @@ import org.junit.runners.MethodSorters; * Test basic bit operations for {@link Bitstream} */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestBitstream00 extends JunitTracer { +public class TestBitstream00 extends SingletonTestCase { @Test public void test00ShowByteOrder() { diff --git a/src/junit/com/jogamp/common/util/TestBitstream01.java b/src/junit/com/jogamp/common/util/TestBitstream01.java index f0415bc..bd8f563 100644 --- a/src/junit/com/jogamp/common/util/TestBitstream01.java +++ b/src/junit/com/jogamp/common/util/TestBitstream01.java @@ -34,7 +34,7 @@ import java.nio.ByteBuffer; import org.junit.Assert; import org.junit.Test; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import static com.jogamp.common.util.BitstreamData.*; import org.junit.FixMethodOrder; @@ -53,7 +53,7 @@ import org.junit.runners.MethodSorters; * </ul> */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestBitstream01 extends JunitTracer { +public class TestBitstream01 extends SingletonTestCase { Bitstream<ByteBuffer> getTestStream(final boolean msbFirst, final int preBits, final int skipBits, final int postBits) throws IOException { final int byteCount = ( preBits + skipBits + postBits + 7 ) / 8; diff --git a/src/junit/com/jogamp/common/util/TestBitstream02.java b/src/junit/com/jogamp/common/util/TestBitstream02.java index e1a9eb0..e5789e7 100644 --- a/src/junit/com/jogamp/common/util/TestBitstream02.java +++ b/src/junit/com/jogamp/common/util/TestBitstream02.java @@ -35,7 +35,7 @@ import org.junit.Assert; import org.junit.Test; import com.jogamp.common.nio.Buffers; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import static com.jogamp.common.util.BitstreamData.*; @@ -51,7 +51,7 @@ import org.junit.runners.MethodSorters; * </ul> */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestBitstream02 extends JunitTracer { +public class TestBitstream02 extends SingletonTestCase { @Test public void test01Int8BitsAligned() throws IOException { diff --git a/src/junit/com/jogamp/common/util/TestBitstream03.java b/src/junit/com/jogamp/common/util/TestBitstream03.java index 29debc8..02555a5 100644 --- a/src/junit/com/jogamp/common/util/TestBitstream03.java +++ b/src/junit/com/jogamp/common/util/TestBitstream03.java @@ -36,7 +36,7 @@ import org.junit.Assert; import org.junit.Test; import com.jogamp.common.nio.Buffers; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import static com.jogamp.common.util.BitstreamData.*; @@ -52,7 +52,7 @@ import org.junit.runners.MethodSorters; * </ul> */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestBitstream03 extends JunitTracer { +public class TestBitstream03 extends SingletonTestCase { @Test public void test01Int16BitsAligned() throws IOException { diff --git a/src/junit/com/jogamp/common/util/TestBitstream04.java b/src/junit/com/jogamp/common/util/TestBitstream04.java index f61ebea..b05f0ff 100644 --- a/src/junit/com/jogamp/common/util/TestBitstream04.java +++ b/src/junit/com/jogamp/common/util/TestBitstream04.java @@ -36,7 +36,7 @@ import org.junit.Assert; import org.junit.Test; import com.jogamp.common.nio.Buffers; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import static com.jogamp.common.util.BitstreamData.*; @@ -52,7 +52,7 @@ import org.junit.runners.MethodSorters; * </ul> */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestBitstream04 extends JunitTracer { +public class TestBitstream04 extends SingletonTestCase { @Test public void test01Int32BitsAligned() throws IOException { diff --git a/src/junit/com/jogamp/common/util/TestFloatStack01.java b/src/junit/com/jogamp/common/util/TestFloatStack01.java index c0c1a2f..409236e 100644 --- a/src/junit/com/jogamp/common/util/TestFloatStack01.java +++ b/src/junit/com/jogamp/common/util/TestFloatStack01.java @@ -35,13 +35,13 @@ import java.util.Arrays; import org.junit.Assert; import org.junit.Test; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class /*testname*/TestFloatStack01/*testname*/ extends JunitTracer { +public class /*testname*/TestFloatStack01/*testname*/ extends SingletonTestCase { static final boolean equals(final /*value*/float/*value*/[] b, final int bOffset, final /*value*/float/*value*/[] stack, final int stackOffset, final int length) { diff --git a/src/junit/com/jogamp/common/util/TestIOUtil01.java b/src/junit/com/jogamp/common/util/TestIOUtil01.java index 68f472f..bbe0d64 100644 --- a/src/junit/com/jogamp/common/util/TestIOUtil01.java +++ b/src/junit/com/jogamp/common/util/TestIOUtil01.java @@ -45,13 +45,13 @@ import org.junit.Test; import com.jogamp.common.os.MachineDescription; import com.jogamp.common.os.Platform; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestIOUtil01 extends JunitTracer { +public class TestIOUtil01 extends SingletonTestCase { static final MachineDescription machine = Platform.getMachineDescription(); static final int tsz = machine.pageSizeInBytes() + machine.pageSizeInBytes() / 2 ; diff --git a/src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java b/src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java index 110d1cd..9ade783 100644 --- a/src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java +++ b/src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java @@ -34,13 +34,13 @@ import java.io.IOException; import org.junit.Test; import com.jogamp.common.os.Platform; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestIteratorIndexCORE extends JunitTracer { +public class TestIteratorIndexCORE extends SingletonTestCase { static int elems = 10; static int loop = ( Platform.getCPUFamily() == Platform.CPUFamily.ARM ) ? 20 : 9999999; diff --git a/src/junit/com/jogamp/common/util/TestJarUtil.java b/src/junit/com/jogamp/common/util/TestJarUtil.java index 06a2e43..42aa707 100644 --- a/src/junit/com/jogamp/common/util/TestJarUtil.java +++ b/src/junit/com/jogamp/common/util/TestJarUtil.java @@ -51,13 +51,13 @@ import com.jogamp.common.os.AndroidVersion; import com.jogamp.common.util.cache.TempCacheReg; import com.jogamp.common.util.cache.TempFileCache; import com.jogamp.common.util.cache.TempJarCache; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestJarUtil extends JunitTracer { +public class TestJarUtil extends SingletonTestCase { static TempFileCache fileCache; @BeforeClass diff --git a/src/junit/com/jogamp/common/util/TestPlatform01.java b/src/junit/com/jogamp/common/util/TestPlatform01.java index ebdfe19..acdced3 100644 --- a/src/junit/com/jogamp/common/util/TestPlatform01.java +++ b/src/junit/com/jogamp/common/util/TestPlatform01.java @@ -33,13 +33,13 @@ import org.junit.Test; import com.jogamp.common.os.MachineDescription; import com.jogamp.common.os.Platform; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestPlatform01 extends JunitTracer { +public class TestPlatform01 extends SingletonTestCase { @Test public void testInfo00() { diff --git a/src/junit/com/jogamp/common/util/TestRunnableTask01.java b/src/junit/com/jogamp/common/util/TestRunnableTask01.java index feb0468..7c2f27a 100644 --- a/src/junit/com/jogamp/common/util/TestRunnableTask01.java +++ b/src/junit/com/jogamp/common/util/TestRunnableTask01.java @@ -34,13 +34,13 @@ import java.lang.reflect.InvocationTargetException; import org.junit.Assert; import org.junit.Test; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestRunnableTask01 extends JunitTracer { +public class TestRunnableTask01 extends SingletonTestCase { @Test public void testInvokeAndWait00() throws IOException, InterruptedException, InvocationTargetException { diff --git a/src/junit/com/jogamp/common/util/TestSystemPropsAndEnvs.java b/src/junit/com/jogamp/common/util/TestSystemPropsAndEnvs.java index a78957a..44eea42 100644 --- a/src/junit/com/jogamp/common/util/TestSystemPropsAndEnvs.java +++ b/src/junit/com/jogamp/common/util/TestSystemPropsAndEnvs.java @@ -35,13 +35,13 @@ import java.util.Properties; import org.junit.Test; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestSystemPropsAndEnvs extends JunitTracer { +public class TestSystemPropsAndEnvs extends SingletonTestCase { @Test public void dumpProperties() { diff --git a/src/junit/com/jogamp/common/util/TestTempJarCache.java b/src/junit/com/jogamp/common/util/TestTempJarCache.java index 474a17a..20b14fb 100644 --- a/src/junit/com/jogamp/common/util/TestTempJarCache.java +++ b/src/junit/com/jogamp/common/util/TestTempJarCache.java @@ -51,10 +51,10 @@ import com.jogamp.common.os.Platform; import com.jogamp.common.util.cache.TempCacheReg; import com.jogamp.common.util.cache.TempFileCache; import com.jogamp.common.util.cache.TempJarCache; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestTempJarCache extends JunitTracer { +public class TestTempJarCache extends SingletonTestCase { static TempFileCache fileCache; static class TestClassLoader extends URLClassLoader { diff --git a/src/junit/com/jogamp/common/util/TestVersionInfo.java b/src/junit/com/jogamp/common/util/TestVersionInfo.java index 7466d0d..f548e39 100644 --- a/src/junit/com/jogamp/common/util/TestVersionInfo.java +++ b/src/junit/com/jogamp/common/util/TestVersionInfo.java @@ -32,13 +32,13 @@ import java.io.IOException; import org.junit.Test; import com.jogamp.common.GlueGenVersion; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestVersionInfo extends JunitTracer { +public class TestVersionInfo extends SingletonTestCase { @Test public void testInfo01() { diff --git a/src/junit/com/jogamp/common/util/TestVersionNumber.java b/src/junit/com/jogamp/common/util/TestVersionNumber.java index 2b4f6d2..2959d18 100644 --- a/src/junit/com/jogamp/common/util/TestVersionNumber.java +++ b/src/junit/com/jogamp/common/util/TestVersionNumber.java @@ -33,13 +33,13 @@ import java.io.IOException; import org.junit.Assert; import org.junit.Test; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestVersionNumber extends JunitTracer { +public class TestVersionNumber extends SingletonTestCase { @Test public void test01() { diff --git a/src/junit/com/jogamp/common/util/TestVersionSemantics.java b/src/junit/com/jogamp/common/util/TestVersionSemantics.java index edc0dc2..8163ffb 100644 --- a/src/junit/com/jogamp/common/util/TestVersionSemantics.java +++ b/src/junit/com/jogamp/common/util/TestVersionSemantics.java @@ -42,7 +42,7 @@ import org.semver.Delta; import com.jogamp.common.GlueGenVersion; import com.jogamp.common.util.VersionNumberString; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import com.jogamp.junit.util.VersionSemanticsUtil; /** @@ -64,7 +64,7 @@ import com.jogamp.junit.util.VersionSemanticsUtil; * @throws URISyntaxException */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestVersionSemantics extends JunitTracer { +public class TestVersionSemantics extends SingletonTestCase { static final String jarFile = "gluegen-rt.jar"; static final VersionNumberString preVersionNumber = new VersionNumberString("2.2.0"); static final Delta.CompatibilityType expectedCompatibilityType = Delta.CompatibilityType.NON_BACKWARD_COMPATIBLE; diff --git a/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java b/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java index 26677c0..09d96f2 100644 --- a/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java +++ b/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java @@ -38,13 +38,13 @@ import org.junit.Assert; import org.junit.Test; import com.jogamp.common.os.Platform; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestRecursiveLock01 extends JunitTracer { +public class TestRecursiveLock01 extends SingletonTestCase { public enum YieldMode { NONE(0), YIELD(1), SLEEP(2); diff --git a/src/junit/com/jogamp/common/util/locks/TestRecursiveThreadGroupLock01.java b/src/junit/com/jogamp/common/util/locks/TestRecursiveThreadGroupLock01.java index b361463..b338abe 100644 --- a/src/junit/com/jogamp/common/util/locks/TestRecursiveThreadGroupLock01.java +++ b/src/junit/com/jogamp/common/util/locks/TestRecursiveThreadGroupLock01.java @@ -34,13 +34,13 @@ import org.junit.Assert; import org.junit.Test; import com.jogamp.common.os.Platform; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestRecursiveThreadGroupLock01 extends JunitTracer { +public class TestRecursiveThreadGroupLock01 extends SingletonTestCase { public enum YieldMode { NONE(0), YIELD(1), SLEEP(2); diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java index b90eeb0..bde32fd 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java @@ -32,7 +32,7 @@ import com.jogamp.common.nio.Buffers; import com.jogamp.common.nio.PointerBuffer; import com.jogamp.common.os.MachineDescription; import com.jogamp.common.os.Platform; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -50,7 +50,7 @@ import org.junit.Assert; * @author Michael Bien * @author Sven Gothel */ -public class BaseClass extends JunitTracer { +public class BaseClass extends SingletonTestCase { /** * Verifies the existence and creation of the generated class. diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/PCPPTest.java b/src/junit/com/jogamp/gluegen/test/junit/generation/PCPPTest.java index f45297f..6a38b35 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/PCPPTest.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/PCPPTest.java @@ -30,7 +30,7 @@ package com.jogamp.gluegen.test.junit.generation; import com.jogamp.common.os.AndroidVersion; import com.jogamp.gluegen.pcpp.PCPP; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; @@ -51,7 +51,7 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class PCPPTest extends JunitTracer { +public class PCPPTest extends SingletonTestCase { @BeforeClass public static void init() { diff --git a/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen01.java b/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen01.java index 89a9a68..68c5aa4 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen01.java +++ b/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen01.java @@ -1,6 +1,6 @@ package com.jogamp.gluegen.test.junit.structgen; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.Assert; import org.junit.BeforeClass; @@ -9,7 +9,7 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestStructGen01 extends JunitTracer { +public class TestStructGen01 extends SingletonTestCase { @BeforeClass public static void init() { diff --git a/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen02.java b/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen02.java index cf0fadc..e7ec20c 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen02.java +++ b/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen02.java @@ -1,6 +1,6 @@ package com.jogamp.gluegen.test.junit.structgen; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.Assert; import org.junit.BeforeClass; @@ -9,7 +9,7 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestStructGen02 extends JunitTracer { +public class TestStructGen02 extends SingletonTestCase { @BeforeClass public static void init() { diff --git a/src/junit/com/jogamp/junit/sec/TestSecIOUtil01.java b/src/junit/com/jogamp/junit/sec/TestSecIOUtil01.java index a36b50b..7c4018d 100644 --- a/src/junit/com/jogamp/junit/sec/TestSecIOUtil01.java +++ b/src/junit/com/jogamp/junit/sec/TestSecIOUtil01.java @@ -41,13 +41,13 @@ import com.jogamp.common.net.Uri; import com.jogamp.common.os.NativeLibrary; import com.jogamp.common.os.Platform; import com.jogamp.common.util.IOUtil; -import com.jogamp.junit.util.JunitTracer; +import com.jogamp.junit.util.SingletonTestCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestSecIOUtil01 extends JunitTracer { +public class TestSecIOUtil01 extends SingletonTestCase { static final String java_io_tmpdir_propkey = "java.io.tmpdir"; static final String java_home_propkey = "java.home"; static final String os_name_propkey = "os.name"; diff --git a/src/junit/com/jogamp/junit/util/JunitTracer.java b/src/junit/com/jogamp/junit/util/JunitTracer.java index 0575532..f6cb953 100644 --- a/src/junit/com/jogamp/junit/util/JunitTracer.java +++ b/src/junit/com/jogamp/junit/util/JunitTracer.java @@ -28,6 +28,10 @@ package com.jogamp.junit.util; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + import org.junit.Assume; import org.junit.Before; import org.junit.BeforeClass; @@ -41,11 +45,15 @@ import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public abstract class JunitTracer { - @Rule public TestName _unitTestName = new TestName(); + @Rule public final TestName _unitTestName = new TestName(); static volatile boolean testSupported = true; - public static void setTestSupported(final boolean v) { + public static final boolean isTestSupported() { + return testSupported; + } + + public static final void setTestSupported(final boolean v) { System.err.println("setTestSupported: "+v); testSupported = v; } @@ -63,18 +71,18 @@ public abstract class JunitTracer { } @BeforeClass - public static void oneTimeSetUp() { + public static final void oneTimeSetUpBase() { // one-time initialization code } @AfterClass - public static void oneTimeTearDown() { + public static final void oneTimeTearDownBase() { // one-time cleanup code System.gc(); // force cleanup } @Before - public void setUp() { + public final void setUpBase() { System.err.print("++++ TestCase.setUp: "+getFullTestName(" - ")); if(!testSupported) { System.err.println(" - "+unsupportedTestMsg); @@ -84,10 +92,18 @@ public abstract class JunitTracer { } @After - public void tearDown() { + public final void tearDownBase() { System.err.println("++++ TestCase.tearDown: "+getFullTestName(" - ")); } static final String unsupportedTestMsg = "Test not supported on this platform."; + + public static final void waitForKey(final String preMessage) { + final BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); + System.err.println(preMessage+"> Press enter to continue"); + try { + System.err.println(stdin.readLine()); + } catch (final IOException e) { e.printStackTrace(); } + } } diff --git a/src/junit/com/jogamp/junit/util/SingletonTestCase.java b/src/junit/com/jogamp/junit/util/SingletonTestCase.java new file mode 100644 index 0000000..69cb31f --- /dev/null +++ b/src/junit/com/jogamp/junit/util/SingletonTestCase.java @@ -0,0 +1,71 @@ +/** + * Copyright 2010 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community 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. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +package com.jogamp.junit.util; + +import com.jogamp.common.util.locks.SingletonInstance; + +import org.junit.BeforeClass; +import org.junit.AfterClass; +import org.junit.FixMethodOrder; +import org.junit.runners.MethodSorters; + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public abstract class SingletonTestCase extends JunitTracer { + public static final String SINGLE_INSTANCE_LOCK_FILE = "SingletonTestCase.lock"; + public static final int SINGLE_INSTANCE_LOCK_PORT = 59999; + + public static final long SINGLE_INSTANCE_LOCK_TO = 6*60*1000; // wait up to 6 mins + public static final long SINGLE_INSTANCE_LOCK_POLL = 1000; // poll every 1s + + private static volatile SingletonInstance singletonInstance; + + private static final synchronized void initSingletonInstance() { + if( null == singletonInstance ) { + // singletonInstance = SingletonInstance.createFileLock(SINGLE_INSTANCE_LOCK_POLL, SINGLE_INSTANCE_LOCK_FILE); + singletonInstance = SingletonInstance.createServerSocket(SINGLE_INSTANCE_LOCK_POLL, SINGLE_INSTANCE_LOCK_PORT); + if(!singletonInstance.tryLock(SINGLE_INSTANCE_LOCK_TO)) { + throw new RuntimeException("Fatal: Could not lock single instance: "+singletonInstance.getName()); + } + } + } + + @BeforeClass + public static final void oneTimeSetUpSingleton() { + // one-time initialization code + initSingletonInstance(); + } + + @AfterClass + public static final void oneTimeTearDownSingleton() { + // one-time cleanup code + System.gc(); // force cleanup + singletonInstance.unlock(); + } +} + |