Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2018-04-24 23:36:37 -0400
committerEike Stepper2018-04-24 23:36:37 -0400
commitb1cf5c385c916946ea044f0325b74b3907c262ed (patch)
tree5a60268564f4f3fe6272b638f2d4c4970f0aa2a0
parentd3d54f27b1c256e2416c4cd0e873d2764b5edcaf (diff)
downloadcdo-b1cf5c385c916946ea044f0325b74b3907c262ed.tar.gz
cdo-b1cf5c385c916946ea044f0325b74b3907c262ed.tar.xz
cdo-b1cf5c385c916946ea044f0325b74b3907c262ed.zip
[Releng] Provide AbstractOMTest.await(CountDownLatch) helper
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Bugzilla_396743_Test.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InvalidationTest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingSequenceTest.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/Locking_SequenceWithChildListTest_DISABLED.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_273565_Test.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_329254_Test.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_340709_Test.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_341995_Test.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_349793_Test.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_349804_Test.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_353448_Test.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_355915_Test.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359992_Test.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_376620_Test.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_390185_Test.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_417483_Test.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_486458a_Test.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_486458b_Test.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_486458c_Test.java11
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java20
23 files changed, 60 insertions, 154 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Bugzilla_396743_Test.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Bugzilla_396743_Test.java
index 733d8e7c0d..2d1199f066 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Bugzilla_396743_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Bugzilla_396743_Test.java
@@ -25,8 +25,6 @@ import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.net4j.db.IDBPreparedStatement;
-import org.eclipse.net4j.util.WrappedException;
-import org.eclipse.net4j.util.concurrent.TimeoutRuntimeException;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -34,7 +32,6 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
/**
* Bug 396743: [DB] List size column mismatching the row entries.
@@ -65,17 +62,7 @@ public class Bugzilla_396743_Test extends AbstractCDOTest
return;
}
- try
- {
- if (!readValueLatch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS))
- {
- throw new TimeoutRuntimeException();
- }
- }
- catch (InterruptedException ex)
- {
- throw WrappedException.wrap(ex);
- }
+ await(readValueLatch);
}
public void testWrongListSizeAdditions() throws Exception
@@ -148,7 +135,7 @@ public class Bugzilla_396743_Test extends AbstractCDOTest
};
readerClient.start();
- commitLatch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(commitLatch);
company1.getCategories().add(getModel1Factory().createCategory());
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InvalidationTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InvalidationTest.java
index fe4b8095fe..1adf4fdd05 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InvalidationTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InvalidationTest.java
@@ -51,7 +51,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
/**
* @author Eike Stepper
@@ -281,8 +280,7 @@ public class InvalidationTest extends AbstractCDOTest
category1A.setName("CHANGED NAME");
transaction.commit();
- boolean notified = latch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
- assertEquals(true, notified);
+ await(latch);
}
public void testConflictSameSession() throws Exception, IOException
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingSequenceTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingSequenceTest.java
index d12b60d045..ef0a9308c1 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingSequenceTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingSequenceTest.java
@@ -20,7 +20,6 @@ import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.net4j.util.io.IOUtil;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
@@ -72,7 +71,7 @@ public class LockingSequenceTest extends AbstractLockingTest
users[userID].start();
}
- latch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(latch);
IOUtil.OUT().println("FINISHED");
Exception exception = null;
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/Locking_SequenceWithChildListTest_DISABLED.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/Locking_SequenceWithChildListTest_DISABLED.java
index 20c375a711..1548ee98b8 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/Locking_SequenceWithChildListTest_DISABLED.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/Locking_SequenceWithChildListTest_DISABLED.java
@@ -27,7 +27,6 @@ import org.eclipse.net4j.util.io.IOUtil;
import org.eclipse.emf.spi.cdo.InternalCDOTransaction;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
@@ -89,8 +88,8 @@ public class Locking_SequenceWithChildListTest_DISABLED extends AbstractLockingT
// A maximum of USERS x ADDITIONS x RETRIES calls to .lock() : should not last more than USERS x ADDITIONS x
// RETRIES x LOCK_TIMEOUT milliseconds...
// Let's leave them twice as long, just to be sure!
- long TIMEOUT = 2 * USERS * ADDITIONS * RETRIES * LOCK_TIMEOUT;
- latch.await(TIMEOUT, TimeUnit.MILLISECONDS);
+ long timeout = 2 * USERS * ADDITIONS * RETRIES * LOCK_TIMEOUT;
+ await(latch, timeout);
IOUtil.OUT().println("FINISHED");
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java
index fa94426a7a..ba4a348b5c 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java
@@ -50,7 +50,6 @@ import org.eclipse.emf.spi.cdo.InternalCDOSession;
import java.util.Collection;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
/**
* @author Eike Stepper
@@ -243,7 +242,7 @@ public class SessionTest extends AbstractCDOTest
{
try
{
- startLatch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(startLatch);
msg("Committing NOW!");
commitTime[0] = transaction.commit().getTimeStamp();
@@ -260,7 +259,7 @@ public class SessionTest extends AbstractCDOTest
CDOSession session2 = openSession();
startLatch.countDown();
- stopLatch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(stopLatch);
assertEquals(true, session2.waitForUpdate(commitTime[0], DEFAULT_TIMEOUT));
transaction.getSession().close();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionTest.java
index ac04d5b0d1..f23a4d0abc 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionTest.java
@@ -381,7 +381,7 @@ public class TransactionTest extends AbstractCDOTest
category1.setName("session1");
transaction1.commit();
- rollback.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(rollback);
category2.setName("session2");
transaction2.commit();
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_273565_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_273565_Test.java
index 8d67627124..8f705200ff 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_273565_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_273565_Test.java
@@ -70,7 +70,7 @@ public class Bugzilla_273565_Test extends AbstractCDOTest
try
{
- start.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(start);
while (!done[0])
{
while (orderDetail.getPrice() != 1 && !done[0])
@@ -123,7 +123,7 @@ public class Bugzilla_273565_Test extends AbstractCDOTest
{
try
{
- start.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(start);
for (int i = 0; i < 50 && exception[0] == null; i++)
{
try
@@ -211,7 +211,7 @@ public class Bugzilla_273565_Test extends AbstractCDOTest
try
{
- start.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(start);
for (int i = 0; i < 5000 && exception[0] == null; i++)
{
CDOUtil.getCDOObject(orderDetail).cdoWriteLock().lock(DEFAULT_TIMEOUT);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java
index 98bae8746e..d7cd3663ea 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java
@@ -252,8 +252,8 @@ public class Bugzilla_316444_Test extends AbstractCDOTest
sleepIfNeeded();
threadB.start();
- threadA.done.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
- threadB.done.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(threadA.done);
+ await(threadB.done);
// threadA.join(DEFAULT_TIMEOUT);
// threadB.join(DEFAULT_TIMEOUT);
@@ -327,8 +327,8 @@ public class Bugzilla_316444_Test extends AbstractCDOTest
sleepIfNeeded();
threadX.start();
- threadA.done.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
- threadX.done.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(threadA.done);
+ await(threadX.done);
// threadX.join(DEFAULT_TIMEOUT);
// threadA.join(DEFAULT_TIMEOUT);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_329254_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_329254_Test.java
index 7fa41e3da4..bfb3eb048c 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_329254_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_329254_Test.java
@@ -31,7 +31,6 @@ import org.eclipse.net4j.util.io.IOUtil;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
/**
* LastCommitTimeStamp updated even when a serverSide Error occurred.
@@ -84,14 +83,7 @@ public class Bugzilla_329254_Test extends AbstractCDOTest
// block until it has left again.
enterLatch.countDown();
- try
- {
- leaveLatch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException ex)
- {
- ex.printStackTrace();
- }
+ await(leaveLatch);
}
super.adjustForCommit();
@@ -243,15 +235,8 @@ public class Bugzilla_329254_Test extends AbstractCDOTest
{
try
{
- try
- {
- // wait until session 2 has entered write.
- enterLatch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException ex)
- {
- ex.printStackTrace();
- }
+ // wait until session 2 has entered write.
+ await(enterLatch);
transaction3.commit();
}
@@ -341,15 +326,8 @@ public class Bugzilla_329254_Test extends AbstractCDOTest
{
try
{
- try
- {
- // wait until session 2 has entered write.
- enterLatch.await();
- }
- catch (InterruptedException ex)
- {
- ex.printStackTrace();
- }
+ // wait until session 2 has entered write.
+ await(enterLatch);
transaction3.commit();
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_340709_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_340709_Test.java
index ebeb250a11..ba994b7e96 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_340709_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_340709_Test.java
@@ -21,7 +21,6 @@ import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
/**
* @author Martin Fluegge
@@ -69,14 +68,7 @@ public class Bugzilla_340709_Test extends AbstractCDOTest
{
handleNotify(transaction);
- try
- {
- latch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException ex)
- {
- throw new RuntimeException(ex);
- }
+ await(latch);
}
}
@@ -88,6 +80,7 @@ public class Bugzilla_340709_Test extends AbstractCDOTest
{
msg("DEAD");
transaction.getRootResource();
+
msg("LOCK");
latch.countDown();
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_341995_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_341995_Test.java
index 9317b98e55..520032656c 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_341995_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_341995_Test.java
@@ -53,7 +53,7 @@ public class Bugzilla_341995_Test extends AbstractCDOTest
try
{
doSecondSessionAsync();
- sessionManager.getDelayLatch().await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS); // Wait until the delay commences
+ await(sessionManager.getDelayLatch()); // Wait until the delay commences
long time1 = System.currentTimeMillis();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_349793_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_349793_Test.java
index 7ea8803693..7d4edfaed1 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_349793_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_349793_Test.java
@@ -24,7 +24,6 @@ import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
/**
* @author Egidijus Vaisnora
@@ -53,21 +52,15 @@ public class Bugzilla_349793_Test extends AbstractCDOTest
{
if (event instanceof CDOViewInvalidationEvent)
{
- try
- {
- testExecutionLatch.countDown();
- invalidationLatch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException ex)
- {
- Thread.currentThread().interrupt();
- }
+ testExecutionLatch.countDown();
+ await(invalidationLatch);
}
}
});
long timestamp = doSecondSessionSync();
- testExecutionLatch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(testExecutionLatch);
+
CDOTransaction freshTransaction = session.openTransaction();
invalidationLatch.countDown();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_349804_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_349804_Test.java
index 364975a469..3e9156dcdf 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_349804_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_349804_Test.java
@@ -28,7 +28,6 @@ import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
@@ -99,7 +98,7 @@ public class Bugzilla_349804_Test extends AbstractCDOTest
// Invalidation shall fail, because it will use lastUpdateTime from TimeStampAuthority for commit result
transaction.commit();
- invalidationLatch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(invalidationLatch);
assertEquals("Invalidation was not delivered", 0, invalidationLatch.getCount());
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_353448_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_353448_Test.java
index 4adcb7dcff..97f3f9736e 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_353448_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_353448_Test.java
@@ -27,7 +27,6 @@ import org.eclipse.core.runtime.Path;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
/**
* @author Eike Stepper
@@ -112,10 +111,7 @@ public class Bugzilla_353448_Test extends AbstractCDOTest
}.start();
}
- if (!latch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS))
- {
- throw new TimeoutException();
- }
+ await(latch);
if (exception[0] != null)
{
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_355915_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_355915_Test.java
index e280885ab2..91a6d63d32 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_355915_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_355915_Test.java
@@ -25,7 +25,6 @@ import org.eclipse.emf.ecore.resource.Resource;
import java.util.Collections;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
/**
* @author Martin Fluegge
@@ -89,7 +88,7 @@ public class Bugzilla_355915_Test extends AbstractCDOTest
thread.start();
thread.join();
- latch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(latch);
assertEquals(true, adapter.notified());
assertEquals(true, adapter.assertCorrectNotification());
}
@@ -140,7 +139,7 @@ public class Bugzilla_355915_Test extends AbstractCDOTest
thread.start();
thread.join();
- latch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(latch);
assertEquals(true, adapter.notified());
assertEquals(true, adapter.assertCorrectNotification());
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359992_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359992_Test.java
index e963eb109b..cea57dfa99 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359992_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359992_Test.java
@@ -32,7 +32,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
import java.util.Collections;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
/**
* Bug 359992.
@@ -85,7 +84,7 @@ public class Bugzilla_359992_Test extends AbstractCDOTest
doClient2();
- latch.await(10 * DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(latch, 10 * DEFAULT_TIMEOUT);
assertEquals(true, adapter.notified());
assertEquals(adapter.getFailureMessage(), true, adapter.assertCorrectNotification());
}
@@ -123,7 +122,7 @@ public class Bugzilla_359992_Test extends AbstractCDOTest
doClient2();
- latch.await(10 * DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(latch, 10 * DEFAULT_TIMEOUT);
assertEquals(true, adapter.notified());
assertEquals(adapter.getFailureMessage(), true, adapter.assertCorrectNotification());
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_376620_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_376620_Test.java
index d05a6d97a9..06d65eb0dc 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_376620_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_376620_Test.java
@@ -29,7 +29,6 @@ import org.eclipse.emf.ecore.resource.Resource;
import java.util.Collections;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
/**
* @author Esteban Dugueperoux
@@ -77,7 +76,7 @@ public class Bugzilla_376620_Test extends AbstractCDOTest
supplier.eAdapters().add(adapter);
doClient2();
- latch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
+ await(latch);
assertEquals(true, adapter.notified());
assertEquals(adapter.getFailureMessage(), true, adapter.assertCorrectNotification());
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_390185_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_390185_Test.java
index b875183f4e..9aee0dfe6d 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_390185_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_390185_Test.java
@@ -23,8 +23,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
/**
* Bug 390185: Deadlock on multiple concurrent transactions.
@@ -49,10 +47,7 @@ public class Bugzilla_390185_Test extends AbstractCDOTest
actors.add(actor);
}
- if (!latch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS))
- {
- throw new TimeoutException("Not all actors finished in time");
- }
+ await(latch);
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_417483_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_417483_Test.java
index b854821ffd..848b04f8fb 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_417483_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_417483_Test.java
@@ -50,7 +50,6 @@ import org.eclipse.emf.transaction.impl.TransactionChangeRecorder;
import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
/**
* Bug 417483 - [Security] Issues in invalidation when missing write Permission.
@@ -183,8 +182,7 @@ public class Bugzilla_417483_Test extends AbstractCDOTest
transaction.commit();
// User without write permission should be able to integrate changes without permission issues
- boolean notified = latch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
- assertEquals("Timeout: User should have been notified of changes", true, notified);
+ await(latch);
assertEquals("User should not have write permission on resource", false, isWritable(resourceReadOnly));
assertEquals("User should not have write permission on element", false, isWritable(categoryReadOnly));
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_486458a_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_486458a_Test.java
index bb71e9e16e..b58bc9daed 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_486458a_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_486458a_Test.java
@@ -52,7 +52,6 @@ import org.eclipse.emf.ecore.util.InternalEList;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
/**
* Bug 486458 - Provide support for optimized loading and notifying of object units
@@ -94,14 +93,7 @@ public class Bugzilla_486458a_Test extends AbstractCDOTest
committed[0] = fillCategory(category, 3);
- try
- {
- unitRegistered.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException ex)
- {
- return;
- }
+ await(unitRegistered);
try
{
@@ -203,14 +195,7 @@ public class Bugzilla_486458a_Test extends AbstractCDOTest
unitRegistered.countDown();
}
- try
- {
- startInitializeUnit.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException ex)
- {
- return null;
- }
+ await(startInitializeUnit);
return super.initialize(monitor);
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_486458b_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_486458b_Test.java
index 75a0a55fc8..e895c41b21 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_486458b_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_486458b_Test.java
@@ -50,7 +50,6 @@ import org.eclipse.emf.ecore.util.InternalEList;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
/**
* Bug 486458 - Provide support for optimized loading and notifying of object units
@@ -192,14 +191,7 @@ public class Bugzilla_486458b_Test extends AbstractCDOTest
{
if (analyzeStarted != null)
{
- try
- {
- analyzeStarted.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException ex)
- {
- return null;
- }
+ await(analyzeStarted);
}
return super.createUnit(rootID, view, revisionHandler, monitor);
@@ -238,15 +230,8 @@ public class Bugzilla_486458b_Test extends AbstractCDOTest
{
if (initializeFinished != null)
{
- try
- {
- initializeFinished.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
- Thread.sleep(2000);
- }
- catch (InterruptedException ex)
- {
- return;
- }
+ await(initializeFinished);
+ sleep(2000);
}
super.objectAttacherFinishedCommit(objectAttacher);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_486458c_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_486458c_Test.java
index 65fd074e75..56384fb7c7 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_486458c_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_486458c_Test.java
@@ -43,7 +43,6 @@ import org.eclipse.emf.ecore.util.InternalEList;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
/**
* Bug 486458 - Provide support for optimized loading and notifying of object units
@@ -77,15 +76,7 @@ public class Bugzilla_486458c_Test extends AbstractCDOTest
CDOTransaction transaction = session.openTransaction();
CDOResource resource = transaction.getResource(getResourcePath("test"));
- try
- {
- createStarted.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException ex)
- {
- ex.printStackTrace();
- return;
- }
+ await(createStarted);
CDOUnit unit = transaction.getUnitManager().createUnit(resource, true, null);
secondCreated[0] = unit.getElements();
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
index aea3b9e3e1..52c7d0e029 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
@@ -13,7 +13,9 @@ package org.eclipse.net4j.util.tests;
import org.eclipse.net4j.internal.util.test.TestExecuter;
import org.eclipse.net4j.tests.bundle.OM;
import org.eclipse.net4j.util.ReflectUtil;
+import org.eclipse.net4j.util.WrappedException;
import org.eclipse.net4j.util.concurrent.ConcurrencyUtil;
+import org.eclipse.net4j.util.concurrent.TimeoutRuntimeException;
import org.eclipse.net4j.util.concurrent.TrackableTimerTask;
import org.eclipse.net4j.util.event.EventUtil;
import org.eclipse.net4j.util.event.IEvent;
@@ -857,11 +859,23 @@ public abstract class AbstractOMTest extends TestCase
});
}
- public static final void await(CountDownLatch latch) throws InterruptedException, TimeoutException
+ public static void await(CountDownLatch latch) throws TimeoutRuntimeException
{
- if (!latch.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS))
+ await(latch, DEFAULT_TIMEOUT);
+ }
+
+ public static void await(CountDownLatch latch, long millis) throws TimeoutRuntimeException
+ {
+ try
+ {
+ if (!latch.await(millis, TimeUnit.MILLISECONDS))
+ {
+ throw new TimeoutRuntimeException("Latch timed out: " + latch);
+ }
+ }
+ catch (InterruptedException ex)
{
- throw new TimeoutException("Latch timed out: " + latch);
+ throw WrappedException.wrap(ex);
}
}

Back to the top