[jboss-cvs] JBossAS SVN: r84916 - in projects/jboss-jca/trunk/core/src/test: java/org/jboss/jca/test/core/spec/chapter10/section3 and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Mar 2 03:15:19 EST 2009
Author: jeff.zhang
Date: 2009-03-02 03:15:18 -0500 (Mon, 02 Mar 2009)
New Revision: 84916
Added:
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/SimpleBootstrapContext.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/SimpleResourceAdapter.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/SimpleWork.java
projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/section3/
projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/section3/WorkInterfaceTestCase-jboss-beans.xml
projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/section3/WorkManagerInterfaceTestCase-jboss-beans.xml
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/WorkManagerInterfaceTestCase.java
Log:
[JBJCA-33] some tests
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/SimpleBootstrapContext.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/SimpleBootstrapContext.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/SimpleBootstrapContext.java 2009-03-02 08:15:18 UTC (rev 84916)
@@ -0,0 +1,80 @@
+/*
+ * 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;
+
+import java.util.Timer;
+
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.UnavailableException;
+import javax.resource.spi.XATerminator;
+import javax.resource.spi.work.WorkContext;
+import javax.resource.spi.work.WorkManager;
+
+import javax.transaction.TransactionSynchronizationRegistry;
+/**
+ * SimpleBootstrapContext.
+
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class SimpleBootstrapContext implements BootstrapContext
+{
+ private WorkManager workManager;
+ private XATerminator xATerminator;
+
+ public Timer createTimer() throws UnavailableException
+ {
+ return null;
+ }
+
+ public TransactionSynchronizationRegistry getTransactionSynchronizationRegistry()
+ {
+ return null;
+ }
+
+ public WorkManager getWorkManager()
+ {
+ return workManager;
+ }
+
+ public void setWorkManager(WorkManager workManager)
+ {
+ this.workManager = workManager;
+ }
+
+ public XATerminator getXATerminator()
+ {
+ return xATerminator;
+ }
+
+ public void setXATerminator(XATerminator terminator)
+ {
+ xATerminator = terminator;
+ }
+
+ public boolean isContextSupported(
+ Class<? extends WorkContext> inflowContextClass)
+ {
+ return false;
+ }
+
+}
Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/SimpleBootstrapContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Reversion Date
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/SimpleResourceAdapter.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/SimpleResourceAdapter.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/SimpleResourceAdapter.java 2009-03-02 08:15:18 UTC (rev 84916)
@@ -0,0 +1,75 @@
+/*
+ * 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;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ActivationSpec;
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterInternalException;
+import javax.resource.spi.endpoint.MessageEndpointFactory;
+import javax.transaction.xa.XAResource;
+
+/**
+ * SimpleBootstrapContext.
+
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class SimpleResourceAdapter implements ResourceAdapter
+{
+
+ public void endpointActivation(MessageEndpointFactory endpointFactory,
+ ActivationSpec spec) throws ResourceException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void endpointDeactivation(MessageEndpointFactory endpointFactory,
+ ActivationSpec spec)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public XAResource[] getXAResources(ActivationSpec[] specs)
+ throws ResourceException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void start(BootstrapContext ctx)
+ throws ResourceAdapterInternalException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void stop()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/SimpleResourceAdapter.java
___________________________________________________________________
Name: svn:keywords
+ Id Reversion Date
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/SimpleWork.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/SimpleWork.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/SimpleWork.java 2009-03-02 08:15:18 UTC (rev 84916)
@@ -0,0 +1,157 @@
+/*
+ * 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;
+
+import javax.resource.spi.work.Work;
+import javax.resource.spi.work.WorkException;
+import javax.resource.spi.work.WorkManager;
+
+public class SimpleWork implements Work
+{
+ public static int BLOCK_TIME = 100;
+ public static int Follow_TIME = 50;
+
+ private static StringBuffer buf = new StringBuffer();
+ private static WorkManager workManager = null;
+
+ private boolean callRun = false;
+ private boolean callRelease = false;
+ private boolean throwWorkAException = false;
+ private boolean blockRun = false;
+ private String name = "";
+ private boolean nestDoWork = false;
+ private boolean nestStartWork = false;
+
+
+ public SimpleWork()
+ {
+ }
+
+ public SimpleWork(String name)
+ {
+ this.name = name;
+ }
+
+ public void release()
+ {
+ synchronized(this)
+ {
+ callRelease = true;
+ }
+ }
+
+ public void run()
+ {
+
+ if (throwWorkAException)
+ throw new WorkAException();
+
+ if (nestDoWork)
+ {
+ SimpleWork workB = new SimpleWork("B");
+ workB.setBlockRun(true);
+ try
+ {
+ workManager.doWork(workB);
+ } catch (WorkException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ if (nestStartWork)
+ {
+ SimpleWork workB = new SimpleWork("B");
+ workB.setBlockRun(true);
+ try
+ {
+ workManager.startWork(workB);
+ } catch (WorkException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ if (blockRun)
+ {
+ try
+ {
+ Thread.currentThread().sleep(BLOCK_TIME);
+ } catch (InterruptedException e)
+ {
+ }
+ }
+ synchronized(this)
+ {
+ callRun = true;
+ }
+
+ buf.append(name);
+ }
+
+ public static void setWorkManager(WorkManager workManager)
+ {
+ SimpleWork.workManager = workManager;
+ }
+
+ public boolean isCallRun()
+ {
+ return callRun;
+ }
+
+ public void setThrowWorkAException(boolean throwWorkAException)
+ {
+ this.throwWorkAException = throwWorkAException;
+ }
+
+ public boolean isCallRelease()
+ {
+ return callRelease;
+ }
+
+ public void setBlockRun(boolean blockRun)
+ {
+ this.blockRun = blockRun;
+ }
+
+ public void setNestDoWork(boolean nestDoWork)
+ {
+ this.nestDoWork = nestDoWork;
+ }
+
+ public void setNestStartWork(boolean nestStartWork)
+ {
+ this.nestStartWork = nestStartWork;
+ }
+
+ public String getStringBuffer()
+ {
+ return buf.toString();
+ }
+ public void resetStringBuffer()
+ {
+ buf = new StringBuffer();
+ }
+
+ public class WorkAException extends RuntimeException
+ {
+ private static final long serialVersionUID = 1L;
+ }
+}
Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/SimpleWork.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-03-02 07:52:09 UTC (rev 84915)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section3/WorkInterfaceTestCase.java 2009-03-02 08:15:18 UTC (rev 84916)
@@ -21,6 +21,18 @@
*/
package org.jboss.jca.test.core.spec.chapter10.section3;
+import java.lang.reflect.Modifier;
+
+import javax.resource.spi.work.Work;
+import javax.resource.spi.work.WorkCompletedException;
+import javax.resource.spi.work.WorkException;
+import javax.resource.spi.work.WorkManager;
+import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
+
+import org.jboss.jca.common.api.ThreadPool;
+import org.jboss.jca.common.threadpool.ThreadPoolImpl;
+import org.jboss.jca.test.core.spec.chapter10.SimpleWork;
+
import org.junit.AfterClass;
import static org.junit.Assert.* ;
import org.junit.BeforeClass;
@@ -37,7 +49,10 @@
*/
public class WorkInterfaceTestCase
{
-
+ /*
+ * Bootstrap (MC Facade)
+ */
+ private static EmbeddedTestMcBootstrap bootstrap;
/**
* Test for paragraph 2
@@ -47,7 +62,12 @@
@Test
public void testCallRunMethod() throws Throwable
{
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+ SimpleWork work = new SimpleWork();
+ assertFalse(work.isCallRun());
+ workManager.doWork(work);
+ assertTrue(work.isCallRun());
}
/**
@@ -57,9 +77,24 @@
* WorkCompletedException set to an appropriate error code,
* which indicates the nature of the error condition.
*/
- @Ignore
+ @Test
public void testCatchAllExceptionAroundRun() throws Throwable
{
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+
+ SimpleWork work = new SimpleWork();
+ work.setThrowWorkAException(true);
+
+ try
+ {
+ workManager.doWork(work);
+ fail("should throw WorkAException");
+ } catch(WorkException e)
+ {
+ assertNotNull(e);
+ assertTrue(e instanceof WorkCompletedException);
+ assertTrue(e.getMessage().indexOf("WorkAException") > 0);
+ }
}
/**
@@ -70,6 +105,19 @@
@Ignore
public void testReleaseMethod() throws Throwable
{
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+ ThreadPool tp = bootstrap.lookup("WorkManagerThreadPool", ThreadPoolImpl.class);
+
+ SimpleWork work = new SimpleWork();
+ work.setBlockRun(true);
+ assertFalse(work.isCallRelease());
+
+ workManager.startWork(work, WorkManager.IMMEDIATE, null, null);
+ tp.stop(false);
+ Thread.currentThread().sleep(3000);
+ //assertTrue(work.isCallRelease());
+ //TODO test fail here
+
}
/**
@@ -95,10 +143,53 @@
/**
* Test for paragraph 5
* Both the run and release methods in the Work implementation may contain synchronization
- * blocks but they must not be declared as synchronized methods.
+ * synchronization but they must not be declared as synchronized methods.
*/
- @Ignore
+ @Test
public void testCannotDeclaredSynchronized() throws Throwable
{
+ //In SimpleWork class, both in run() and release(), there are synchronization synchronization
+ assertFalse(Modifier.isSynchronized(SimpleWork.class.getMethod("run", null).getModifiers()));
+ assertFalse(Modifier.isSynchronized(SimpleWork.class.getMethod("release", null).getModifiers()));
}
+
+ // --------------------------------------------------------------------------------||
+ // 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(WorkInterfaceTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+ bootstrap.deploy(WorkInterfaceTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+
+ // Deploy Beans
+ bootstrap.deploy(WorkInterfaceTestCase.class);
+ }
+
+ /**
+ * Lifecycle stop, after the suite is executed
+ */
+ @AfterClass
+ public static void afterClass() throws Throwable
+ {
+ // Undeploy Transaction and Naming
+ bootstrap.undeploy(WorkInterfaceTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+ bootstrap.undeploy(WorkInterfaceTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+
+ // Undeploy Beans
+ bootstrap.undeploy(WorkInterfaceTestCase.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-03-02 07:52:09 UTC (rev 84915)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/spec/chapter10/section3/WorkManagerInterfaceTestCase.java 2009-03-02 08:15:18 UTC (rev 84916)
@@ -21,8 +21,17 @@
*/
package org.jboss.jca.test.core.spec.chapter10.section3;
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.work.Work;
+import javax.resource.spi.work.WorkManager;
+
+import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
+import org.jboss.jca.test.core.spec.chapter10.SimpleBootstrapContext;
+import org.jboss.jca.test.core.spec.chapter10.SimpleWork;
+
import org.junit.AfterClass;
import static org.junit.Assert.* ;
+
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
@@ -37,25 +46,40 @@
*/
public class WorkManagerInterfaceTestCase
{
-
+ /*
+ * Bootstrap (MC Facade)
+ */
+ private static EmbeddedTestMcBootstrap bootstrap;
+
/**
* Test for paragraph 1
* WorkManager instance can be obtained by calling the getWorkManager method of the BootstrapContext instance.
*/
- @Ignore
+ @Test
public void testGetWorkManagerFromBootstrapConext() throws Throwable
{
+ BootstrapContext bootstrapContext = bootstrap.lookup("SimpleBootstrapContext", SimpleBootstrapContext.class);
+ assertTrue(bootstrapContext instanceof SimpleBootstrapContext);
+
+ assertNotNull(bootstrapContext.getWorkManager());
}
/**
* Test for paragraph 3
* doWork method: This call blocks until the Work instance completes execution.
*/
- @Ignore
+ @Test
public void testDoWorkMethod() throws Throwable
{
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+ SimpleWork work = new SimpleWork();
+ work.setBlockRun(true);
+
+ assertFalse(work.isCallRun());
+ workManager.doWork(work);
+ assertTrue(work.isCallRun());
}
/**
@@ -63,9 +87,20 @@
* doWork method: this provides a first in, first out (FIFO) execution start
* ordering and last in, first out (LIFO) execution completion ordering guarantee.
*/
- @Ignore
+ @Test
public void testFifoStartLifoFinish() throws Throwable
{
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+ SimpleWork workA = new SimpleWork("A");
+ workA.setWorkManager(workManager);
+
+ assertFalse(workA.isCallRun());
+ workA.setNestDoWork(true);
+ workA.resetStringBuffer();
+ workManager.doWork(workA);
+ assertTrue(workA.isCallRun());
+ assertEquals(workA.getStringBuffer(), "BA");
+ workA = null;
}
/**
@@ -73,9 +108,19 @@
* startWork method: This call blocks until the Work instance starts execution but
* not until its completion.
*/
- @Ignore
+ @Test
public void testStartWorkMethod() throws Throwable
{
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+ SimpleWork work = new SimpleWork();
+ work.setBlockRun(true);
+
+ assertFalse(work.isCallRun());
+ workManager.startWork(work);
+ assertFalse(work.isCallRun());
+ Thread.currentThread().sleep(SimpleWork.BLOCK_TIME + SimpleWork.Follow_TIME);
+ assertTrue(work.isCallRun());
+ work = null;
}
/**
@@ -85,6 +130,7 @@
@Ignore
public void testReturnTimeBeforeStart() throws Throwable
{
+ //TODO test against BasicThreadPool.java?
}
/**
@@ -94,6 +140,7 @@
@Ignore
public void testUnknownReturnedIfDonotKnowDelay() throws Throwable
{
+ //TODO test against BasicThreadPool.java?
}
/**
@@ -101,9 +148,21 @@
* startWork method: this provides a FIFO execution start ordering guarantee,
* but no execution completion ordering guarantee.
*/
- @Ignore
+ @Test
public void testFifoStart() throws Throwable
{
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+ SimpleWork workA = new SimpleWork("A");
+ workA.setWorkManager(workManager);
+
+ assertFalse(workA.isCallRun());
+ workA.setNestStartWork(true);
+ workA.resetStringBuffer();
+ workManager.startWork(workA);
+
+ Thread.currentThread().sleep(SimpleWork.BLOCK_TIME + SimpleWork.Follow_TIME);
+ assertEquals(workA.getStringBuffer(), "AB");
+ workA = null;
}
/**
@@ -111,9 +170,19 @@
* scheduleWork method: This call does not block and returns immediately once a
* Work instance has been accepted for processing.
*/
- @Ignore
+ @Test
public void testScheduleWorkMethod() throws Throwable
{
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+ SimpleWork work = new SimpleWork();
+ work.setBlockRun(true);
+
+ assertFalse(work.isCallRun());
+ workManager.scheduleWork(work);
+ assertFalse(work.isCallRun());
+ Thread.currentThread().sleep(SimpleWork.BLOCK_TIME + SimpleWork.Follow_TIME);
+ assertTrue(work.isCallRun());
+ work = null;
}
/**
@@ -142,9 +211,18 @@
* Test for bullet 2 Section 3.3.6
* The application server must allow nested Work submissions.
*/
- @Ignore
+ @Test
public void testAllowNestedWork() throws Throwable
{
+ WorkManager workManager = bootstrap.lookup("WorkManager", WorkManager.class);
+ SimpleWork workA = new SimpleWork("A");
+ workA.setWorkManager(workManager);
+
+ assertFalse(workA.isCallRun());
+ workA.setNestDoWork(true);
+ workManager.doWork(workA);
+ assertTrue(workA.isCallRun());
+ workA = null;
}
/**
@@ -157,5 +235,45 @@
public void testThrowWorkCompletedException() throws Throwable
{
}
+
+ // --------------------------------------------------------------------------------||
+ // 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(WorkManagerInterfaceTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+ bootstrap.deploy(WorkManagerInterfaceTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+
+ // Deploy Beans
+ bootstrap.deploy(WorkManagerInterfaceTestCase.class);
+ }
+
+ /**
+ * Lifecycle stop, after the suite is executed
+ */
+ @AfterClass
+ public static void afterClass() throws Throwable
+ {
+ // Undeploy Transaction and Naming
+ bootstrap.undeploy(WorkManagerInterfaceTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+ bootstrap.undeploy(WorkManagerInterfaceTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+
+ // Undeploy Beans
+ bootstrap.undeploy(WorkManagerInterfaceTestCase.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/section3/WorkInterfaceTestCase-jboss-beans.xml
===================================================================
--- projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/section3/WorkInterfaceTestCase-jboss-beans.xml (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/section3/WorkInterfaceTestCase-jboss-beans.xml 2009-03-02 08:15:18 UTC (rev 84916)
@@ -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>
Property changes on: projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/section3/WorkInterfaceTestCase-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/section3/WorkManagerInterfaceTestCase-jboss-beans.xml
===================================================================
--- projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/section3/WorkManagerInterfaceTestCase-jboss-beans.xml (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/resources/org/jboss/jca/test/core/spec/chapter10/section3/WorkManagerInterfaceTestCase-jboss-beans.xml 2009-03-02 08:15:18 UTC (rev 84916)
@@ -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.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>
+
+ <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/section3/WorkManagerInterfaceTestCase-jboss-beans.xml
___________________________________________________________________
Name: svn:keywords
+ Id Reversion Date
More information about the jboss-cvs-commits
mailing list