[jboss-cvs] JBossAS SVN: r80608 - in trunk/testsuite: imports/config and 13 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Nov 6 13:21:08 EST 2008


Author: galder.zamarreno at jboss.com
Date: 2008-11-06 13:21:06 -0500 (Thu, 06 Nov 2008)
New Revision: 80608

Added:
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/ejb2/ustxsticky/
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/ejb2/ustxsticky/test/
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/ejb2/ustxsticky/test/UserTransactionStickyUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/
   trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/UserTransactionStickinessVerifierInterceptor.java
   trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/UserTransactionStickyBean.java
   trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/UserTransactionStickyHome.java
   trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/UserTransactionStickyRemote.java
   trunk/testsuite/src/resources/cluster/ejb2/ustxsticky/
   trunk/testsuite/src/resources/cluster/ejb2/ustxsticky/META-INF/
   trunk/testsuite/src/resources/cluster/ejb2/ustxsticky/META-INF/ejb-jar.xml
   trunk/testsuite/src/resources/cluster/ejb2/ustxsticky/META-INF/jboss.xml
   trunk/testsuite/src/resources/test-configs/ustxsticky/
   trunk/testsuite/src/resources/test-configs/ustxsticky/deploy/
   trunk/testsuite/src/resources/test-configs/ustxsticky/deploy/transaction-service.xml
Modified:
   trunk/testsuite/imports/config/tests-clustering.xml
   trunk/testsuite/imports/sections/cluster.xml
   trunk/testsuite/imports/server-config.xml
   trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/AbstractInvokerHaTransactionSticky.java
   trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaMockUtils.java
   trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaMockUtils.java
Log:
[JBAS-6056] [JBAS-6153] Added user transaction sticky test case that tests stickyness of both UserTransaction and EJB invocations. This required addition of a new test config where ClientUserTransactionService returned an HA proxy with transaction sticky lbp.

Modified: trunk/testsuite/imports/config/tests-clustering.xml
===================================================================
--- trunk/testsuite/imports/config/tests-clustering.xml	2008-11-06 18:19:27 UTC (rev 80607)
+++ trunk/testsuite/imports/config/tests-clustering.xml	2008-11-06 18:21:06 UTC (rev 80608)
@@ -60,6 +60,9 @@
   <patternset id="cluster.profileservice.includes">
     <include name="org/jboss/test/cluster/defaultcfg/profileservice/test/*TestCase.class"/>
   </patternset>
+  <patternset id="cluster.ustxsticky.includes">
+    <include name="org/jboss/test/cluster/defaultcfg/ejb2/ustxsticky/test/UserTransactionStickyUnitTestCase.class"/>
+  </patternset>    
   <patternset id="cluster.excludes">
     <exclude name="org/jboss/test/cluster/**/*TestCase.class"/>
   </patternset>
@@ -254,6 +257,8 @@
     <server:stop name="cluster-${jboss-junit-configuration}-BR-0"/>
     <server:stop name="cluster-${jboss-junit-configuration}-BR-1"/>
 
+    <antcall target="tests-clustered-ustxsticky"/>
+
   </target>
   
   <target name="tests-clustering-configure" unless="${tests.clustering.skip.startup}">
@@ -348,6 +353,29 @@
 		    
   </target> 
 
+  <target name="tests-clustered-ustxsticky">
+
+    <mkdir dir="${build.reports}"/>
+    <mkdir dir="${build.testlog}"/>
+      
+    <create-ustxsticky-config newconf="cluster-ustxsticky-0" />    
+    <create-ustxsticky-config newconf="cluster-ustxsticky-1" />
+     
+    <server:start name="cluster-ustxsticky-0"/>
+    <server:start name="cluster-ustxsticky-1"/>
+      
+    <antcall target="tests-clustering-unit">
+      <param name="cluster.includes.refid" value="cluster.ustxsticky.includes"/>
+      <param name="jboss-junit-configuration" value="ClusteredUsTxSticky"/>
+      <param name="jbosstest.cluster.node0.config" value="cluster-ustxsticky-0"/>
+      <param name="jbosstest.cluster.node1.config" value="cluster-ustxsticky-1"/>
+    </antcall>
+     
+    <server:stop name="cluster-ustxsticky-0"/>
+    <server:stop name="cluster-ustxsticky-1"/>
+    
+  </target> 
+
    <!-- Executes a set of tests in a clustered environment -->  
    <target name="tests-clustering-unit">
       <mkdir dir="${build.reports}"/>

Modified: trunk/testsuite/imports/sections/cluster.xml
===================================================================
--- trunk/testsuite/imports/sections/cluster.xml	2008-11-06 18:19:27 UTC (rev 80607)
+++ trunk/testsuite/imports/sections/cluster.xml	2008-11-06 18:21:06 UTC (rev 80608)
@@ -794,6 +794,14 @@
       <metainf dir="${build.resources}/cache/aop/META-INF/"/>
       </jar>
       -->
+
+      <!-- ustxsticky.jar -->
+      <zip destfile="${build.lib}/ustxsticky.jar">
+         <zipfileset dir="${build.resources}/cluster/ejb2/ustxsticky"/>
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/test/cluster/ejb2/ustxsticky/*"/>
+         </fileset>
+      </zip>    
       
    </target>  
 </project>

Modified: trunk/testsuite/imports/server-config.xml
===================================================================
--- trunk/testsuite/imports/server-config.xml	2008-11-06 18:19:27 UTC (rev 80607)
+++ trunk/testsuite/imports/server-config.xml	2008-11-06 18:21:06 UTC (rev 80608)
@@ -719,6 +719,30 @@
          <sysproperty key="jboss.messaging.ServerPeerID" value="1" />
          <sysproperty key="jboss.partition.name" value="${partitionName}"/>
       </server>
+      <server name="cluster-ustxsticky-0" host="${node0}">
+         <jvmarg value="-Xms128m" />
+         <jvmarg value="-Xmx512m" />
+         <jvmarg value="-XX:MaxPermSize=512m" />        
+         <jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
+         <sysproperty key="java.net.preferIPv4Stack" value="true" />
+         <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+         <sysproperty key="resolve.dns" value="false" />
+         <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+         <sysproperty key="jboss.messaging.ServerPeerID" value="0" />
+         <sysproperty key="jboss.partition.name" value="${partitionName}"/>
+      </server>
+      <server name="cluster-ustxsticky-1" host="${node1}">
+         <jvmarg value="-Xms128m" />
+         <jvmarg value="-Xmx512m" />
+         <jvmarg value="-XX:MaxPermSize=512m" />        
+         <jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
+         <sysproperty key="java.net.preferIPv4Stack" value="true" />
+         <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+         <sysproperty key="resolve.dns" value="false" />
+         <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+         <sysproperty key="jboss.messaging.ServerPeerID" value="1" />
+         <sysproperty key="jboss.partition.name" value="${partitionName}"/>
+      </server>
       <server name="springdeployer" host="${node0}">
          <jvmarg value="-Xms128m" />
          <jvmarg value="-Xmx512m" />
@@ -1036,6 +1060,25 @@
 	    </create-config>
     </sequential>
    </macrodef>
+   
+   <!-- A macro for creating a user transaction sticky config -->
+   <macrodef name="create-ustxsticky-config"
+        description="Create a simplified clustered-ustxsticky configuration">
+     <attribute name="newconf"/>
+     <sequential>
+       <create-config baseconf="all" newconf="@{newconf}"
+        newconf-src="ustxsticky">
+         <patternset>
+            <include name="conf/**"/>
+            <include name="deploy/**"/>
+            <include name="deployers/**"/>            
+            <include name="deploy-hasingleton/**"/>
+            <include name="farm/**"/>
+            <include name="lib/**"/>
+         </patternset>
+       </create-config>
+     </sequential>
+   </macrodef> 
 
    <!-- This macro makes a new config whose name is given by the newconf
    attribute by copying the config given by the baseconf. The content that

Added: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/ejb2/ustxsticky/test/UserTransactionStickyUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/ejb2/ustxsticky/test/UserTransactionStickyUnitTestCase.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/ejb2/ustxsticky/test/UserTransactionStickyUnitTestCase.java	2008-11-06 18:21:06 UTC (rev 80608)
@@ -0,0 +1,129 @@
+/*
+ * 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.test.cluster.defaultcfg.ejb2.ustxsticky.test;
+
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.transaction.Status;
+import javax.transaction.UserTransaction;
+
+import junit.framework.Test;
+
+import org.jboss.logging.Logger;
+import org.jboss.test.JBossClusteredTestCase;
+import org.jboss.test.cluster.ejb2.ustxsticky.UserTransactionStickyHome;
+import org.jboss.test.cluster.ejb2.ustxsticky.UserTransactionStickyRemote;
+import org.jnp.interfaces.NamingContext;
+
+/**
+ * UserTransactionStickyTestCase.
+ * 
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class UserTransactionStickyUnitTestCase extends JBossClusteredTestCase
+{   
+   private static final String deployment = "ustxsticky.jar";
+
+   private static final Logger log = Logger.getLogger(UserTransactionStickyUnitTestCase.class);   
+
+   private Context ctx;   
+   
+   public UserTransactionStickyUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(UserTransactionStickyUnitTestCase.class, deployment);
+   }
+   
+   public void testSeveralTransactionalStickyCalls() throws Exception
+   {
+      severalTransactionalCalls(3, 3, "ejb/UserTransactionStickyEjb");
+   }
+
+   private void severalTransactionalCalls(int numTxs, int numCallsPerTx, String jndiName) throws Exception
+   {
+      UserTransaction tx;
+
+      // Connect to the server0 JNDI
+      String[] urls = getNamingURLs();
+      Properties env1 = new Properties();
+      env1.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
+      env1.setProperty(Context.PROVIDER_URL, urls[0]);
+      ctx = new InitialContext(env1);
+      
+      // ctx = createDefaultPartitionContext();
+      
+      for (int i = 1; i <= numTxs; i++)
+      {         
+         tx = (UserTransaction)ctx.lookup("UserTransaction");
+         tx.begin();
+         try
+         {
+            UserTransactionStickyHome home = (UserTransactionStickyHome)ctx.lookup(jndiName);
+            UserTransactionStickyRemote bean = home.create();
+            for (int j = 1; j <= numCallsPerTx; j++)
+            {
+               String origin = "tx" + i + "-c" + j;            
+               log(origin + " " + bean.amISticky());
+            }
+            log("");
+         }
+         catch (Exception e)
+         {
+            tx.setRollbackOnly(); // Force a rollback for this error
+            throw e;
+         }
+         finally
+         {
+            if (tx.getStatus() == Status.STATUS_ACTIVE)
+               tx.commit();
+            else
+               tx.rollback();
+         }
+      }      
+   }
+
+   private Properties getDefaultProperties()
+   {
+      Properties p = new Properties();
+      p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
+      p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
+      return p;
+   }   
+   
+   private Context createDefaultPartitionContext() throws Exception
+   {
+      Properties p = getDefaultProperties();
+      p.put(NamingContext.JNP_PARTITION_NAME, "DefaultPartition"); // partition name.
+      return new InitialContext(p);
+   }
+   
+   private static void log(Object message)
+   {
+      log.info(message);
+   }
+}

Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/UserTransactionStickinessVerifierInterceptor.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/UserTransactionStickinessVerifierInterceptor.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/UserTransactionStickinessVerifierInterceptor.java	2008-11-06 18:21:06 UTC (rev 80608)
@@ -0,0 +1,63 @@
+/*
+ * 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.test.cluster.ejb2.ustxsticky;
+
+import javax.transaction.Transaction;
+
+import org.jboss.ejb.plugins.AbstractInterceptor;
+import org.jboss.invocation.Invocation;
+import org.jboss.invocation.MarshalledInvocation;
+import org.jboss.logging.Logger;
+import org.jboss.tm.TransactionPropagationContextImporter;
+import org.jboss.tm.TransactionPropagationContextUtil;
+
+/**
+ * StickinessVerifierInterceptor.
+ * 
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class UserTransactionStickinessVerifierInterceptor extends AbstractInterceptor
+{
+   private static final Logger log = Logger.getLogger(UserTransactionStickinessVerifierInterceptor.class);
+   
+   @Override
+   public Object invoke(Invocation inv) throws Exception
+   {
+      MarshalledInvocation mi = (MarshalledInvocation)inv;      
+      Object tpc = mi.getTransactionPropagationContext();
+      TransactionPropagationContextImporter tpcImporter = TransactionPropagationContextUtil.getTPCImporter();
+      Transaction tx = tpcImporter.importTransactionPropagationContext(tpc);
+      log.debug("Tpc " + tpc + " is associated with tx " + tx);
+      
+      /* If a tpc is retrieved on the server side but matches no transaction 
+       * there, then it means that invocation was not sticky. An invocation 
+       * containing a tpc must, under transaction stikcy rules, hit the server
+       * where the tpc was generated from and where the transaction is running.
+       */
+      if (tx == null && tpc != null)
+      {
+         throw new IllegalStateException("Tpc " + tpc + " does not match a transaction on this node, invocation not sticky!");
+      }
+      
+      return getNext().invoke(inv);
+   }
+}

Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/UserTransactionStickyBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/UserTransactionStickyBean.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/UserTransactionStickyBean.java	2008-11-06 18:21:06 UTC (rev 80608)
@@ -0,0 +1,73 @@
+/*
+ * 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.test.cluster.ejb2.ustxsticky;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+
+import org.jboss.logging.Logger;
+
+/**
+ * UserTransactionStickyBean.
+ * 
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class UserTransactionStickyBean implements SessionBean
+{
+   private static Logger log = Logger.getLogger(UserTransactionStickyBean.class);   
+
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 3926319963458764127L;
+
+   public boolean amISticky()
+   {
+      return true;
+   }
+   
+   public void ejbCreate() throws CreateException
+   {
+      log.debug("ejbCreate() called");
+   }
+
+   public void ejbActivate()
+   {
+      log.debug("ejbActivate() called");
+   }
+
+   public void ejbPassivate()
+   {
+      log.debug("ejbPassivate() called");
+   }
+
+   public void ejbRemove()
+   {
+      log.debug("ejbRemove() called");
+   }
+
+   public void setSessionContext(SessionContext ctx) throws EJBException, RemoteException
+   {
+   }
+}

Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/UserTransactionStickyHome.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/UserTransactionStickyHome.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/UserTransactionStickyHome.java	2008-11-06 18:21:06 UTC (rev 80608)
@@ -0,0 +1,37 @@
+/*
+ * 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.test.cluster.ejb2.ustxsticky;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+/**
+ * UserTransactionStickyHome.
+ * 
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public interface UserTransactionStickyHome extends EJBHome
+{
+   UserTransactionStickyRemote create() throws CreateException, RemoteException;
+}

Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/UserTransactionStickyRemote.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/UserTransactionStickyRemote.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb2/ustxsticky/UserTransactionStickyRemote.java	2008-11-06 18:21:06 UTC (rev 80608)
@@ -0,0 +1,36 @@
+/*
+ * 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.test.cluster.ejb2.ustxsticky;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+
+/**
+ * UserTransactionStickyRemote.
+ * 
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public interface UserTransactionStickyRemote extends EJBObject
+{
+   boolean amISticky() throws RemoteException;
+}

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/AbstractInvokerHaTransactionSticky.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/AbstractInvokerHaTransactionSticky.java	2008-11-06 18:19:27 UTC (rev 80607)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/AbstractInvokerHaTransactionSticky.java	2008-11-06 18:21:06 UTC (rev 80608)
@@ -21,7 +21,6 @@
  */
 package org.jboss.test.cluster.invokerha;
 
-import java.rmi.ServerException;
 import java.rmi.server.UID;
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -30,7 +29,6 @@
 
 import javax.transaction.Transaction;
 
-import org.jboss.ha.framework.interfaces.GenericClusteringException;
 import org.jboss.ha.framework.interfaces.LoadBalancePolicy;
 import org.jboss.ha.framework.interfaces.TransactionStickyFirstAvailable;
 import org.jboss.ha.framework.interfaces.TransactionStickyFirstAvailableIdenticalAllProxies;
@@ -38,6 +36,7 @@
 import org.jboss.ha.framework.interfaces.TransactionStickyRoundRobin;
 import org.jboss.invocation.Invocation;
 import org.jboss.invocation.InvokerProxyHA;
+import org.jboss.invocation.ServiceUnavailableException;
 import org.jboss.logging.Logger;
 import org.jboss.test.cluster.invokerha.InvokerHaTransactionalMockUtils.MockTransaction;
 
@@ -308,7 +307,7 @@
       catch(Exception e)
       {
          log.debug("Expected exception", e);
-         assertTrue(e instanceof GenericClusteringException || e.getCause() instanceof GenericClusteringException);
+         assertTrue(e instanceof ServiceUnavailableException || e.getCause() instanceof ServiceUnavailableException);
       }
    }
    

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaMockUtils.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaMockUtils.java	2008-11-06 18:19:27 UTC (rev 80607)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaMockUtils.java	2008-11-06 18:21:06 UTC (rev 80608)
@@ -23,7 +23,6 @@
 
 import java.util.ArrayList;
 
-import org.jboss.ha.framework.interfaces.GenericClusteringException;
 import org.jboss.ha.framework.interfaces.LoadBalancePolicy;
 import org.jboss.invocation.Invocation;
 import org.jboss.invocation.Invoker;
@@ -126,7 +125,7 @@
       }
       
       @Override
-      protected void putIfExistsTransactionTarget(Invocation invocation, Object tpc) throws GenericClusteringException
+      protected void putIfExistsTransactionTarget(Invocation invocation, Object tpc) throws Exception
       {
          InvokerHaFailureType failureType = (InvokerHaFailureType)invocation.getValue("FAILURE_TYPE");
          if (failureType != null)

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaMockUtils.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaMockUtils.java	2008-11-06 18:19:27 UTC (rev 80607)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaMockUtils.java	2008-11-06 18:21:06 UTC (rev 80608)
@@ -29,7 +29,6 @@
 import javax.management.MBeanServer;
 import javax.net.SocketFactory;
 
-import org.jboss.ha.framework.interfaces.GenericClusteringException;
 import org.jboss.ha.framework.interfaces.LoadBalancePolicy;
 import org.jboss.invocation.Invocation;
 import org.jboss.invocation.Invoker;
@@ -131,7 +130,7 @@
       }
 
       @Override
-      protected void putIfExistsTransactionTarget(Invocation invocation, Object tpc) throws GenericClusteringException
+      protected void putIfExistsTransactionTarget(Invocation invocation, Object tpc) throws Exception
       {
          InvokerHaFailureType failureType = (InvokerHaFailureType)invocation.getValue("FAILURE_TYPE");
          if (failureType != null)

Added: trunk/testsuite/src/resources/cluster/ejb2/ustxsticky/META-INF/ejb-jar.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/ejb2/ustxsticky/META-INF/ejb-jar.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/cluster/ejb2/ustxsticky/META-INF/ejb-jar.xml	2008-11-06 18:21:06 UTC (rev 80608)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+        http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
+         version="2.1">
+
+   <enterprise-beans>
+   
+      <session>
+         <ejb-name>UserTransactionStickyEjb</ejb-name>
+         <home>org.jboss.test.cluster.ejb2.ustxsticky.UserTransactionStickyHome</home>
+         <remote>org.jboss.test.cluster.ejb2.ustxsticky.UserTransactionStickyRemote</remote>
+         <ejb-class>org.jboss.test.cluster.ejb2.ustxsticky.UserTransactionStickyBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+      </session>
+      
+   </enterprise-beans>
+</ejb-jar>
\ No newline at end of file

Added: trunk/testsuite/src/resources/cluster/ejb2/ustxsticky/META-INF/jboss.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/ejb2/ustxsticky/META-INF/jboss.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/cluster/ejb2/ustxsticky/META-INF/jboss.xml	2008-11-06 18:21:06 UTC (rev 80608)
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN"
+        "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
+<jboss>
+    <enterprise-beans>
+       <session>
+          <ejb-name>UserTransactionStickyEjb</ejb-name>
+          <jndi-name>ejb/UserTransactionStickyEjb</jndi-name>
+          <configuration-name>User Transaction Stickiness Verifier Clustered Stateless SessionBean</configuration-name>
+          <clustered>true</clustered>
+          <cluster-config>
+             <partition-name>${jboss.partition.name:DefaultPartition}</partition-name>          
+             <home-load-balance-policy>org.jboss.ha.framework.interfaces.TransactionStickyRoundRobin</home-load-balance-policy> 
+             <bean-load-balance-policy>org.jboss.ha.framework.interfaces.TransactionStickyRoundRobin</bean-load-balance-policy>
+          </cluster-config>
+       </session>
+    </enterprise-beans>
+    
+    <container-configurations>
+      <container-configuration extends="Clustered Stateless SessionBean">
+         <container-name>User Transaction Stickiness Verifier Clustered Stateless SessionBean</container-name>
+         <container-interceptors>
+           <interceptor>org.jboss.test.cluster.invokerha.ejb.UserTransactionStickinessVerifierInterceptor</interceptor>
+           <interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
+           <interceptor>org.jboss.ejb.plugins.CleanShutdownInterceptor</interceptor>
+           <interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
+           <interceptor>org.jboss.ejb.plugins.SecurityInterceptor</interceptor>
+           <!-- CMT -->
+           <interceptor transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
+           <interceptor transaction="Container">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
+           <interceptor transaction="Container">org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor</interceptor>
+           <!-- BMT -->
+           <interceptor transaction="Bean">org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor</interceptor>
+           <interceptor transaction="Bean">org.jboss.ejb.plugins.TxInterceptorBMT</interceptor>
+           <interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
+           <interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
+         </container-interceptors>         
+      </container-configuration>
+    </container-configurations>
+</jboss>
\ No newline at end of file

Added: trunk/testsuite/src/resources/test-configs/ustxsticky/deploy/transaction-service.xml
===================================================================
--- trunk/testsuite/src/resources/test-configs/ustxsticky/deploy/transaction-service.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/test-configs/ustxsticky/deploy/transaction-service.xml	2008-11-06 18:21:06 UTC (rev 80608)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id: jboss-service.xml 70749 2008-03-11 20:09:45Z sguilhen at redhat.com $ -->
+
+<!-- ===================================================================== -->
+<!--  JBoss Server Configuration                                           -->
+<!-- ===================================================================== -->
+
+<server>
+
+   <!-- ==================================================================== -->
+   <!-- Transactions                                                         -->
+   <!-- ==================================================================== -->
+
+   <!--
+      | UserTransaction support. Will be replaced by the DTM once
+      | the DTM is made to play nice with JBossTS.
+   -->
+   <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=unified</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=unified</depends>
+         </mbean>
+      </depends>
+      <depends optional-attribute-name="TxProxyName">
+         <mbean code="org.jboss.proxy.generic.ProxyFactoryHA"
+            name="jboss:service=proxyFactory,target=ClientUserTransaction">
+            <attribute name="TargetName">jboss:service=ClientUserTransaction</attribute>
+            <attribute name="JndiName"></attribute>
+            <attribute name="LoadBalancePolicy">org.jboss.ha.framework.interfaces.TransactionStickyRoundRobin</attribute>
+            <attribute name="ExportedInterface">org.jboss.tm.usertx.interfaces.UserTransactionSession</attribute>
+            <attribute name="Partition"><inject bean="HAPartition"/></attribute>
+            <attribute name="ClientInterceptors">
+               <interceptors>
+                  <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
+                  <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
+               </interceptors>
+            </attribute>
+            <!-- depends optional-attribute-name="PartitionObjectName">jboss:service=${jboss.partition.name:DefaultPartition}</depends -->
+            <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=unifiedha</depends>
+         </mbean>
+      </depends>
+   </mbean>
+
+</server>
\ No newline at end of file




More information about the jboss-cvs-commits mailing list