[jboss-cvs] JBossAS SVN: r86901 - 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
Tue Apr 7 04:38:49 EDT 2009


Author: jeff.zhang
Date: 2009-04-07 04:38:48 -0400 (Tue, 07 Apr 2009)
New Revision: 86901

Added:
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkAdapterTestCase.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkListenerTestCase.java
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkTestCase.java
   projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkAdapterTestCase-jboss-beans.xml
   projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkListenerTestCase-jboss-beans.xml
   projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkTestCase-jboss-beans.xml
Modified:
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section3/WorkInterfaceTestCase.java
Log:
[JBJCA-33] add spec api test

Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkAdapterTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkAdapterTestCase.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkAdapterTestCase.java	2009-04-07 08:38:48 UTC (rev 86901)
@@ -0,0 +1,203 @@
+/*
+ * 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 org.jboss.jca.test.core.spec.chapter10.common.ShortRunningWork;
+
+import java.util.concurrent.CountDownLatch;
+
+import javax.resource.spi.work.Work;
+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.*;
+
+/**
+ * WorkAdapterTestCase.
+ * 
+ * Tests for the JCA specific API about WorkAdapte
+ * 
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class WorkAdapterTestCase
+{
+   /*
+    * Bootstrap (MC Facade)
+    */
+   private static EmbeddedTestMcBootstrap bootstrap;
+
+
+   /**
+    * workAccepted method
+    * @throws Throwable throwable exception 
+    */
+   @Test
+   public void testWorkAcceptedStatus() throws Throwable
+   {
+      WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+      Work work1 = new ShortRunningWork();
+      Work work2 = new ShortRunningWork();
+      Work work3 = new ShortRunningWork();
+      
+      MyWorkAdapter wa = new MyWorkAdapter();
+      CallbackCount callbackCount = new CallbackCount();
+      wa.setCallbackCount(callbackCount);
+
+      workManager.doWork(work1, WorkManager.INDEFINITE, null, wa);
+      workManager.startWork(work2, WorkManager.INDEFINITE, null, wa);
+      workManager.scheduleWork(work3, WorkManager.INDEFINITE, null, wa);
+
+      assertEquals("should be same", 3, callbackCount.getAcceptCount());
+   }   
+   
+   /**
+    * Test for paragraph 1 Section 3.3.3
+    * @throws Throwable throwable exception 
+    */
+   @Ignore
+   public void testWorkRejectedStatus() throws Throwable
+   {
+      //TODO
+   }   
+   
+   /**
+    * Test for paragraph 1 Section 3.3.4
+    * @throws Throwable throwable exception 
+    */
+   @Test
+   public void testWorkStartedStatus() throws Throwable
+   {
+      WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+      final CountDownLatch start = new CountDownLatch(1);
+      final CountDownLatch done = new CountDownLatch(1);
+      
+      Work work1 = new ShortRunningWork();
+      Work work2 = new ShortRunningWork();
+      Work work3 = new LongRunningWork(start, done);
+      
+      MyWorkAdapter wa = new MyWorkAdapter();
+      CallbackCount callbackCount = new CallbackCount();
+      wa.setCallbackCount(callbackCount);
+
+      workManager.doWork(work1, WorkManager.INDEFINITE, null, wa);
+      workManager.startWork(work2, WorkManager.INDEFINITE, null, wa);
+      workManager.scheduleWork(work3, WorkManager.INDEFINITE, null, wa);
+
+      assertEquals("should be same", 3, callbackCount.getAcceptCount());
+      //assertEquals("should be same", 2, callbackCount.getStartCount());
+      //TODO workManagerImpl maybe have a bug here
+      
+      start.countDown();
+
+      done.await();
+   }   
+   
+   /**
+    * Test for paragraph 1 Section 3.3.5
+    * @throws Throwable throwable exception 
+    */
+   @Test
+   public void testWorkCompletedStatus() throws Throwable
+   {
+      WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+      final CountDownLatch start2 = new CountDownLatch(1);
+      final CountDownLatch done2 = new CountDownLatch(1);
+      final CountDownLatch start3 = new CountDownLatch(1);
+      final CountDownLatch done3 = new CountDownLatch(1);
+      
+      Work work1 = new ShortRunningWork();
+      Work work2 = new LongRunningWork(start2, done2);
+      Work work3 = new LongRunningWork(start3, done3);
+      
+      MyWorkAdapter wa = new MyWorkAdapter();
+      CallbackCount callbackCount = new CallbackCount();
+      wa.setCallbackCount(callbackCount);
+
+      workManager.doWork(work1, WorkManager.INDEFINITE, null, wa);
+      workManager.startWork(work2, WorkManager.INDEFINITE, null, wa);
+      workManager.scheduleWork(work3, WorkManager.INDEFINITE, null, wa);
+      
+      assertEquals("should be same", 3, callbackCount.getAcceptCount());
+      assertEquals("should be same", 1, callbackCount.getCompletedCount());
+
+      start2.countDown();
+      start3.countDown();
+      
+      done2.await();
+      done3.await();
+   }
+   
+   
+   // --------------------------------------------------------------------------------||
+   // 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(WorkAdapterTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+      bootstrap.deploy(WorkAdapterTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+      
+      // Deploy Beans
+      bootstrap.deploy(WorkAdapterTestCase.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(WorkAdapterTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+      bootstrap.undeploy(WorkAdapterTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+
+      // Undeploy Beans
+      bootstrap.undeploy(WorkAdapterTestCase.class);
+
+      // Shutdown MC
+      bootstrap.shutdown();
+
+      // Set Bootstrap to null
+      bootstrap = null;
+   }
+}


Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkAdapterTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Reversion Date

Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkListenerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkListenerTestCase.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkListenerTestCase.java	2009-04-07 08:38:48 UTC (rev 86901)
@@ -0,0 +1,203 @@
+/*
+ * 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 org.jboss.jca.test.core.spec.chapter10.common.ShortRunningWork;
+
+import java.util.concurrent.CountDownLatch;
+
+import javax.resource.spi.work.Work;
+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.*;
+
+/**
+ * WorkListenerTestCase.
+ * 
+ * Tests for the JCA specific API about WorkListener
+ * 
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class WorkListenerTestCase
+{
+   /*
+    * Bootstrap (MC Facade)
+    */
+   private static EmbeddedTestMcBootstrap bootstrap;
+
+
+   /**
+    * workAccepted method
+    * @throws Throwable throwable exception 
+    */
+   @Test
+   public void testWorkAcceptedStatus() throws Throwable
+   {
+      WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+      Work work1 = new ShortRunningWork();
+      Work work2 = new ShortRunningWork();
+      Work work3 = new ShortRunningWork();
+      
+      MyWorkAdapter wa = new MyWorkAdapter();
+      CallbackCount callbackCount = new CallbackCount();
+      wa.setCallbackCount(callbackCount);
+
+      workManager.doWork(work1, WorkManager.INDEFINITE, null, wa);
+      workManager.startWork(work2, WorkManager.INDEFINITE, null, wa);
+      workManager.scheduleWork(work3, WorkManager.INDEFINITE, null, wa);
+
+      assertEquals("should be same", 3, callbackCount.getAcceptCount());
+   }   
+   
+   /**
+    * Test for paragraph 1 Section 3.3.3
+    * @throws Throwable throwable exception 
+    */
+   @Ignore
+   public void testWorkRejectedStatus() throws Throwable
+   {
+      //TODO
+   }   
+   
+   /**
+    * Test for paragraph 1 Section 3.3.4
+    * @throws Throwable throwable exception 
+    */
+   @Test
+   public void testWorkStartedStatus() throws Throwable
+   {
+      WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+      final CountDownLatch start = new CountDownLatch(1);
+      final CountDownLatch done = new CountDownLatch(1);
+      
+      Work work1 = new ShortRunningWork();
+      Work work2 = new ShortRunningWork();
+      Work work3 = new LongRunningWork(start, done);
+      
+      MyWorkAdapter wa = new MyWorkAdapter();
+      CallbackCount callbackCount = new CallbackCount();
+      wa.setCallbackCount(callbackCount);
+
+      workManager.doWork(work1, WorkManager.INDEFINITE, null, wa);
+      workManager.startWork(work2, WorkManager.INDEFINITE, null, wa);
+      workManager.scheduleWork(work3, WorkManager.INDEFINITE, null, wa);
+
+      assertEquals("should be same", 3, callbackCount.getAcceptCount());
+      //assertEquals("should be same", 2, callbackCount.getStartCount());
+      //TODO workManagerImpl maybe have a bug here
+      
+      start.countDown();
+
+      done.await();
+   }   
+   
+   /**
+    * Test for paragraph 1 Section 3.3.5
+    * @throws Throwable throwable exception 
+    */
+   @Test
+   public void testWorkCompletedStatus() throws Throwable
+   {
+      WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+      final CountDownLatch start2 = new CountDownLatch(1);
+      final CountDownLatch done2 = new CountDownLatch(1);
+      final CountDownLatch start3 = new CountDownLatch(1);
+      final CountDownLatch done3 = new CountDownLatch(1);
+      
+      Work work1 = new ShortRunningWork();
+      Work work2 = new LongRunningWork(start2, done2);
+      Work work3 = new LongRunningWork(start3, done3);
+      
+      MyWorkAdapter wa = new MyWorkAdapter();
+      CallbackCount callbackCount = new CallbackCount();
+      wa.setCallbackCount(callbackCount);
+
+      workManager.doWork(work1, WorkManager.INDEFINITE, null, wa);
+      workManager.startWork(work2, WorkManager.INDEFINITE, null, wa);
+      workManager.scheduleWork(work3, WorkManager.INDEFINITE, null, wa);
+      
+      assertEquals("should be same", 3, callbackCount.getAcceptCount());
+      assertEquals("should be same", 1, callbackCount.getCompletedCount());
+
+      start2.countDown();
+      start3.countDown();
+      
+      done2.await();
+      done3.await();
+   }
+   
+   
+   // --------------------------------------------------------------------------------||
+   // 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(WorkListenerTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+      bootstrap.deploy(WorkListenerTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+      
+      // Deploy Beans
+      bootstrap.deploy(WorkListenerTestCase.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(WorkListenerTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+      bootstrap.undeploy(WorkListenerTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+
+      // Undeploy Beans
+      bootstrap.undeploy(WorkListenerTestCase.class);
+
+      // Shutdown MC
+      bootstrap.shutdown();
+
+      // Set Bootstrap to null
+      bootstrap = null;
+   }
+}


Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkListenerTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Reversion Date

Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkTestCase.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkTestCase.java	2009-04-07 08:38:48 UTC (rev 86901)
@@ -0,0 +1,138 @@
+/*
+ * 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.LongRunningWork;
+import org.jboss.jca.test.core.spec.chapter10.common.ShortRunningWork;
+
+import java.util.concurrent.CountDownLatch;
+
+import javax.resource.spi.work.Work;
+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.*;
+
+/**
+ * WorkTestCase.
+ * 
+ * Tests for the JCA specific API about Work
+ * 
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class WorkTestCase
+{
+   /*
+    * Bootstrap (MC Facade)
+    */
+   private static EmbeddedTestMcBootstrap bootstrap;
+   
+   /**
+    * testRun
+    * The WorkManager dispatches a thread that calls the run method to
+    *             begin execution of a Work instance.
+    * @throws Throwable throwable exception 
+    */
+   @Test
+   public void testRun() throws Throwable
+   {
+      WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+      ShortRunningWork work = new ShortRunningWork();
+      
+      assertFalse(work.hasCallRun());
+      workManager.doWork(work);
+      assertTrue(work.hasCallRun());
+   }
+   
+   /**
+    * testRelease
+    * The WorkManager may call the release method to request the active Work 
+    *            instance to complete execution as soon as possible. 
+    * @throws Throwable throwable exception 
+    */
+   @Test
+   public void testRelease() throws Throwable
+   {
+      WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+      
+      ShortRunningWork shortWork = new ShortRunningWork();
+      workManager.startWork(shortWork);
+      assertFalse(shortWork.getWasReleased());
+      
+      final CountDownLatch start = new CountDownLatch(1);
+      final CountDownLatch done = new CountDownLatch(1);
+      
+      LongRunningWork longWork = new LongRunningWork(start, done);
+      workManager.startWork(longWork);
+      //TODO we should impl call release()
+      //assertTrue(longWork.getWasReleased();
+
+   }
+   
+   // --------------------------------------------------------------------------------||
+   // 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(WorkTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+      bootstrap.deploy(WorkTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+      
+      // Deploy Beans
+      bootstrap.deploy(WorkTestCase.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(WorkTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+      bootstrap.undeploy(WorkTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+
+      // Undeploy Beans
+      bootstrap.undeploy(WorkTestCase.class);
+
+      // Shutdown MC
+      bootstrap.shutdown();
+
+      // Set Bootstrap to null
+      bootstrap = null;
+   }
+}


Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/api/WorkTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Reversion Date

Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section3/WorkInterfaceTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section3/WorkInterfaceTestCase.java	2009-04-07 08:36:05 UTC (rev 86900)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section3/WorkInterfaceTestCase.java	2009-04-07 08:38:48 UTC (rev 86901)
@@ -116,7 +116,11 @@
       ShortRunningWork shortWork = new ShortRunningWork();
       workManager.startWork(shortWork);
       assertFalse(shortWork.getWasReleased());
-      ShortRunningWork longWork = new ShortRunningWork();
+      
+      final CountDownLatch start = new CountDownLatch(1);
+      final CountDownLatch done = new CountDownLatch(1);
+      
+      LongRunningWork longWork = new LongRunningWork(start, done);
       workManager.startWork(longWork);
       //TODO we should impl call release()
       //assertTrue(longWork.getWasReleased();

Added: projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkAdapterTestCase-jboss-beans.xml
===================================================================
--- projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkAdapterTestCase-jboss-beans.xml	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkAdapterTestCase-jboss-beans.xml	2009-04-07 08:38:48 UTC (rev 86901)
@@ -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>


Property changes on: projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkAdapterTestCase-jboss-beans.xml
___________________________________________________________________
Name: svn:keywords
   + Id Reversion Date

Added: projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkListenerTestCase-jboss-beans.xml
===================================================================
--- projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkListenerTestCase-jboss-beans.xml	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkListenerTestCase-jboss-beans.xml	2009-04-07 08:38:48 UTC (rev 86901)
@@ -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>


Property changes on: projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkListenerTestCase-jboss-beans.xml
___________________________________________________________________
Name: svn:keywords
   + Id Reversion Date

Added: projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkTestCase-jboss-beans.xml
===================================================================
--- projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkTestCase-jboss-beans.xml	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkTestCase-jboss-beans.xml	2009-04-07 08:38:48 UTC (rev 86901)
@@ -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>


Property changes on: projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/api/WorkTestCase-jboss-beans.xml
___________________________________________________________________
Name: svn:keywords
   + Id Reversion Date




More information about the jboss-cvs-commits mailing list