[Jboss-cvs] JBossAS SVN: r57090 - in branches/Branch_4_0/ejb3: . src/main/org/jboss/ejb3/entity src/main/org/jboss/ejb3/tx src/resources/test/arjuna/META-INF src/resources/test-configs/arjuna/conf src/resources/test-configs/arjuna/lib src/test/org/jboss/ejb3/test/arjuna src/test/org/jboss/ejb3/test/arjuna/unit

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 22 18:13:54 EDT 2006


Author: bdecoste
Date: 2006-09-22 18:13:26 -0400 (Fri, 22 Sep 2006)
New Revision: 57090

Added:
   branches/Branch_4_0/ejb3/src/resources/test-configs/arjuna/conf/jboss-service.xml
   branches/Branch_4_0/ejb3/src/resources/test-configs/arjuna/lib/jbossjts-integration.jar
   branches/Branch_4_0/ejb3/src/resources/test-configs/arjuna/lib/jbossjts-jacorb.jar
   branches/Branch_4_0/ejb3/src/resources/test-configs/arjuna/lib/jbossjts.jar
   branches/Branch_4_0/ejb3/src/resources/test-configs/arjuna/lib/jbossts-common.jar
   branches/Branch_4_0/ejb3/src/resources/test/arjuna/META-INF/persistence.xml
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/arjuna/Entity.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/arjuna/StatefulTx.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/arjuna/StatefulTxBean.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/arjuna/unit/ArjunaTestCase.java
Modified:
   branches/Branch_4_0/ejb3/build-test.xml
   branches/Branch_4_0/ejb3/src/main/org/jboss/ejb3/entity/ManagedEntityManagerFactory.java
   branches/Branch_4_0/ejb3/src/main/org/jboss/ejb3/tx/TxInterceptorFactory.java
   branches/Branch_4_0/ejb3/src/main/org/jboss/ejb3/tx/TxUtil.java
Log:
Replaced TxManager.getInstance() calls with JNDI TM lookup. Added test for TM plugin using Arjuna

Modified: branches/Branch_4_0/ejb3/build-test.xml
===================================================================
--- branches/Branch_4_0/ejb3/build-test.xml	2006-09-22 22:13:21 UTC (rev 57089)
+++ branches/Branch_4_0/ejb3/build-test.xml	2006-09-22 22:13:26 UTC (rev 57090)
@@ -1868,6 +1868,22 @@
       </jar>
    </target>
 
+   <target name="arjuna"
+      description="Builds all jar files."
+      depends="compile-classes">
+
+      <mkdir dir="${build.lib}"/>
+
+      <jar jarfile="${build.lib}/arjuna-test.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/ejb3/test/arjuna/*.class"/>
+         </fileset>
+         <fileset dir="${resources}/test/arjuna">
+            <include name="META-INF/*.xml"/>
+         </fileset>
+      </jar>
+   </target>
+
    <target name="ssladvanced"
       description="Builds all jar files."
       depends="compile-classes">
@@ -2576,7 +2592,7 @@
       </jar>
    </target>
    
-   <target name="jars" depends="mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader, 
+   <target name="jars" depends="arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader, 
       circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ejbthree440, 
       ejbthree454, ejbthree653, ejbthree670, aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency, 
       securitydomain, enventry, 
@@ -2845,6 +2861,7 @@
       <antcall target="clustered-tests" inheritRefs="true"/>
       <antcall target="invoker-test"  inheritRefs="true"/>
       <antcall target="iiop-tests"  inheritRefs="true"/>
+      <antcall target="arjuna-test"  inheritRefs="true"/>
    </target>
 
    <target name="no-start-jboss-tests" depends="init" description="Execute all tests">
@@ -3171,6 +3188,26 @@
 
    </target>
 
+   <target name="arjuna-test" depends="init">
+      <create-config baseconf="default" newconf="arjuna">
+         <patternset>
+            <include name="conf/**"/>
+            <include name="deploy*/**"/>
+            <include name="lib/**"/>
+         </patternset>
+      </create-config>
+     
+      <start-jboss conf="arjuna" host="${node0}"/>
+      <wait-on-host/>
+      
+      <antcall target="test" inheritRefs="true">
+         <param name="test" value="arjuna"/>
+      </antcall>
+      
+      <stop-jboss/>
+      <wait-on-shutdown conf="arjuna"/>
+   </target>
+
    <target name="ssl-simple-test" depends="init">
      <create-config baseconf="all" newconf="ejb3-ssl" jboss.dist="${ejb3.dist}">
          <patternset>

Modified: branches/Branch_4_0/ejb3/src/main/org/jboss/ejb3/entity/ManagedEntityManagerFactory.java
===================================================================
--- branches/Branch_4_0/ejb3/src/main/org/jboss/ejb3/entity/ManagedEntityManagerFactory.java	2006-09-22 22:13:21 UTC (rev 57089)
+++ branches/Branch_4_0/ejb3/src/main/org/jboss/ejb3/entity/ManagedEntityManagerFactory.java	2006-09-22 22:13:26 UTC (rev 57090)
@@ -34,6 +34,7 @@
 import org.jboss.tm.TxManager;
 import org.jboss.tm.TxUtils;
 import org.jboss.ejb3.ThreadLocalStack;
+import org.jboss.ejb3.tx.TxUtil;
 
 import java.util.IdentityHashMap;
 import java.util.Map;
@@ -47,7 +48,7 @@
    private static final Logger log = Logger.getLogger(ManagedEntityManagerFactory.class);
 
    protected EntityManagerFactory entityManagerFactory;
-   protected TransactionLocal session = new TransactionLocal(TxManager.getInstance());
+   protected TransactionLocal session = new TransactionLocal(TxUtil.getTransactionManager());
    protected String kernelName;
 
    public static ThreadLocalStack<Map> nonTxStack = new ThreadLocalStack<Map>();

Modified: branches/Branch_4_0/ejb3/src/main/org/jboss/ejb3/tx/TxInterceptorFactory.java
===================================================================
--- branches/Branch_4_0/ejb3/src/main/org/jboss/ejb3/tx/TxInterceptorFactory.java	2006-09-22 22:13:21 UTC (rev 57089)
+++ branches/Branch_4_0/ejb3/src/main/org/jboss/ejb3/tx/TxInterceptorFactory.java	2006-09-22 22:13:26 UTC (rev 57090)
@@ -33,6 +33,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.tm.TransactionManagerLocator;
 import org.jboss.tm.TxManager;
+import org.jboss.ejb3.tx.TxUtil;
 import org.jboss.ejb3.stateful.StatefulContainer;
 import org.jboss.ejb3.stateless.StatelessContainer;
 
@@ -102,7 +103,7 @@
       // We have to do this until AOP supports matching based on annotation attributes
       TransactionManagementType type = TxUtil.getTransactionManagementType(advisor);
       if (type == TransactionManagementType.BEAN)
-         return new BMTInterceptor(TxManager.getInstance(), !(advisor instanceof StatefulContainer));
+         return new BMTInterceptor(TxUtil.getTransactionManager(), !(advisor instanceof StatefulContainer));
 
       Method method = ((MethodJoinpoint) jp).getMethod();
       int timeout = resolveTransactionTimeout(advisor, method);
@@ -113,11 +114,11 @@
       String txType = resolveTxType(advisor, jp).toUpperCase();
       if (txType.equals("REQUIRED"))
       {
-         return new TxInterceptor.Required(TxManager.getInstance(), policy, timeout);
+         return new TxInterceptor.Required(TxUtil.getTransactionManager(), policy, timeout);
       }
       else if (txType.equals("REQUIRESNEW"))
       {
-         return new TxInterceptor.RequiresNew(TxManager.getInstance(), policy, timeout);
+         return new TxInterceptor.RequiresNew(TxUtil.getTransactionManager(), policy, timeout);
       }
       else
       {

Modified: branches/Branch_4_0/ejb3/src/main/org/jboss/ejb3/tx/TxUtil.java
===================================================================
--- branches/Branch_4_0/ejb3/src/main/org/jboss/ejb3/tx/TxUtil.java	2006-09-22 22:13:21 UTC (rev 57089)
+++ branches/Branch_4_0/ejb3/src/main/org/jboss/ejb3/tx/TxUtil.java	2006-09-22 22:13:26 UTC (rev 57090)
@@ -41,7 +41,6 @@
    {
       try
       {
-         //return TxManager.getInstance();
          InitialContext jndiContext = new InitialContext();
          TransactionManager tm = (TransactionManager)jndiContext.lookup("java:TransactionManager");
          return tm;

Added: branches/Branch_4_0/ejb3/src/resources/test/arjuna/META-INF/persistence.xml
===================================================================
--- branches/Branch_4_0/ejb3/src/resources/test/arjuna/META-INF/persistence.xml	2006-09-22 22:13:21 UTC (rev 57089)
+++ branches/Branch_4_0/ejb3/src/resources/test/arjuna/META-INF/persistence.xml	2006-09-22 22:13:26 UTC (rev 57090)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence>
+   <persistence-unit name="tempdb">
+      <jta-data-source>java:/DefaultDS</jta-data-source>
+      <properties>
+          <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+      </properties>
+   </persistence-unit>
+</persistence>

Added: branches/Branch_4_0/ejb3/src/resources/test-configs/arjuna/conf/jboss-service.xml
===================================================================
--- branches/Branch_4_0/ejb3/src/resources/test-configs/arjuna/conf/jboss-service.xml	2006-09-22 22:13:21 UTC (rev 57089)
+++ branches/Branch_4_0/ejb3/src/resources/test-configs/arjuna/conf/jboss-service.xml	2006-09-22 22:13:26 UTC (rev 57090)
@@ -0,0 +1,515 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id: jboss-service.xml 38992 2005-12-13 15:29:35Z jerrygauth $ -->
+
+<!-- ===================================================================== -->
+<!--  JBoss Server Configuration                                           -->
+<!-- ===================================================================== -->
+
+<server>
+
+   <!-- Load all jars from the JBOSS_DIST/server/<config>/lib directory. This
+     can be restricted to specific jars by specifying them in the archives
+     attribute.
+    -->
+   <classpath codebase="${jboss.server.lib.url:lib}" archives="*"/>
+
+   <!-- ==================================================================== -->
+   <!-- JSR-77 Single JBoss Server Management Domain                         -->
+   <!-- ==================================================================== -->
+   <mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"
+      name="jboss.management.local:j2eeType=J2EEDomain,name=Manager">
+      <attribute name="MainDeployer">jboss.system:service=MainDeployer</attribute>
+      <attribute name="SARDeployer">jboss.system:service=ServiceDeployer</attribute>
+      <attribute name="EARDeployer">jboss.j2ee:service=EARDeployer</attribute>
+      <attribute name="EJBDeployer">jboss.ejb:service=EJBDeployer</attribute>
+      <attribute name="RARDeployer">jboss.jca:service=RARDeployer</attribute>
+      <attribute name="CMDeployer">jboss.jca:service=ConnectionFactoryDeployer</attribute>
+      <attribute name="WARDeployer">jboss.web:service=WebServer</attribute>
+      <attribute name="CARDeployer">jboss.j2ee:service=ClientDeployer</attribute>
+      <attribute name="MailService">jboss:service=Mail</attribute>
+      <attribute name="JMSService">jboss.mq:service=DestinationManager</attribute>
+      <attribute name="JNDIService">jboss:service=Naming</attribute>
+      <attribute name="JTAService">jboss:service=TransactionManager</attribute>
+      <attribute name="UserTransactionService">jboss:service=ClientUserTransaction</attribute>
+      <attribute name="RMI_IIOPService">jboss:service=CorbaORB</attribute>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- XMBean Persistence                                                   -->
+   <!-- ==================================================================== -->   
+   <mbean code="org.jboss.system.pm.AttributePersistenceService"
+      name="jboss:service=AttributePersistenceService"
+      xmbean-dd="resource:xmdesc/AttributePersistenceService-xmbean.xml">
+      <!-- the AttributePersistenceService is persistent, itself -->
+           
+      <!--
+      <attribute name="AttributePersistenceManagerClass">org.jboss.system.pm.XMLAttributePersistenceManager</attribute>
+      <attribute name="AttributePersistenceManagerConfig">
+         <data-directory>data/xmbean-attrs</data-directory>
+      </attribute>      
+      <attribute name="ApmDestroyOnServiceStop">false</attribute>
+      <attribute name="VersionTag"></attribute>
+      -->
+   </mbean>
+
+   <!-- A Thread pool service -->
+   <mbean code="org.jboss.util.threadpool.BasicThreadPool"
+      name="jboss.system:service=ThreadPool">
+      <attribute name="Name">JBoss System Threads</attribute>
+      <attribute name="ThreadGroupName">System Threads</attribute>
+      <!-- How long a thread will live without any tasks in MS -->
+      <attribute name="KeepAliveTime">60000</attribute>
+      <!-- The max number of threads in the pool -->
+      <attribute name="MaximumPoolSize">10</attribute>
+      <!-- The max number of tasks before the queue is full -->
+      <attribute name="MaximumQueueSize">1000</attribute>
+      <!-- The behavior of the pool when a task is added and the queue is full.
+      abort - a RuntimeException is thrown
+      run - the calling thread executes the task
+      wait - the calling thread blocks until the queue has room
+      discard - the task is silently discarded without being run
+      discardOldest - check to see if a task is about to complete and enque
+         the new task if possible, else run the task in the calling thread
+      -->
+      <attribute name="BlockingMode">run</attribute>
+   </mbean>
+
+   <!-- Preload all custom editors for VMs that don't use the thread
+        context class loader when searching for PropertyEditors. Uncomment
+        if your JDK 1.3.0 VM fails to find JBoss PropertyEditors.
+   <mbean code="org.jboss.varia.property.PropertyEditorManagerService"
+     name="jboss:type=Service,name=BootstrapEditors">
+     <attribute name="BootstrapEditors">
+       java.math.BigDecimal=org.jboss.util.propertyeditor.BigDecimalEditor
+       java.lang.Boolean=org.jboss.util.propertyeditor.BooleanEditor
+       java.lang.Class=org.jboss.util.propertyeditor.ClassEditor
+       java.util.Date=org.jboss.util.propertyeditor.DateEditor
+       java.io.File=org.jboss.util.propertyeditor.FileEditor
+       java.net.InetAddress=org.jboss.util.propertyeditor.InetAddressEditor
+       java.lang.Integer=org.jboss.util.propertyeditor.IntegerEditor
+       javax.management.ObjectName=org.jboss.mx.util.propertyeditor.ObjectNameEditor
+       java.util.Properties=org.jboss.util.propertyeditor.PropertiesEditor
+       [Ljava.lang.String;=org.jboss.util.propertyeditor.StringArrayEditor
+       java.net.URL=org.jboss.util.propertyeditor.URLEditor
+     </attribute>
+   </mbean>
+   -->
+
+   <!-- ==================================================================== -->
+   <!-- Log4j Initialization                                                 -->
+   <!-- ==================================================================== -->
+
+   <mbean code="org.jboss.logging.Log4jService"
+      name="jboss.system:type=Log4jService,service=Logging"
+	  xmbean-dd="resource:xmdesc/Log4jService-xmbean.xml">
+      <attribute name="ConfigurationURL">resource:log4j.xml</attribute>
+      <!-- Set the org.apache.log4j.helpers.LogLog.setQuiteMode. As of log4j1.2.8
+      this needs to be set to avoid a possible deadlock on exception at the
+      appender level. See bug#696819.
+      -->
+      <attribute name="Log4jQuietMode">true</attribute>
+      <!-- How frequently in seconds the ConfigurationURL is checked for changes -->
+      <attribute name="RefreshPeriod">60</attribute>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Active Alarm Table                                                   -->
+   <!-- ==================================================================== -->
+
+   <!--
+      | The ActiveAlarmTable service is a simple JMX notification listener
+      | that maintains a table with the received notifications (alarms).
+      | The alarms can be acknowledged through the jmx or the web console.
+      | Modify the SubscriptionList below to subscribe for any notification
+      | in the system and treat it as an alarm.
+      | The JMXNotificationAppender is a log4j Appender that can be configured
+      | in log4j.xml, that trasforms logging events to JMX notification so they
+      | can be fed back into the table. By storing the WARN or higher level logging
+      | events you can have a quick view of important system faults.
+      |
+      | The following attributes may be set:
+      |
+      | MaxTableSize (default 1000)
+      |  - set an upper limit to the number of stored alarms
+      | LogLevel (default DEBUG)
+      |  - the log level to use for received notification, can be set to NONE
+      | ServerId (default jboss)
+      |  - used to construct unique alarm ids
+      | SubscriptionList
+      |  - subscribe for the notifications to be stored in the table
+
+   <mbean code="org.jboss.monitor.services.ActiveAlarmTable" 
+          name="jboss.monitor:service=ActiveAlarmTable">
+      <attribute name="SubscriptionList">
+         <subscription-list>
+            <mbean name="jboss.monitor:*">
+               <notification type="jboss.alarm"/>
+               <notification type="JBOSS_MONITOR_NOTIFICATION"/>               
+            </mbean>
+            <mbean name="jboss.system:service=Logging,type=JMXNotificationAppender"/>
+         </subscription-list>
+      </attribute>
+   </mbean>
+   -->
+  
+   <!-- ==================================================================== -->
+   <!-- JBoss RMI Classloader - only install when available                  -->
+   <!-- ==================================================================== -->
+   <mbean code="org.jboss.util.property.jmx.SystemPropertyClassValue"
+      name="jboss.rmi:type=RMIClassLoader">
+      <attribute name="Property">java.rmi.server.RMIClassLoaderSpi</attribute>
+      <attribute name="ClassName">org.jboss.system.JBossRMIClassLoader</attribute>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Service Binding                                                      -->
+   <!-- ==================================================================== -->
+
+   <!-- Automatically activated when generatting the clustering environment -->
+   <!-- @TESTSUITE_CLUSTER_CONFIG@ -->
+
+   <!--
+      | Binding service manager for port/host mapping. This is a sample
+      | config that demonstrates a JBoss instances with a server name 'ports-01'
+      | loading its bindings from an XML file using the ServicesStoreFactory
+      | implementation returned by the XMLServicesStoreFactory.
+      |
+      | ServerName: The unique name assigned to a JBoss server instance for
+      | lookup purposes. This allows a single ServicesStore to handle mulitiple
+      | JBoss servers.
+      |
+      | StoreURL: The URL string passed to org.jboss.services.binding.ServicesStore
+      | during initialization that specifies how to connect to the bindings store.
+      | StoreFactory: The org.jboss.services.binding.ServicesStoreFactory interface
+      | implementation to create to obtain the ServicesStore instance.
+
+   <mbean code="org.jboss.services.binding.ServiceBindingManager"
+     name="jboss.system:service=ServiceBindingManager">
+     <attribute name="ServerName">ports-01</attribute>
+     <attribute name="StoreURL">${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml</attribute>
+     <attribute name="StoreFactoryClassName">
+       org.jboss.services.binding.XMLServicesStoreFactory
+     </attribute>
+   </mbean>
+   -->
+
+   <!-- ==================================================================== -->
+   <!-- Class Loading                                                        -->
+   <!-- ==================================================================== -->
+
+   <mbean code="org.jboss.web.WebService"
+      name="jboss:service=WebService">
+      <attribute name="Port">8083</attribute>
+      <!-- Should non-EJB .class files be downloadable -->
+      <attribute name="DownloadServerClasses">true</attribute>
+      <!-- Should resources other than .class files be downloadable. Both
+         DownloadServerClasses and DownloadResources must be true for resources
+         to be downloadable. This is false by default because its generally a
+         bad idea as server configuration files that container security
+         information can be accessed.
+       -->
+      <attribute name="DownloadResources">false</attribute>
+      <attribute name="Host">${jboss.bind.address}</attribute>
+      <attribute name="BindAddress">${jboss.bind.address}</attribute>
+      <!-- Use the default thread pool for dynamic class loading -->
+      <depends optional-attribute-name="ThreadPool"
+         proxy-type="attribute">jboss.system:service=ThreadPool</depends>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- JNDI                                                                 -->
+   <!-- ==================================================================== -->
+
+   <mbean code="org.jboss.naming.NamingService"
+      name="jboss:service=Naming"
+      xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">
+      <!-- The call by value mode. true if all lookups are unmarshalled using
+      the caller's TCL, false if in VM lookups return the value by reference.
+      -->
+      <attribute name="CallByValue">false</attribute>
+      <!-- The listening port for the bootstrap JNP service. Set this to -1
+        to run the NamingService without the JNP invoker listening port.
+      -->
+      <attribute name="Port">1099</attribute>
+      <!-- The bootstrap JNP server bind address. This also sets the default
+      RMI service bind address. Empty == all addresses
+       -->
+      <attribute name="BindAddress">${jboss.bind.address}</attribute>
+      <!-- The port of the RMI naming service, 0 == anonymous -->
+      <attribute name="RmiPort">1098</attribute>
+      <!-- The RMI service bind address. Empty == all addresses
+       -->
+      <attribute name="RmiBindAddress">${jboss.bind.address}</attribute>
+      <!-- The thread pool service used to control the bootstrap lookups -->
+      <depends optional-attribute-name="LookupPool"
+         proxy-type="attribute">jboss.system:service=ThreadPool</depends>
+   </mbean>
+
+   <mbean code="org.jboss.naming.JNDIView"
+   	name="jboss:service=JNDIView"
+   	xmbean-dd="resource:xmdesc/JNDIView-xmbean.xml">
+   	<!-- The HANamingService service name -->
+   	<attribute name="HANamingService">jboss:service=HAJNDI</attribute>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Security                                                             -->
+   <!-- ==================================================================== -->
+
+   <mbean code="org.jboss.security.plugins.SecurityConfig"
+      name="jboss.security:service=SecurityConfig">
+      <attribute name="LoginConfig">jboss.security:service=XMLLoginConfig</attribute>
+   </mbean>
+   <mbean code="org.jboss.security.auth.login.XMLLoginConfig"
+      name="jboss.security:service=XMLLoginConfig">
+      <attribute name="ConfigResource">login-config.xml</attribute>
+   </mbean>
+
+   <!-- JAAS security manager and realm mapping -->
+   <mbean code="org.jboss.security.plugins.JaasSecurityManagerService"
+      name="jboss.security:service=JaasSecurityManager">
+      <!-- A flag which indicates whether the SecurityAssociation server mode
+      is set on service creation. This is true by default since the
+      SecurityAssociation should be thread local for multi-threaded server
+      operation.
+      -->
+      <attribute name="ServerMode">true</attribute>
+      <attribute name="SecurityManagerClassName">org.jboss.security.plugins.JaasSecurityManager</attribute>
+      <attribute name="DefaultUnauthenticatedPrincipal">anonymous</attribute>
+      <!-- DefaultCacheTimeout: Specifies the default timed cache policy timeout
+      in seconds.
+      If you want to disable caching of security credentials, set this to 0 to
+      force authentication to occur every time. This has no affect if the
+      AuthenticationCacheJndiName has been changed from the default value.
+      -->
+      <attribute name="DefaultCacheTimeout">1800</attribute>
+      <!-- DefaultCacheResolution: Specifies the default timed cache policy
+      resolution in seconds. This controls the interval at which the cache
+      current timestamp is updated and should be less than the DefaultCacheTimeout
+      in order for the timeout to be meaningful. This has no affect if the
+      AuthenticationCacheJndiName has been changed from the default value.
+      -->
+      <attribute name="DefaultCacheResolution">60</attribute>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Transactions                                                         -->
+   <!-- ==================================================================== -->
+   <!-- The configurable Xid factory.  For use with Oracle, set pad to true -->
+   <mbean code="org.jboss.tm.XidFactory"
+      name="jboss:service=XidFactory">
+      <!--attribute name="Pad">true</attribute-->
+   </mbean>
+
+   <mbean code="com.arjuna.ats.jbossatx.jta.TransactionManagerService"
+      name="jboss:service=TransactionManager">
+      <attribute name="TransactionTimeout">300</attribute>
+   </mbean>
+
+   <!--
+      | UserTransaction support.
+    -->
+   <mbean code="org.jboss.tm.usertx.server.ClientUserTransactionService"
+      name="jboss:service=ClientUserTransaction"
+      xmbean-dd="resource:xmdesc/ClientUserTransaction-xmbean.xml">
+      <depends>
+         <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
+            name="jboss:service=proxyFactory,target=ClientUserTransactionFactory">
+            <attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>
+            <attribute name="TargetName">jboss:service=ClientUserTransaction</attribute>
+            <attribute name="JndiName">UserTransactionSessionFactory</attribute>
+            <attribute name="ExportedInterface">org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory</attribute>
+            <attribute name="ClientInterceptors">
+               <interceptors>
+                  <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
+                  <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
+               </interceptors>
+            </attribute>
+            <depends>jboss:service=invoker,type=jrmp</depends>
+         </mbean>
+      </depends>
+      <depends optional-attribute-name="TxProxyName">
+         <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
+            name="jboss:service=proxyFactory,target=ClientUserTransaction">
+            <attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>
+            <attribute name="TargetName">jboss:service=ClientUserTransaction</attribute>
+            <attribute name="JndiName"></attribute>
+            <attribute name="ExportedInterface">org.jboss.tm.usertx.interfaces.UserTransactionSession</attribute>
+            <attribute name="ClientInterceptors">
+               <interceptors>
+                  <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
+                  <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
+               </interceptors>
+            </attribute>
+            <depends>jboss:service=invoker,type=jrmp</depends>
+         </mbean>
+      </depends>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Invokers to the JMX node                                             -->
+   <!-- ==================================================================== -->
+
+   <!-- RMI/JRMP invoker -->
+   <mbean code="org.jboss.invocation.jrmp.server.JRMPInvoker"
+      name="jboss:service=invoker,type=jrmp">
+      <attribute name="RMIObjectPort">4444</attribute>
+      <attribute name="ServerAddress">${jboss.bind.address}</attribute>
+      <!--
+      <attribute name="RMIClientSocketFactory">custom</attribute>
+      <attribute name="RMIServerSocketFactory">custom</attribute>
+      <attribute name="RMIServerSocketAddr">custom</attribute>
+      <attribute name="SecurityDomain">ssl-domain-name</attribute>
+      -->
+      <depends>jboss:service=TransactionManager</depends>
+   </mbean>
+
+   <mbean code="org.jboss.invocation.local.LocalInvoker"
+      name="jboss:service=invoker,type=local">
+
+      <depends>jboss:service=TransactionManager</depends>
+   </mbean>
+
+   <mbean code="org.jboss.invocation.pooled.server.PooledInvoker"
+      name="jboss:service=invoker,type=pooled">
+      <attribute name="NumAcceptThreads">1</attribute>
+      <attribute name="MaxPoolSize">300</attribute>
+      <attribute name="ClientMaxPoolSize">300</attribute>
+      <attribute name="SocketTimeout">60000</attribute>
+      <attribute name="ServerBindAddress">${jboss.bind.address}</attribute>
+      <attribute name="ServerBindPort">4445</attribute>
+      <attribute name="ClientConnectAddress">${jboss.bind.address}</attribute>
+      <attribute name="ClientConnectPort">0</attribute>
+      <attribute name="ClientRetryCount">1</attribute>
+      <attribute name="EnableTcpNoDelay">false</attribute>
+
+      <!-- Customized socket factory attributes
+      <attribute name="ClientSocketFactoryName">custom.client.factory</attribute>
+      <attribute name="ServerSocketFactoryName">custom.server.factory</attribute>
+      <attribute name="SslDomain">java:/jaas/pooledInvoker</attribute>
+      -->
+      <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Monitoring and Management                                            -->
+   <!-- ==================================================================== -->
+
+   <!-- Uncomment to enable JMX monitoring of the bean cache
+   <mbean code="org.jboss.monitor.BeanCacheMonitor"
+          name="jboss.monitor:name=BeanCacheMonitor"/>
+   -->
+
+   <!-- Uncomment to enable JMX monitoring of the entity bean locking
+   <mbean code="org.jboss.monitor.EntityLockMonitor"
+          name="jboss.monitor:name=EntityLockMonitor"/>
+   -->
+
+   <!-- ==================================================================== -->
+   <!-- An MBean that is a registry for JDBC type-mapping metadata           -->
+   <!-- ==================================================================== -->
+
+   <mbean code="org.jboss.ejb.plugins.cmp.jdbc.metadata.MetaDataLibrary"
+      name="jboss.jdbc:service=metadata"/>
+
+   <!-- ==================================================================== -->
+   <!-- Deployment Scanning                                                  -->
+   <!-- ==================================================================== -->
+
+   <!-- An mbean for hot deployment/undeployment of archives.
+   -->
+   <mbean code="org.jboss.deployment.scanner.URLDeploymentScanner"
+      name="jboss.deployment:type=DeploymentScanner,flavor=URL">
+
+      <!-- Uncomment (and comment/remove version below) to enable usage of the
+        DeploymentCache
+      <depends optional-attribute-name="Deployer">jboss.deployment:type=DeploymentCache</depends>
+      -->
+      <depends optional-attribute-name="Deployer">jboss.system:service=MainDeployer</depends>
+
+      <!-- The URLComparator can be used to specify a deployment ordering
+           for deployments found in a scanned directory.  The class specified
+           must be an implementation of java.util.Comparator, it must be able
+           to compare two URL objects, and it must have a no-arg constructor.
+           Two deployment comparators are shipped with JBoss:
+             - org.jboss.deployment.DeploymentSorter
+               Sorts by file extension, as follows:
+                 "sar", "service.xml", "rar", "jar", "war", "wsr", "ear", "zip",
+                 "*"
+             - org.jboss.deployment.scanner.PrefixDeploymentSorter
+               If the name portion of the url begins with 1 or more digits, those
+               digits are converted to an int (ignoring leading zeroes), and
+               files are deployed in that order.  Files that do not start with
+               any digits will be deployed first, and they will be sorted by
+               extension as above with DeploymentSorter.
+      -->
+      <attribute name="URLComparator">org.jboss.deployment.DeploymentSorter</attribute>
+      
+      <!--
+      <attribute name="URLComparator">org.jboss.deployment.scanner.PrefixDeploymentSorter</attribute>
+      -->
+
+      <!-- The FilterInstance specifies a URLLister.URLFilter for scanned
+           directories. This DeploymentFilter is initialized with the given
+           prefixes, suffixes and matches that define which URLs should be
+           ignored.
+      -->
+      <attribute name="FilterInstance"
+         attributeClass="org.jboss.deployment.scanner.DeploymentFilter"
+         serialDataType="javaBean">
+         <!-- Files starting with theses strings are ignored -->
+         <property name="prefixes">#,%,\,,.,_$</property>
+         <!-- Files ending with theses strings are ignored -->
+         <property name="suffixes">#,$,%,~,\,v,.BAK,.bak,.old,.orig,.tmp,.rej,.sh</property>
+         <!-- Files matching with theses strings are ignored -->
+         <property name="matches">.make.state,.nse_depinfo,CVS,CVS.admin,RCS,RCSLOG,SCCS,TAGS,core,tags</property>
+      </attribute>
+
+      <!-- Frequency in milliseconds to rescan the URLs for changes -->
+      <attribute name="ScanPeriod">5000</attribute>
+      
+      <!-- A flag to disable the scans -->
+      <attribute name="ScanEnabled">true</attribute>
+
+      <!-- URLs are comma separated and resolve relative to the server home URL
+         unless the given path is absolute. If the URL ends in "/" it is
+         considered a collection and scanned, otherwise it is simply deployed;
+         this follows RFC2518 convention and allows discrimination between
+         collections and directories that are simply unpacked archives.
+
+         URLs may be local (file:) or remote (http:). Scanning is supported
+         for remote URLs but unpacked deployment units are not.
+
+         Example URLs:
+            deploy/
+                 scans ${jboss.server.url}/deploy/, which is local or remote
+                 depending on the URL used to boot the server
+            ${jboss.server.home}/deploy/
+                 scans ${jboss.server.home)/deploy, which is always local
+            file:/var/opt/myapp.ear
+                 deploy myapp.ear from a local location
+            file:/var/opt/apps/
+                 scans the specified directory
+            http://www.test.com/netboot/myapp.ear
+                 deploys myapp.ear from a remote location
+            http://www.test.com/netboot/apps/
+                 scans the specified WebDAV location
+       -->
+      <attribute name="URLs">
+         deploy/
+      </attribute>
+
+      <!-- Indicates if the scanner should recursively scan directories that
+      contain no "." in their names. This can be used to group applications
+      and services that must be deployed and that have the same
+      logical function in the same directory i.e.
+        deploy/JMX/
+        deploy/JMS/
+        ...
+      -->
+      <attribute name="RecursiveSearch">True</attribute>
+
+   </mbean>
+
+</server>

Added: branches/Branch_4_0/ejb3/src/resources/test-configs/arjuna/lib/jbossjts-integration.jar
===================================================================
(Binary files differ)


Property changes on: branches/Branch_4_0/ejb3/src/resources/test-configs/arjuna/lib/jbossjts-integration.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/Branch_4_0/ejb3/src/resources/test-configs/arjuna/lib/jbossjts-jacorb.jar
===================================================================
(Binary files differ)


Property changes on: branches/Branch_4_0/ejb3/src/resources/test-configs/arjuna/lib/jbossjts-jacorb.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/Branch_4_0/ejb3/src/resources/test-configs/arjuna/lib/jbossjts.jar
===================================================================
(Binary files differ)


Property changes on: branches/Branch_4_0/ejb3/src/resources/test-configs/arjuna/lib/jbossjts.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/Branch_4_0/ejb3/src/resources/test-configs/arjuna/lib/jbossts-common.jar
===================================================================
(Binary files differ)


Property changes on: branches/Branch_4_0/ejb3/src/resources/test-configs/arjuna/lib/jbossts-common.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/arjuna/Entity.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/arjuna/Entity.java	2006-09-22 22:13:21 UTC (rev 57089)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/arjuna/Entity.java	2006-09-22 22:13:26 UTC (rev 57090)
@@ -0,0 +1,58 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.ejb3.test.arjuna;
+
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at javax.persistence.Entity
+ at Table(name = "ENTITY")
+public class Entity implements java.io.Serializable
+{
+   private Long id;
+   private String name;
+
+   @Id
+   //@GeneratedValue(strategy= GenerationType.IDENTITY)
+   public Long getId()
+   {
+      return id;
+   }
+
+   public void setId(Long id)
+   {
+      this.id = id;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/arjuna/StatefulTx.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/arjuna/StatefulTx.java	2006-09-22 22:13:21 UTC (rev 57089)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/arjuna/StatefulTx.java	2006-09-22 22:13:26 UTC (rev 57090)
@@ -0,0 +1,38 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.ejb3.test.arjuna;
+
+import org.jboss.ejb3.test.arjuna.Entity;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface StatefulTx
+{
+   boolean isArjunaTransactedRequired() throws javax.transaction.SystemException;
+   
+   boolean isArjunaTransactedRequiresNew() throws javax.transaction.SystemException;
+   
+   boolean clear(Entity entity) throws javax.transaction.SystemException;
+   
+   boolean persist(Entity entity) throws javax.transaction.SystemException;
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/arjuna/StatefulTxBean.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/arjuna/StatefulTxBean.java	2006-09-22 22:13:21 UTC (rev 57089)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/arjuna/StatefulTxBean.java	2006-09-22 22:13:26 UTC (rev 57090)
@@ -0,0 +1,96 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.ejb3.test.arjuna;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.transaction.TransactionManager;
+
+import org.jboss.annotation.JndiInject;
+import org.jboss.annotation.ejb.RemoteBinding;
+import org.jboss.ejb3.test.arjuna.Entity;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Stateful(name="StatefulTx")
+ at Remote(StatefulTx.class)
+ at RemoteBinding(jndiBinding = "StatefulTx")
+ at TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) 
+public class StatefulTxBean implements StatefulTx
+{
+   private static final Logger log = Logger.getLogger(StatefulTxBean.class);
+   
+   @JndiInject(jndiName="java:/TransactionManager") private TransactionManager tm;
+   
+   @PersistenceContext private EntityManager manager;
+   
+   @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+   public boolean clear(Entity entity) throws javax.transaction.SystemException
+   {
+     entity = manager.find(Entity.class, entity.getId());
+     if (entity != null)
+        manager.remove(entity);
+     
+     return getReturn();
+   }
+   
+   @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+   public boolean persist(Entity entity) throws javax.transaction.SystemException
+   {
+      manager.persist(entity);
+      
+      return getReturn();
+   }
+    
+   @TransactionAttribute(TransactionAttributeType.REQUIRED)
+   public boolean isArjunaTransactedRequired() throws javax.transaction.SystemException
+   {
+      return getReturn();
+   }
+   
+   @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+   public boolean isArjunaTransactedRequiresNew() throws javax.transaction.SystemException
+   {
+      return getReturn();
+   }
+   
+   protected boolean getReturn() throws javax.transaction.SystemException
+   {
+      if (tm.getTransaction() == null)
+         return false;
+      
+      if (!tm.getClass().toString().contains("arjuna"))
+         return false;
+      
+      if (!tm.getTransaction().getClass().toString().contains("arjuna"))
+         return false;
+      
+      return true;
+   }
+
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/arjuna/unit/ArjunaTestCase.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/arjuna/unit/ArjunaTestCase.java	2006-09-22 22:13:21 UTC (rev 57089)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/arjuna/unit/ArjunaTestCase.java	2006-09-22 22:13:26 UTC (rev 57090)
@@ -0,0 +1,71 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.ejb3.test.arjuna.unit;
+
+import org.jboss.ejb3.test.arjuna.StatefulTx;
+import org.jboss.ejb3.test.arjuna.Entity;
+import org.jboss.logging.Logger;
+import org.jboss.test.JBossTestCase;
+import junit.framework.Test;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public class ArjunaTestCase
+extends JBossTestCase
+{
+   private static final Logger log = Logger.getLogger(ArjunaTestCase.class);
+
+   public ArjunaTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testStatefulTx() throws Exception
+   {     
+      StatefulTx stateful = (StatefulTx)getInitialContext().lookup("StatefulTx");
+      assertNotNull(stateful);
+      
+      boolean arjunaTransacted = stateful.isArjunaTransactedRequired();
+      assertTrue(arjunaTransacted);
+      arjunaTransacted = stateful.isArjunaTransactedRequiresNew();
+      assertTrue(arjunaTransacted);
+      
+      Entity entity = new Entity();
+      entity.setName("test-entity");
+      entity.setId(1234L);
+      
+      arjunaTransacted = stateful.clear(entity);
+      assertTrue(arjunaTransacted);
+      
+      arjunaTransacted = stateful.persist(entity);
+      assertTrue(arjunaTransacted);
+      
+      stateful.clear(entity);
+   }
+ 
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(ArjunaTestCase.class, "arjuna-test.jar");
+   }
+
+}




More information about the jboss-cvs-commits mailing list