[jboss-cvs] JBossAS SVN: r86649 - in projects/jboss-jca/trunk/core/src/test: java/org/jboss/jca/test/core/spec/chapter10/section3 and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 2 04:57:34 EDT 2009
Author: jeff.zhang
Date: 2009-04-02 04:57:34 -0400 (Thu, 02 Apr 2009)
New Revision: 86649
Added:
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerScheduleWorkTestCase.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerStartWorkTestCase.java
projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerScheduleWorkTestCase-jboss-beans.xml
projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerStartWorkTestCase-jboss-beans.xml
Modified:
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerDoWorkTestCase.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section3/WorkManagerInterfaceTestCase.java
Log:
[JBJCA-33] add spec.api tests
Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerDoWorkTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerDoWorkTestCase.java 2009-04-02 08:26:46 UTC (rev 86648)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerDoWorkTestCase.java 2009-04-02 08:57:34 UTC (rev 86649)
@@ -47,7 +47,7 @@
/**
* WorkManagerInterfaceTestCase.
*
- * Tests for the JCA specific Chapter 10 Section 3.3
+ * Tests for the JCA specific API about WorkManager
*
* @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
* @version $Revision: $
@@ -78,6 +78,7 @@
/**
* doWork method: This call blocks until the Work instance completes execution.
+ * Negative test against Null Work
* @throws Throwable throwable exception
*/
@Test(expected = WorkException.class)
@@ -101,7 +102,7 @@
}
/**
- * doWork method: throws WorkCompletedException indicates that a Workinstance has completed
+ * doWork method: throws WorkCompletedException indicates that a Work instance has completed
* execution with an exception.
* @throws Throwable throwable exception
*/
@@ -123,8 +124,8 @@
}
/**
- * doWork method: This call blocks until the Work instance completes execution. test defalut
- * param A maximum timeout value indicates that an action be performed arbitrarily without any time constraint.
+ * doWork method: This call blocks until the Work instance completes execution. test default
+ * parameter A maximum timeout value indicates that an action be performed arbitrarily without any time constraint.
* @throws Throwable throwable exception
*/
@Test
@@ -140,8 +141,8 @@
}
/**
- * doWork method: This call blocks until the Work instance completes execution. test defalut
- * param A maximum timeout value indicates that an action be performed arbitrarily without any time constraint.
+ * doWork method: This call blocks until the Work instance completes execution.
+ * Negative test against Null Work
* @throws Throwable throwable exception
*/
@Test(expected = WorkException.class)
@@ -154,8 +155,8 @@
}
/**
- * doWork method: This call blocks until the Work instance completes execution. test defalut
- * param A maximum timeout value indicates that an action be performed arbitrarily without any time constraint.
+ * doWork method: This call blocks until the Work instance completes execution. test default
+ * parameter A maximum timeout value indicates that an action be performed arbitrarily without any time constraint.
* @throws Throwable throwable exception
*/
@Test
@@ -172,7 +173,7 @@
/**
* doWork method: This call blocks until the Work instance completes execution. test IMMEDIATE
- * param A zero timeout value indicates an action be performed immediately. The WorkManager implementation
+ * parameter 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
*/
@@ -293,7 +294,7 @@
}
/**
- * doWork method: throws WorkCompletedException indicates that a Workinstance has completed
+ * doWork method: throws WorkCompletedException indicates that a Work instance has completed
* execution with an exception.
* @throws Throwable throwable exception
*/
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerScheduleWorkTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerScheduleWorkTestCase.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerScheduleWorkTestCase.java 2009-04-02 08:57:34 UTC (rev 86649)
@@ -0,0 +1,437 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.core.spec.chapter10.api;
+
+import org.jboss.jca.test.core.spec.chapter10.common.BlockRunningWork;
+import org.jboss.jca.test.core.spec.chapter10.common.CallbackCount;
+import org.jboss.jca.test.core.spec.chapter10.common.LongRunningWork;
+import org.jboss.jca.test.core.spec.chapter10.common.MyWorkAdapter;
+import org.jboss.jca.test.core.spec.chapter10.common.NestCharWork;
+import org.jboss.jca.test.core.spec.chapter10.common.ShortRunningWork;
+
+
+import java.util.concurrent.CountDownLatch;
+
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.work.ExecutionContext;
+import javax.resource.spi.work.Work;
+import javax.resource.spi.work.WorkException;
+import javax.resource.spi.work.WorkManager;
+
+import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * WorkManagerScheduleWorkTestCase.
+ *
+ * Tests for the JCA specific API about WorkManager
+ *
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class WorkManagerScheduleWorkTestCase
+{
+ /*
+ * Bootstrap (MC Facade)
+ */
+ private static EmbeddedTestMcBootstrap bootstrap;
+
+ /**
+ * scheduleWork method: TThis call does not block and returns immediately once a
+ * Work instance has been accepted for processing.
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testScheduleWork() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.scheduleWork(work);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * scheduleWork method:This call does not block and returns immediately once a
+ * Work instance has been accepted for processing. Negative test against Null Work
+ * @throws Throwable throwable exception
+ */
+ @Test(expected = WorkException.class)
+ public void testScheduleWorkNullWork() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+ Work work = null;
+ workManager.scheduleWork(work);
+ }
+
+ /**
+ * scheduleWork method: This call does not block and returns immediately once a
+ * Work instance has been accepted for processing. test for expected WorkException
+ * @throws Throwable throwable exception
+ */
+ @Test(expected = WorkException.class)
+ public void testScheduleWorkThrowWorkException() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+ Work work = null;
+ workManager.scheduleWork(work);
+ }
+
+ /**
+ * scheduleWork method: throws WorkCompletedException indicates that a Work instance has completed
+ * execution with an exception.
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testScheduleWorkThrowWorkCompletedException() 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 testScheduleWorkThrowWorkRejectedException() throws Throwable
+ {
+ //TODO
+ }
+
+ /**
+ * scheduleWork method: This call does not block and returns immediately once a
+ * Work instance has been accepted for processing. test default parameter A maximum timeout
+ * value indicates that an action be performed arbitrarily without any time constraint.
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testScheduleWorkFullSpec() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.scheduleWork(work, WorkManager.INDEFINITE, null, null);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * scheduleWork method: This call does not block and returns immediately once a
+ * Work instance has been accepted for processing. test for expected WorkException
+ * @throws Throwable throwable exception
+ */
+ @Test(expected = WorkException.class)
+ public void testScheduleWorkFullSpecNullWork() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ Work work = null;
+ workManager.scheduleWork(work, WorkManager.INDEFINITE, null, null);
+ }
+
+ /**
+ * scheduleWork method: This call does not block and returns immediately once a
+ * Work instance has been accepted for processing. test default parameter A maximum timeout value
+ * indicates that an action be performed arbitrarily without any time constraint.
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testScheduleWorkFullSpecWithIndefiniteStartTimeout() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.scheduleWork(work, WorkManager.INDEFINITE, null, null);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * scheduleWork method: This call does not block and returns immediately once a
+ * Work instance has been accepted for processing. test IMMEDIATE parameter 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
+ */
+ @Test
+ public void testScheduleWorkFullSpecWithImmediateStartTimeout() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.scheduleWork(work, WorkManager.IMMEDIATE, null, null);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * scheduleWork method: This call does not block and returns immediately once a
+ * Work instance has been accepted for processing. test UNKNOWN parameter A constant
+ * to indicate an unknown start delay duration or other unknown values.
+ * @throws Throwable throwable exception
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void testScheduleWorkFullSpecWithUnknowStartTimeout() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.scheduleWork(work, WorkManager.UNKNOWN, null, null);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * scheduleWork method: This call does not block and returns immediately once a
+ * Work instance has been accepted for processing. test negative parameter constant
+ * to indicate an negative value start delay duration
+ * @throws Throwable throwable exception
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void testScheduleWorkFullSpecWithNegativeStartTimeout() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.scheduleWork(work, -5, null, null);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * scheduleWork method: This call does not block and returns immediately once a
+ * Work instance has been accepted for processing. test ExecutionContext parameter object containing
+ * the execution context with which the submitted Work instance must be executed.
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testScheduleWorkFullSpecWithExecutionContext() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ ExecutionContext ec = new ExecutionContext();
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.scheduleWork(work, WorkManager.INDEFINITE, ec, null);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * scheduleWork method: This call does not block and returns immediately once a
+ * Work instance has been accepted for processing. test ExecutionContext parameter object containing
+ * the execution context with which the submitted Work instance must be executed.
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testScheduleWorkFullSpecWithNullExecutionContext() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.scheduleWork(work, WorkManager.INDEFINITE, null, null);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * scheduleWork method: This call does not block and returns immediately once a
+ * Work instance has been accepted for processing. test WorkListener parameter workListener an object
+ * which would be notified when the various Work processing events
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testScheduleWorkFullSpecWithWorkListener() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+
+ MyWorkAdapter wa = new MyWorkAdapter();
+ CallbackCount callbackCount = new CallbackCount();
+ wa.setCallbackCount(callbackCount);
+
+ workManager.scheduleWork(work, WorkManager.INDEFINITE, null, wa);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+
+ /**
+ * scheduleWork method: This call does not block and returns immediately once a
+ * Work instance has been accepted for processing.test WorkListener parameter
+ * workListener an object which would be notified when the various Work processing events
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testScheduleWorkFullSpecWithWorkNullListener() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.scheduleWork(work, WorkManager.INDEFINITE, null, null);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * scheduleWork method: throws WorkException Thrown if an error occurs
+ * @throws Throwable throwable exception
+ */
+ @Test(expected = WorkException.class)
+ public void testScheduleWorkFullSpecThrowWorkException() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+ Work work = null;
+ workManager.scheduleWork(work, WorkManager.INDEFINITE, null, null);
+ }
+
+ /**
+ * scheduleWork method: throws WorkCompletedException indicates that a Work instance has completed
+ * execution with an exception.
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testScheduleWorkFullSpecThrowWorkCompletedException() 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 testScheduleWorkFullSpecThrowWorkRejectedException() throws Throwable
+ {
+ //TODO
+ }
+
+ // --------------------------------------------------------------------------------||
+ // Lifecycle Methods --------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+ /**
+ * Lifecycle start, before the suite is executed
+ * @throws Throwable throwable exception
+ */
+ @BeforeClass
+ public static void beforeClass() throws Throwable
+ {
+ // Create and set a new MC Bootstrap
+ bootstrap = EmbeddedTestMcBootstrap.createEmbeddedMcBootstrap();
+
+ // Deploy Naming and Transaction
+ bootstrap.deploy(WorkManagerScheduleWorkTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+ bootstrap.deploy(WorkManagerScheduleWorkTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+
+ // Deploy Beans
+ bootstrap.deploy(WorkManagerScheduleWorkTestCase.class);
+ }
+
+ /**
+ * Lifecycle stop, after the suite is executed
+ * @throws Throwable throwable exception
+ */
+ @AfterClass
+ public static void afterClass() throws Throwable
+ {
+ // Undeploy Transaction and Naming
+ bootstrap.undeploy(WorkManagerScheduleWorkTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+ bootstrap.undeploy(WorkManagerScheduleWorkTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+
+ // Undeploy Beans
+ bootstrap.undeploy(WorkManagerScheduleWorkTestCase.class);
+
+ // Shutdown MC
+ bootstrap.shutdown();
+
+ // Set Bootstrap to null
+ bootstrap = null;
+ }
+}
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerStartWorkTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerStartWorkTestCase.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerStartWorkTestCase.java 2009-04-02 08:57:34 UTC (rev 86649)
@@ -0,0 +1,455 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.core.spec.chapter10.api;
+
+import org.jboss.jca.test.core.spec.chapter10.common.CallbackCount;
+import org.jboss.jca.test.core.spec.chapter10.common.LongRunningWork;
+import org.jboss.jca.test.core.spec.chapter10.common.MyWorkAdapter;
+
+import java.util.concurrent.CountDownLatch;
+
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.work.ExecutionContext;
+import javax.resource.spi.work.Work;
+import javax.resource.spi.work.WorkException;
+import javax.resource.spi.work.WorkManager;
+
+import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * WorkManagerStartWorkTestCase.
+ *
+ * Tests for the JCA specific API about WorkManager
+ *
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class WorkManagerStartWorkTestCase
+{
+ /*
+ * Bootstrap (MC Facade)
+ */
+ private static EmbeddedTestMcBootstrap bootstrap;
+
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but
+ * not until its completion.
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testStartWork() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.startWork(work);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but
+ * not until its completion. Negative test against Null Work
+ * @throws Throwable throwable exception
+ */
+ @Test(expected = WorkException.class)
+ public void testStartWorkNullWork() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+ Work work = null;
+ workManager.startWork(work);
+ }
+
+
+ /**
+ * startWork method: return the time elapsed from Work acceptance until start of execution.
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testStartWorkReturnLong() throws Throwable
+ {
+ //TODO
+ }
+
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but
+ * not until its completion. test for expected WorkException
+ * @throws Throwable throwable exception
+ */
+ @Test(expected = WorkException.class)
+ public void testStartWorkThrowWorkException() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+ Work work = null;
+ workManager.startWork(work);
+ }
+
+ /**
+ * startWork method: throws WorkCompletedException indicates that a Workinstance has completed
+ * execution with an exception.
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testStartWorkThrowWorkCompletedException() 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 testStartWorkThrowWorkRejectedException() throws Throwable
+ {
+ //TODO
+ }
+
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but
+ * not until its completion. test default
+ * param A maximum timeout value indicates that an action be performed arbitrarily without any time constraint.
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testStartWorkFullSpec() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.startWork(work, WorkManager.INDEFINITE, null, null);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but
+ * not until its completion. test for expected WorkException
+ * @throws Throwable throwable exception
+ */
+ @Test(expected = WorkException.class)
+ public void testStartWorkFullSpecNullWork() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ Work work = null;
+ workManager.startWork(work, WorkManager.INDEFINITE, null, null);
+ }
+
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but
+ * not until its completion. test default parameter A maximum timeout value
+ * indicates that an action be performed arbitrarily without any time constraint.
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testStartWorkFullSpecWithIndefiniteStartTimeout() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.startWork(work, WorkManager.INDEFINITE, null, null);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but
+ * not until its completion. test IMMEDIATE parameter 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
+ */
+ @Test
+ public void testStartWorkFullSpecWithImmediateStartTimeout() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.startWork(work, WorkManager.IMMEDIATE, null, null);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but
+ * not until its completion. test UNKNOWN parameter A constant
+ * to indicate an unknown start delay duration or other unknown values.
+ * @throws Throwable throwable exception
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void testStartWorkFullSpecWithUnknowStartTimeout() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.startWork(work, WorkManager.UNKNOWN, null, null);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but
+ * not until its completion. test negative parameter constant
+ * to indicate an negative value start delay duration
+ * @throws Throwable throwable exception
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void testStartWorkFullSpecWithNegativeStartTimeout() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.startWork(work, -5, null, null);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but
+ * not until its completion. test ExecutionContext parameter object containing
+ * the execution context with which the submitted Work instance must be executed.
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testStartWorkFullSpecWithExecutionContext() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ ExecutionContext ec = new ExecutionContext();
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.startWork(work, WorkManager.INDEFINITE, ec, null);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but
+ * not until its completion. test ExecutionContext parameter object containing
+ * the execution context with which the submitted Work instance must be executed.
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testStartWorkFullSpecWithNullExecutionContext() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.startWork(work, WorkManager.INDEFINITE, null, null);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but
+ * not until its completion. test WorkListener parameter workListener an object
+ * which would be notified when the various Work processing events
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testStartWorkFullSpecWithWorkListener() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+
+ MyWorkAdapter wa = new MyWorkAdapter();
+ CallbackCount callbackCount = new CallbackCount();
+ wa.setCallbackCount(callbackCount);
+
+ workManager.startWork(work, WorkManager.INDEFINITE, null, wa);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+
+ /**
+ * startWork method: This call blocks until the Work instance starts execution but
+ * not until its completion. test WorkListener parameter
+ * workListener an object which would be notified when the various Work processing events
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testStartWorkFullSpecWithWorkNullListener() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ final CountDownLatch start = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
+
+ LongRunningWork work = new LongRunningWork(start, done);
+ assertFalse(work.hasPostRun());
+ start.countDown();
+
+ workManager.startWork(work, WorkManager.INDEFINITE, null, null);
+ done.await();
+ assertTrue(work.hasPostRun());
+ }
+
+ /**
+ * startWork method: return the time elapsed from Work acceptance until start of execution.
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testStartWorkFullSpecReturnLong() throws Throwable
+ {
+ //TODO
+ }
+
+
+ /**
+ * startWork method: throws WorkException Thrown if an error occurs
+ * @throws Throwable throwable exception
+ */
+ @Test(expected = WorkException.class)
+ public void testStartWorkFullSpecThrowWorkException() throws Throwable
+ {
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+ Work work = null;
+ workManager.startWork(work, WorkManager.INDEFINITE, null, null);
+ }
+
+ /**
+ * startWork method: throws WorkCompletedException indicates that a Work instance has completed
+ * execution with an exception.
+ * @throws Throwable throwable exception
+ */
+ @Ignore
+ public void testStartWorkFullSpecThrowWorkCompletedException() 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 testStartWorkFullSpecThrowWorkRejectedException() throws Throwable
+ {
+ //TODO
+ }
+
+ // --------------------------------------------------------------------------------||
+ // Lifecycle Methods --------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+ /**
+ * Lifecycle start, before the suite is executed
+ * @throws Throwable throwable exception
+ */
+ @BeforeClass
+ public static void beforeClass() throws Throwable
+ {
+ // Create and set a new MC Bootstrap
+ bootstrap = EmbeddedTestMcBootstrap.createEmbeddedMcBootstrap();
+
+ // Deploy Naming and Transaction
+ bootstrap.deploy(WorkManagerStartWorkTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+ bootstrap.deploy(WorkManagerStartWorkTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+
+ // Deploy Beans
+ bootstrap.deploy(WorkManagerStartWorkTestCase.class);
+ }
+
+ /**
+ * Lifecycle stop, after the suite is executed
+ * @throws Throwable throwable exception
+ */
+ @AfterClass
+ public static void afterClass() throws Throwable
+ {
+ // Undeploy Transaction and Naming
+ bootstrap.undeploy(WorkManagerStartWorkTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+ bootstrap.undeploy(WorkManagerStartWorkTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+
+ // Undeploy Beans
+ bootstrap.undeploy(WorkManagerStartWorkTestCase.class);
+
+ // Shutdown MC
+ bootstrap.shutdown();
+
+ // Set Bootstrap to null
+ bootstrap = null;
+ }
+}
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-04-02 08:26:46 UTC (rev 86648)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section3/WorkManagerInterfaceTestCase.java 2009-04-02 08:57:34 UTC (rev 86649)
@@ -101,134 +101,6 @@
}
/**
- * doWork method: throws WorkException Thrown if an error occurs
- * @throws Throwable throwable exception
- */
- @Ignore
- public void testDoWorkMethodThrowWorkException() throws Throwable
- {
- //TODO
- }
-
- /**
- * doWork method: throws WorkCompletedException indicates that a Workinstance has completed
- * execution with an exception.
- * @throws Throwable throwable exception
- */
- @Ignore
- public void testDoWorkMethodThrowWorkCompletedException() throws Throwable
- {
- //TODO
- }
-
- /**
- * doWork method: throws WorkRejectedException indicates that a Work instance has been
- * rejected from further processing.
- * @throws Throwable throwable exception
- */
- @Ignore
- public void testDoWorkMethodThrowWorkRejectedException() throws Throwable
- {
- //TODO
- }
-
- /**
- * doWork method: This call blocks until the Work instance completes execution. 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 testDoWorkMethodWithDefaultParams() 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();
- start.countDown();
- workManager.doWork(mw, WorkManager.INDEFINITE, null, null);
- hold.await();
- done.await();
-
- assertTrue(mw.hasPreRun());
- assertTrue(mw.hasPostRun());
- }
-
- /**
- * doWork method: This call blocks until the Work instance completes execution. 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 testDoWorkMethodWithImmediateStart() throws Throwable
- {
- //TODO
- }
-
- /**
- * doWork method: This call blocks until the Work instance completes execution. test UNKNOWN param A constant
- * to indicate an unknown start delay duration or other unknown values.
- * @throws Throwable throwable exception
- */
- @Ignore
- public void testDoWorkMethodWithUnknowStart() throws Throwable
- {
- //TODO
- }
- /**
- * doWork method: This call blocks until the Work instance completes execution. test ExecutionContext paraman.
- * object containing the execution context with which the submitted Work instance must be executed.
- * @throws Throwable throwable exception
- */
- @Ignore
- public void testDoWorkMethodWithExecutionContextParams() throws Throwable
- {
- //TODO
- }
- /**
- * doWork method: This call blocks until the Work instance completes execution. test WorkListener param
- * workListener an object which would be notified when the various Work processing events
- * @throws Throwable throwable exception
- */
- @Test
- public void testDoWorkMethodWithWorkListenerParams() 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.doWork(mw, WorkManager.INDEFINITE, null, wa);
- hold.await();
- done.await();
-
- assertEquals(1, callbackCount.getAcceptCount());
- assertTrue(mw.hasPreRun());
- assertTrue(mw.hasPostRun());
- }
-
- /**
* Test for paragraph 3
* doWork method: this provides a first in, first out (FIFO) execution start
* ordering and last in, first out (LIFO) execution completion ordering guarantee.
@@ -293,141 +165,8 @@
assertTrue(mw.hasPreRun());
assertTrue(mw.hasPostRun());
}
-
- /**
- * 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.
@@ -518,156 +257,6 @@
}
/**
- * 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
- * is rejected with a WorkRejectedException set to an appropriate error code (WorkException.START_TIMED_OUT).
- * @throws Throwable throwable exception
- */
- @Ignore
- public void testStartTimeoutThrowWorkRejectedException() throws Throwable
- {
- }
-
- /**
* Test for bullet 1 Section 3.3.6
* The application server must implement the WorkManager interface
* @throws Throwable throwable exception
Added: projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerScheduleWorkTestCase-jboss-beans.xml
===================================================================
--- projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerScheduleWorkTestCase-jboss-beans.xml (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerScheduleWorkTestCase-jboss-beans.xml 2009-04-02 08:57:34 UTC (rev 86649)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ JBoss JCA
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="WorkManagerThreadPool" interface="org.jboss.jca.common.api.ThreadPool" class="org.jboss.jca.common.threadpool.ThreadPoolImpl">
+ <!-- The name that appears in thread names -->
+ <property name="name">WorkManager</property>
+
+ <!-- The maximum amount of work in the queue -->
+ <property name="maximumQueueSize">1024</property>
+
+ <!-- The maximum number of active threads -->
+ <property name="maximumPoolSize">100</property>
+
+ <!-- How long to keep threads alive after their last work (default one minute) -->
+ <property name="keepAliveTime">60000</property>
+ </bean>
+
+ <bean name="WorkManager" interface="org.jboss.jca.core.api.WorkManager" class="org.jboss.jca.core.workmanager.WorkManagerImpl">
+ <!-- The thread pool -->
+ <property name="threadPool"><inject bean="WorkManagerThreadPool"/></property>
+
+ <!-- The XA terminator -->
+ <property name="XATerminator"><inject bean="TransactionManager" property="XATerminator"/></property>
+ </bean>
+
+ <bean name="SimpleBootstrapContext" interface="javax.resource.spi.BootstrapContext" class="org.jboss.jca.test.core.spec.chapter10.SimpleBootstrapContext">
+ <!-- The work manager -->
+ <property name="workManager"><inject bean="WorkManager"/></property>
+
+ <!-- The XA terminator -->
+ <property name="XATerminator"><inject bean="TransactionManager" property="XATerminator"/></property>
+ </bean>
+</deployment>
Added: projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerStartWorkTestCase-jboss-beans.xml
===================================================================
--- projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerStartWorkTestCase-jboss-beans.xml (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkManagerStartWorkTestCase-jboss-beans.xml 2009-04-02 08:57:34 UTC (rev 86649)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ JBoss JCA
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="WorkManagerThreadPool" interface="org.jboss.jca.common.api.ThreadPool" class="org.jboss.jca.common.threadpool.ThreadPoolImpl">
+ <!-- The name that appears in thread names -->
+ <property name="name">WorkManager</property>
+
+ <!-- The maximum amount of work in the queue -->
+ <property name="maximumQueueSize">1024</property>
+
+ <!-- The maximum number of active threads -->
+ <property name="maximumPoolSize">100</property>
+
+ <!-- How long to keep threads alive after their last work (default one minute) -->
+ <property name="keepAliveTime">60000</property>
+ </bean>
+
+ <bean name="WorkManager" interface="org.jboss.jca.core.api.WorkManager" class="org.jboss.jca.core.workmanager.WorkManagerImpl">
+ <!-- The thread pool -->
+ <property name="threadPool"><inject bean="WorkManagerThreadPool"/></property>
+
+ <!-- The XA terminator -->
+ <property name="XATerminator"><inject bean="TransactionManager" property="XATerminator"/></property>
+ </bean>
+
+ <bean name="SimpleBootstrapContext" interface="javax.resource.spi.BootstrapContext" class="org.jboss.jca.test.core.spec.chapter10.SimpleBootstrapContext">
+ <!-- The work manager -->
+ <property name="workManager"><inject bean="WorkManager"/></property>
+
+ <!-- The XA terminator -->
+ <property name="XATerminator"><inject bean="TransactionManager" property="XATerminator"/></property>
+ </bean>
+</deployment>
More information about the jboss-cvs-commits
mailing list