Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2013-07-11 14:30:46 -0400
committerjmisinco2013-07-16 14:59:10 -0400
commit46f8200295486608bd448a0f0aa49e53f01470be (patch)
tree2dc34e944aa82d284dcbf49a9f4eb96660546284 /plugins/org.eclipse.osee.executor.admin.test
parentdb255184fb04c64d7fa2910e514810f61d2a1b36 (diff)
downloadorg.eclipse.osee-46f8200295486608bd448a0f0aa49e53f01470be.tar.gz
org.eclipse.osee-46f8200295486608bd448a0f0aa49e53f01470be.tar.xz
org.eclipse.osee-46f8200295486608bd448a0f0aa49e53f01470be.zip
refactor[ats_LRLBR]: Change ExecutorAdmin to support different executors
Two types of executors are now supported, fixed thread pool executors which will be used for database bound operations, and cached pool executors while will be used for non DB bound operations. Guava's ListeningExecutorService is used to support the callback functionality on futures. Change-Id: I87bd0c79c6be5cfed07c33be3fcbb9878fd20346
Diffstat (limited to 'plugins/org.eclipse.osee.executor.admin.test')
-rw-r--r--plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutionCallbackTest.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutionCallbackTest.java b/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutionCallbackTest.java
index 994a6ec44e..a384cd39d4 100644
--- a/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutionCallbackTest.java
+++ b/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutionCallbackTest.java
@@ -99,10 +99,14 @@ public class ExecutionCallbackTest {
verify(callback).onFailure(expectedException);
}
- @Test
+ @Test(timeout = 5000)
public void testCallbackOnCancel() throws Exception {
TestCancellableCallable callable = new TestCancellableCallable("results");
Future<String> future = admin.schedule(callable, callback);
+
+ while (!callable.hasBeenCalled()) {
+ Thread.sleep(20);
+ }
future.cancel(true);
verify(callback, times(0)).onSuccess(Matchers.anyString());
@@ -119,13 +123,19 @@ public class ExecutionCallbackTest {
private class TestCancellableCallable extends CancellableCallable<String> {
private final String results;
+ private volatile boolean beenCalled = false;
public TestCancellableCallable(String results) {
this.results = results;
}
+ public boolean hasBeenCalled() {
+ return beenCalled;
+ }
+
@Override
public String call() throws Exception {
+ beenCalled = true;
while (!isCancelled()) {
checkForCancelled();
}

Back to the top