[jboss-cvs] JBossAS SVN: r59444 - in trunk/ejb3/src: test/org/jboss/ejb3/test/clusteredsession and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jan 9 13:02:59 EST 2007
Author: bstansberry at jboss.com
Date: 2007-01-09 13:02:56 -0500 (Tue, 09 Jan 2007)
New Revision: 59444
Added:
trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/NonAnnotationStatefulBean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/OverrideAnnotationStatefulBean.java
Modified:
trunk/ejb3/src/resources/test/clusteredsession/META-INF/ejb-jar.xml
trunk/ejb3/src/resources/test/clusteredsession/META-INF/jboss.xml
trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/StatefulBean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/unit/BeanUnitTestCase.java
trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/unit/StatelessUnitTestCase.java
Log:
[EJBTHREE-424] Test setting of partition name for clustered SFSBs
Modified: trunk/ejb3/src/resources/test/clusteredsession/META-INF/ejb-jar.xml
===================================================================
--- trunk/ejb3/src/resources/test/clusteredsession/META-INF/ejb-jar.xml 2007-01-09 18:00:48 UTC (rev 59443)
+++ trunk/ejb3/src/resources/test/clusteredsession/META-INF/ejb-jar.xml 2007-01-09 18:02:56 UTC (rev 59444)
@@ -7,13 +7,20 @@
version="3.0">
<enterprise-beans>
<session>
- <ejb-name>OverrideStateful</ejb-name>
- <remote>org.jboss.ejb3.test.clusteredsession.OverrideStatefulRemote</remote>
- <ejb-class>org.jboss.ejb3.test.clusteredsession.OverrideStatefulBean</ejb-class>
+ <ejb-name>NonAnnotationStateful</ejb-name>
+ <remote>org.jboss.ejb3.test.clusteredsession.StatefulRemote</remote>
+ <ejb-class>org.jboss.ejb3.test.clusteredsession.NonAnnotationStatefulBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
</session>
<session>
+ <ejb-name>EjbJarOverrideAnnotationStateful</ejb-name>
+ <remote>org.jboss.ejb3.test.clusteredsession.StatefulRemote</remote>
+ <ejb-class>org.jboss.ejb3.test.clusteredsession.OverrideAnnotationStatefulBean</ejb-class>
+ <session-type>Stateful</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ <session>
<ejb-name>NonClusteredStateful</ejb-name>
<remote>org.jboss.ejb3.test.clusteredsession.OverrideStatefulRemote</remote>
<ejb-class>org.jboss.ejb3.test.clusteredsession.OverrideStatefulBean</ejb-class>
Modified: trunk/ejb3/src/resources/test/clusteredsession/META-INF/jboss.xml
===================================================================
--- trunk/ejb3/src/resources/test/clusteredsession/META-INF/jboss.xml 2007-01-09 18:00:48 UTC (rev 59443)
+++ trunk/ejb3/src/resources/test/clusteredsession/META-INF/jboss.xml 2007-01-09 18:02:56 UTC (rev 59444)
@@ -16,6 +16,30 @@
</cluster-config>
</session>
<session>
+ <ejb-name>NonAnnotationStateful</ejb-name>
+ <clustered>true</clustered>
+ <cluster-config>
+ <partition-name>${jboss.partition.name:DefaultPartition}</partition-name>
+ <load-balance-policy>org.jboss.ha.framework.interfaces.FirstAvailableIdenticalAllProxies</load-balance-policy>
+ </cluster-config>
+ </session>
+ <session>
+ <ejb-name>OverrideAnnotationStateful</ejb-name>
+ <clustered>true</clustered>
+ <cluster-config>
+ <partition-name>${jboss.partition.name:DefaultPartition}</partition-name>
+ <load-balance-policy>org.jboss.ha.framework.interfaces.FirstAvailableIdenticalAllProxies</load-balance-policy>
+ </cluster-config>
+ </session>
+ <session>
+ <ejb-name>EjbJarOverrideAnnotationStateful</ejb-name>
+ <clustered>true</clustered>
+ <cluster-config>
+ <partition-name>${jboss.partition.name:DefaultPartition}</partition-name>
+ <load-balance-policy>org.jboss.ha.framework.interfaces.FirstAvailableIdenticalAllProxies</load-balance-policy>
+ </cluster-config>
+ </session>
+ <session>
<ejb-name>NonClusteredStateful</ejb-name>
<jndi-name>NonClusteredStatefulRemote</jndi-name>
<clustered>false</clustered>
Copied: trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/NonAnnotationStatefulBean.java (from rev 59243, branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/NonAnnotationStatefulBean.java)
===================================================================
--- branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/NonAnnotationStatefulBean.java 2006-12-28 23:35:15 UTC (rev 59243)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/NonAnnotationStatefulBean.java 2007-01-09 18:02:56 UTC (rev 59444)
@@ -0,0 +1,182 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.ejb3.test.clusteredsession;
+
+import java.rmi.dgc.VMID;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.EJBException;
+import javax.ejb.PostActivate;
+import javax.ejb.PrePassivate;
+import javax.ejb.Remove;
+import javax.interceptor.Interceptors;
+
+import org.jboss.logging.Logger;
+import org.jboss.system.server.ServerConfig;
+
+/**
+ * Base class for various configs of a SFSB. No class-level clustering
+ * annotations applied so it can serve as a bean class that doesn't use
+ * annotations, or be subclassed by a bean that adds annotations.
+ *
+ * @see StatefulBean
+ *
+ * @author Ben Wang
+ * @author Brian Stansberry
+ *
+ * @version $Revision: 57207 $
+ */
+public class NonAnnotationStatefulBean implements java.io.Serializable, StatefulRemote
+{
+ private Logger log = Logger.getLogger(getClass());
+ private int counter = 0;
+ private String state;
+ public transient VMID myId = null;
+ public String name;
+
+ public int increment()
+ {
+ System.out.println("INCREMENT - counter: " + (counter++));
+ return counter;
+ }
+
+ public String getHostAddress()
+ {
+ return System.getProperty(ServerConfig.SERVER_BIND_ADDRESS);
+ }
+
+ public static int postActivateCalled = 0;
+ public static int prePassivateCalled = 0;
+
+ /**
+ * Sleep to test
+ * @throws Exception
+ */
+ public void longRunning() throws Exception
+ {
+ log.debug("+++ longRunning() enter ");
+ Thread.sleep(20000); // 20000 will break the passivation test now.
+ log.debug("+++ longRunning() leave ");
+ }
+
+ public int getPostActivate()
+ {
+ return postActivateCalled;
+ }
+
+ public int getPrePassivate()
+ {
+ return prePassivateCalled;
+ }
+
+ public void setState(String state)
+ {
+ this.state = state;
+ }
+
+ public String getState()
+ {
+ log.debug("getState(): entering ...");
+ return this.state;
+ }
+
+ public void reset()
+ {
+ state = null;
+ postActivateCalled = 0;
+ prePassivateCalled = 0;
+ }
+
+ public void resetActivationCounter() {
+ postActivateCalled = 0;
+ prePassivateCalled = 0;
+ }
+
+ @PostActivate
+ public void postActivate()
+ {
+ ++postActivateCalled;
+ if (this.myId == null)
+ {
+ //it is a failover: we need to assign ourself an id
+ this.myId = new VMID();
+ }
+ log.debug("Activate. My ID: " + this.myId + " name: " + this.name);
+ }
+
+ @PrePassivate
+ public void prePassivate()
+ {
+ ++prePassivateCalled;
+ log.debug("Passivate. My ID: " + this.myId + " name: " + this.name);
+ }
+
+ @Remove
+ public void remove()
+ {
+ }
+
+ @PostConstruct
+ public void ejbCreate()
+ {
+ this.myId = new VMID();
+ log.debug("My ID: " + this.myId);
+ }
+
+ // Remote Interface implementation ----------------------------------------------
+
+ // Mimic explict failover
+ @Interceptors({ExplicitFailoverInterceptor.class})
+ public NodeAnswer getNodeState()
+ {
+ if (this.myId == null)
+ {
+ //it is a failover: we need to assign ourself an id because of transient nature
+ this.myId = new VMID();
+ }
+
+ NodeAnswer state = new NodeAnswer(this.myId, this.name);
+ log.debug("getNodeState, " + state);
+ return state;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ log.debug("Name set to " + name);
+ }
+
+ public void setNameOnlyOnNode(String name, VMID node)
+ {
+ if (node.equals(this.myId))
+ this.setName(name);
+ else
+ throw new EJBException("Trying to assign value on node " + this.myId + " but this node expected: " + node);
+ }
+
+ public void setUpFailover(String failover) {
+ // To setup the failover property
+ log.debug("Setting up failover property: " +failover);
+ System.setProperty ("JBossCluster-DoFail", failover);
+ }
+
+}
Copied: trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/OverrideAnnotationStatefulBean.java (from rev 59243, branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/OverrideAnnotationStatefulBean.java)
===================================================================
--- branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/OverrideAnnotationStatefulBean.java 2006-12-28 23:35:15 UTC (rev 59243)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/OverrideAnnotationStatefulBean.java 2007-01-09 18:02:56 UTC (rev 59444)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.ejb3.test.clusteredsession;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+
+import org.jboss.annotation.ejb.Clustered;
+
+/**
+ * SFSB whose clustering annotations are overridden in xml.
+ *
+ * @author Brian Stansberry
+ * @version $Revision: 57207 $
+ */
+ at Stateful(name="OverrideAnnotationStateful")
+ at Clustered(partition="BogusPartition")
+ at Remote(StatefulRemote.class)
+public class OverrideAnnotationStatefulBean extends NonAnnotationStatefulBean
+{
+
+}
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/StatefulBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/StatefulBean.java 2007-01-09 18:00:48 UTC (rev 59443)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/StatefulBean.java 2007-01-09 18:02:56 UTC (rev 59444)
@@ -1,8 +1,8 @@
/*
- * 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.
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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
@@ -23,163 +23,21 @@
import javax.ejb.Remote;
import javax.ejb.Stateful;
-import javax.ejb.PostActivate;
-import javax.ejb.PrePassivate;
-import javax.ejb.Remove;
-import javax.ejb.EJBException;
-import javax.naming.InitialContext;
-import javax.annotation.PostConstruct;
-import javax.interceptor.Interceptors;
import org.jboss.annotation.ejb.Clustered;
import org.jboss.annotation.ejb.cache.tree.CacheConfig;
-import org.jboss.system.server.ServerConfig;
-import java.rmi.dgc.VMID;
-import org.jboss.logging.Logger;
-
/**
- * SFSB interface
+ * Stateful bean that configures clustering via annotations.
*
* @author Ben Wang
* @version $Revision$
*/
@Stateful(name="testStateful")
@Clustered
-// Mimic explict failover
- at Interceptors({ExplicitFailoverInterceptor.class})
- at CacheConfig(maxSize=1000, idleTimeoutSeconds=3) // this will get evicted the second time eviction thread wakes up
+//@CacheConfig(maxSize=1000, idleTimeoutSeconds=3) // this will get evicted the second time eviction thread wakes up
@Remote(StatefulRemote.class)
-public class StatefulBean implements java.io.Serializable, StatefulRemote
-{
- private Logger log = Logger.getLogger(StatefulBean.class);
- private int counter = 0;
- private String state;
- public transient VMID myId = null;
- public String name;
-
- public int increment()
- {
- System.out.println("INCREMENT - counter: " + (counter++));
- return counter;
- }
-
- public String getHostAddress()
- {
- return System.getProperty(ServerConfig.SERVER_BIND_ADDRESS);
- }
-
- public static int postActivateCalled = 0;
- public static int prePassivateCalled = 0;
-
- /**
- * Sleep to test
- * @throws Exception
- */
- public void longRunning() throws Exception
- {
- log.debug("+++ longRunning() enter ");
- Thread.sleep(20000); // 20000 will break the passivation test now.
- log.debug("+++ longRunning() leave ");
- }
-
- public int getPostActivate()
- {
- return postActivateCalled;
- }
-
- public int getPrePassivate()
- {
- return prePassivateCalled;
- }
-
- public void setState(String state)
- {
- this.state = state;
- }
-
- public String getState()
- {
- log.debug("getState(): entering ...");
- return this.state;
- }
-
- public void reset()
- {
- state = null;
- postActivateCalled = 0;
- prePassivateCalled = 0;
- }
-
- public void resetActivationCounter() {
- postActivateCalled = 0;
- prePassivateCalled = 0;
- }
-
- @PostActivate
- public void postActivate()
- {
- ++postActivateCalled;
- if (this.myId == null)
- {
- //it is a failover: we need to assign ourself an id
- this.myId = new VMID();
- }
- log.debug("Activate. My ID: " + this.myId + " name: " + this.name);
- }
-
- @PrePassivate
- public void prePassivate()
- {
- ++prePassivateCalled;
- log.debug("Passivate. My ID: " + this.myId + " name: " + this.name);
- }
-
- @Remove
- public void remove()
- {
- }
-
- @PostConstruct
- public void ejbCreate()
- {
- this.myId = new VMID();
- log.debug("My ID: " + this.myId);
- }
-
- // Remote Interface implementation ----------------------------------------------
-
- public NodeAnswer getNodeState()
- {
- if (this.myId == null)
- {
- //it is a failover: we need to assign ourself an id because of transient nature
- this.myId = new VMID();
- }
-
- NodeAnswer state = new NodeAnswer(this.myId, this.name);
- log.debug("getNodeState, " + state);
- return state;
- }
-
- public void setName(String name)
- {
- this.name = name;
- log.debug("Name set to " + name);
- }
-
- public void setNameOnlyOnNode(String name, VMID node)
- {
- if (node.equals(this.myId))
- this.setName(name);
- else
- throw new EJBException("Trying to assign value on node " + this.myId + " but this node expected: " + node);
- }
-
- public void setUpFailover(String failover) {
- // To setup the failover property
- log.debug("Setting up failover property: " +failover);
- System.setProperty ("JBossCluster-DoFail", failover);
- }
-
+public class StatefulBean extends NonAnnotationStatefulBean
+{
+ // Only difference from superclass is the added class-level annotations
}
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/unit/BeanUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/unit/BeanUnitTestCase.java 2007-01-09 18:00:48 UTC (rev 59443)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/unit/BeanUnitTestCase.java 2007-01-09 18:02:56 UTC (rev 59444)
@@ -1,8 +1,23 @@
/*
- * JBoss, Home of Professional Open Source
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.
*
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ * 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.clusteredsession.unit;
@@ -22,6 +37,7 @@
* Test SFSB for load-balancing and failover behaviour
*
* @author Ben.Wang at jboss.org
+ * @author Brian Stansberry
* @version $Revision$
*/
public class BeanUnitTestCase extends JBossClusteredTestCase
@@ -62,17 +78,40 @@
public void testBasic()
throws Exception
{
+ basicTest("testStateful/remote");
+ }
+
+ public void testBasicWithoutAnnotation()
+ throws Exception
+ {
+ basicTest("NonAnnotationStateful/remote");
+ }
+
+ public void testBasicWithXMLOverride()
+ throws Exception
+ {
+ basicTest("OverrideAnnotationStateful/remote");
+ }
+
+ public void testBasicWithEjbJarXMLOverride()
+ throws Exception
+ {
+ basicTest("EjbJarOverrideAnnotationStateful/remote");
+ }
+
+ private void basicTest(String jndiBinding) throws Exception
+ {
getLog().debug(++org.jboss.ejb3.test.clusteredsession.unit.BeanUnitTestCase.test +"- "
+"Trying the context...");
// Connect to the server0 JNDI
InitialContext ctx = getInitialContext(0);
- getLog().debug("Test Stateful Bean");
+ getLog().debug("Basic Test with " + jndiBinding);
getLog().debug("==================================");
getLog().debug(++org.jboss.ejb3.test.clusteredsession.unit.BeanUnitTestCase.test +"- "
- +"Looking up testBasic...");
- StatefulRemote stateful = (StatefulRemote) ctx.lookup("testStateful/remote");
+ +"Looking up " + jndiBinding + "...");
+ StatefulRemote stateful = (StatefulRemote) ctx.lookup(jndiBinding);
stateful.setName("The Code");
_sleep(300);
@@ -90,16 +129,40 @@
public void testStatefulBeanCounterFailover()
throws Exception
{
+ statefulBeanCounterFailoverTest("testStateful/remote");
+ }
+
+ public void testStatefulBeanCounterFailoverWithoutAnnotation()
+ throws Exception
+ {
+ statefulBeanCounterFailoverTest("NonAnnotationStateful/remote");
+ }
+
+ public void testStatefulBeanCounterFailoverWithXMLOverride()
+ throws Exception
+ {
+ statefulBeanCounterFailoverTest("OverrideAnnotationStateful/remote");
+ }
+
+ public void testStatefulBeanCounterFailoverWithEjbJarXMLOverride()
+ throws Exception
+ {
+ statefulBeanCounterFailoverTest("EjbJarOverrideAnnotationStateful/remote");
+ }
+
+ private void statefulBeanCounterFailoverTest(String jndiBinding)
+ throws Exception
+ {
getLog().debug(++org.jboss.ejb3.test.clusteredsession.unit.BeanUnitTestCase.test +"- "+"Trying the context...");
// Connect to the server0 JNDI
InitialContext ctx = getInitialContext(0);
- getLog().debug("Test Stateful Bean Failover");
- getLog().debug("==================================");
+ getLog().debug("Test Stateful Bean Counter Failover with " + jndiBinding);
+ getLog().debug("=========================================================");
getLog().debug(++org.jboss.ejb3.test.clusteredsession.unit.BeanUnitTestCase.test +"- "
- +"Looking up testStateful...");
- StatefulRemote stateful = (StatefulRemote) ctx.lookup("testStateful/remote");
+ +"Looking up " + jndiBinding + "...");
+ StatefulRemote stateful = (StatefulRemote) ctx.lookup(jndiBinding);
stateful.setName("The Code");
NodeAnswer node1 = stateful.getNodeState ();
@@ -116,7 +179,7 @@
assertNotNull("State node: ", node2);
getLog ().debug ("Node 2 ID : " +node2);
- assertNotSame ("No failover has occured!", node1.nodeId, node2.nodeId);
+ assertFalse("Failover has occured", node1.nodeId.equals(node2.nodeId));
assertEquals ("Node 1: ", "The Code", node1.answer);
assertEquals ("Node 2: ", "The Code", node2.answer);
@@ -131,16 +194,40 @@
public void testStatefulBeanFailover()
throws Exception
{
+ statefulBeanFailoverTest("testStateful/remote");
+ }
+
+ public void testStatefulBeanFailoverWithoutAnnotation()
+ throws Exception
+ {
+ statefulBeanCounterFailoverTest("NonAnnotationStateful/remote");
+ }
+
+ public void testStatefulBeanFailoverWithXMLOverride()
+ throws Exception
+ {
+ statefulBeanCounterFailoverTest("OverrideAnnotationStateful/remote");
+ }
+
+ public void testStatefulBeanFailoverWithEjbJarXMLOverride()
+ throws Exception
+ {
+ statefulBeanCounterFailoverTest("EjbJarOverrideAnnotationStateful/remote");
+ }
+
+ private void statefulBeanFailoverTest(String jndiBinding)
+ throws Exception
+ {
getLog().debug(++org.jboss.ejb3.test.clusteredsession.unit.BeanUnitTestCase.test +"- "+"Trying the context...");
// Connect to the server0 JNDI
InitialContext ctx = getInitialContext(0);
- getLog().debug("Test Stateful Bean Failover");
- getLog().debug("==================================");
+ getLog().debug("Test Stateful Bean Failover with " + jndiBinding);
+ getLog().debug("================================================");
getLog().debug(++org.jboss.ejb3.test.clusteredsession.unit.BeanUnitTestCase.test +"- "
- +"Looking up testStateful...");
- StatefulRemote stateful = (StatefulRemote) ctx.lookup("testStateful/remote");
+ +"Looking up " + jndiBinding + "...");
+ StatefulRemote stateful = (StatefulRemote) ctx.lookup(jndiBinding);
stateful.setName("Bupple-Dupple");
_sleep(300);
@@ -155,7 +242,7 @@
assertNotNull("State node: ", node2);
getLog ().debug ("Node 2 ID : " +node2);
- assertNotSame ("No failover has occured!", node1.nodeId, node2.nodeId);
+ assertFalse("Failover has occured", node1.nodeId.equals(node2.nodeId));
assertEquals ("Node 1: ", "Bupple-Dupple", node1.answer);
assertEquals ("Node 2: ", "Bupple-Dupple", node2.answer);
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/unit/StatelessUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/unit/StatelessUnitTestCase.java 2007-01-09 18:00:48 UTC (rev 59443)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/unit/StatelessUnitTestCase.java 2007-01-09 18:02:56 UTC (rev 59444)
@@ -68,7 +68,7 @@
getLog().debug("Test Stateless Bean loadbalancing");
getLog().debug("==================================");
getLog().debug(++StatelessUnitTestCase.test +"- "
- +"Looking up testStatless...");
+ +"Looking up clusteredStateless/remote...");
ClusteredStatelessRemote stateless = (ClusteredStatelessRemote) ctx.lookup("clusteredStateless/remote");
NodeAnswer node1 = stateless.getNodeState ();
@@ -78,6 +78,6 @@
NodeAnswer node2 = stateless.getNodeState ();
getLog ().debug ("Node 2 ID : " +node2);
- assertNotSame (node1.nodeId, node2.nodeId);
+ assertFalse(node1.nodeId.equals(node2.nodeId));
}
}
More information about the jboss-cvs-commits
mailing list