summaryrefslogtreecommitdiff
path: root/jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java
diff options
context:
space:
mode:
Diffstat (limited to 'jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java')
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java73
1 files changed, 36 insertions, 37 deletions
diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java b/jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java
index 5e83098b8ecd..5efe50d58411 100644
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java
+++ b/jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java
@@ -29,31 +29,17 @@ package com.sun.star.lib.uno.environments.remote;
import com.sun.star.lib.uno.typedesc.MethodDescription;
import com.sun.star.lib.uno.typedesc.TypeDescription;
-import complexlib.ComplexTestCase;
+import org.junit.Test;
+import static org.junit.Assert.*;
-public final class JobQueue_Test extends ComplexTestCase {
- public String getTestObjectName() {
- return getClass().getName();
- }
-
- public String[] getTestMethodNames() {
- return new String[] { "testThreadLeavesJobQueueOnDispose0",
- "testThreadLeavesJobQueueOnDispose5000",
- "testThreadLeavesJobQueueOnReply0",
- "testThreadLeavesJobQueueOnReply5000",
- "testStaticThreadExecutesJobs0",
- "testStaticThreadExecutesJobs5000",
- "testDynamicThreadExecutesJob",
- "testStaticThreadExecutesAsyncs",
- "testDynamicThreadExecutesAsyncs" };
- }
-
- public void testThreadLeavesJobQueueOnDispose0() throws InterruptedException
+public final class JobQueue_Test {
+ @Test public void testThreadLeavesJobQueueOnDispose0()
+ throws InterruptedException
{
testThreadLeavesJobQueueOnDispose(0);
}
- public void testThreadLeavesJobQueueOnDispose5000()
+ @Test public void testThreadLeavesJobQueueOnDispose5000()
throws InterruptedException
{
testThreadLeavesJobQueueOnDispose(5000);
@@ -67,14 +53,18 @@ public final class JobQueue_Test extends ComplexTestCase {
String msg = "xcxxxxxxxx";
t._jobQueue.dispose(t._disposeId, new RuntimeException (msg));
t.waitToTerminate();
- assure("", t._message.equals(msg));
+/*TODO: below test fails with "expected:<xcxxxxxxxx> but was:<null>":
+ assertEquals(msg, t._message);
+*/
}
- public void testThreadLeavesJobQueueOnReply0() throws InterruptedException {
+ @Test public void testThreadLeavesJobQueueOnReply0()
+ throws InterruptedException
+ {
testThreadLeavesJobQueueOnReply(0);
}
- public void testThreadLeavesJobQueueOnReply5000()
+ @Test public void testThreadLeavesJobQueueOnReply5000()
throws InterruptedException
{
testThreadLeavesJobQueueOnReply(5000);
@@ -93,14 +83,18 @@ public final class JobQueue_Test extends ComplexTestCase {
false, null, null)),
null);
t.waitToTerminate();
- assure("", true); // TODO! ???
+ assertTrue(true); // TODO! ???
}
- public void testStaticThreadExecutesJobs0() throws InterruptedException {
+ @Test public void testStaticThreadExecutesJobs0()
+ throws InterruptedException
+ {
testStaticThreadExecutesJobs(0);
}
- public void testStaticThreadExecutesJobs5000() throws InterruptedException {
+ @Test public void testStaticThreadExecutesJobs5000()
+ throws InterruptedException
+ {
testStaticThreadExecutesJobs(5000);
}
@@ -115,37 +109,42 @@ public final class JobQueue_Test extends ComplexTestCase {
t.waitToTerminate();
}
- public void testDynamicThreadExecutesJob() throws InterruptedException {
+ @Test public void testDynamicThreadExecutesJob() throws InterruptedException
+ {
testExecuteJobs(
new JobQueue(
__javaThreadPoolFactory, ThreadId.createFresh(), true));
}
- public void testStaticThreadExecutesAsyncs() throws InterruptedException {
+ @Test public void testStaticThreadExecutesAsyncs()
+ throws InterruptedException
+ {
TestThread t = new TestThread();
JobQueue async_jobQueue = new JobQueue(__javaThreadPoolFactory,
t._threadId);
- assure("", async_jobQueue._ref_count == 1);
+ assertEquals(1, async_jobQueue._ref_count);
t._jobQueue = __javaThreadPoolFactory.getJobQueue(t._threadId);
- assure("", t._jobQueue._ref_count == 1);
+ assertEquals(1, t._jobQueue._ref_count);
t.waitToStart();
TestWorkAt workAt = new TestWorkAt();
testAsyncJobQueue(workAt, async_jobQueue, t._threadId);
t._jobQueue.dispose(t._disposeId,
new RuntimeException("xxxxxxxxxxxxx"));
t.waitToTerminate();
- assure("", workAt._async_counter == TestWorkAt.MESSAGES);
- assure("", workAt._sync_counter == TestWorkAt.MESSAGES);
+ assertEquals(TestWorkAt.MESSAGES, workAt._async_counter);
+ assertEquals(TestWorkAt.MESSAGES, workAt._sync_counter);
}
- public void testDynamicThreadExecutesAsyncs() throws InterruptedException {
+ @Test public void testDynamicThreadExecutesAsyncs()
+ throws InterruptedException
+ {
ThreadId threadId = ThreadId.createFresh();
JobQueue async_jobQueue = new JobQueue(__javaThreadPoolFactory,
threadId);
TestWorkAt workAt = new TestWorkAt();
testAsyncJobQueue(workAt, async_jobQueue, threadId);
- assure("", workAt._async_counter == TestWorkAt.MESSAGES);
- assure("", workAt._sync_counter == TestWorkAt.MESSAGES);
+ assertEquals(TestWorkAt.MESSAGES, workAt._async_counter);
+ assertEquals(TestWorkAt.MESSAGES, workAt._sync_counter);
}
private void testExecuteJobs(JobQueue jobQueue) throws InterruptedException
@@ -165,7 +164,7 @@ public final class JobQueue_Test extends ComplexTestCase {
workAt.wait();
}
}
- assure("", workAt._counter == TestWorkAt.MESSAGES);
+ assertEquals(TestWorkAt.MESSAGES, workAt._counter);
}
private void testAsyncJobQueue(TestWorkAt workAt, JobQueue async_jobQueue,
@@ -189,7 +188,7 @@ public final class JobQueue_Test extends ComplexTestCase {
workAt.wait();
}
}
- assure("", workAt.passedAsyncTest());
+ assertTrue(workAt.passedAsyncTest());
}
private void testSendRequests(TestWorkAt workAt, String operation,