[jboss-cvs] JBossAS SVN: r57735 - in branches/JEE5_TCK/ejb3/src: main/org/jboss/ejb3/stateful test/org/jboss/ejb3/test/stateful test/org/jboss/ejb3/test/stateful/unit
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Oct 19 14:57:32 EDT 2006
Author: bdecoste
Date: 2006-10-19 14:57:29 -0400 (Thu, 19 Oct 2006)
New Revision: 57735
Modified:
branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java
branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/stateful/Stateful.java
branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/stateful/StatefulBean.java
branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/stateful/StatelessBean.java
branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/RemoteUnitTestCase.java
Log:
fix and test for local SFSB passivating before 1st invocation
Modified: branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java
===================================================================
--- branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java 2006-10-19 18:41:34 UTC (rev 57734)
+++ branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java 2006-10-19 18:57:29 UTC (rev 57735)
@@ -29,6 +29,7 @@
import org.jboss.ejb3.JBossProxy;
import org.jboss.ejb3.NonSerializableFactory;
import org.jboss.ejb3.ProxyFactoryHelper;
+import org.jboss.logging.Logger;
/**
@@ -39,6 +40,8 @@
*/
public class StatefulLocalProxyFactory extends BaseStatefulProxyFactory
{
+ private static final Logger log = Logger.getLogger(StatefulLocalProxyFactory.class);
+
protected Class[] getInterfaces()
{
Class[] interfaces;
@@ -97,7 +100,9 @@
try
{
StatefulContainer sfsb = (StatefulContainer) container;
- Object id = sfsb.createSession();
+ StatefulBeanContext ctx = sfsb.getCache().create();
+ ctx.inUse = false;
+ Object id = ctx.getId();
Object[] args = {new StatefulLocalProxy(container, id)};
return proxyConstructor.newInstance(args);
}
Modified: branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/stateful/Stateful.java
===================================================================
--- branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/stateful/Stateful.java 2006-10-19 18:41:34 UTC (rev 57734)
+++ branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/stateful/Stateful.java 2006-10-19 18:57:29 UTC (rev 57735)
@@ -47,5 +47,8 @@
public void removeBean();
void testResources() throws Exception;
+
+ void lookupStateful() throws Exception;
+ void testStateful() throws Exception;
}
Modified: branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/stateful/StatefulBean.java
===================================================================
--- branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/stateful/StatefulBean.java 2006-10-19 18:41:34 UTC (rev 57734)
+++ branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/stateful/StatefulBean.java 2006-10-19 18:57:29 UTC (rev 57735)
@@ -74,10 +74,22 @@
@Resource(mappedName="java:/ConnectionFactory")
public transient javax.jms.QueueConnectionFactory connectionFactory;
+
+ private StatefulLocal localStateful;
private String state;
private int stuff;
private boolean wasPassivated = false;
+
+ public void lookupStateful() throws Exception
+ {
+ localStateful = (StatefulLocal)new InitialContext().lookup("StatefulBean/local");
+ }
+
+ public void testStateful() throws Exception
+ {
+ localStateful.getState();
+ }
@Interceptors(MyInterceptor.class)
public String getInterceptorState()
Modified: branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/stateful/StatelessBean.java
===================================================================
--- branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/stateful/StatelessBean.java 2006-10-19 18:41:34 UTC (rev 57734)
+++ branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/stateful/StatelessBean.java 2006-10-19 18:57:29 UTC (rev 57735)
@@ -25,6 +25,8 @@
import javax.ejb.Remote;
import javax.ejb.Stateless;
+import javax.naming.InitialContext;
+
import org.jboss.annotation.ejb.RemoteBinding;
import org.jboss.logging.Logger;
Modified: branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/RemoteUnitTestCase.java
===================================================================
--- branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/RemoteUnitTestCase.java 2006-10-19 18:41:34 UTC (rev 57734)
+++ branches/JEE5_TCK/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/RemoteUnitTestCase.java 2006-10-19 18:57:29 UTC (rev 57735)
@@ -110,7 +110,7 @@
}
}
- public void atestSmallCache() throws Exception
+ public void testSmallCache() throws Exception
{
ConcurrentInvocation[] threads = new ConcurrentInvocation[5];
for (int i = 0; i < 5; i++) threads[i] = new ConcurrentInvocation(i);
@@ -127,7 +127,7 @@
- public void atestStatefulSynchronization() throws Exception
+ public void testStatefulSynchronization() throws Exception
{
SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
SecurityAssociation.setCredential("password".toCharArray());
@@ -137,7 +137,7 @@
}
- public void atestEJBObject() throws Exception
+ public void testEJBObject() throws Exception
{
SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
SecurityAssociation.setCredential("password".toCharArray());
@@ -150,7 +150,7 @@
assertNotNull(stateful);
}
- public void atestStatefulTx() throws Exception
+ public void testStatefulTx() throws Exception
{
SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
SecurityAssociation.setCredential("password".toCharArray());
@@ -175,7 +175,7 @@
}
}
- public void atestTemplateInterfaceTx() throws Exception
+ public void testTemplateInterfaceTx() throws Exception
{
SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
SecurityAssociation.setCredential("password".toCharArray());
@@ -193,7 +193,7 @@
}
}
- public void atestLocalSFSB() throws Exception
+ public void testLocalSFSB() throws Exception
{
SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
SecurityAssociation.setCredential("password".toCharArray());
@@ -213,7 +213,7 @@
}
}
- public void atestNotSerialableSFSB() throws Exception
+ public void testNotSerialableSFSB() throws Exception
{
SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
SecurityAssociation.setCredential("password".toCharArray());
@@ -225,7 +225,7 @@
assertEquals("state", state);
}
- public void atestSFSBInit() throws Exception
+ public void testSFSBInit() throws Exception
{
SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
SecurityAssociation.setCredential("password".toCharArray());
@@ -239,7 +239,7 @@
assertEquals("Extended_init", s);
}
- public void atestStackTrace() throws Exception
+ public void testStackTrace() throws Exception
{
SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
SecurityAssociation.setCredential("password".toCharArray());
@@ -259,7 +259,7 @@
}
}
- public void atestExceptionCase() throws Exception
+ public void testExceptionCase() throws Exception
{
SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
SecurityAssociation.setCredential("password".toCharArray());
@@ -280,7 +280,7 @@
}
}
- public void atestRemoteBindingProxyFactory() throws Exception
+ public void testRemoteBindingProxyFactory() throws Exception
{
SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
SecurityAssociation.setCredential("password".toCharArray());
@@ -289,7 +289,7 @@
assertNotNull(stateful);
}
- public void atestRemoteBindingInterceptorStack() throws Exception
+ public void testRemoteBindingInterceptorStack() throws Exception
{
SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
SecurityAssociation.setCredential("password".toCharArray());
@@ -299,8 +299,25 @@
assertFalse(stateful.interceptorAccessed());
assertTrue(RemoteBindingInterceptor.accessed);
}
+
+ public void testUninstantiatedPassivation() throws Exception
+ {
+ SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
+ SecurityAssociation.setCredential("password".toCharArray());
+
+ Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
+ assertNotNull(stateful);
+ stateful.lookupStateful();
+ Thread.sleep(10 * 1000);
+ stateful.testStateful();
+
+ stateful.lookupStateful();
+ stateful.testStateful();
+ Thread.sleep(10 * 1000);
+ stateful.testStateful();
+ }
- public void atestPassivation() throws Exception
+ public void testPassivation() throws Exception
{
SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
SecurityAssociation.setCredential("password".toCharArray());
@@ -341,7 +358,7 @@
service.testInjection();
}
- public void testClusteredPassivation() throws Exception
+ public void atestClusteredPassivation() throws Exception
{
SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
SecurityAssociation.setCredential("password".toCharArray());
@@ -383,7 +400,7 @@
service.testInjection();
}
- public void atestRemove() throws Exception
+ public void testRemove() throws Exception
{
SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
SecurityAssociation.setCredential("password".toCharArray());
@@ -405,14 +422,14 @@
}
}
- public void atestRemoveWithRollback() throws Exception
+ public void testRemoveWithRollback() throws Exception
{
Tester test = (Tester) getInitialContext().lookup("TesterBean/remote");
test.testRollback1();
test.testRollback2();
}
- public void atestConcurrentAccess() throws Exception
+ public void testConcurrentAccess() throws Exception
{
ConcurrentStateful stateful = (ConcurrentStateful) new InitialContext().lookup("ConcurrentStateful");
stateful.getState();
@@ -461,7 +478,7 @@
assertTrue(wasConcurrentException);
}
- public void atestOverrideConcurrentAccess() throws Exception
+ public void testOverrideConcurrentAccess() throws Exception
{
ConcurrentStateful stateful = (ConcurrentStateful) new InitialContext().lookup("OverrideConcurrentStateful");
stateful.getState();
@@ -489,7 +506,7 @@
assertTrue(wasConcurrentException);
}
- public void atestJmxName() throws Exception
+ public void testJmxName() throws Exception
{
ObjectName deployment = new ObjectName("test.ejb3:name=Bill,service=EJB3");
More information about the jboss-cvs-commits
mailing list