summaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp/common/util/locks
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-10-24 20:30:31 +0200
committerSven Gothel <[email protected]>2013-10-24 20:30:31 +0200
commitbb7c2da1ed6791bf50a32a880a939cdaecf82701 (patch)
treef4afa51ac6f483eaf2d88d7ffc192002ee87c582 /src/junit/com/jogamp/common/util/locks
parentaa7a0d3a3feee1360ae4d7465a9da263aea530ac (diff)
Use org.junit.Assert instead of deprecated junit.framework.Assert
Diffstat (limited to 'src/junit/com/jogamp/common/util/locks')
-rw-r--r--src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java23
-rw-r--r--src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket01.java18
-rw-r--r--src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket02.java21
3 files changed, 29 insertions, 33 deletions
diff --git a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java
index 2ab6d52..c699e2e 100644
--- a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java
+++ b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -29,8 +29,7 @@ package com.jogamp.common.util.locks;
import java.io.IOException;
-import junit.framework.Assert;
-
+import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -44,10 +43,10 @@ public class TestSingletonServerSocket00 {
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
private static volatile SingletonInstance singletonInstance;
-
+
@BeforeClass
public static void oneTimeSetUp() {
- // one-time initialization code
+ // one-time initialization code
singletonInstance = SingletonInstance.createServerSocket(SINGLE_INSTANCE_LOCK_POLL, SINGLE_INSTANCE_LOCK_PORT);
}
@@ -66,14 +65,14 @@ public class TestSingletonServerSocket00 {
System.gc(); // force cleanup
singletonInstance.unlock();
}
-
+
private Thread startLockUnlockOffThread(int i) {
final Thread t = new Thread(new Runnable() {
public void run() {
SingletonInstance myLock = SingletonInstance.createServerSocket(10, 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");
+ System.err.println(Thread.currentThread().getName()+" LOCK ON");
try {
Thread.sleep(300);
} catch (InterruptedException e) { }
@@ -84,7 +83,7 @@ public class TestSingletonServerSocket00 {
t.start();
return t;
}
-
+
@Test
public void testOffthreadLockUnlock() throws InterruptedException {
Assert.assertTrue("Could not lock single instance: "+singletonInstance.getName(), singletonInstance.tryLock(SINGLE_INSTANCE_LOCK_TO));
@@ -97,7 +96,7 @@ public class TestSingletonServerSocket00 {
Thread.sleep(100);
}
}
-
+
public static void main(String args[]) throws IOException, InterruptedException {
String tstname = TestSingletonServerSocket00.class.getName();
org.junit.runner.JUnitCore.main(tstname);
diff --git a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket01.java b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket01.java
index 6cb5d39..4bdc9bf 100644
--- a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket01.java
+++ b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket01.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -29,9 +29,7 @@ package com.jogamp.common.util.locks;
import java.io.IOException;
-import junit.framework.Assert;
-
-import org.junit.AfterClass;
+import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -45,10 +43,10 @@ public class TestSingletonServerSocket01 {
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
+ // one-time initialization code
singletonInstance = SingletonInstance.createServerSocket(SINGLE_INSTANCE_LOCK_POLL, SINGLE_INSTANCE_LOCK_PORT);
}
@@ -57,7 +55,7 @@ public class TestSingletonServerSocket01 {
Assert.assertTrue("Could not lock single instance: "+singletonInstance.getName(), singletonInstance.tryLock(SINGLE_INSTANCE_LOCK_TO));
singletonInstance.unlock();
}
-
+
public static void main(String args[]) throws IOException, InterruptedException {
String tstname = TestSingletonServerSocket01.class.getName();
org.junit.runner.JUnitCore.main(tstname);
diff --git a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket02.java b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket02.java
index 32a1c00..cb862ce 100644
--- a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket02.java
+++ b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket02.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -29,8 +29,7 @@ package com.jogamp.common.util.locks;
import java.io.IOException;
-import junit.framework.Assert;
-
+import org.junit.Assert;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -45,10 +44,10 @@ public class TestSingletonServerSocket02 {
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
+ // 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));
}
@@ -56,14 +55,14 @@ public class TestSingletonServerSocket02 {
@AfterClass
public static void oneTimeTearDown() {
System.gc(); // force cleanup
- singletonInstance.unlock();
+ singletonInstance.unlock();
}
-
+
@Test
public void dummy() throws InterruptedException {
// make junit happy
}
-
+
// @Test(timeout=10) // Only enable manually to test timeout behavior
public void testTimeout() throws InterruptedException {
Thread.sleep(3000);