diff options
author | Sven Gothel <[email protected]> | 2014-10-03 05:49:57 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-10-03 05:49:57 +0200 |
commit | 773d96584b4edc13eb6ff689eaf891aab09aa5a4 (patch) | |
tree | b670122688f8c6f327664f600fc13d2f54f906f7 /src/junit/com | |
parent | db12572b4f674884c3f7ad8f7e15ba9e97cf865a (diff) |
SingletonTestCase -> SingletonJunitCase: Accomodate ClassLoader lifecycle of static fields; Change name to avoid testing itself.
Diffstat (limited to 'src/junit/com')
47 files changed, 124 insertions, 139 deletions
diff --git a/src/junit/com/jogamp/common/net/AssetURLConnectionBase.java b/src/junit/com/jogamp/common/net/AssetURLConnectionBase.java index c6b90b5..e4ff717 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; -public abstract class AssetURLConnectionBase extends SingletonTestCase { +public abstract class AssetURLConnectionBase extends SingletonJunitCase { /** 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 0ec5bfe..1173610 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestUri01 extends SingletonTestCase { +public class TestUri01 extends SingletonJunitCase { @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 ff7e9bb..51a5cc6 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestUri02Composing extends SingletonTestCase { +public class TestUri02Composing extends SingletonJunitCase { @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 f7fe842..1b0c839 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestUri03Resolving extends SingletonTestCase { +public class TestUri03Resolving extends SingletonJunitCase { // 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 78ecb93..3b3cc6f 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class TestUri99LaunchOnReservedCharPathBug908 extends SingletonJunitCase { 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 847c6e3..27a4bb7 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestUriQueryProps extends SingletonTestCase { +public class TestUriQueryProps extends SingletonJunitCase { @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 55b81a3..1db0888 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestUrisWithAssetHandler extends SingletonTestCase { +public class TestUrisWithAssetHandler extends SingletonJunitCase { @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 c6a98c4..c6a89f1 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class BuffersTest extends SingletonJunitCase { @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 0bdac52..6b9409f 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class CachedBufferFactoryTest extends SingletonJunitCase { 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 3fdaa13..7ee85fc 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestBuffersFloatDoubleConversion extends SingletonTestCase { +public class TestBuffersFloatDoubleConversion extends SingletonJunitCase { 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 926ea49..bef813b 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class TestByteBufferCopyStream extends SingletonJunitCase { 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 39b463c..53ebac9 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class TestByteBufferInputStream extends SingletonJunitCase { /** {@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 8dfc91f..8686b46 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class TestByteBufferOutputStream extends SingletonJunitCase { 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 9c9f3ae..3334f7f 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class TestPointerBufferEndian extends SingletonJunitCase { 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 951fc5a..081337e 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestStructAccessorEndian extends SingletonTestCase { +public class TestStructAccessorEndian extends SingletonJunitCase { @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 c7324aa..a750dd0 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestElfReader01 extends SingletonTestCase { +public class TestElfReader01 extends SingletonJunitCase { 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 2de0c38..466e321 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class IntIntHashMapTest extends SingletonJunitCase { 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 9e5618b..091a159 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class IntObjectHashMapTest extends SingletonJunitCase { 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 9f868ba..9ea4206 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class LongIntHashMapTest extends SingletonJunitCase { 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 f8e2c22..51db2c7 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestArrayHashSet01 extends SingletonTestCase { +public class TestArrayHashSet01 extends SingletonJunitCase { 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 02d8c78..fa9c75d 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class TestBitstream00 extends SingletonJunitCase { @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 bd8f563..99116e6 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class TestBitstream01 extends SingletonJunitCase { 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 e5789e7..3fb4cce 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class TestBitstream02 extends SingletonJunitCase { @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 02555a5..4dfb3d7 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class TestBitstream03 extends SingletonJunitCase { @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 b05f0ff..277510e 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class TestBitstream04 extends SingletonJunitCase { @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 409236e..7a22a44 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class /*testname*/TestFloatStack01/*testname*/ extends SingletonTestCase { +public class /*testname*/TestFloatStack01/*testname*/ extends SingletonJunitCase { 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 bbe0d64..539f883 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestIOUtil01 extends SingletonTestCase { +public class TestIOUtil01 extends SingletonJunitCase { 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 9ade783..8289587 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestIteratorIndexCORE extends SingletonTestCase { +public class TestIteratorIndexCORE extends SingletonJunitCase { 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 42aa707..747da8f 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestJarUtil extends SingletonTestCase { +public class TestJarUtil extends SingletonJunitCase { 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 acdced3..fc88067 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestPlatform01 extends SingletonTestCase { +public class TestPlatform01 extends SingletonJunitCase { @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 7c2f27a..76c2d2a 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestRunnableTask01 extends SingletonTestCase { +public class TestRunnableTask01 extends SingletonJunitCase { @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 44eea42..ec71494 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestSystemPropsAndEnvs extends SingletonTestCase { +public class TestSystemPropsAndEnvs extends SingletonJunitCase { @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 20b14fb..9cc855f 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestTempJarCache extends SingletonTestCase { +public class TestTempJarCache extends SingletonJunitCase { 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 f548e39..2a9dfa1 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestVersionInfo extends SingletonTestCase { +public class TestVersionInfo extends SingletonJunitCase { @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 2959d18..9b86376 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestVersionNumber extends SingletonTestCase { +public class TestVersionNumber extends SingletonJunitCase { @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 8163ffb..6faa9a6 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class TestVersionSemantics extends SingletonJunitCase { 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 09d96f2..4508f94 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestRecursiveLock01 extends SingletonTestCase { +public class TestRecursiveLock01 extends SingletonJunitCase { 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 b338abe..e35d146 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestRecursiveThreadGroupLock01 extends SingletonTestCase { +public class TestRecursiveThreadGroupLock01 extends SingletonJunitCase { public enum YieldMode { NONE(0), YIELD(1), SLEEP(2); diff --git a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java index 775d46f..b018a79 100644 --- a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java +++ b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java @@ -32,35 +32,37 @@ import java.io.IOException; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; - import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; +import com.jogamp.junit.util.SingletonJunitCase; + @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestSingletonServerSocket00 { - // public static final String SINGLE_INSTANCE_LOCK_FILE = "UITestCase.lock"; - public static final int SINGLE_INSTANCE_LOCK_PORT = 59999; - public static final long SINGLE_INSTANCE_LOCK_TO = 3*60*1000; // wait up to 3 min - public static final long SINGLE_INSTANCE_LOCK_POLL = 100; // poll every 100ms + public static final long SINGLE_INSTANCE_LOCK_TO = SingletonJunitCase.SINGLE_INSTANCE_LOCK_TO; + + public static final long SINGLE_INSTANCE_LOCK_POLL = 100; // poll every 100ms + private static volatile SingletonInstance singletonInstance; @BeforeClass public static void oneTimeSetUp() { // one-time initialization code - singletonInstance = SingletonInstance.createServerSocket(SINGLE_INSTANCE_LOCK_POLL, SINGLE_INSTANCE_LOCK_PORT); + singletonInstance = SingletonInstance.createServerSocket(SINGLE_INSTANCE_LOCK_POLL, + SingletonJunitCase.SINGLE_INSTANCE_LOCK_PORT); } @Test - public void testLockUnlock() { + public void test01_LockUnlock() { Assert.assertTrue("Could not lock single instance: "+singletonInstance.getName(), singletonInstance.tryLock(SINGLE_INSTANCE_LOCK_TO)); System.gc(); // force cleanup singletonInstance.unlock(); } @Test - public void test2ndInstanceLockTimeout() { + public void test02_2ndInstanceLockTimeout() { Assert.assertTrue("Could not lock single instance: "+singletonInstance.getName(), singletonInstance.tryLock(SINGLE_INSTANCE_LOCK_TO)); - final SingletonInstance instanceTwo = SingletonInstance.createServerSocket(SINGLE_INSTANCE_LOCK_POLL, SINGLE_INSTANCE_LOCK_PORT); + final SingletonInstance instanceTwo = SingletonInstance.createServerSocket(SINGLE_INSTANCE_LOCK_POLL, SingletonJunitCase.SINGLE_INSTANCE_LOCK_PORT); Assert.assertFalse("Could lock 2nd instance: "+instanceTwo.getName(), instanceTwo.tryLock(1000)); // 10x System.gc(); // force cleanup singletonInstance.unlock(); @@ -69,7 +71,7 @@ public class TestSingletonServerSocket00 { private Thread startLockUnlockOffThread(final int i) { final Thread t = new Thread(new Runnable() { public void run() { - final SingletonInstance myLock = SingletonInstance.createServerSocket(10, SINGLE_INSTANCE_LOCK_PORT); + final SingletonInstance myLock = SingletonInstance.createServerSocket(10, SingletonJunitCase.SINGLE_INSTANCE_LOCK_PORT); System.err.println(Thread.currentThread().getName()+" LOCK try .."); Assert.assertTrue(Thread.currentThread().getName()+" - Could not lock instance: "+myLock.getName(), myLock.tryLock(1000)); System.err.println(Thread.currentThread().getName()+" LOCK ON"); diff --git a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket01.java b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket01.java index 82ca89b..b37e600 100644 --- a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket01.java +++ b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket01.java @@ -32,27 +32,24 @@ import java.io.IOException; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; - import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; +import com.jogamp.junit.util.SingletonJunitCase; + @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestSingletonServerSocket01 { - // public static final String SINGLE_INSTANCE_LOCK_FILE = "UITestCase.lock"; - public static final int SINGLE_INSTANCE_LOCK_PORT = 59999; - public static final long SINGLE_INSTANCE_LOCK_TO = 3*60*1000; // wait up to 3 min - public static final long SINGLE_INSTANCE_LOCK_POLL = 1000; // poll every 1s private static volatile SingletonInstance singletonInstance; @BeforeClass public static void oneTimeSetUp() { // one-time initialization code - singletonInstance = SingletonInstance.createServerSocket(SINGLE_INSTANCE_LOCK_POLL, SINGLE_INSTANCE_LOCK_PORT); + singletonInstance = SingletonInstance.createServerSocket(SingletonJunitCase.SINGLE_INSTANCE_LOCK_POLL, SingletonJunitCase.SINGLE_INSTANCE_LOCK_PORT); } @Test public void testJVMShutdown() { - Assert.assertTrue("Could not lock single instance: "+singletonInstance.getName(), singletonInstance.tryLock(SINGLE_INSTANCE_LOCK_TO)); + Assert.assertTrue("Could not lock single instance: "+singletonInstance.getName(), singletonInstance.tryLock(SingletonJunitCase.SINGLE_INSTANCE_LOCK_TO)); singletonInstance.unlock(); } diff --git a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket02.java b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket02.java index 50eebd6..d29abf0 100644 --- a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket02.java +++ b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket02.java @@ -33,31 +33,13 @@ import org.junit.Assert; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; - import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestSingletonServerSocket02 { - // public static final String SINGLE_INSTANCE_LOCK_FILE = "UITestCase.lock"; - public static final int SINGLE_INSTANCE_LOCK_PORT = 59999; - public static final long SINGLE_INSTANCE_LOCK_TO = 3*60*1000; // wait up to 3 min - public static final long SINGLE_INSTANCE_LOCK_POLL = 1000; // poll every 1s - private static volatile SingletonInstance singletonInstance; - - @BeforeClass - public static void oneTimeSetUp() { - // one-time initialization code - singletonInstance = SingletonInstance.createServerSocket(SINGLE_INSTANCE_LOCK_POLL, SINGLE_INSTANCE_LOCK_PORT); - Assert.assertTrue("Could not lock single instance: "+singletonInstance.getName(), singletonInstance.tryLock(SINGLE_INSTANCE_LOCK_TO)); - } - - @AfterClass - public static void oneTimeTearDown() { - System.gc(); // force cleanup - singletonInstance.unlock(); - } +import com.jogamp.junit.util.SingletonJunitCase; +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestSingletonServerSocket02 extends SingletonJunitCase { @Test public void dummy() throws InterruptedException { // make junit happy @@ -65,7 +47,7 @@ public class TestSingletonServerSocket02 { // @Test(timeout=10) // Only enable manually to test timeout behavior public void testTimeout() throws InterruptedException { - Thread.sleep(3000); + Thread.sleep(SingletonJunitCase.SINGLE_INSTANCE_LOCK_TO+3000); } public static void main(final String args[]) throws IOException, InterruptedException { 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 bde32fd..82e8cd4 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class BaseClass extends SingletonJunitCase { /** * 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 6a38b35..608a17f 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class PCPPTest extends SingletonJunitCase { @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 68c5aa4..4ecc776 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class TestStructGen01 extends SingletonJunitCase { @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 e7ec20c..f3368e0 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; 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 SingletonTestCase { +public class TestStructGen02 extends SingletonJunitCase { @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 7c4018d..b3a1877 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.SingletonTestCase; +import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestSecIOUtil01 extends SingletonTestCase { +public class TestSecIOUtil01 extends SingletonJunitCase { 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/SingletonTestCase.java b/src/junit/com/jogamp/junit/util/SingletonJunitCase.java index 16f2ab3..d7eab35 100644 --- a/src/junit/com/jogamp/junit/util/SingletonTestCase.java +++ b/src/junit/com/jogamp/junit/util/SingletonJunitCase.java @@ -36,36 +36,40 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public abstract class SingletonTestCase extends JunitTracer { +public abstract class SingletonJunitCase 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 = 12*60*1000; // wait up to 12 mins public static final long SINGLE_INSTANCE_LOCK_POLL = 1000; // poll every 1s - private static volatile SingletonInstance singletonInstance; + private static SingletonInstance singletonInstance = null; // system wide lock via port locking + private static final Object singletonSync = new Object(); // classloader wide lock - 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); + @BeforeClass + public static final void oneTimeSetUpSingleton() { + // one-time initialization code + synchronized( singletonSync ) { + if( null == singletonInstance ) { + System.err.println("++++ Test Singleton.ctor()"); + // singletonInstance = SingletonInstance.createFileLock(SINGLE_INSTANCE_LOCK_POLL, SINGLE_INSTANCE_LOCK_FILE); + singletonInstance = SingletonInstance.createServerSocket(SINGLE_INSTANCE_LOCK_POLL, SINGLE_INSTANCE_LOCK_PORT); + } + System.err.println("++++ Test Singleton.lock()"); 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(); + synchronized( singletonSync ) { + System.gc(); // force cleanup + System.err.println("++++ Test Singleton.unlock()"); + singletonInstance.unlock(); + } } } |