[jboss-cvs] JBossAS SVN: r84704 - in projects/jboss-jca/trunk/core/src/test: java/org/jboss/jca/test/core/spec and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Feb 25 01:21:16 EST 2009


Author: jeff.zhang
Date: 2009-02-25 01:21:15 -0500 (Wed, 25 Feb 2009)
New Revision: 84704

Added:
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section1/
   projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section1/ManageThreadTestCase.java
   projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/
   projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/
   projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/section1/
   projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/section1/ManageThreadTestCase-jboss-beans.xml
Log:
[JBJCA-33] first testWorkManagerHasThreadPool

Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section1/ManageThreadTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section1/ManageThreadTestCase.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section1/ManageThreadTestCase.java	2009-02-25 06:21:15 UTC (rev 84704)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.section1;
+
+import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
+import org.jboss.jca.common.api.ThreadPool;
+
+import org.junit.AfterClass;
+import static org.junit.Assert.* ;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * ManageThreadTestCase.
+ * 
+ * Tests for the JCA specific Chapter 10 Section 1
+ * 
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class ManageThreadTestCase
+{
+   /*
+    * Bootstrap (MC Facade)
+    */
+   private static EmbeddedTestMcBootstrap bootstrap;
+   
+   /**
+    * Test for paragraph 4 : bullet 1
+    */
+   @Test
+   public void testWorkManagerHasThreadPool() throws Throwable
+   {
+      org.jboss.jca.core.api.WorkManager workManager = 
+         bootstrap.lookup("WorkManager", org.jboss.jca.core.api.WorkManager.class);
+      ThreadPool threadPool = workManager.getThreadPool();
+      assertNotNull(threadPool);
+   }
+   
+   // --------------------------------------------------------------------------------||
+   // Lifecycle Methods --------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Lifecycle start, before the suite is executed
+    */
+   @BeforeClass
+   public static void beforeClass() throws Throwable
+   {
+      // Create and set a new MC Bootstrap
+      bootstrap = EmbeddedTestMcBootstrap.createEmbeddedMcBootstrap();
+
+      // Deploy Naming and Transaction
+      bootstrap.deploy(ManageThreadTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+      bootstrap.deploy(ManageThreadTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+      
+      // Deploy Beans
+      bootstrap.deploy(ManageThreadTestCase.class);
+   }
+
+   /**
+    * Lifecycle stop, after the suite is executed
+    */
+   @AfterClass
+   public static void afterClass() throws Throwable
+   {
+      // Undeploy Transaction and Naming
+      bootstrap.undeploy(ManageThreadTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+      bootstrap.undeploy(ManageThreadTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+
+      // Undeploy Beans
+      bootstrap.undeploy(ManageThreadTestCase.class);
+
+      // Shutdown MC
+      bootstrap.shutdown();
+
+      // Set Bootstrap to null
+      bootstrap = null;
+   }
+}

Added: projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/section1/ManageThreadTestCase-jboss-beans.xml
===================================================================
--- projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/section1/ManageThreadTestCase-jboss-beans.xml	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/section1/ManageThreadTestCase-jboss-beans.xml	2009-02-25 06:21:15 UTC (rev 84704)
@@ -0,0 +1,30 @@
+<?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.threadpool.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>
+  
+</deployment>




More information about the jboss-cvs-commits mailing list