[jboss-cvs] JBossAS SVN: r86466 - projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section3.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Mar 30 06:09:15 EDT 2009
Author: jeff.zhang
Date: 2009-03-30 06:09:15 -0400 (Mon, 30 Mar 2009)
New Revision: 86466
Modified:
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section3/WorkManagerInterfaceTestCase.java
Log:
[JBJCA-33] add more testplan
Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section3/WorkManagerInterfaceTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section3/WorkManagerInterfaceTestCase.java 2009-03-30 09:44:17 UTC (rev 86465)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section3/WorkManagerInterfaceTestCase.java 2009-03-30 10:09:15 UTC (rev 86466)
@@ -229,6 +229,7 @@
assertTrue(mw.hasPreRun());
assertTrue(mw.hasPostRun());
}
+
/**
* Test for paragraph 3
* doWork method: this provides a first in, first out (FIFO) execution start
@@ -296,6 +297,139 @@
}
/**
+ * startWork method: throws WorkException Thrown if an error occurs
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testStartWorkMethodThrowWorkException() throws Throwable
+ {
+ //TODO
+ }
+
+ /**
+ * startWork method: throws WorkRejectedException indicates that a Work instance has been
+ * rejected from further processing.
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testStartWorkMethodThrowWorkRejectedException() throws Throwable
+ {
+ //TODO
+ }
+
+ /**
+ * startWork method: return the time elapsed from Work acceptance until start of execution.
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testStartWorkMethodReturnLong() throws Throwable
+ {
+ //TODO
+ }
+
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but not until its completion.
+ * test defalut param A maximum timeout value indicates that an action be performed arbitrarily without
+ * any time constraint.
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testStartWorkMethodWithDefaultParams() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch before = new CountDownLatch(1);
+ final CountDownLatch hold = new CountDownLatch(1);
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ BlockRunningWork mw = new BlockRunningWork(before, hold, start, done);
+
+ assertFalse(mw.hasPreRun());
+ assertFalse(mw.hasPostRun());
+
+ before.countDown();
+ workManager.startWork(mw, WorkManager.INDEFINITE, null, null);
+ hold.await();
+ assertTrue(mw.hasPreRun());
+ assertFalse(mw.hasPostRun());
+
+ start.countDown();
+ done.await();
+
+ assertTrue(mw.hasPreRun());
+ assertTrue(mw.hasPostRun());
+ }
+
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but not until its completion.
+ * test IMMEDIATE param A zero timeout value indicates an action be performed immediately. The WorkManager
+ * implementation must timeout the action as soon as possible.
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testStartWorkMethodWithImmediateStart() throws Throwable
+ {
+ //TODO
+ }
+
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but not until its completion.
+ * test UNKNOWN param A constant to indicate an unknown start delay duration or other unknown values.
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testStartWorkMethodWithUnknowStart() throws Throwable
+ {
+ //TODO
+ }
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but not until its completion
+ * test ExecutionContext param.
+ * object containing the execution context with which the submitted Work instance must be executed.
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testStartWorkMethodWithExecutionContextParams() throws Throwable
+ {
+ //TODO
+ }
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but not until
+ * its completion. test WorkListener param
+ * workListener an object which would be notified when the various Work processing events
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testStartWorkMethodWithWorkListenerParams() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch before = new CountDownLatch(1);
+ final CountDownLatch hold = new CountDownLatch(1);
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ BlockRunningWork mw = new BlockRunningWork(before, hold, start, done);
+ MyWorkAdapter wa = new MyWorkAdapter();
+ CallbackCount callbackCount = new CallbackCount();
+ wa.setCallbackCount(callbackCount);
+
+ assertFalse(mw.hasPreRun());
+ assertFalse(mw.hasPostRun());
+
+ before.countDown();
+ start.countDown();
+ workManager.startWork(mw, WorkManager.INDEFINITE, null, wa);
+ hold.await();
+ done.await();
+
+ assertEquals(1, callbackCount.getAcceptCount());
+ assertTrue(mw.hasPreRun());
+ assertTrue(mw.hasPostRun());
+ }
+
+ /**
* Test for paragraph 4
* startWork method: This returns the time elapsed in milliseconds from Work acceptance until
* the start of execution.
@@ -386,6 +520,144 @@
}
/**
+ * scheduleWork method: throws WorkException Thrown if an error occurs
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testScheduleWorkMethodThrowWorkException() throws Throwable
+ {
+ //TODO
+ }
+
+ /**
+ * scheduleWork method: throws WorkRejectedException indicates that a Work instance has been
+ * rejected from further processing.
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testScheduleWorkMethodThrowWorkRejectedException() throws Throwable
+ {
+ //TODO
+ }
+
+ /**
+ * scheduleWork method: throws WorkCompletedException indicates that a Workinstance has completed
+ * execution with an exception.
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testScheduleWorkMethodThrowWorkCompletedException() throws Throwable
+ {
+ //TODO
+ }
+
+ /**
+ * scheduleWork method: This call does not block and returns immediately once a Work instance has been
+ * accepted for processing.
+ * test defalut param A maximum timeout value indicates that an action be performed arbitrarily without
+ * any time constraint.
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testScheduleWorkMethodWithDefaultParams() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch before = new CountDownLatch(1);
+ final CountDownLatch hold = new CountDownLatch(1);
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ BlockRunningWork mw = new BlockRunningWork(before, hold, start, done);
+
+ assertFalse(mw.hasPreRun());
+ assertFalse(mw.hasPostRun());
+
+ workManager.scheduleWork(mw, WorkManager.INDEFINITE, null, null);
+ before.countDown();
+ hold.await();
+ assertTrue(mw.hasPreRun());
+ assertFalse(mw.hasPostRun());
+
+ start.countDown();
+ done.await();
+
+ assertTrue(mw.hasPreRun());
+ assertTrue(mw.hasPostRun());
+ }
+
+ /**
+ * scheduleWork method: This call does not block and returns immediately once a Work instance has been
+ * accepted for processing.
+ * test IMMEDIATE param A zero timeout value indicates an action be performed immediately. The WorkManager
+ * implementation must timeout the action as soon as possible.
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testScheduleWorkMethodWithImmediateStart() throws Throwable
+ {
+ //TODO
+ }
+
+ /**
+ * scheduleWork method: This call does not block and returns immediately once a Work instance has been
+ * accepted for processing.
+ * test UNKNOWN param A constant to indicate an unknown start delay duration or other unknown values.
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testScheduleWorkMethodWithUnknowStart() throws Throwable
+ {
+ //TODO
+ }
+ /**
+ * scheduleWork method: ThThis call does not block and returns immediately once a Work instance has been
+ * accepted for processing.
+ * test ExecutionContext param.
+ * object containing the execution context with which the submitted Work instance must be executed.
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testScheduleWorkMethodWithExecutionContextParams() throws Throwable
+ {
+ //TODO
+ }
+ /**
+ * scheduleWork method: This call does not block and returns immediately once a Work instance has been
+ * accepted for processing. test WorkListener param
+ * workListener an object which would be notified when the various Work processing events
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testScheduleWorkMethodWithWorkListenerParams() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch before = new CountDownLatch(1);
+ final CountDownLatch hold = new CountDownLatch(1);
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ BlockRunningWork mw = new BlockRunningWork(before, hold, start, done);
+ MyWorkAdapter wa = new MyWorkAdapter();
+ CallbackCount callbackCount = new CallbackCount();
+ wa.setCallbackCount(callbackCount);
+
+ assertFalse(mw.hasPreRun());
+ assertFalse(mw.hasPostRun());
+
+ before.countDown();
+ start.countDown();
+ workManager.scheduleWork(mw, WorkManager.INDEFINITE, null, wa);
+ hold.await();
+ done.await();
+
+ assertEquals(1, callbackCount.getAcceptCount());
+ assertTrue(mw.hasPreRun());
+ assertTrue(mw.hasPostRun());
+ }
+
+ /**
* Test for paragraph 6
* The optional startTimeout parameter specifies a time duration in milliseconds within which
* the execution of the Work instance must start. Otherwise, the Work instance
More information about the jboss-cvs-commits
mailing list