djencks 2004/10/28 17:21:28
Modified: modules/core/src/test/org/openejb/deployment
CMPEntityBuilderTest.java
CMPEntityBuilderTestUtil.java
EJBConfigBuilderTest.java
MockConnectionProxyFactory.java
TransactionPolicyHelperTest.java
Added: modules/core/src/test/org/openejb/deployment
BMPSystemMethodIndicesTest.java
CMPSystemMethodIndicesTest.java
DeploymentHelper.java
MessageDrivenSystemMethodIndicesTest.java
MockTransaction.java MockTransactionManager.java
StatelessSystemMethodIndicesTest.java
StatelfulSystemMethodIndicesTest.java
Log:
Move the deployment classes ***ContainerBuilder to deployment. Drag most ofthe
testsuite along with them. Don't you wish we were on svn?
Revision Changes Path
1.4 +3 -4
openejb/modules/core/src/test/org/openejb/deployment/CMPEntityBuilderTest.java
Index: CMPEntityBuilderTest.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/test/org/openejb/deployment/CMPEntityBuilderTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CMPEntityBuilderTest.java 28 Oct 2004 01:56:11 -0000 1.3
+++ CMPEntityBuilderTest.java 28 Oct 2004 21:21:27 -0000 1.4
@@ -56,25 +56,24 @@
import java.util.Map;
import junit.framework.TestCase;
-
+import org.apache.geronimo.deployment.util.DeploymentUtil;
import org.apache.geronimo.j2ee.deployment.EARContext;
import org.apache.geronimo.j2ee.deployment.j2eeobjectnames.J2eeContext;
import org.apache.geronimo.j2ee.deployment.j2eeobjectnames.J2eeContextImpl;
import org.apache.geronimo.kernel.config.ConfigurationModuleType;
import org.apache.geronimo.xbeans.j2ee.EjbJarDocument;
import org.apache.geronimo.xbeans.j2ee.EjbJarType;
-import org.apache.geronimo.deployment.util.DeploymentUtil;
import org.apache.xmlbeans.XmlObject;
import org.openejb.xbeans.ejbjar.OpenejbOpenejbJarDocument;
import org.openejb.xbeans.ejbjar.OpenejbOpenejbJarType;
import org.tranql.cache.GlobalSchema;
import org.tranql.ejb.EJBSchema;
import org.tranql.schema.Association;
+import org.tranql.schema.Association.JoinDefinition;
import org.tranql.schema.AssociationEnd;
import org.tranql.schema.Attribute;
import org.tranql.schema.Entity;
import org.tranql.schema.FKAttribute;
-import org.tranql.schema.Association.JoinDefinition;
import org.tranql.sql.Table;
import org.tranql.sql.sql92.SQL92Schema;
1.3 +2 -3
openejb/modules/core/src/test/org/openejb/deployment/CMPEntityBuilderTestUtil.java
Index: CMPEntityBuilderTestUtil.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/test/org/openejb/deployment/CMPEntityBuilderTestUtil.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CMPEntityBuilderTestUtil.java 28 Oct 2004 01:56:11 -0000 1.2
+++ CMPEntityBuilderTestUtil.java 28 Oct 2004 21:21:27 -0000 1.3
@@ -48,6 +48,7 @@
package org.openejb.deployment;
+import junit.framework.TestCase;
import org.apache.geronimo.deployment.DeploymentException;
import org.apache.geronimo.j2ee.deployment.EARContext;
import org.apache.geronimo.j2ee.deployment.j2eeobjectnames.J2eeContext;
@@ -56,8 +57,6 @@
import org.tranql.cache.GlobalSchema;
import org.tranql.ejb.EJBSchema;
import org.tranql.sql.sql92.SQL92Schema;
-
-import junit.framework.TestCase;
/**
*
1.36 +3 -6
openejb/modules/core/src/test/org/openejb/deployment/EJBConfigBuilderTest.java
Index: EJBConfigBuilderTest.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/test/org/openejb/deployment/EJBConfigBuilderTest.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- EJBConfigBuilderTest.java 28 Oct 2004 01:56:11 -0000 1.35
+++ EJBConfigBuilderTest.java 28 Oct 2004 21:21:27 -0000 1.36
@@ -52,7 +52,6 @@
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.ObjectInputStream;
-import java.net.URI;
import java.net.URL;
import java.net.URLClassLoader;
import java.sql.Connection;
@@ -63,12 +62,12 @@
import java.util.jar.JarFile;
import javax.ejb.EJBHome;
import javax.management.ObjectName;
-import javax.sql.DataSource;
import javax.naming.Reference;
+import javax.sql.DataSource;
import junit.framework.TestCase;
-import org.apache.geronimo.deployment.util.DeploymentUtil;
import org.apache.geronimo.deployment.DeploymentException;
+import org.apache.geronimo.deployment.util.DeploymentUtil;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.jmx.GBeanMBean;
import org.apache.geronimo.j2ee.deployment.EARConfigBuilder;
@@ -82,11 +81,9 @@
import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.config.Configuration;
-import org.apache.geronimo.kernel.config.ConfigurationModuleType;
import org.apache.geronimo.kernel.management.State;
import org.apache.geronimo.system.serverinfo.ServerInfo;
import org.openejb.ContainerIndex;
-import org.openejb.DeploymentHelper;
import org.tranql.sql.jdbc.JDBCUtil;
/**
1.3 +2 -3
openejb/modules/core/src/test/org/openejb/deployment/MockConnectionProxyFactory.java
Index: MockConnectionProxyFactory.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/test/org/openejb/deployment/MockConnectionProxyFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MockConnectionProxyFactory.java 28 Oct 2004 01:56:11 -0000 1.2
+++ MockConnectionProxyFactory.java 28 Oct 2004 21:21:27 -0000 1.3
@@ -49,9 +49,8 @@
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoFactory;
-
-import org.openejb.entity.cmp.ConnectionProxyFactory;
import org.axiondb.jdbc.AxionDataSource;
+import org.openejb.entity.cmp.ConnectionProxyFactory;
/**
*
1.4 +3 -3
openejb/modules/core/src/test/org/openejb/deployment/TransactionPolicyHelperTest.java
Index: TransactionPolicyHelperTest.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/test/org/openejb/deployment/TransactionPolicyHelperTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TransactionPolicyHelperTest.java 10 Apr 2004 06:51:38 -0000 1.3
+++ TransactionPolicyHelperTest.java 28 Oct 2004 21:21:27 -0000 1.4
@@ -51,14 +51,14 @@
import java.util.ArrayList;
import java.util.List;
+import junit.framework.TestCase;
import org.apache.geronimo.xbeans.j2ee.ContainerTransactionType;
import org.apache.geronimo.xbeans.j2ee.MethodParamsType;
import org.apache.geronimo.xbeans.j2ee.MethodType;
-
-import junit.framework.TestCase;
import org.openejb.dispatch.InterfaceMethodSignature;
import org.openejb.transaction.ContainerPolicy;
import org.openejb.transaction.TransactionPolicy;
+import org.openejb.transaction.TransactionPolicySource;
/**
*
1.1
openejb/modules/core/src/test/org/openejb/deployment/BMPSystemMethodIndicesTest.java
Index: BMPSystemMethodIndicesTest.java
===================================================================
/* ====================================================================
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce this list of
* conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the OpenEJB Project. For more information
* please see <http://openejb.org/>.
*
* ====================================================================
*/
package org.openejb.deployment;
import java.util.Map;
import javax.ejb.EntityContext;
import junit.framework.TestCase;
import org.openejb.deployment.entity.MockBMPEJB;
import org.openejb.dispatch.InterfaceMethodSignature;
import org.openejb.dispatch.SystemMethodIndices;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/10/28 21:21:27 $
*
* */
public class BMPSystemMethodIndicesTest extends TestCase {
public void testSystemMethodIndices() throws Exception {
BMPContainerBuilder builder = new BMPContainerBuilder();
builder.setClassLoader(MockBMPEJB.class.getClassLoader());
Map vopMap = builder.buildVopMap(MockBMPEJB.class);
InterfaceMethodSignature[] signatures = (InterfaceMethodSignature[])
vopMap.keySet().toArray(new InterfaceMethodSignature[vopMap.size()]);
SystemMethodIndices systemMethodIndices =
SystemMethodIndices.createSystemMethodIndices(signatures, "setEntityContext", new
String(EntityContext.class.getName()), "unsetEntityContext");
assertFalse(systemMethodIndices.getEjbActivateInvocation(null).getMethodIndex() == -1);
assertFalse(systemMethodIndices.getEjbLoadInvocation(null).getMethodIndex()
== -1);
assertFalse(systemMethodIndices.getEjbPassivateInvocation(null).getMethodIndex() ==
-1);
assertFalse(systemMethodIndices.getEjbStoreInvocation(null).getMethodIndex()
== -1);
assertFalse(systemMethodIndices.getSetContextInvocation(null,
null).getMethodIndex() == -1);
assertFalse(systemMethodIndices.getUnsetContextInvocation(null).getMethodIndex() ==
-1);
}
}
1.1
openejb/modules/core/src/test/org/openejb/deployment/CMPSystemMethodIndicesTest.java
Index: CMPSystemMethodIndicesTest.java
===================================================================
/* ====================================================================
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce this list of
* conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the OpenEJB Project. For more information
* please see <http://openejb.org/>.
*
* ====================================================================
*/
package org.openejb.deployment;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.ejb.EntityContext;
import junit.framework.TestCase;
import org.openejb.deployment.entity.MockCMPEJB;
import org.openejb.dispatch.InterfaceMethodSignature;
import org.openejb.dispatch.SystemMethodIndices;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/10/28 21:21:27 $
*
* */
public class CMPSystemMethodIndicesTest extends TestCase {
public void testSystemMethodIndices() throws Exception {
CMPContainerBuilder builder = new CMPContainerBuilder();
builder.setClassLoader(MockCMPEJB.class.getClassLoader());
Map vopMap = builder.buildVopMap(MockCMPEJB.class, null, null, null, null,
null, null, null, new LinkedHashMap());
InterfaceMethodSignature[] signatures = (InterfaceMethodSignature[])
vopMap.keySet().toArray(new InterfaceMethodSignature[vopMap.size()]);
SystemMethodIndices systemMethodIndices =
SystemMethodIndices.createSystemMethodIndices(signatures, "setEntityContext", new
String(EntityContext.class.getName()), "unsetEntityContext");
assertFalse(systemMethodIndices.getEjbActivateInvocation(null).getMethodIndex() == -1);
assertFalse(systemMethodIndices.getEjbLoadInvocation(null).getMethodIndex()
== -1);
assertFalse(systemMethodIndices.getEjbPassivateInvocation(null).getMethodIndex() ==
-1);
assertFalse(systemMethodIndices.getEjbStoreInvocation(null).getMethodIndex()
== -1);
assertFalse(systemMethodIndices.getSetContextInvocation(null,
null).getMethodIndex() == -1);
assertFalse(systemMethodIndices.getUnsetContextInvocation(null).getMethodIndex() ==
-1);
}
}
1.1
openejb/modules/core/src/test/org/openejb/deployment/DeploymentHelper.java
Index: DeploymentHelper.java
===================================================================
/* ====================================================================
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce this list of
* conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the OpenEJB Project. For more information
* please see <http://openejb.org/>.
*
* ====================================================================
*/
package org.openejb.deployment;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.management.ObjectName;
import org.apache.geronimo.connector.ActivationSpecInfo;
import org.apache.geronimo.connector.ActivationSpecWrapper;
import org.apache.geronimo.connector.ResourceAdapterWrapper;
import
org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator;
import org.apache.geronimo.connector.work.GeronimoWorkManager;
import org.apache.geronimo.gbean.jmx.GBeanMBean;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.jmx.JMXUtil;
import org.apache.geronimo.pool.ThreadPool;
import org.apache.geronimo.timer.vm.VMStoreThreadPooledNonTransactionalTimer;
import org.apache.geronimo.timer.vm.VMStoreThreadPooledTransactionalTimer;
import org.apache.geronimo.transaction.GeronimoTransactionManager;
import org.apache.geronimo.transaction.context.TransactionContextManager;
import org.openejb.deployment.mdb.mockra.MockActivationSpec;
import org.openejb.deployment.mdb.mockra.MockResourceAdapter;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/10/28 21:21:27 $
*
* */
public class DeploymentHelper {
private static final String j2eeDomainName = "openejb.server";
private static final String j2eeServerName = "TestOpenEJBServer";
public static final ObjectName CONTAINER_NAME =
JMXUtil.getObjectName("geronimo.test:ejb=Mock");
public static final ObjectName TRANSACTIONMANAGER_NAME =
JMXUtil.getObjectName(j2eeDomainName + ":type=TransactionManager");
public static final ObjectName TRANSACTIONCONTEXTMANAGER_NAME =
JMXUtil.getObjectName(j2eeDomainName + ":type=TransactionContextManager");
public static final ObjectName TRACKEDCONNECTIONASSOCIATOR_NAME =
JMXUtil.getObjectName("geronimo.test:role=TrackedConnectionAssociator");
public static final ObjectName WORKMANAGER_NAME =
JMXUtil.getObjectName("geronimo.server:type=WorkManager,name=DefaultWorkManager");
public static final ObjectName RESOURCE_ADAPTER_NAME =
JMXUtil.getObjectName("openejb.server:j2eeType=JCAResourceAdapter,J2EEServer=TestOpenEJBServer,J2EEApplication=null,ResourceAdapterModule=something,name=MockRA");
public static final ObjectName ACTIVATIONSPEC_NAME =
JMXUtil.getObjectName("geronimo.server:j2eeType=ActivationSpec,name=MockMDB");
public static final ObjectName THREADPOOL_NAME =
JMXUtil.getObjectName(j2eeServerName + ":type=ThreadPool,name=DefaultThreadPool");
public static final ObjectName TRANSACTIONALTIMER_NAME =
JMXUtil.getObjectName(j2eeServerName +
":type=ThreadPooledTimer,name=TransactionalThreaPooledTimer");
public static final ObjectName NONTRANSACTIONALTIMER_NAME =
JMXUtil.getObjectName(j2eeServerName +
":type=ThreadPooledTimer,name=NonTransactionalThreaPooledTimer");
public static final ActivationSpecInfo ACTIVATION_SPEC_INFO = new
ActivationSpecInfo(MockActivationSpec.class.getName(),
ActivationSpecWrapper.getGBeanInfo());
public static Kernel setUpKernelWithTransactionManager(String kernelName) throws
Exception {
Kernel kernel = new Kernel(kernelName);
kernel.boot();
GBeanMBean tmGBean = new GBeanMBean(GeronimoTransactionManager.GBEAN_INFO);
Set rmpatterns = new HashSet();
rmpatterns.add(ObjectName.getInstance("geronimo.server:j2eeType=JCAManagedConnectionFactory,*"));
tmGBean.setAttribute("defaultTransactionTimeoutSeconds", new Integer(10));
tmGBean.setReferencePatterns("ResourceManagers", rmpatterns);
start(kernel, TRANSACTIONMANAGER_NAME, tmGBean);
GBeanMBean tcmGBean = new GBeanMBean(TransactionContextManager.GBEAN_INFO);
tcmGBean.setReferencePattern("TransactionManager", TRANSACTIONMANAGER_NAME);
tcmGBean.setReferencePattern("XidImporter", TRANSACTIONMANAGER_NAME);
tcmGBean.setReferencePattern("Recovery", TRANSACTIONMANAGER_NAME);
start(kernel, TRANSACTIONCONTEXTMANAGER_NAME, tcmGBean);
GBeanMBean trackedConnectionAssociator = new
GBeanMBean(ConnectionTrackingCoordinator.GBEAN_INFO);
DeploymentHelper.start(kernel, TRACKEDCONNECTIONASSOCIATOR_NAME,
trackedConnectionAssociator);
return kernel;
}
public static void setUpTimer(Kernel kernel) throws Exception {
GBeanMBean threadPoolGBean = new GBeanMBean(ThreadPool.GBEAN_INFO);
threadPoolGBean.setAttribute("keepAliveTime", new Integer(5000));
threadPoolGBean.setAttribute("poolSize", new Integer(5));
threadPoolGBean.setAttribute("poolName", "DefaultThreadPool");
start(kernel, THREADPOOL_NAME, threadPoolGBean);
GBeanMBean transactionalTimerGBean = new
GBeanMBean(VMStoreThreadPooledTransactionalTimer.GBEAN_INFO);
transactionalTimerGBean.setAttribute("repeatCount", new Integer(5));
transactionalTimerGBean.setReferencePattern("TransactionContextManager",
TRANSACTIONCONTEXTMANAGER_NAME);
transactionalTimerGBean.setReferencePattern("ThreadPool", THREADPOOL_NAME);
start(kernel, TRANSACTIONALTIMER_NAME, transactionalTimerGBean);
GBeanMBean nonTransactionalTimerGBean = new
GBeanMBean(VMStoreThreadPooledNonTransactionalTimer.GBEAN_INFO);
nonTransactionalTimerGBean.setReferencePattern("ThreadPool",
THREADPOOL_NAME);
start(kernel, NONTRANSACTIONALTIMER_NAME, nonTransactionalTimerGBean);
}
public static void setUpResourceAdapter(Kernel kernel) throws Exception {
GBeanMBean geronimoWorkManagerGBean = new
GBeanMBean(GeronimoWorkManager.getGBeanInfo());
geronimoWorkManagerGBean.setAttribute("syncMaximumPoolSize", new Integer(5));
geronimoWorkManagerGBean.setAttribute("startMaximumPoolSize", new
Integer(5));
geronimoWorkManagerGBean.setAttribute("scheduledMaximumPoolSize", new
Integer(5));
geronimoWorkManagerGBean.setReferencePattern("TransactionContextManager",
TRANSACTIONCONTEXTMANAGER_NAME);
start(kernel, WORKMANAGER_NAME, geronimoWorkManagerGBean);
GBeanMBean resourceAdapterGBean = new
GBeanMBean(ResourceAdapterWrapper.getGBeanInfo());
Map activationSpecInfoMap = new HashMap();
activationSpecInfoMap.put(javax.jms.MessageListener.class.getName(),
ACTIVATION_SPEC_INFO);
resourceAdapterGBean.setAttribute("resourceAdapterClass",
MockResourceAdapter.class);
resourceAdapterGBean.setAttribute("activationSpecInfoMap",
activationSpecInfoMap);
resourceAdapterGBean.setReferencePattern("WorkManager", WORKMANAGER_NAME);
start(kernel, RESOURCE_ADAPTER_NAME, resourceAdapterGBean);
GBeanMBean activationSpecGBean = new
GBeanMBean(ActivationSpecWrapper.getGBeanInfo());
activationSpecGBean.setAttribute("activationSpecClass",
MockActivationSpec.class);
activationSpecGBean.setAttribute("containerId",
CONTAINER_NAME.getCanonicalName());
activationSpecGBean.setReferencePattern("ResourceAdapterWrapper",
RESOURCE_ADAPTER_NAME);
start(kernel, ACTIVATIONSPEC_NAME, activationSpecGBean);
}
public static void start(Kernel kernel, ObjectName name, GBeanMBean instance)
throws Exception {
kernel.loadGBean(name, instance);
kernel.startGBean(name);
}
public static void tearDownAdapter(Kernel kernel) throws Exception {
stop(kernel, ACTIVATIONSPEC_NAME);
stop(kernel, RESOURCE_ADAPTER_NAME);
stop(kernel, WORKMANAGER_NAME);
}
public static void stop(Kernel kernel, ObjectName name) throws Exception {
kernel.stopGBean(name);
kernel.unloadGBean(name);
}
}
1.1
openejb/modules/core/src/test/org/openejb/deployment/MessageDrivenSystemMethodIndicesTest.java
Index: MessageDrivenSystemMethodIndicesTest.java
===================================================================
/* ====================================================================
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce this list of
* conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the OpenEJB Project. For more information
* please see <http://openejb.org/>.
*
* ====================================================================
*/
package org.openejb.deployment;
import java.util.Map;
import javax.ejb.MessageDrivenContext;
import junit.framework.TestCase;
import org.openejb.deployment.mdb.MockEJB;
import org.openejb.dispatch.InterfaceMethodSignature;
import org.openejb.dispatch.SystemMethodIndices;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/10/28 21:21:27 $
*
* */
public class MessageDrivenSystemMethodIndicesTest extends TestCase {
public void testSystemMethodIndices() throws Exception {
MDBContainerBuilder builder = new MDBContainerBuilder();
builder.setClassLoader(MockEJB.class.getClassLoader());
Map vopMap = builder.buildVopMap(MockEJB.class);
InterfaceMethodSignature[] signatures = (InterfaceMethodSignature[])
vopMap.keySet().toArray(new InterfaceMethodSignature[vopMap.size()]);
SystemMethodIndices systemMethodIndices =
SystemMethodIndices.createSystemMethodIndices(signatures, "setMessageDrivenContext",
new String(MessageDrivenContext.class.getName()), null);
assertTrue(systemMethodIndices.getEjbActivateInvocation(null).getMethodIndex() == -1);
assertTrue(systemMethodIndices.getEjbLoadInvocation(null).getMethodIndex()
== -1);
assertTrue(systemMethodIndices.getEjbPassivateInvocation(null).getMethodIndex() == -1);
assertTrue(systemMethodIndices.getEjbStoreInvocation(null).getMethodIndex()
== -1);
assertFalse(systemMethodIndices.getSetContextInvocation(null,
null).getMethodIndex() == -1);
assertTrue(systemMethodIndices.getUnsetContextInvocation(null).getMethodIndex() == -1);
}
}
1.1
openejb/modules/core/src/test/org/openejb/deployment/MockTransaction.java
Index: MockTransaction.java
===================================================================
/* ====================================================================
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce this list of
* conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the OpenEJB Project. For more information
* please see <http://openejb.org/>.
*
* ====================================================================
*/
package org.openejb.deployment;
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
import javax.transaction.RollbackException;
import javax.transaction.Status;
import javax.transaction.Synchronization;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
import javax.transaction.xa.XAResource;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/10/28 21:21:27 $
*/
public class MockTransaction implements Transaction {
public void commit() throws HeuristicMixedException, HeuristicRollbackException,
RollbackException, SecurityException, SystemException {
}
public boolean delistResource(XAResource xaResource, int i) throws
IllegalStateException, SystemException {
return false;
}
public boolean enlistResource(XAResource xaResource) throws
IllegalStateException, RollbackException, SystemException {
return false;
}
public int getStatus() throws SystemException {
return Status.STATUS_NO_TRANSACTION;
}
public void registerSynchronization(Synchronization synchronization) throws
IllegalStateException, RollbackException, SystemException {
}
public void rollback() throws IllegalStateException, SystemException {
}
public void setRollbackOnly() throws IllegalStateException, SystemException {
}
}
1.1
openejb/modules/core/src/test/org/openejb/deployment/MockTransactionManager.java
Index: MockTransactionManager.java
===================================================================
/* ====================================================================
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce this list of
* conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the OpenEJB Project. For more information
* please see <http://openejb.org/>.
*
* ====================================================================
*/
package org.openejb.deployment;
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
import javax.transaction.InvalidTransactionException;
import javax.transaction.NotSupportedException;
import javax.transaction.RollbackException;
import javax.transaction.Status;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
import org.apache.geronimo.transaction.ExtendedTransactionManager;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/10/28 21:21:27 $
*/
public class MockTransactionManager implements ExtendedTransactionManager {
private Transaction transaction = new MockTransaction();
public boolean committed;
public boolean rolledBack;
public void clear() {
committed = false;
rolledBack = false;
}
public void begin() throws NotSupportedException, SystemException {
}
public void commit() throws HeuristicMixedException, HeuristicRollbackException,
IllegalStateException, RollbackException, SecurityException, SystemException {
committed = true;
}
public int getStatus() throws SystemException {
return Status.STATUS_ACTIVE;
}
public Transaction getTransaction() throws SystemException {
return transaction;
}
public void resume(Transaction tobj) throws IllegalStateException,
InvalidTransactionException, SystemException {
}
public void rollback() throws IllegalStateException, SecurityException,
SystemException {
rolledBack = true;
}
public void setRollbackOnly() throws IllegalStateException, SystemException {
}
public void setTransactionTimeout(int seconds) throws SystemException {
}
public Transaction suspend() throws SystemException {
return null;
}
public Transaction begin(long transactionTimeoutMilliseconds) throws
NotSupportedException, SystemException {
return transaction;
}
}
1.1
openejb/modules/core/src/test/org/openejb/deployment/StatelessSystemMethodIndicesTest.java
Index: StatelessSystemMethodIndicesTest.java
===================================================================
/* ====================================================================
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce this list of
* conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the OpenEJB Project. For more information
* please see <http://openejb.org/>.
*
* ====================================================================
*/
package org.openejb.deployment;
import java.util.Map;
import javax.ejb.SessionContext;
import junit.framework.TestCase;
import org.openejb.dispatch.InterfaceMethodSignature;
import org.openejb.dispatch.SystemMethodIndices;
import org.openejb.slsb.MockEJB;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/10/28 21:21:27 $
*
* */
public class StatelessSystemMethodIndicesTest extends TestCase {
public void testSystemMethodIndices() throws Exception {
StatelessContainerBuilder builder = new StatelessContainerBuilder();
builder.setClassLoader(MockEJB.class.getClassLoader());
Map vopMap = builder.buildVopMap(MockEJB.class);
InterfaceMethodSignature[] signatures = (InterfaceMethodSignature[])
vopMap.keySet().toArray(new InterfaceMethodSignature[vopMap.size()]);
SystemMethodIndices systemMethodIndices =
SystemMethodIndices.createSystemMethodIndices(signatures, "setSessionContext", new
String(SessionContext.class.getName()), null);
assertFalse(systemMethodIndices.getEjbActivateInvocation(null).getMethodIndex() == -1);
assertTrue(systemMethodIndices.getEjbLoadInvocation(null).getMethodIndex()
== -1);
assertFalse(systemMethodIndices.getEjbPassivateInvocation(null).getMethodIndex() ==
-1);
assertTrue(systemMethodIndices.getEjbStoreInvocation(null).getMethodIndex()
== -1);
assertFalse(systemMethodIndices.getSetContextInvocation(null,
null).getMethodIndex() == -1);
assertTrue(systemMethodIndices.getUnsetContextInvocation(null).getMethodIndex() == -1);
}
}
1.1
openejb/modules/core/src/test/org/openejb/deployment/StatelfulSystemMethodIndicesTest.java
Index: StatelfulSystemMethodIndicesTest.java
===================================================================
/* ====================================================================
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce this list of
* conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the OpenEJB Project. For more information
* please see <http://openejb.org/>.
*
* ====================================================================
*/
package org.openejb.deployment;
import java.util.Map;
import javax.ejb.SessionContext;
import junit.framework.TestCase;
import org.openejb.dispatch.InterfaceMethodSignature;
import org.openejb.dispatch.SystemMethodIndices;
import org.openejb.slsb.MockEJB;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/10/28 21:21:27 $
*
* */
public class StatelfulSystemMethodIndicesTest extends TestCase {
public void testSystemMethodIndices() throws Exception {
StatefulContainerBuilder builder = new StatefulContainerBuilder();
builder.setClassLoader(MockEJB.class.getClassLoader());
Map vopMap = builder.buildVopMap(MockEJB.class);
InterfaceMethodSignature[] signatures = (InterfaceMethodSignature[])
vopMap.keySet().toArray(new InterfaceMethodSignature[vopMap.size()]);
SystemMethodIndices systemMethodIndices =
SystemMethodIndices.createSystemMethodIndices(signatures, "setSessionContext", new
String(SessionContext.class.getName()), null);
assertFalse(systemMethodIndices.getEjbActivateInvocation(null).getMethodIndex() == -1);
assertTrue(systemMethodIndices.getEjbLoadInvocation(null).getMethodIndex()
== -1);
assertFalse(systemMethodIndices.getEjbPassivateInvocation(null).getMethodIndex() ==
-1);
assertTrue(systemMethodIndices.getEjbStoreInvocation(null).getMethodIndex()
== -1);
assertFalse(systemMethodIndices.getSetContextInvocation(null,
null).getMethodIndex() == -1);
assertTrue(systemMethodIndices.getUnsetContextInvocation(null).getMethodIndex() == -1);
}
}