[jboss-cvs] JBossAS SVN: r108940 - in trunk/testsuite: src/main/org/jboss/ejb3/test and 18 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 27 14:02:22 EDT 2010
Author: pferraro
Date: 2010-10-27 14:02:19 -0400 (Wed, 27 Oct 2010)
New Revision: 108940
Added:
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/common/
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/common/unit/
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/common/unit/DBSetup.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/AnnotatedAppException.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/CheckedApplicationException.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ClusteredStateful.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ClusteredStatefulBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ConcurrentStateful.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ConcurrentStatefulBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Entity.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/EntityFacade.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/EntityFacadeBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ExtendedState.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/MyInterceptor.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ProxyFactoryInterface.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/RemoteBindingInterceptor.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/RemoteTx.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/RemoveTest.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/RemoveTestBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ServiceBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ServiceRemote.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/SmallCacheStateful.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/SmallCacheStatefulBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/State.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Stateful.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Stateful21.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulClusteredTimeoutBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulHome.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulInvoker.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulLocal.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulRemoteProxyFactory.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulSyncBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulSyncLocal.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulTimeout.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulTimeoutBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulTx.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulTxBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Stateless.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatelessBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Tester.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/TesterBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/TreeCacheRemovalStatefulBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/TreeCacheStatefulBase.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/TreeCacheStatefulBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/BeanMonitor.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/BeanMonitorBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/DeepNestedStateful.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/DeepNestedStatefulBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/MidLevel.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/PassivationActivationWatcher.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/PassivationActivationWatcherBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/Removable.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/TopLevel.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/VMTracker.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/VMTrackerBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/NestedBeanMonitor.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/NestedBeanMonitorBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/NestedStateful.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/NestedStatefulBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/OptimizedNestedStatefulBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/ParentStatefulBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/ParentStatefulRemote.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/Contained.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/ContainedBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/Customer.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/DeepNestedContained.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/DeepNestedContainedBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/NestedStatelessLocal.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/NestedStatelessSessionBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/NestedXPCMonitor.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/NestedXPCMonitorBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/ShoppingCart.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/ShoppingCartBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/BaseTestRunner.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/ExtendedPersistenceUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/MetricsUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/NestedBeanTestRunner.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/NestedBeanUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/RemoteUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/XPCTestRunner.java
Removed:
trunk/testsuite/src/main/org/jboss/ejb3/test/clusteredentity/
trunk/testsuite/src/main/org/jboss/ejb3/test/common/unit/
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/AnnotatedAppException.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/CheckedApplicationException.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ClusteredStateful.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ClusteredStatefulBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ConcurrentStateful.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ConcurrentStatefulBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Entity.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/EntityFacade.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/EntityFacadeBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ExtendedState.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/MyInterceptor.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ProxyFactoryInterface.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/RemoteBindingInterceptor.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/RemoteTx.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/RemoveTest.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/RemoveTestBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ServiceBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ServiceRemote.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/SmallCacheStateful.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/SmallCacheStatefulBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/State.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Stateful.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Stateful21.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulClusteredTimeoutBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulHome.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulInvoker.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulLocal.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulSyncBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulSyncLocal.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulTimeout.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulTimeoutBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulTx.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulTxBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Stateless.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatelessBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Tester.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/TesterBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/TreeCacheRemovalStatefulBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/TreeCacheStatefulBase.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/TreeCacheStatefulBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/BeanMonitor.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/BeanMonitorBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/DeepNestedStateful.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/DeepNestedStatefulBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/MidLevel.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/PassivationActivationWatcher.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/PassivationActivationWatcherBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/Removable.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/TopLevel.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/VMTracker.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/VMTrackerBean.java
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/std/
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/xpc/
trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/unit/
Modified:
trunk/testsuite/imports/sections/cluster.xml
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/NonAnnotationStatefulBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/ejbthree1053/unit/ConsistentPassivatedStateUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/ClusteredDeepNestedStatefulBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/std/ClusteredLocalNestedStatefulBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/std/ClusteredParentStatefulBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/std/ClusteredRemoteNestedStatefulBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/xpc/ClusteredDeepNestedContainedBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/xpc/ClusteredLocalContainedBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/xpc/ClusteredRemoteContainedBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/xpc/ClusteredShoppingCartBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/unit/ExtendedPersistenceUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/unit/NestedBeanUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/unit/RedeployUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/unit/ScopedExtendedPersistenceUnitTestCase.java
Log:
Refactor org.jboss.ejb3.test into org.jboss.test.cluster.ejb3
Modified: trunk/testsuite/imports/sections/cluster.xml
===================================================================
--- trunk/testsuite/imports/sections/cluster.xml 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/imports/sections/cluster.xml 2010-10-27 18:02:19 UTC (rev 108940)
@@ -897,7 +897,7 @@
<include name="org/jboss/test/cluster/ejb3/clusteredsession/util/*.class"/>
</fileset>
<fileset dir="${build.classes}">
- <include name="org/jboss/ejb3/test/stateful/nested/base/*.class"/>
+ <include name="org/jboss/test/cluster/ejb3/stateful/nested/base/*.class"/>
</fileset>
<fileset dir="${build.resources}/cluster/ejb3/clusteredsession">
<include name="META-INF/*.xml"/>
@@ -915,10 +915,10 @@
<include name="org/jboss/test/cluster/ejb3/clusteredsession/util/*.class"/>
</fileset>
<fileset dir="${build.classes}">
- <include name="org/jboss/ejb3/test/stateful/nested/base/*.class"/>
+ <include name="org/jboss/test/cluster/ejb3/stateful/nested/base/*.class"/>
</fileset>
<fileset dir="${build.classes}">
- <include name="org/jboss/ejb3/test/stateful/nested/base/std/*.class"/>
+ <include name="org/jboss/test/cluster/ejb3/stateful/nested/base/std/*.class"/>
</fileset>
</jar>
@@ -932,10 +932,10 @@
<include name="org/jboss/test/cluster/ejb3/clusteredsession/util/*.class"/>
</fileset>
<fileset dir="${build.classes}">
- <include name="org/jboss/ejb3/test/stateful/nested/base/*.class"/>
+ <include name="org/jboss/test/cluster/ejb3/stateful/nested/base/*.class"/>
</fileset>
<fileset dir="${build.classes}">
- <include name="org/jboss/ejb3/test/stateful/nested/base/xpc/*.class"/>
+ <include name="org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/*.class"/>
</fileset>
<fileset dir="${build.resources}/cluster/ejb3/clusteredsession/xpc">
<include name="META-INF/persistence.xml"/>
@@ -950,10 +950,10 @@
<include name="org/jboss/test/cluster/ejb3/clusteredsession/util/*.class"/>
</fileset>
<fileset dir="${build.classes}">
- <include name="org/jboss/ejb3/test/stateful/nested/base/*.class"/>
+ <include name="org/jboss/test/cluster/ejb3/stateful/nested/base/*.class"/>
</fileset>
<fileset dir="${build.classes}">
- <include name="org/jboss/ejb3/test/stateful/nested/base/xpc/*.class"/>
+ <include name="org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/*.class"/>
</fileset>
<fileset dir="${build.resources}/cluster/ejb3/clusteredsession/xpc">
<include name="META-INF/persistence.xml"/>
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/AnnotatedAppException.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/AnnotatedAppException.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/AnnotatedAppException.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,41 +0,0 @@
-/*
- * 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.stateful;
-
-import javax.ejb.ApplicationException;
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
- at ApplicationException
-public class AnnotatedAppException extends RuntimeException
-{
- public AnnotatedAppException()
- {
- super();
- }
-
- public AnnotatedAppException(String s)
- {
- super(s);
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/CheckedApplicationException.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/CheckedApplicationException.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/CheckedApplicationException.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,38 +0,0 @@
-/*
- * 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.stateful;
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
-public class CheckedApplicationException extends RuntimeException
-{
- public CheckedApplicationException()
- {
- super();
- }
-
- public CheckedApplicationException(String s)
- {
- super(s);
- }
-}
\ No newline at end of file
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ClusteredStateful.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ClusteredStateful.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ClusteredStateful.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,45 +0,0 @@
-/*
- * 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.stateful;
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
-public interface ClusteredStateful extends ConcurrentStateful
-{
- boolean interceptorAccessed();
-
- boolean testSessionContext();
-
- boolean wasPassivated();
- String getInterceptorState();
- void setInterceptorState(String param);
-
- void testThrownException() throws Exception;
-
- void testExceptionCause() throws Exception;
- void testSerializedState(String state);
-
- void removeBean();
-
- void testResources() throws Exception;
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ClusteredStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ClusteredStatefulBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ClusteredStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,208 +0,0 @@
-/*
- * 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.stateful;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
-import javax.annotation.Resource;
-import javax.annotation.Resources;
-import javax.ejb.Init;
-import javax.ejb.Local;
-import javax.ejb.PostActivate;
-import javax.ejb.PrePassivate;
-import javax.ejb.Remote;
-import javax.ejb.SessionContext;
-import javax.ejb.Stateful;
-import javax.interceptor.Interceptors;
-import javax.naming.InitialContext;
-
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.annotation.CacheConfig;
-import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.SecurityDomain;
-import org.jboss.ejb3.annotation.defaults.RemoteBindingDefaults;
-import org.jboss.logging.Logger;
-import org.jboss.serial.io.JBossObjectInputStream;
-import org.jboss.serial.io.JBossObjectOutputStream;
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
- at Stateful(name="ClusteredStatefulBean")
- at Remote(org.jboss.ejb3.test.stateful.ClusteredStateful.class)
- at Local(org.jboss.ejb3.test.stateful.StatefulLocal.class)
- at RemoteBinding(jndiBinding = "ClusteredStateful",
- interceptorStack="RemoteBindingStatefulSessionClientInterceptors",
- factory = RemoteBindingDefaults.PROXY_FACTORY_STATEFUL_REMOTE)
- at CacheConfig(maxSize = 1000, idleTimeoutSeconds = 1, name="jboss.cache:service=EJB3SFSBClusteredCache")
- at SecurityDomain("test")
- at Resources({@Resource(name="jdbc/ds", mappedName="java:/DefaultDS")})
- at Clustered
-public class ClusteredStatefulBean implements ClusteredStateful
-{
- private static final Logger log = Logger.getLogger(ClusteredStatefulBean.class);
-
- @Resource
- private SessionContext sessionContext;
-
-// @Resource(mappedName="java:/DefaultDS")
-// private transient javax.sql.DataSource datasource;
-
-// @Resource(mappedName="java:/ConnectionFactory")
-// public transient javax.jms.QueueConnectionFactory connectionFactory;
-
- private String state;
- private int stuff;
- private boolean wasPassivated = false;
-
- @Interceptors(MyInterceptor.class)
- public String getInterceptorState()
- {
- throw new RuntimeException("NOT REACHABLE");
- }
-
- @Interceptors(MyInterceptor.class)
- public void setInterceptorState(String param)
- {
- throw new RuntimeException("NOT REACHABLE");
- }
-
- public boolean testSessionContext()
- {
- return sessionContext.isCallerInRole("role");
- }
-
- public void testResources() throws Exception
- {
-// datasource.toString();
-// connectionFactory.toString();
-
- javax.sql.DataSource ds = (javax.sql.DataSource)new InitialContext().lookup(Container.ENC_CTX_NAME + "/env/jdbc/ds");
- ds.toString();
- }
-
- public String getState() throws Exception
- {
- Thread.sleep(1000);
- return state;
- }
-
- public void setState(String state) throws Exception
- {
- Thread.sleep(1000);
- this.state = state;
- }
-
- public boolean interceptorAccessed()
- {
- return RemoteBindingInterceptor.accessed;
- }
-
- public void testThrownException() throws Exception
- {
- throw new Exception();
- }
-
- public void testExceptionCause() throws Exception
- {
- Object o = null;
- o.toString();
- }
-
- @PrePassivate
- public void passivate()
- {
- log.info("************ passivating " + this);
- wasPassivated = true;
- }
-
- @PostActivate
- public void activate()
- {
- log.info("************ activating");
- }
-
- public void testSerializedState(String state)
- {
- this.state = state;
-
- ClusteredStatefulBean bean = null;
- try
- {
- ObjectOutputStream out;
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- out = new JBossObjectOutputStream(baos, false);
- out.writeObject(this);
- out.flush();
-
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-
- JBossObjectInputStream is = new JBossObjectInputStream(bais);
- bean = (ClusteredStatefulBean)is.readObject();
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- catch (ClassNotFoundException e)
- {
- throw new RuntimeException(e);
- }
-
- if (!state.equals(bean.state)) throw new RuntimeException("failed to serialize: " + bean.state);
- }
-
- public boolean wasPassivated()
- {
- log.info("************ wasPassivated " + wasPassivated + " " + this);
- return wasPassivated;
- }
-
- @Init
- public void ejbCreate(Integer state)
- {
- this.state=state.toString();
- }
-
- @Init
- public void ejbCreate(State state)
- {
- this.state=state.getState();
- }
-
- @Init
- public void ejbCreate(String state)
- {
- this.state=state;
- }
-
- public void removeBean()
- {
-
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ConcurrentStateful.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ConcurrentStateful.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ConcurrentStateful.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,37 +0,0 @@
-/*
- * 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.stateful;
-
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public interface ConcurrentStateful
-{
- String getState() throws Exception;
-
- void setState(String state) throws Exception;
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ConcurrentStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ConcurrentStatefulBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ConcurrentStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,56 +0,0 @@
-/*
- * 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.stateful;
-
-import javax.ejb.Remote;
-import javax.ejb.Stateful;
-
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.SerializedConcurrentAccess;
-import org.jboss.logging.Logger;
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
- at Stateful
- at Remote(ConcurrentStateful.class)
- at SerializedConcurrentAccess
-public class ConcurrentStatefulBean implements ConcurrentStateful
-{
- private static final Logger log = Logger.getLogger(ConcurrentStatefulBean.class);
-
- private String state;
-
- public String getState() throws Exception
- {
- Thread.sleep(1000);
- return state;
- }
-
- public void setState(String state) throws Exception
- {
- this.state = state;
- Thread.sleep(1000);
- }
-
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Entity.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Entity.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Entity.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,60 +0,0 @@
-/*
- * 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.stateful;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-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;
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/EntityFacade.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/EntityFacade.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/EntityFacade.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,43 +0,0 @@
-/*
- * 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.stateful;
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
-public interface EntityFacade
-{
- public static enum REMOVE_EXCEPTION_TYPE
- {
- NONE, CHECKED, APPLICATION, RUNTIME,
- }
-
- Entity createEntity(String name);
-
- Entity loadEntity(Long id);
-
- void remove();
-
- void removeWithTx();
-
- void setThrowRemoveException(REMOVE_EXCEPTION_TYPE throwDestroyException);
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/EntityFacadeBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/EntityFacadeBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/EntityFacadeBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,123 +0,0 @@
-/*
- * 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.stateful;
-
-import javax.annotation.PreDestroy;
-import javax.ejb.PostActivate;
-import javax.ejb.PrePassivate;
-import javax.ejb.Remote;
-import javax.ejb.Remove;
-import javax.ejb.Stateful;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-
-import org.jboss.ejb3.annotation.CacheConfig;
-import org.jboss.logging.Logger;
-
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
- at Stateful
- at Remote(EntityFacade.class)
- at CacheConfig(maxSize = 1000, idleTimeoutSeconds = 1)
- at TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
-public class EntityFacadeBean implements EntityFacade
-{
- private @PersistenceContext(type = PersistenceContextType.EXTENDED)
- EntityManager manager;
-
- private static final Logger log = Logger.getLogger(EntityFacadeBean.class);
-
- private static REMOVE_EXCEPTION_TYPE throwRemoveException = REMOVE_EXCEPTION_TYPE.NONE;
-
- public Entity createEntity(String name) {
- log.info("********* createEntity " + name);
- Entity entity = new Entity();
- entity.setName(name);
- manager.persist(entity);
- return entity;
- }
-
- public void setThrowRemoveException(REMOVE_EXCEPTION_TYPE throwRemoveException)
- {
- this.throwRemoveException = throwRemoveException;
- }
-
- public Entity loadEntity(Long id) {
- log.info("********* loadEntity " + id);
- Entity entity = manager.find(Entity.class, id);
- return entity;
- }
-
- @PrePassivate
- public void passivate()
- {
- log.info("************ passivating");
- }
-
- @PostActivate
- public void activate()
- {
- log.info("************ activating");
- }
-
- @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
- @Remove(retainIfException=true)
- public void remove() throws CheckedApplicationException
- {
- log.info("************ removing no tx");
-
- if (throwRemoveException == REMOVE_EXCEPTION_TYPE.APPLICATION)
- throw new AnnotatedAppException("From @Remove");
-
- if (throwRemoveException == REMOVE_EXCEPTION_TYPE.CHECKED)
- throw new CheckedApplicationException("From @Remove");
-
- if (throwRemoveException == REMOVE_EXCEPTION_TYPE.RUNTIME)
- throw new RuntimeException("From @Remove");
- }
-
- @Remove(retainIfException=true)
- public void removeWithTx()
- {
- log.info("************ removing with tx");
-
- if (throwRemoveException == REMOVE_EXCEPTION_TYPE.APPLICATION)
- throw new AnnotatedAppException("From @Remove");
-
- if (throwRemoveException == REMOVE_EXCEPTION_TYPE.CHECKED)
- throw new CheckedApplicationException("From @Remove");
-
- if (throwRemoveException == REMOVE_EXCEPTION_TYPE.RUNTIME)
- throw new RuntimeException("From @Remove");
- }
-
- @PreDestroy
- public void destroy()
- {
- log.info("************ destroying ");
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ExtendedState.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ExtendedState.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ExtendedState.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,36 +0,0 @@
-/*
- * 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.stateful;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public class ExtendedState extends State
-{
- public ExtendedState(String state)
- {
- super("Extended_" + state);
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/MyInterceptor.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/MyInterceptor.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/MyInterceptor.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,47 +0,0 @@
-/*
- * 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.stateful;
-
-import javax.interceptor.AroundInvoke;
-import javax.interceptor.InvocationContext;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class MyInterceptor
-{
- Object field;
-
- @AroundInvoke
- public Object invoke(InvocationContext ctx) throws Exception
- {
- if (ctx.getMethod().getName().startsWith("set"))
- {
- field = ctx.getParameters()[0];
- return null;
- }
- return field;
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ProxyFactoryInterface.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ProxyFactoryInterface.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ProxyFactoryInterface.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,36 +0,0 @@
-/*
- * 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.stateful;
-
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public interface ProxyFactoryInterface
-{
- String method();
-
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/RemoteBindingInterceptor.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/RemoteBindingInterceptor.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/RemoteBindingInterceptor.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,60 +0,0 @@
-/*
- * 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.stateful;
-
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.logging.Logger;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public class RemoteBindingInterceptor implements Interceptor, java.io.Serializable
-{
- private static final Logger log = Logger.getLogger(RemoteBindingInterceptor.class);
-
- public static boolean accessed = false;
-
- public RemoteBindingInterceptor()
- {
- }
-
- public String getName()
- {
- return "RemoteBindingInterceptor";
- }
-
- public Object invoke(Invocation invocation) throws Throwable
- {
- try
- {
- return invocation.invokeNext();
- }
- finally
- {
- accessed = true;
- }
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/RemoteTx.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/RemoteTx.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/RemoteTx.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,34 +0,0 @@
-/*
- * 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.stateful;
-
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
-public interface RemoteTx<T>
-{
- T testMandatoryTx(T t);
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/RemoveTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/RemoveTest.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/RemoveTest.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,39 +0,0 @@
-/*
- * 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.stateful;
-
-import javax.ejb.Remove;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public interface RemoveTest
-{
- @Remove
- void callRollbackOnly();
-
- @Remove
- void removeit();
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/RemoveTestBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/RemoveTestBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/RemoveTestBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,52 +0,0 @@
-/*
- * 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.stateful;
-
-import javax.ejb.Stateful;
-import javax.ejb.Remove;
-import javax.ejb.SessionContext;
-import javax.annotation.Resource;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
- at Stateful
-public class RemoveTestBean implements RemoveTest
-{
- @Resource SessionContext ctx;
-
- @Remove
- public void callRollbackOnly()
- {
- ctx.setRollbackOnly();
- }
-
- @Remove
- public void removeit()
- {
- ctx.setRollbackOnly();
- }
-
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ServiceBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ServiceBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ServiceBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,53 +0,0 @@
-/*
- * 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.stateful;
-
-import javax.ejb.EJB;
-import javax.ejb.Remote;
-
-import org.jboss.ejb3.annotation.SecurityDomain;
-import org.jboss.ejb3.annotation.Service;
-import org.jboss.logging.Logger;
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
- at Service
- at Remote(ServiceRemote.class)
- at SecurityDomain("other")
-public class ServiceBean implements ServiceRemote
-{
- private static final Logger log = Logger.getLogger(ServiceBean.class);
-
- @EJB(beanName="StatefulBean")
- private Stateful stateful;
-
- @EJB
- private ClusteredStateful clusteredStateful;
-
- public void testInjection() throws Exception
- {
- stateful.getState();
-
- clusteredStateful.getState();
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ServiceRemote.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ServiceRemote.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/ServiceRemote.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,30 +0,0 @@
-/*
- * 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.stateful;
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
-public interface ServiceRemote
-{
- void testInjection() throws Exception;
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/SmallCacheStateful.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/SmallCacheStateful.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/SmallCacheStateful.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,12 +0,0 @@
-package org.jboss.ejb3.test.stateful;
-
-import javax.ejb.Remote;
-
- at Remote
-public interface SmallCacheStateful
-{
- public void setId(int id);
-
- public int doit(int id);
-
-}
\ No newline at end of file
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/SmallCacheStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/SmallCacheStatefulBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/SmallCacheStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,61 +0,0 @@
-/*
- * 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.stateful;
-
-import javax.ejb.Stateful;
-
-import org.jboss.ejb3.annotation.CacheConfig;
-
-/**
- * Test small maxSize for cache
- *
- * @author <a href="mailto:bill at jboss.com">Bill Burke</a>
- * @version $Revision$
- */
- at Stateful
- at CacheConfig(maxSize = 1000, idleTimeoutSeconds = 1)
-public class SmallCacheStatefulBean implements SmallCacheStateful
-{
- private int count;
- private int id;
-
-
- public void setId(int id)
- {
- this.id = id;
- }
-
-
- public int doit(int passedId)
- {
- if (passedId != id) throw new RuntimeException();
- try
- {
- Thread.sleep(3000);
- }
- catch (InterruptedException e)
- {
-
- }
- return count++;
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/State.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/State.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/State.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,48 +0,0 @@
-/*
- * 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.stateful;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public class State implements java.io.Serializable
-{
- protected String state;
-
- public State(String state)
- {
- this.state = state;
- }
-
- public String getState()
- {
- return state;
- }
-
- public void setState(String state)
- {
- this.state = state;
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Stateful.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Stateful.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Stateful.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,56 +0,0 @@
-/*
- * 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.stateful;
-
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public interface Stateful extends ConcurrentStateful
-{
- boolean interceptorAccessed();
-
- boolean testSessionContext();
-
- public boolean wasPassivated();
- public void clearPassivated();
- public String getInterceptorState();
- public void setInterceptorState(String param);
-
- public void testThrownException() throws Exception;
-
- public void testExceptionCause() throws Exception;
- public void testSerializedState(String state);
-
- public void removeMe();
- public int beansRemoved();
-
- void testResources() throws Exception;
-
- void lookupStateful() throws Exception;
- void testStateful() throws Exception;
-
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Stateful21.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Stateful21.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Stateful21.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, 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.stateful;
-
-import javax.ejb.EJBObject;
-
-/**
- * A remote interface for a stateful bean.
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision$
- */
-public interface Stateful21 extends Stateful, EJBObject
-{
-
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,236 +0,0 @@
-/*
- * 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.stateful;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
-import javax.annotation.Resource;
-import javax.annotation.Resources;
-import javax.ejb.Init;
-import javax.ejb.Local;
-import javax.ejb.PostActivate;
-import javax.ejb.PrePassivate;
-import javax.ejb.Remote;
-import javax.ejb.SessionContext;
-import javax.ejb.Stateful;
-import javax.interceptor.Interceptors;
-import javax.naming.InitialContext;
-
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.annotation.CacheConfig;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.SecurityDomain;
-import org.jboss.ejb3.annotation.defaults.RemoteBindingDefaults;
-import org.jboss.logging.Logger;
-import org.jboss.serial.io.JBossObjectInputStream;
-import org.jboss.serial.io.JBossObjectOutputStream;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
- at Stateful(name="StatefulBean")
- at Remote({org.jboss.ejb3.test.stateful.Stateful.class})
- at Local(org.jboss.ejb3.test.stateful.StatefulLocal.class)
- at RemoteBinding(jndiBinding = "Stateful",
- interceptorStack="RemoteBindingStatefulSessionClientInterceptors",
- factory = RemoteBindingDefaults.PROXY_FACTORY_STATEFUL_REMOTE)
- at CacheConfig(maxSize = 1000, idleTimeoutSeconds = 5)
- at SecurityDomain("test")
- at Resources({@Resource(name="jdbc/ds", mappedName="java:/DefaultDS")})
-public class StatefulBean implements org.jboss.ejb3.test.stateful.Stateful
-{
- private static final Logger log = Logger.getLogger(StatefulBean.class);
-
- private static int beansRemoved = 0;
-
- @Resource
- private SessionContext sessionContext;
-
- @Resource(mappedName="java:/DefaultDS")
- private transient javax.sql.DataSource datasource;
-
- @Resource(mappedName="java:/ConnectionFactory")
- public transient javax.jms.QueueConnectionFactory connectionFactory;
-
- private StatefulLocal localStateful;
-
- private String state;
- private boolean wasPassivated = false;
-
- public void lookupStateful() throws Exception
- {
- localStateful = (StatefulLocal)new InitialContext().lookup("StatefulBean/local");
- log.info("lookup localStateful " + localStateful);
- }
-
- public void testStateful() throws Exception
- {
- log.info("get state of localStateful " + localStateful);
- localStateful.getState();
- }
-
- @Interceptors(MyInterceptor.class)
- public String getInterceptorState()
- {
- throw new RuntimeException("NOT REACHABLE");
- }
-
- @Interceptors(MyInterceptor.class)
- public void setInterceptorState(String param)
- {
- throw new RuntimeException("NOT REACHABLE");
- }
-
- public boolean testSessionContext()
- {
- return sessionContext.isCallerInRole("role");
- }
-
- public void testResources() throws Exception
- {
- if(datasource == null)
- throw new IllegalStateException("transient property datasource was not injected");
- if(connectionFactory == null)
- throw new IllegalStateException("transient property connectionFactory was not injected");
-
- javax.sql.DataSource ds = (javax.sql.DataSource)new InitialContext().lookup(Container.ENC_CTX_NAME + "/env/jdbc/ds");
- ds.toString();
- }
-
- public String getState() throws Exception
- {
- Thread.sleep(1000);
- return state;
- }
-
- public void setState(String state) throws Exception
- {
- Thread.sleep(1000);
- this.state = state;
- }
-
- public boolean interceptorAccessed()
- {
- return RemoteBindingInterceptor.accessed;
- }
-
- public void testThrownException() throws Exception
- {
- throw new Exception();
- }
-
- public void testExceptionCause() throws Exception
- {
- Object o = null;
- o.toString();
- }
-
- @PrePassivate
- public void passivate()
- {
- log.info("************ passivating");
- wasPassivated = true;
- }
-
- @PostActivate
- public void activate()
- {
- log.info("************ activating");
- }
-
- public void testSerializedState(String state)
- {
- this.state = state;
-
- StatefulBean bean = null;
- try
- {
- ObjectOutputStream out;
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- out = new JBossObjectOutputStream(baos, false);
- out.writeObject(this);
- out.flush();
-
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-
- JBossObjectInputStream is = new JBossObjectInputStream(bais);
- bean = (StatefulBean)is.readObject();
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- catch (ClassNotFoundException e)
- {
- throw new RuntimeException(e);
- }
-
- if (!state.equals(bean.state)) throw new RuntimeException("failed to serialize: " + bean.state);
- }
-
- public boolean wasPassivated()
- {
- return wasPassivated;
- }
-
- public void clearPassivated()
- {
- wasPassivated = false;
- }
-
- @Init
- public void ejbCreate(Integer state)
- {
- this.state=state.toString();
- }
-
- @Init
- public void ejbCreate(State state)
- {
- this.state=state.getState();
- }
-
- @Init
- public void ejbCreate(String state)
- {
- this.state=state;
- }
-
- public int beansRemoved()
- {
- return beansRemoved;
- }
-
- // @Remove from xml
- public void removeMe()
- {
- ++beansRemoved;
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulClusteredTimeoutBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulClusteredTimeoutBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulClusteredTimeoutBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,51 +0,0 @@
-/*
- * 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.stateful;
-
-import javax.ejb.Remote;
-import javax.ejb.Remove;
-import javax.ejb.Stateful;
-
-import org.jboss.ejb3.annotation.CacheConfig;
-import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.logging.Logger;
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
- at Stateful
- at Remote(StatefulTimeout.class)
- at CacheConfig(removalTimeoutSeconds = 1)
- at Clustered
-public class StatefulClusteredTimeoutBean implements StatefulTimeout
-{
- private static final Logger log = Logger.getLogger(StatefulClusteredTimeoutBean.class);
-
- public void test()
- {
- }
-
- @Remove
- public void remove()
- {
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulHome.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulHome.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulHome.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,36 +0,0 @@
-/*
- * 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.stateful;
-
-import javax.ejb.EJBHome;
-
-/**
- * @version <tt>$Revision$</tt>
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
-public interface StatefulHome extends EJBHome {
-
- public Stateful21 create() throws java.rmi.RemoteException, javax.ejb.CreateException;
-
- public Stateful21 create(State state) throws java.rmi.RemoteException, javax.ejb.CreateException;
-}
-
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulInvoker.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulInvoker.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulInvoker.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,61 +0,0 @@
-/*
- * 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.stateful;
-
-import org.jboss.logging.Logger;
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public class StatefulInvoker extends Thread
-{
- private static final Logger log = Logger.getLogger(StatefulInvoker.class);
-
- Exception exception = null;
-
- ConcurrentStateful stateful;
-
- public StatefulInvoker(ConcurrentStateful stateful)
- {
- this.stateful = stateful;
- }
-
- public Exception getException()
- {
- return exception;
- }
-
- public void run()
- {
- try
- {
- stateful.setState("state");
- stateful.getState();
- }
- catch(Exception e)
- {
- exception = e;
- }
- }
-
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulLocal.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulLocal.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulLocal.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,36 +0,0 @@
-/*
- * 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.stateful;
-
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public interface StatefulLocal
-{
- String getState();
-
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulRemoteProxyFactory.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,46 +0,0 @@
-/*
- * 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.stateful;
-
-import org.jboss.aop.Advisor;
-import org.jboss.ejb3.proxy.impl.factory.session.stateful.StatefulSessionRemoteProxyFactory;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public class StatefulRemoteProxyFactory extends StatefulSessionRemoteProxyFactory
-{
- @SuppressWarnings("unused")
- private static final Logger log = Logger.getLogger(StatefulRemoteProxyFactory.class);
-
- public StatefulRemoteProxyFactory(final String name, final String containerName, final String containerGuid,
- final JBossSessionBeanMetaData metadata, final ClassLoader classloader, final String url,
- final Advisor advisor, final String interceptorStackName)
- {
- super(name, containerName, containerGuid, metadata, classloader, url, advisor, interceptorStackName);
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulSyncBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulSyncBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulSyncBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,77 +0,0 @@
-/*
- * 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.stateful;
-
-import java.rmi.RemoteException;
-import javax.ejb.EJBException;
-import javax.ejb.SessionSynchronization;
-import javax.ejb.Stateful;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
- at Stateful
-public class StatefulSyncBean implements SessionSynchronization, StatefulSyncLocal, java.io.Serializable
-{
- private String state;
- private String rollbackState;
- private boolean beforeCalled;
-
- public boolean isBeforeCalled()
- {
- return beforeCalled;
- }
-
- public void setBeforeCalled(boolean beforeCalled)
- {
- this.beforeCalled = beforeCalled;
- }
-
- public String getState()
- {
- return state;
- }
-
- public void setState(String state)
- {
- this.state = state;
- }
-
-
- public void afterBegin() throws EJBException, RemoteException
- {
- rollbackState = state;
- }
-
- public void beforeCompletion() throws EJBException, RemoteException
- {
- beforeCalled = true;
- }
-
- public void afterCompletion(boolean committed) throws EJBException, RemoteException
- {
- if (!committed) state = rollbackState;
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulSyncLocal.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulSyncLocal.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulSyncLocal.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,41 +0,0 @@
-/*
- * 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.stateful;
-
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public interface StatefulSyncLocal
-{
- boolean isBeforeCalled();
-
- void setBeforeCalled(boolean beforeCalled);
-
- String getState();
-
- void setState(String state);
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulTimeout.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulTimeout.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulTimeout.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,35 +0,0 @@
-/*
- * 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.stateful;
-
-
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
-public interface StatefulTimeout
-{
- void test();
-
- void remove();
-
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulTimeoutBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulTimeoutBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulTimeoutBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,49 +0,0 @@
-/*
- * 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.stateful;
-
-import javax.ejb.Remote;
-import javax.ejb.Remove;
-import javax.ejb.Stateful;
-
-import org.jboss.ejb3.annotation.CacheConfig;
-import org.jboss.logging.Logger;
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
- at Stateful
- at Remote(StatefulTimeout.class)
- at CacheConfig(removalTimeoutSeconds = 1)
-public class StatefulTimeoutBean implements StatefulTimeout
-{
- private static final Logger log = Logger.getLogger(StatefulTimeoutBean.class);
-
- public void test()
- {
- }
-
- @Remove
- public void remove()
- {
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulTx.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulTx.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulTx.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,41 +0,0 @@
-/*
- * 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.stateful;
-
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
-public interface StatefulTx extends RemoteTx<State>
-{
- boolean isGlobalTransacted() throws javax.transaction.SystemException;
-
- boolean isLocalTransacted() throws javax.transaction.SystemException;
-
- boolean testNewTx() throws javax.transaction.SystemException;
-
- void testTxRollback();
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulTxBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulTxBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatefulTxBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,84 +0,0 @@
-/*
- * 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.stateful;
-
-import javax.annotation.security.RolesAllowed;
-import javax.ejb.Remote;
-import javax.ejb.Stateful;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
-import javax.transaction.TransactionManager;
-
-import org.jboss.ejb3.annotation.JndiInject;
-import org.jboss.ejb3.annotation.SecurityDomain;
-import org.jboss.logging.Logger;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version $Revision$
- */
- at Stateful
- at Remote(StatefulTx.class)
- at TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
- at SecurityDomain("test")
-public class StatefulTxBean implements StatefulTx
-{
- private static final Logger log = Logger.getLogger(StatefulTxBean.class);
-
- @JndiInject(jndiName="java:/TransactionManager") private TransactionManager tm;
-
- @RolesAllowed("allowed")
- public boolean isGlobalTransacted() throws javax.transaction.SystemException
- {
- return (tm.getTransaction() != null);
- }
-
- @TransactionAttribute(TransactionAttributeType.REQUIRED)
- @RolesAllowed("allowed")
- public boolean isLocalTransacted() throws javax.transaction.SystemException
- {
- return (tm.getTransaction() != null);
- }
-
- @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
- @RolesAllowed("allowed")
- public boolean testNewTx() throws javax.transaction.SystemException
- {
- return (tm.getTransaction() != null);
- }
-
- @TransactionAttribute(TransactionAttributeType.REQUIRED)
- @RolesAllowed("allowed")
- public void testTxRollback()
- {
- throw new RuntimeException("test rollback");
- }
-
- @TransactionAttribute(value = TransactionAttributeType.MANDATORY)
- @RolesAllowed("allowed")
- public State testMandatoryTx(State o)
- {
- return o;
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Stateless.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Stateless.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Stateless.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,30 +0,0 @@
-/*
- * 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.stateful;
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
-public interface Stateless
-{
- void testInjection() throws Exception;
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatelessBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatelessBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/StatelessBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,55 +0,0 @@
-/*
- * 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.stateful;
-
-import javax.ejb.EJB;
-import javax.ejb.Remote;
-import javax.ejb.Stateless;
-
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.SecurityDomain;
-import org.jboss.logging.Logger;
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
- at Stateless(name="StatelessBean")
- at RemoteBinding(jndiBinding = "Stateless")
- at Remote(org.jboss.ejb3.test.stateful.Stateless.class)
- at SecurityDomain("test")
-public class StatelessBean implements org.jboss.ejb3.test.stateful.Stateless
-{
- private static final Logger log = Logger.getLogger(StatelessBean.class);
-
- @EJB(beanName="StatefulBean")
- private Stateful stateful;
-
- @EJB
- private ClusteredStateful clusteredStateful;
-
- public void testInjection() throws Exception
- {
- stateful.getState();
-
- clusteredStateful.getState();
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Tester.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Tester.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/Tester.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,39 +0,0 @@
-/*
- * 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.stateful;
-
-
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public interface Tester
-{
- void testSessionSynchronization() throws Exception;
-
- void testRollback1() throws Exception;
-
- void testRollback2() throws Exception;
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/TesterBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/TesterBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/TesterBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,79 +0,0 @@
-/*
- * 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.stateful;
-
-import javax.annotation.Resource;
-import javax.ejb.Remote;
-import javax.ejb.Stateless;
-import javax.ejb.TransactionManagement;
-import javax.ejb.TransactionManagementType;
-import javax.naming.InitialContext;
-import javax.transaction.UserTransaction;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
- at Stateless()
- at TransactionManagement(TransactionManagementType.BEAN)
- at Remote(Tester.class)
-public class TesterBean implements Tester
-{
- @Resource private UserTransaction ut;
-
- public void testSessionSynchronization() throws Exception
- {
- StatefulSyncLocal sfsb = (StatefulSyncLocal)new InitialContext().lookup("StatefulSyncBean/local");
- sfsb.setState("hello");
- sfsb.setBeforeCalled(false);
-
- ut.begin();
- sfsb.setState("world");
- ut.rollback();
-
- if (!sfsb.getState().equals("hello")) throw new RuntimeException("rollback didn't work");
- if (!sfsb.isBeforeCalled()) throw new RuntimeException("BEFORE WAS NOT CALLED");
-
- // test new proxy
-
- sfsb = (StatefulSyncLocal)new InitialContext().lookup("StatefulSyncBean/local");
- if (sfsb.getState() != null) throw new RuntimeException("State should be null: " + sfsb.getState());
- }
-
- public void testRollback1() throws Exception
- {
- RemoveTest test = (RemoveTest)new InitialContext().lookup("RemoveTestBean/local");
- ut.begin();
- test.callRollbackOnly();
- ut.rollback();
- }
- public void testRollback2() throws Exception
- {
- RemoveTest test = (RemoveTest)new InitialContext().lookup("RemoveTestBean/local");
- ut.begin();
- ut.setRollbackOnly();
- test.removeit();
- ut.rollback();
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/TreeCacheRemovalStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/TreeCacheRemovalStatefulBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/TreeCacheRemovalStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,54 +0,0 @@
-/*
- * 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.stateful;
-
-import javax.annotation.Resource;
-import javax.annotation.Resources;
-import javax.ejb.Local;
-import javax.ejb.Remote;
-import javax.ejb.Stateful;
-
-import org.jboss.ejb3.annotation.Cache;
-import org.jboss.ejb3.annotation.CacheConfig;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.SecurityDomain;
-import org.jboss.ejb3.annotation.defaults.RemoteBindingDefaults;
-
-/**
- * Same as TreeCacheStatefulBean, but configures a removalTimeoutSeconds to
- * validate metrics when a removal thread is used.
- *
- * @author Brian Stansberry
- */
- at Stateful(name = "TreeCacheRemovalStatefulBean")
- at Remote(org.jboss.ejb3.test.stateful.Stateful.class)
- at Local(org.jboss.ejb3.test.stateful.StatefulLocal.class)
- at RemoteBinding(jndiBinding = "TreeCacheRemovalStateful", interceptorStack = "RemoteBindingStatefulSessionClientInterceptors", factory = RemoteBindingDefaults.PROXY_FACTORY_STATEFUL_REMOTE)
- at CacheConfig(name = "jboss.cache:service=EJB3SFSBClusteredCache", maxSize = 1000, idleTimeoutSeconds = 1, removalTimeoutSeconds = 20)
- at SecurityDomain("test")
- at Resources(
-{@Resource(name = "jdbc/ds", mappedName = "java:/DefaultDS")})
- at Cache("StatefulTreeCache")
-public class TreeCacheRemovalStatefulBean extends TreeCacheStatefulBase
-{
-
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/TreeCacheStatefulBase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/TreeCacheStatefulBase.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/TreeCacheStatefulBase.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,216 +0,0 @@
-/*
- * 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.stateful;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
-import javax.annotation.Resource;
-import javax.ejb.Init;
-import javax.ejb.PostActivate;
-import javax.ejb.PrePassivate;
-import javax.ejb.Remove;
-import javax.ejb.SessionContext;
-import javax.interceptor.Interceptors;
-import javax.naming.InitialContext;
-
-import org.jboss.ejb3.Container;
-import org.jboss.logging.Logger;
-import org.jboss.serial.io.JBossObjectInputStream;
-import org.jboss.serial.io.JBossObjectOutputStream;
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
-public class TreeCacheStatefulBase implements org.jboss.ejb3.test.stateful.Stateful
-{
- private static final Logger log = Logger.getLogger(TreeCacheStatefulBase.class);
-
- private static int beansRemoved = 0;
-
- @Resource
- private SessionContext sessionContext;
-
- @Resource(mappedName = "java:/DefaultDS")
- private transient javax.sql.DataSource datasource;
-
- @Resource(mappedName = "java:/ConnectionFactory")
- public transient javax.jms.QueueConnectionFactory connectionFactory;
-
- private String state;
-
- @Interceptors(MyInterceptor.class)
- public String getInterceptorState()
- {
- throw new RuntimeException("NOT REACHABLE");
- }
-
- @Interceptors(MyInterceptor.class)
- public void setInterceptorState(String param)
- {
- throw new RuntimeException("NOT REACHABLE");
- }
-
- public boolean testSessionContext()
- {
- return sessionContext.isCallerInRole("role");
- }
-
- public void testResources() throws Exception
- {
- datasource.toString();
- connectionFactory.toString();
-
- javax.sql.DataSource ds = (javax.sql.DataSource) new InitialContext().lookup(Container.ENC_CTX_NAME
- + "/env/jdbc/ds");
- ds.toString();
- }
-
- public String getState() throws Exception
- {
- Thread.sleep(1000);
- return state;
- }
-
- public void setState(String state) throws Exception
- {
- Thread.sleep(1000);
- this.state = state;
- }
-
- public boolean interceptorAccessed()
- {
- return RemoteBindingInterceptor.accessed;
- }
-
- public void testThrownException() throws Exception
- {
- throw new Exception();
- }
-
- public void testExceptionCause() throws Exception
- {
- Object o = null;
- o.toString();
- }
-
- @PrePassivate
- public void passivate()
- {
- log.info("************ passivating");
- wasPassivated = true;
- }
-
- @PostActivate
- public void activate()
- {
- log.info("************ activating");
- }
-
- private static boolean wasPassivated = false;
-
- public void testSerializedState(String state)
- {
- this.state = state;
-
- TreeCacheStatefulBase bean = null;
- try
- {
- ObjectOutputStream out;
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- out = new JBossObjectOutputStream(baos, false);
- out.writeObject(this);
- out.flush();
-
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-
- JBossObjectInputStream is = new JBossObjectInputStream(bais);
- bean = (TreeCacheStatefulBase) is.readObject();
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- catch (ClassNotFoundException e)
- {
- throw new RuntimeException(e);
- }
-
- if (!state.equals(bean.state))
- throw new RuntimeException("failed to serialize: " + bean.state);
- }
-
- public boolean wasPassivated()
- {
- return wasPassivated;
- }
-
- public void clearPassivated()
- {
- wasPassivated = false;
- }
-
- @Init
- public void ejbCreate(Integer state)
- {
- this.state = state.toString();
- }
-
- @Init
- public void ejbCreate(State state)
- {
- this.state = state.getState();
- }
-
- @Init
- public void ejbCreate(String state)
- {
- this.state = state;
- }
-
- @Remove
- public void removeMe()
- {
- ++beansRemoved;
- }
-
- public int beansRemoved()
- {
- return beansRemoved;
- }
-
- public void lookupStateful() throws Exception
- {
- // FIXME: NYI
- throw new RuntimeException("NYI");
- }
-
- public void testStateful() throws Exception
- {
- // FIXME: NYI
- throw new RuntimeException("NYI");
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/TreeCacheStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/TreeCacheStatefulBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/TreeCacheStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,66 +0,0 @@
-/*
- * 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.stateful;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
-import javax.annotation.Resource;
-import javax.annotation.Resources;
-import javax.ejb.Init;
-import javax.ejb.Local;
-import javax.ejb.PostActivate;
-import javax.ejb.PrePassivate;
-import javax.ejb.Remote;
-import javax.ejb.Remove;
-import javax.ejb.SessionContext;
-import javax.ejb.Stateful;
-import javax.interceptor.Interceptors;
-import javax.naming.InitialContext;
-
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.annotation.Cache;
-import org.jboss.ejb3.annotation.CacheConfig;
-import org.jboss.ejb3.annotation.RemoteBinding;
-import org.jboss.ejb3.annotation.SecurityDomain;
-import org.jboss.ejb3.annotation.defaults.RemoteBindingDefaults;
-import org.jboss.logging.Logger;
-import org.jboss.serial.io.JBossObjectInputStream;
-import org.jboss.serial.io.JBossObjectOutputStream;
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- */
- at Stateful(name = "TreeCacheStatefulBean")
- at Remote(org.jboss.ejb3.test.stateful.Stateful.class)
- at Local(org.jboss.ejb3.test.stateful.StatefulLocal.class)
- at RemoteBinding(jndiBinding = "TreeCacheStateful", interceptorStack = "RemoteBindingStatefulSessionClientInterceptors", factory = RemoteBindingDefaults.PROXY_FACTORY_STATEFUL_REMOTE)
- at CacheConfig(name = "jboss.cache:service=EJB3SFSBClusteredCache", maxSize = 1000, idleTimeoutSeconds = 1)
- at SecurityDomain("test")
- at Resources(
-{@Resource(name = "jdbc/ds", mappedName = "java:/DefaultDS")})
- at Cache("StatefulTreeCache")
-public class TreeCacheStatefulBean extends TreeCacheStatefulBase
-{
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/BeanMonitor.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/BeanMonitor.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/BeanMonitor.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,67 +0,0 @@
-/*
- * 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.stateful.nested.base;
-
-import java.rmi.dgc.VMID;
-
-public interface BeanMonitor extends Removable
-{
- VMID getVMID();
-
- void monitor(TopLevel topLevel);
-
- String getDeepNestedId();
-
- String getLocalDeepNestedId();
-
- int getParentPassivations();
-
- int getNestedPassivations();
-
- int getLocalNestedPassivations();
-
- int getDeepNestedPassivations();
-
- int getLocalDeepNestedPassivations();
-
- int getParentActivations();
-
- int getNestedActivations();
-
- int getLocalNestedActivations();
-
- int getDeepNestedActivations();
-
- int getLocalDeepNestedActivations();
-
- boolean removeParent();
-
- boolean removeNested();
-
- boolean removeLocalNested();
-
- boolean removeDeepNested();
-
- boolean removeLocalDeepNested();
-
-}
\ No newline at end of file
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/BeanMonitorBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/BeanMonitorBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/BeanMonitorBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,305 +0,0 @@
-/*
- * 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.stateful.nested.base;
-
-import java.rmi.dgc.VMID;
-
-import javax.ejb.Remote;
-import javax.ejb.Remove;
-import javax.ejb.Stateful;
-
-import org.jboss.logging.Logger;
-
-/**
- * A BeanMonitorBean.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-public class BeanMonitorBean implements BeanMonitor
-{
- protected Logger log = Logger.getLogger(getClass());
-
- protected TopLevel parent;
- protected MidLevel nested;
- protected MidLevel localNested;
- protected DeepNestedStateful deepNested;
- protected DeepNestedStateful localDeepNested;
-
- public VMID getVMID()
- {
- return VMTracker.VMID;
- }
-
- public void monitor(TopLevel topLevel)
- {
- this.parent = topLevel;
- log.debug("parent is " + parent);
- this.nested = parent.getNested();
- log.debug("nested is " + nested);
- this.localNested = parent.getLocalNested();
- log.debug("localNested is " + localNested);
- this.deepNested = nested.getDeepNestedStateful();
- log.debug("deepNested is " + deepNested);
- this.localDeepNested = localNested.getDeepNestedStateful();
- log.debug("localDeepNested is " + localDeepNested);
- }
-
- public String getDeepNestedId()
- {
- try
- {
- return deepNested.getInternalId();
- }
- catch (Exception e)
- {
- log.warn("getDeepNestedId() " + e.getLocalizedMessage(), e);
- return "ERROR";
- }
- }
-
- public String getLocalDeepNestedId()
- {
- try
- {
- return localDeepNested.getInternalId();
- }
- catch (Exception e)
- {
- log.warn("getLocalDeepNestedId() " + e.getLocalizedMessage(), e);
- return "ERROR";
- }
- }
-
- public int getParentPassivations()
- {
- try
- {
- return parent.getPrePassivate();
- }
- catch (Exception e)
- {
- log.warn("getParentPassivations() " + e.getLocalizedMessage(), e);
- return -1;
- }
- }
-
- public int getNestedPassivations()
- {
- try
- {
- return nested.getPrePassivate();
- }
- catch (Exception e)
- {
- log.warn("getNestedPassivations() " + e.getLocalizedMessage(), e);
- return -1;
- }
- }
-
- public int getLocalNestedPassivations()
- {
- try
- {
- return localNested.getPrePassivate();
- }
- catch (Exception e)
- {
- log.warn("getLocalNestedPassivations() " + e.getLocalizedMessage(), e);
- return -1;
- }
- }
-
- public int getDeepNestedPassivations()
- {
- try
- {
- return deepNested.getPrePassivate();
- }
- catch (Exception e)
- {
- log.warn("getDeepNestedPassivations() " + e.getLocalizedMessage(), e);
- return -1;
- }
- }
-
- public int getLocalDeepNestedPassivations()
- {
- try
- {
- return localDeepNested.getPrePassivate();
- }
- catch (Exception e)
- {
- log.warn("getLocalDeepNestedPassivations() " + e.getLocalizedMessage(), e);
- return -1;
- }
- }
-
- public int getParentActivations()
- {
- try
- {
- return parent.getPostActivate();
- }
- catch (Exception e)
- {
- log.warn("getParentActivations() " + e.getLocalizedMessage(), e);
- return -1;
- }
- }
-
- public int getNestedActivations()
- {
- try
- {
- return nested.getPostActivate();
- }
- catch (Exception e)
- {
- log.debug("getNestedActivations() " + e.getLocalizedMessage());
- return -1;
- }
- }
-
- public int getLocalNestedActivations()
- {
- try
- {
- return localNested.getPostActivate();
- }
- catch (Exception e)
- {
- log.warn("getLocalNestedActivations() " + e.getLocalizedMessage(), e);
- return -1;
- }
- }
-
- public int getDeepNestedActivations()
- {
- try
- {
- return deepNested.getPostActivate();
- }
- catch (Exception e)
- {
- log.warn("getDeepNestedActivations() " + e.getLocalizedMessage(), e);
- return -1;
- }
- }
-
- public int getLocalDeepNestedActivations()
- {
- try
- {
- return localDeepNested.getPostActivate();
- }
- catch (Exception e)
- {
- log.debug("getLocalDeepNestedActivations() " + e.getLocalizedMessage());
- return -1;
- }
- }
-
- public boolean removeParent()
- {
- try
- {
- parent.remove();
- return true;
- }
- catch (Exception e)
- {
- log.warn("removeParent() " + e.getLocalizedMessage(), e);
- return false;
- }
- }
-
- public boolean removeNested()
- {
- try
- {
- nested.remove();
- return true;
- }
- catch (Exception e)
- {
- log.debug("removeNested() " + e.getLocalizedMessage());
- return false;
- }
- }
-
- public boolean removeLocalNested()
- {
- try
- {
- localNested.remove();
- return true;
- }
- catch (Exception e)
- {
- log.warn("removeLocalNested() " + e.getLocalizedMessage(), e);
- return false;
- }
- }
-
- public boolean removeDeepNested()
- {
- try
- {
- deepNested.remove();
- return true;
- }
- catch (Exception e)
- {
- log.debug("removeDeepNested() " + e.getLocalizedMessage());
- return false;
- }
- }
-
- public boolean removeLocalDeepNested()
- {
- try
- {
- localDeepNested.remove();
- return true;
- }
- catch (Exception e)
- {
- log.warn("removeLocalDeepNested() " + e.getLocalizedMessage(), e);
- return false;
- }
- }
-
- @Remove
- public void remove()
- {
- log.debug("Being removed");
- removeParent();
- removeNested();
- removeLocalNested();
- removeDeepNested();
- removeLocalDeepNested();
- }
-
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/DeepNestedStateful.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/DeepNestedStateful.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/DeepNestedStateful.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,34 +0,0 @@
-/*
- * 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.stateful.nested.base;
-
-/**
- * A nested SFSB that operates at the 3rd level of a tree of beans.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-public interface DeepNestedStateful extends PassivationActivationWatcher
-{
- String getInternalId();
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/DeepNestedStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/DeepNestedStatefulBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/DeepNestedStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,55 +0,0 @@
-/*
- * 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.stateful.nested.base;
-
-import javax.ejb.Remove;
-
-import org.jboss.util.id.GUID;
-
-/**
- * A DeepNestedStatefulBean.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-public class DeepNestedStatefulBean
- extends PassivationActivationWatcherBean
- implements DeepNestedStateful
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 1L;
-
- private String internalId = new GUID().toString();
-
- public String getInternalId()
- {
- return internalId;
- }
-
- @Remove
- public void remove()
- {
- log.debug(internalId + " is being removed");
- }
-
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/MidLevel.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/MidLevel.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/MidLevel.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,34 +0,0 @@
-/*
- * 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.stateful.nested.base;
-
-/**
- * A MidLevel.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-public interface MidLevel extends PassivationActivationWatcher
-{
- DeepNestedStateful getDeepNestedStateful();
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/PassivationActivationWatcher.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/PassivationActivationWatcher.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/PassivationActivationWatcher.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,38 +0,0 @@
-/*
- * 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.stateful.nested.base;
-
-/**
- * Interface for a bean that tracks the number invocations of @PrePassivate
- * and @PostActivate.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-public interface PassivationActivationWatcher extends Removable
-{
- int getPostActivate();
-
- int getPrePassivate();
-
- void reset();
-}
\ No newline at end of file
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/PassivationActivationWatcherBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/PassivationActivationWatcherBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/PassivationActivationWatcherBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,92 +0,0 @@
-/*
- * 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.stateful.nested.base;
-
-import java.io.Serializable;
-
-import javax.ejb.PostActivate;
-import javax.ejb.PrePassivate;
-
-import org.jboss.logging.Logger;
-
-/**
- * Superclass for SFSBs that monitor calls to @PrePassivate and @PostActivate.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-public abstract class PassivationActivationWatcherBean
- implements Serializable, PassivationActivationWatcher
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 1L;
-
- protected Logger log = Logger.getLogger(getClass());
- private int postActivateCalled = 0;
- private int prePassivateCalled = 0;
-
- public PassivationActivationWatcherBean()
- {
- super();
- }
-
- @PostActivate
- public void postActivate()
- {
- postActivateCalled++;
- int sysHC = System.identityHashCode(this);
- log.debug(sysHC + ": Activated -- activate count = " + postActivateCalled );
- }
-
- @PrePassivate
- public void prePassivate()
- {
- prePassivateCalled++;
- int sysHC = System.identityHashCode(this);
- log.debug(sysHC + ": Passivated -- passivate count = " + prePassivateCalled );
- }
-
- public int getPostActivate()
- {
- int sysHC = System.identityHashCode(this);
- log.debug(sysHC + ": getPostActivate() -- activate count = " +
- postActivateCalled );
- return postActivateCalled;
- }
-
- public int getPrePassivate()
- {
- int sysHC = System.identityHashCode(this);
- log.debug(sysHC + ": getPrePassivate() -- passivate count = " +
- prePassivateCalled );
- return prePassivateCalled;
- }
-
- public void reset()
- {
- int sysHC = System.identityHashCode(this);
- log.debug(sysHC + "Being reset");
- prePassivateCalled = 0;
- postActivateCalled = 0;
- }
-
-}
\ No newline at end of file
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/Removable.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/Removable.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/Removable.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,34 +0,0 @@
-/*
- * 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.stateful.nested.base;
-
-/**
- * An SFSB with a remove method.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-public interface Removable
-{
- void remove();
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/TopLevel.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/TopLevel.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/TopLevel.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,36 +0,0 @@
-/*
- * 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.stateful.nested.base;
-
-/**
- * A TopLevel.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-public interface TopLevel extends PassivationActivationWatcher
-{
- MidLevel getNested();
-
- MidLevel getLocalNested();
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/VMTracker.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/VMTracker.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/VMTracker.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,38 +0,0 @@
-/*
- * 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.stateful.nested.base;
-
-import java.rmi.dgc.VMID;
-
-/**
- * Provides SLSB access to a static VMID field.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-public interface VMTracker
-{
- public static final VMID VMID = new VMID();
-
- VMID getVMID();
-}
Deleted: trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/VMTrackerBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/VMTrackerBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/ejb3/test/stateful/nested/base/VMTrackerBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -1,44 +0,0 @@
-/*
- * 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.stateful.nested.base;
-
-import java.rmi.dgc.VMID;
-
-import javax.ejb.Remote;
-import javax.ejb.Stateless;
-
-/**
- * Provides SLSB access to a static VMID (allowing identification of a JVM.)
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
- at Stateless
- at Remote(VMTracker.class)
-public class VMTrackerBean implements VMTracker
-{
- public VMID getVMID()
- {
- return VMID;
- }
-}
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/NonAnnotationStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/NonAnnotationStatefulBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/NonAnnotationStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -30,9 +30,9 @@
import javax.ejb.Remove;
import javax.interceptor.Interceptors;
-import org.jboss.ejb3.test.stateful.nested.base.VMTracker;
import org.jboss.logging.Logger;
import org.jboss.test.cluster.ejb3.clusteredsession.util.ExplicitFailoverInterceptor;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.VMTracker;
/**
* Base class for various configs of a SFSB. No class-level clustering
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/ejbthree1053/unit/ConsistentPassivatedStateUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/ejbthree1053/unit/ConsistentPassivatedStateUnitTestCase.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/ejbthree1053/unit/ConsistentPassivatedStateUnitTestCase.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -30,12 +30,12 @@
import junit.framework.Test;
-import org.jboss.ejb3.test.stateful.nested.base.std.NestedBeanMonitor;
-import org.jboss.ejb3.test.stateful.nested.base.std.NestedStateful;
-import org.jboss.ejb3.test.stateful.nested.base.std.ParentStatefulRemote;
-import org.jboss.ejb3.test.stateful.unit.NestedBeanTestRunner;
-import org.jboss.ejb3.test.stateful.unit.NestedBeanTestRunner.NestedBeanSet;
import org.jboss.test.JBossClusteredTestCase;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.std.NestedBeanMonitor;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.std.NestedStateful;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.std.ParentStatefulRemote;
+import org.jboss.test.cluster.ejb3.stateful.unit.NestedBeanTestRunner;
+import org.jboss.test.cluster.ejb3.stateful.unit.NestedBeanTestRunner.NestedBeanSet;
import org.jnp.interfaces.NamingContext;
/**
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/ClusteredDeepNestedStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/ClusteredDeepNestedStatefulBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/ClusteredDeepNestedStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -27,8 +27,8 @@
import org.jboss.ejb3.annotation.CacheConfig;
import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.test.stateful.nested.base.DeepNestedStateful;
-import org.jboss.ejb3.test.stateful.nested.base.DeepNestedStatefulBean;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.DeepNestedStateful;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.DeepNestedStatefulBean;
/**
* A ClusteredDeepNestedStatefulBean.
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/std/ClusteredLocalNestedStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/std/ClusteredLocalNestedStatefulBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/std/ClusteredLocalNestedStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -14,9 +14,9 @@
import org.jboss.ejb3.annotation.CacheConfig;
import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.test.stateful.nested.base.VMTracker;
-import org.jboss.ejb3.test.stateful.nested.base.std.NestedStateful;
-import org.jboss.ejb3.test.stateful.nested.base.std.NestedStatefulBean;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.VMTracker;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.std.NestedStateful;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.std.NestedStatefulBean;
/**
* Nested SFSB with only a local interface.
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/std/ClusteredParentStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/std/ClusteredParentStatefulBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/std/ClusteredParentStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -15,9 +15,9 @@
import org.jboss.ejb3.annotation.CacheConfig;
import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.test.stateful.nested.base.std.ParentStatefulBean;
-import org.jboss.ejb3.test.stateful.nested.base.std.ParentStatefulRemote;
import org.jboss.test.cluster.ejb3.clusteredsession.util.ExplicitFailoverInterceptor;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.std.ParentStatefulBean;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.std.ParentStatefulRemote;
/**
* Parent SFSB that contains nested SFSB.
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/std/ClusteredRemoteNestedStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/std/ClusteredRemoteNestedStatefulBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/std/ClusteredRemoteNestedStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -14,9 +14,9 @@
import org.jboss.ejb3.annotation.CacheConfig;
import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.test.stateful.nested.base.VMTracker;
-import org.jboss.ejb3.test.stateful.nested.base.std.NestedStateful;
-import org.jboss.ejb3.test.stateful.nested.base.std.OptimizedNestedStatefulBean;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.VMTracker;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.std.NestedStateful;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.std.OptimizedNestedStatefulBean;
/**
* Nested SFSB with a remote interface.
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/xpc/ClusteredDeepNestedContainedBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/xpc/ClusteredDeepNestedContainedBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/xpc/ClusteredDeepNestedContainedBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -27,8 +27,8 @@
import org.jboss.ejb3.annotation.CacheConfig;
import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.test.stateful.nested.base.xpc.DeepNestedContained;
-import org.jboss.ejb3.test.stateful.nested.base.xpc.DeepNestedContainedBean;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.xpc.DeepNestedContained;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.xpc.DeepNestedContainedBean;
/**
* A ClusteredDeepNestedStatefulBean.
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/xpc/ClusteredLocalContainedBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/xpc/ClusteredLocalContainedBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/xpc/ClusteredLocalContainedBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -27,8 +27,8 @@
import org.jboss.ejb3.annotation.CacheConfig;
import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.test.stateful.nested.base.xpc.Contained;
-import org.jboss.ejb3.test.stateful.nested.base.xpc.ContainedBean;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.xpc.Contained;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.xpc.ContainedBean;
/**
* ContainedBean bean meant for testing with a clustered SFSB cache.
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/xpc/ClusteredRemoteContainedBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/xpc/ClusteredRemoteContainedBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/xpc/ClusteredRemoteContainedBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -27,8 +27,8 @@
import org.jboss.ejb3.annotation.CacheConfig;
import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.test.stateful.nested.base.xpc.Contained;
-import org.jboss.ejb3.test.stateful.nested.base.xpc.ContainedBean;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.xpc.Contained;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.xpc.ContainedBean;
/**
* ContainedBean bean meant for testing with a clustered SFSB cache.
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/xpc/ClusteredShoppingCartBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/xpc/ClusteredShoppingCartBean.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/nested/base/xpc/ClusteredShoppingCartBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -30,9 +30,9 @@
import org.jboss.ejb3.annotation.CacheConfig;
import org.jboss.ejb3.annotation.Clustered;
-import org.jboss.ejb3.test.stateful.nested.base.xpc.ShoppingCart;
-import org.jboss.ejb3.test.stateful.nested.base.xpc.ShoppingCartBean;
import org.jboss.test.cluster.ejb3.clusteredsession.util.ExplicitFailoverInterceptor;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.xpc.ShoppingCart;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.xpc.ShoppingCartBean;
/**
* ShoppingCartBean subclass for testing with a clustered SFSB cache.
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/unit/ExtendedPersistenceUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/unit/ExtendedPersistenceUnitTestCase.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/unit/ExtendedPersistenceUnitTestCase.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -31,13 +31,13 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.jboss.ejb3.test.common.unit.DBSetup;
-import org.jboss.ejb3.test.stateful.nested.base.xpc.Customer;
-import org.jboss.ejb3.test.stateful.nested.base.xpc.NestedXPCMonitor;
-import org.jboss.ejb3.test.stateful.nested.base.xpc.ShoppingCart;
-import org.jboss.ejb3.test.stateful.unit.XPCTestRunner;
-import org.jboss.ejb3.test.stateful.unit.XPCTestRunner.BeanSet;
import org.jboss.test.JBossClusteredTestCase;
+import org.jboss.test.cluster.ejb3.common.unit.DBSetup;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.xpc.Customer;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.xpc.NestedXPCMonitor;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.xpc.ShoppingCart;
+import org.jboss.test.cluster.ejb3.stateful.unit.XPCTestRunner;
+import org.jboss.test.cluster.ejb3.stateful.unit.XPCTestRunner.BeanSet;
/**
* Tests for ExtendedPersistenceContext management.
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/unit/NestedBeanUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/unit/NestedBeanUnitTestCase.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/unit/NestedBeanUnitTestCase.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -30,10 +30,10 @@
import junit.framework.Test;
-import org.jboss.ejb3.test.stateful.nested.base.std.ParentStatefulRemote;
-import org.jboss.ejb3.test.stateful.unit.NestedBeanTestRunner;
-import org.jboss.ejb3.test.stateful.unit.NestedBeanTestRunner.NestedBeanSet;
import org.jboss.test.JBossClusteredTestCase;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.std.ParentStatefulRemote;
+import org.jboss.test.cluster.ejb3.stateful.unit.NestedBeanTestRunner;
+import org.jboss.test.cluster.ejb3.stateful.unit.NestedBeanTestRunner.NestedBeanSet;
/**
* Overrides the parent test to use clustered versions of
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/unit/RedeployUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/unit/RedeployUnitTestCase.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/unit/RedeployUnitTestCase.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -32,10 +32,10 @@
import junit.framework.Assert;
import junit.framework.Test;
-import org.jboss.ejb3.test.stateful.nested.base.VMTracker;
import org.jboss.test.JBossClusteredTestCase;
import org.jboss.test.cluster.ejb3.clusteredsession.NodeAnswer;
import org.jboss.test.cluster.ejb3.clusteredsession.StatefulRemote;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.VMTracker;
/**
* Tests redeployment and state transfer.
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/unit/ScopedExtendedPersistenceUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/unit/ScopedExtendedPersistenceUnitTestCase.java 2010-10-27 18:00:48 UTC (rev 108939)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/clusteredsession/unit/ScopedExtendedPersistenceUnitTestCase.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -24,7 +24,7 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.jboss.ejb3.test.common.unit.DBSetup;
+import org.jboss.test.cluster.ejb3.common.unit.DBSetup;
/**
* Tests for extended persistence under clustering with a scoped classloader.
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/common/unit/DBSetup.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/common/unit/DBSetup.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/common/unit/DBSetup.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,187 @@
+/*
+ * 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.test.cluster.ejb3.common.unit;
+
+import java.sql.DriverManager;
+import java.sql.Connection;
+import java.sql.Statement;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.lang.reflect.Method;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+/** A TestSetup that starts hypersonic before the testcase with a tcp
+ * listening port at 1701.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revison:$
+ */
+public class DBSetup extends TestSetup
+{
+ private static final String HYPERSONIC_DIR = "output/hypersonic";
+ private static final String DB_NAME = "clusteredentity-db";
+ private final boolean deleteInTearDown;
+
+ public DBSetup(Test test)
+ {
+ this(test, true);
+ }
+
+ public DBSetup(Test test, boolean deleteInTearDown)
+ {
+ super(test);
+ this.deleteInTearDown = deleteInTearDown;
+ }
+
+ protected void setUp() throws Exception
+ {
+ File hypersoniDir = new File(HYPERSONIC_DIR);
+ if (!hypersoniDir.exists())
+ {
+ hypersoniDir.mkdirs();
+ }
+
+ if (!hypersoniDir.isDirectory())
+ {
+ throw new IOException("Failed to create directory: " + hypersoniDir);
+ }
+
+ File dbPath = new File(hypersoniDir, DB_NAME);
+
+ // Start DB in new thread, or else it will block us
+ DBThread serverThread = new DBThread(dbPath);
+ serverThread.start();
+
+ int elapsed = 0;
+ while (!serverThread.isStarted() && elapsed < 15000)
+ {
+ try
+ {
+ Thread.sleep(100);
+ elapsed += 100;
+ }
+ catch (InterruptedException ie)
+ {
+ System.out.println("Interrupted while waiting for Hypersonic");
+ }
+ }
+
+ if (!serverThread.isStarted())
+ System.out.println("Hypersonic failed to start in a timely fashion");
+ }
+
+ protected void tearDown() throws Exception
+ {
+ Class.forName("org.hsqldb.jdbcDriver");
+ String dbURL = "jdbc:hsqldb:hsql://" + System.getProperty("jbosstest.server.host", "localhost") + ":1701";
+ Connection conn = DriverManager.getConnection(dbURL, "sa", "");
+ Statement statement = conn.createStatement();
+ statement.executeQuery("SHUTDOWN COMPACT");
+
+ if (deleteInTearDown)
+ {
+ File hypersonicDir = new File(HYPERSONIC_DIR);
+ if (hypersonicDir.exists() && hypersonicDir.isDirectory())
+ {
+ FileFilter filter = new FileFilter() {
+ public boolean accept(File file)
+ {
+ return file.getName().indexOf(DB_NAME) >= 0;
+ }
+ };
+
+ File[] dbFiles = hypersonicDir.listFiles(filter);
+ for (File file : dbFiles)
+ {
+ file.delete();
+ }
+ }
+ }
+
+ }
+
+ public static void main(String[] args) throws Exception
+ {
+ DBSetup setup = new DBSetup(null);
+ setup.setUp();
+ Thread.sleep(120*1000);
+ setup.tearDown();
+ }
+
+ class DBThread extends Thread
+ {
+ boolean started;
+ File dbPath;
+
+ DBThread(File dbPath)
+ {
+ super("hypersonic");
+ this.dbPath = dbPath;
+ }
+
+ boolean isStarted()
+ {
+ return started;
+ }
+
+ public void run()
+ {
+ try
+ {
+ // Create startup arguments
+ // BES 2007/09/25 We use -silent true to avoid
+ // http://sourceforge.net/tracker/index.php?func=detail&aid=1673747&group_id=23316&atid=378131
+ String[] args = {
+ "-database",
+ dbPath.toString(),
+ "-port",
+ String.valueOf(1701),
+ "-silent",
+ "true",
+ "-trace",
+ "false",
+ "-no_system_exit",
+ "true",
+ };
+ System.out.println("Starting hsqldb");
+ // HACK Do this by reflection for now until we determine how
+ // we want to handle this in EJB3
+ Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass("org.hsqldb.Server");
+ Method main = clazz.getDeclaredMethod("main", new Class[] { String[].class });
+ main.invoke(null, new Object[] { args });
+// org.hsqldb.Server.main(args);
+ System.out.println("Done");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ started = true;
+ }
+ }
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/AnnotatedAppException.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/AnnotatedAppException.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/AnnotatedAppException.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -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.test.cluster.ejb3.stateful;
+
+import javax.ejb.ApplicationException;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at ApplicationException
+public class AnnotatedAppException extends RuntimeException
+{
+ public AnnotatedAppException()
+ {
+ super();
+ }
+
+ public AnnotatedAppException(String s)
+ {
+ super(s);
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/CheckedApplicationException.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/CheckedApplicationException.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/CheckedApplicationException.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,38 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public class CheckedApplicationException extends RuntimeException
+{
+ public CheckedApplicationException()
+ {
+ super();
+ }
+
+ public CheckedApplicationException(String s)
+ {
+ super(s);
+ }
+}
\ No newline at end of file
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ClusteredStateful.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ClusteredStateful.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ClusteredStateful.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,45 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface ClusteredStateful extends ConcurrentStateful
+{
+ boolean interceptorAccessed();
+
+ boolean testSessionContext();
+
+ boolean wasPassivated();
+ String getInterceptorState();
+ void setInterceptorState(String param);
+
+ void testThrownException() throws Exception;
+
+ void testExceptionCause() throws Exception;
+ void testSerializedState(String state);
+
+ void removeBean();
+
+ void testResources() throws Exception;
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ClusteredStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ClusteredStatefulBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ClusteredStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,208 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import javax.annotation.Resource;
+import javax.annotation.Resources;
+import javax.ejb.Init;
+import javax.ejb.Local;
+import javax.ejb.PostActivate;
+import javax.ejb.PrePassivate;
+import javax.ejb.Remote;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateful;
+import javax.interceptor.Interceptors;
+import javax.naming.InitialContext;
+
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.annotation.CacheConfig;
+import org.jboss.ejb3.annotation.Clustered;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.SecurityDomain;
+import org.jboss.ejb3.annotation.defaults.RemoteBindingDefaults;
+import org.jboss.logging.Logger;
+import org.jboss.serial.io.JBossObjectInputStream;
+import org.jboss.serial.io.JBossObjectOutputStream;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Stateful(name="ClusteredStatefulBean")
+ at Remote(ClusteredStateful.class)
+ at Local(StatefulLocal.class)
+ at RemoteBinding(jndiBinding = "ClusteredStateful",
+ interceptorStack="RemoteBindingStatefulSessionClientInterceptors",
+ factory = RemoteBindingDefaults.PROXY_FACTORY_STATEFUL_REMOTE)
+ at CacheConfig(maxSize = 1000, idleTimeoutSeconds = 1, name="jboss.cache:service=EJB3SFSBClusteredCache")
+ at SecurityDomain("test")
+ at Resources({@Resource(name="jdbc/ds", mappedName="java:/DefaultDS")})
+ at Clustered
+public class ClusteredStatefulBean implements ClusteredStateful
+{
+ private static final Logger log = Logger.getLogger(ClusteredStatefulBean.class);
+
+ @Resource
+ private SessionContext sessionContext;
+
+// @Resource(mappedName="java:/DefaultDS")
+// private transient javax.sql.DataSource datasource;
+
+// @Resource(mappedName="java:/ConnectionFactory")
+// public transient javax.jms.QueueConnectionFactory connectionFactory;
+
+ private String state;
+ private int stuff;
+ private boolean wasPassivated = false;
+
+ @Interceptors(MyInterceptor.class)
+ public String getInterceptorState()
+ {
+ throw new RuntimeException("NOT REACHABLE");
+ }
+
+ @Interceptors(MyInterceptor.class)
+ public void setInterceptorState(String param)
+ {
+ throw new RuntimeException("NOT REACHABLE");
+ }
+
+ public boolean testSessionContext()
+ {
+ return sessionContext.isCallerInRole("role");
+ }
+
+ public void testResources() throws Exception
+ {
+// datasource.toString();
+// connectionFactory.toString();
+
+ javax.sql.DataSource ds = (javax.sql.DataSource)new InitialContext().lookup(Container.ENC_CTX_NAME + "/env/jdbc/ds");
+ ds.toString();
+ }
+
+ public String getState() throws Exception
+ {
+ Thread.sleep(1000);
+ return state;
+ }
+
+ public void setState(String state) throws Exception
+ {
+ Thread.sleep(1000);
+ this.state = state;
+ }
+
+ public boolean interceptorAccessed()
+ {
+ return RemoteBindingInterceptor.accessed;
+ }
+
+ public void testThrownException() throws Exception
+ {
+ throw new Exception();
+ }
+
+ public void testExceptionCause() throws Exception
+ {
+ Object o = null;
+ o.toString();
+ }
+
+ @PrePassivate
+ public void passivate()
+ {
+ log.info("************ passivating " + this);
+ wasPassivated = true;
+ }
+
+ @PostActivate
+ public void activate()
+ {
+ log.info("************ activating");
+ }
+
+ public void testSerializedState(String state)
+ {
+ this.state = state;
+
+ ClusteredStatefulBean bean = null;
+ try
+ {
+ ObjectOutputStream out;
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ out = new JBossObjectOutputStream(baos, false);
+ out.writeObject(this);
+ out.flush();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+
+ JBossObjectInputStream is = new JBossObjectInputStream(bais);
+ bean = (ClusteredStatefulBean)is.readObject();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ if (!state.equals(bean.state)) throw new RuntimeException("failed to serialize: " + bean.state);
+ }
+
+ public boolean wasPassivated()
+ {
+ log.info("************ wasPassivated " + wasPassivated + " " + this);
+ return wasPassivated;
+ }
+
+ @Init
+ public void ejbCreate(Integer state)
+ {
+ this.state=state.toString();
+ }
+
+ @Init
+ public void ejbCreate(State state)
+ {
+ this.state=state.getState();
+ }
+
+ @Init
+ public void ejbCreate(String state)
+ {
+ this.state=state;
+ }
+
+ public void removeBean()
+ {
+
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ConcurrentStateful.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ConcurrentStateful.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ConcurrentStateful.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,37 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 108925 $
+ */
+public interface ConcurrentStateful
+{
+ String getState() throws Exception;
+
+ void setState(String state) throws Exception;
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ConcurrentStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ConcurrentStatefulBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ConcurrentStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,56 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.SerializedConcurrentAccess;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 108925 $
+ */
+ at Stateful
+ at Remote(ConcurrentStateful.class)
+ at SerializedConcurrentAccess
+public class ConcurrentStatefulBean implements ConcurrentStateful
+{
+ private static final Logger log = Logger.getLogger(ConcurrentStatefulBean.class);
+
+ private String state;
+
+ public String getState() throws Exception
+ {
+ Thread.sleep(1000);
+ return state;
+ }
+
+ public void setState(String state) throws Exception
+ {
+ this.state = state;
+ Thread.sleep(1000);
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Entity.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Entity.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Entity.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,60 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+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: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/EntityFacade.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/EntityFacade.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/EntityFacade.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,43 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface EntityFacade
+{
+ public static enum REMOVE_EXCEPTION_TYPE
+ {
+ NONE, CHECKED, APPLICATION, RUNTIME,
+ }
+
+ Entity createEntity(String name);
+
+ Entity loadEntity(Long id);
+
+ void remove();
+
+ void removeWithTx();
+
+ void setThrowRemoveException(REMOVE_EXCEPTION_TYPE throwDestroyException);
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/EntityFacadeBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/EntityFacadeBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/EntityFacadeBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,123 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import javax.annotation.PreDestroy;
+import javax.ejb.PostActivate;
+import javax.ejb.PrePassivate;
+import javax.ejb.Remote;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+
+import org.jboss.ejb3.annotation.CacheConfig;
+import org.jboss.logging.Logger;
+
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Stateful
+ at Remote(EntityFacade.class)
+ at CacheConfig(maxSize = 1000, idleTimeoutSeconds = 1)
+ at TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+public class EntityFacadeBean implements EntityFacade
+{
+ private @PersistenceContext(type = PersistenceContextType.EXTENDED)
+ EntityManager manager;
+
+ private static final Logger log = Logger.getLogger(EntityFacadeBean.class);
+
+ private static REMOVE_EXCEPTION_TYPE throwRemoveException = REMOVE_EXCEPTION_TYPE.NONE;
+
+ public Entity createEntity(String name) {
+ log.info("********* createEntity " + name);
+ Entity entity = new Entity();
+ entity.setName(name);
+ manager.persist(entity);
+ return entity;
+ }
+
+ public void setThrowRemoveException(REMOVE_EXCEPTION_TYPE throwRemoveException)
+ {
+ this.throwRemoveException = throwRemoveException;
+ }
+
+ public Entity loadEntity(Long id) {
+ log.info("********* loadEntity " + id);
+ Entity entity = manager.find(Entity.class, id);
+ return entity;
+ }
+
+ @PrePassivate
+ public void passivate()
+ {
+ log.info("************ passivating");
+ }
+
+ @PostActivate
+ public void activate()
+ {
+ log.info("************ activating");
+ }
+
+ @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
+ @Remove(retainIfException=true)
+ public void remove() throws CheckedApplicationException
+ {
+ log.info("************ removing no tx");
+
+ if (throwRemoveException == REMOVE_EXCEPTION_TYPE.APPLICATION)
+ throw new AnnotatedAppException("From @Remove");
+
+ if (throwRemoveException == REMOVE_EXCEPTION_TYPE.CHECKED)
+ throw new CheckedApplicationException("From @Remove");
+
+ if (throwRemoveException == REMOVE_EXCEPTION_TYPE.RUNTIME)
+ throw new RuntimeException("From @Remove");
+ }
+
+ @Remove(retainIfException=true)
+ public void removeWithTx()
+ {
+ log.info("************ removing with tx");
+
+ if (throwRemoveException == REMOVE_EXCEPTION_TYPE.APPLICATION)
+ throw new AnnotatedAppException("From @Remove");
+
+ if (throwRemoveException == REMOVE_EXCEPTION_TYPE.CHECKED)
+ throw new CheckedApplicationException("From @Remove");
+
+ if (throwRemoveException == REMOVE_EXCEPTION_TYPE.RUNTIME)
+ throw new RuntimeException("From @Remove");
+ }
+
+ @PreDestroy
+ public void destroy()
+ {
+ log.info("************ destroying ");
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ExtendedState.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ExtendedState.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ExtendedState.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,36 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 108925 $
+ */
+public class ExtendedState extends State
+{
+ public ExtendedState(String state)
+ {
+ super("Extended_" + state);
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/MyInterceptor.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/MyInterceptor.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/MyInterceptor.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,47 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 108925 $
+ */
+public class MyInterceptor
+{
+ Object field;
+
+ @AroundInvoke
+ public Object invoke(InvocationContext ctx) throws Exception
+ {
+ if (ctx.getMethod().getName().startsWith("set"))
+ {
+ field = ctx.getParameters()[0];
+ return null;
+ }
+ return field;
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ProxyFactoryInterface.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ProxyFactoryInterface.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ProxyFactoryInterface.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,36 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 108925 $
+ */
+public interface ProxyFactoryInterface
+{
+ String method();
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/RemoteBindingInterceptor.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/RemoteBindingInterceptor.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/RemoteBindingInterceptor.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,60 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 108925 $
+ */
+public class RemoteBindingInterceptor implements Interceptor, java.io.Serializable
+{
+ private static final Logger log = Logger.getLogger(RemoteBindingInterceptor.class);
+
+ public static boolean accessed = false;
+
+ public RemoteBindingInterceptor()
+ {
+ }
+
+ public String getName()
+ {
+ return "RemoteBindingInterceptor";
+ }
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ try
+ {
+ return invocation.invokeNext();
+ }
+ finally
+ {
+ accessed = true;
+ }
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/RemoteTx.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/RemoteTx.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/RemoteTx.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,34 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface RemoteTx<T>
+{
+ T testMandatoryTx(T t);
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/RemoveTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/RemoveTest.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/RemoveTest.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,39 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import javax.ejb.Remove;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 108925 $
+ */
+public interface RemoveTest
+{
+ @Remove
+ void callRollbackOnly();
+
+ @Remove
+ void removeit();
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/RemoveTestBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/RemoveTestBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/RemoveTestBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,52 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import javax.ejb.Stateful;
+import javax.ejb.Remove;
+import javax.ejb.SessionContext;
+import javax.annotation.Resource;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 108925 $
+ */
+ at Stateful
+public class RemoveTestBean implements RemoveTest
+{
+ @Resource SessionContext ctx;
+
+ @Remove
+ public void callRollbackOnly()
+ {
+ ctx.setRollbackOnly();
+ }
+
+ @Remove
+ public void removeit()
+ {
+ ctx.setRollbackOnly();
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ServiceBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ServiceBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ServiceBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,53 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import javax.ejb.EJB;
+import javax.ejb.Remote;
+
+import org.jboss.ejb3.annotation.SecurityDomain;
+import org.jboss.ejb3.annotation.Service;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Service
+ at Remote(ServiceRemote.class)
+ at SecurityDomain("other")
+public class ServiceBean implements ServiceRemote
+{
+ private static final Logger log = Logger.getLogger(ServiceBean.class);
+
+ @EJB(beanName="StatefulBean")
+ private Stateful stateful;
+
+ @EJB
+ private ClusteredStateful clusteredStateful;
+
+ public void testInjection() throws Exception
+ {
+ stateful.getState();
+
+ clusteredStateful.getState();
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ServiceRemote.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ServiceRemote.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/ServiceRemote.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,30 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface ServiceRemote
+{
+ void testInjection() throws Exception;
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/SmallCacheStateful.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/SmallCacheStateful.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/SmallCacheStateful.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,12 @@
+package org.jboss.test.cluster.ejb3.stateful;
+
+import javax.ejb.Remote;
+
+ at Remote
+public interface SmallCacheStateful
+{
+ public void setId(int id);
+
+ public int doit(int id);
+
+}
\ No newline at end of file
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/SmallCacheStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/SmallCacheStatefulBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/SmallCacheStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,61 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import javax.ejb.Stateful;
+
+import org.jboss.ejb3.annotation.CacheConfig;
+
+/**
+ * Test small maxSize for cache
+ *
+ * @author <a href="mailto:bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 108925 $
+ */
+ at Stateful
+ at CacheConfig(maxSize = 1000, idleTimeoutSeconds = 1)
+public class SmallCacheStatefulBean implements SmallCacheStateful
+{
+ private int count;
+ private int id;
+
+
+ public void setId(int id)
+ {
+ this.id = id;
+ }
+
+
+ public int doit(int passedId)
+ {
+ if (passedId != id) throw new RuntimeException();
+ try
+ {
+ Thread.sleep(3000);
+ }
+ catch (InterruptedException e)
+ {
+
+ }
+ return count++;
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/State.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/State.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/State.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,48 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 108925 $
+ */
+public class State implements java.io.Serializable
+{
+ protected String state;
+
+ public State(String state)
+ {
+ this.state = state;
+ }
+
+ public String getState()
+ {
+ return state;
+ }
+
+ public void setState(String state)
+ {
+ this.state = state;
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Stateful.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Stateful.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Stateful.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,56 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 108925 $
+ */
+public interface Stateful extends ConcurrentStateful
+{
+ boolean interceptorAccessed();
+
+ boolean testSessionContext();
+
+ public boolean wasPassivated();
+ public void clearPassivated();
+ public String getInterceptorState();
+ public void setInterceptorState(String param);
+
+ public void testThrownException() throws Exception;
+
+ public void testExceptionCause() throws Exception;
+ public void testSerializedState(String state);
+
+ public void removeMe();
+ public int beansRemoved();
+
+ void testResources() throws Exception;
+
+ void lookupStateful() throws Exception;
+ void testStateful() throws Exception;
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Stateful21.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Stateful21.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Stateful21.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejb3.stateful;
+
+import javax.ejb.EJBObject;
+
+/**
+ * A remote interface for a stateful bean.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: 108925 $
+ */
+public interface Stateful21 extends Stateful, EJBObject
+{
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,236 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import javax.annotation.Resource;
+import javax.annotation.Resources;
+import javax.ejb.Init;
+import javax.ejb.Local;
+import javax.ejb.PostActivate;
+import javax.ejb.PrePassivate;
+import javax.ejb.Remote;
+import javax.ejb.SessionContext;
+import javax.interceptor.Interceptors;
+import javax.naming.InitialContext;
+
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.annotation.CacheConfig;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.SecurityDomain;
+import org.jboss.ejb3.annotation.defaults.RemoteBindingDefaults;
+import org.jboss.logging.Logger;
+import org.jboss.serial.io.JBossObjectInputStream;
+import org.jboss.serial.io.JBossObjectOutputStream;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 108925 $
+ */
+ at javax.ejb.Stateful(name="StatefulBean")
+ at Remote({org.jboss.test.cluster.ejb3.stateful.Stateful.class})
+ at Local(StatefulLocal.class)
+ at RemoteBinding(jndiBinding = "Stateful",
+ interceptorStack="RemoteBindingStatefulSessionClientInterceptors",
+ factory = RemoteBindingDefaults.PROXY_FACTORY_STATEFUL_REMOTE)
+ at CacheConfig(maxSize = 1000, idleTimeoutSeconds = 5)
+ at SecurityDomain("test")
+ at Resources({@Resource(name="jdbc/ds", mappedName="java:/DefaultDS")})
+public class StatefulBean implements Stateful
+{
+ private static final Logger log = Logger.getLogger(StatefulBean.class);
+
+ private static int beansRemoved = 0;
+
+ @Resource
+ private SessionContext sessionContext;
+
+ @Resource(mappedName="java:/DefaultDS")
+ private transient javax.sql.DataSource datasource;
+
+ @Resource(mappedName="java:/ConnectionFactory")
+ public transient javax.jms.QueueConnectionFactory connectionFactory;
+
+ private StatefulLocal localStateful;
+
+ private String state;
+ private boolean wasPassivated = false;
+
+ public void lookupStateful() throws Exception
+ {
+ localStateful = (StatefulLocal)new InitialContext().lookup("StatefulBean/local");
+ log.info("lookup localStateful " + localStateful);
+ }
+
+ public void testStateful() throws Exception
+ {
+ log.info("get state of localStateful " + localStateful);
+ localStateful.getState();
+ }
+
+ @Interceptors(MyInterceptor.class)
+ public String getInterceptorState()
+ {
+ throw new RuntimeException("NOT REACHABLE");
+ }
+
+ @Interceptors(MyInterceptor.class)
+ public void setInterceptorState(String param)
+ {
+ throw new RuntimeException("NOT REACHABLE");
+ }
+
+ public boolean testSessionContext()
+ {
+ return sessionContext.isCallerInRole("role");
+ }
+
+ public void testResources() throws Exception
+ {
+ if(datasource == null)
+ throw new IllegalStateException("transient property datasource was not injected");
+ if(connectionFactory == null)
+ throw new IllegalStateException("transient property connectionFactory was not injected");
+
+ javax.sql.DataSource ds = (javax.sql.DataSource)new InitialContext().lookup(Container.ENC_CTX_NAME + "/env/jdbc/ds");
+ ds.toString();
+ }
+
+ public String getState() throws Exception
+ {
+ Thread.sleep(1000);
+ return state;
+ }
+
+ public void setState(String state) throws Exception
+ {
+ Thread.sleep(1000);
+ this.state = state;
+ }
+
+ public boolean interceptorAccessed()
+ {
+ return RemoteBindingInterceptor.accessed;
+ }
+
+ public void testThrownException() throws Exception
+ {
+ throw new Exception();
+ }
+
+ @SuppressWarnings("null")
+ public void testExceptionCause() throws Exception
+ {
+ Object o = null;
+ o.toString();
+ }
+
+ @PrePassivate
+ public void passivate()
+ {
+ log.info("************ passivating");
+ wasPassivated = true;
+ }
+
+ @PostActivate
+ public void activate()
+ {
+ log.info("************ activating");
+ }
+
+ public void testSerializedState(String state)
+ {
+ this.state = state;
+
+ StatefulBean bean = null;
+ try
+ {
+ ObjectOutputStream out;
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ out = new JBossObjectOutputStream(baos, false);
+ out.writeObject(this);
+ out.flush();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+
+ JBossObjectInputStream is = new JBossObjectInputStream(bais);
+ bean = (StatefulBean)is.readObject();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ if (!state.equals(bean.state)) throw new RuntimeException("failed to serialize: " + bean.state);
+ }
+
+ public boolean wasPassivated()
+ {
+ return wasPassivated;
+ }
+
+ public void clearPassivated()
+ {
+ wasPassivated = false;
+ }
+
+ @Init
+ public void ejbCreate(Integer state)
+ {
+ this.state=state.toString();
+ }
+
+ @Init
+ public void ejbCreate(State state)
+ {
+ this.state=state.getState();
+ }
+
+ @Init
+ public void ejbCreate(String state)
+ {
+ this.state=state;
+ }
+
+ public int beansRemoved()
+ {
+ return beansRemoved;
+ }
+
+ // @Remove from xml
+ public void removeMe()
+ {
+ ++beansRemoved;
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulClusteredTimeoutBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulClusteredTimeoutBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulClusteredTimeoutBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,51 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import javax.ejb.Remote;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+
+import org.jboss.ejb3.annotation.CacheConfig;
+import org.jboss.ejb3.annotation.Clustered;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Stateful
+ at Remote(StatefulTimeout.class)
+ at CacheConfig(removalTimeoutSeconds = 1)
+ at Clustered
+public class StatefulClusteredTimeoutBean implements StatefulTimeout
+{
+ private static final Logger log = Logger.getLogger(StatefulClusteredTimeoutBean.class);
+
+ public void test()
+ {
+ }
+
+ @Remove
+ public void remove()
+ {
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulHome.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulHome.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulHome.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,36 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import javax.ejb.EJBHome;
+
+/**
+ * @version <tt>$Revision: 108925 $</tt>
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface StatefulHome extends EJBHome {
+
+ public Stateful21 create() throws java.rmi.RemoteException, javax.ejb.CreateException;
+
+ public Stateful21 create(State state) throws java.rmi.RemoteException, javax.ejb.CreateException;
+}
+
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulInvoker.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulInvoker.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulInvoker.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,61 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 108925 $
+ */
+public class StatefulInvoker extends Thread
+{
+ private static final Logger log = Logger.getLogger(StatefulInvoker.class);
+
+ Exception exception = null;
+
+ ConcurrentStateful stateful;
+
+ public StatefulInvoker(ConcurrentStateful stateful)
+ {
+ this.stateful = stateful;
+ }
+
+ public Exception getException()
+ {
+ return exception;
+ }
+
+ public void run()
+ {
+ try
+ {
+ stateful.setState("state");
+ stateful.getState();
+ }
+ catch(Exception e)
+ {
+ exception = e;
+ }
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulLocal.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulLocal.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulLocal.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,36 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 108925 $
+ */
+public interface StatefulLocal
+{
+ String getState();
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulRemoteProxyFactory.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulRemoteProxyFactory.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulRemoteProxyFactory.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,46 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import org.jboss.aop.Advisor;
+import org.jboss.ejb3.proxy.impl.factory.session.stateful.StatefulSessionRemoteProxyFactory;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 108925 $
+ */
+public class StatefulRemoteProxyFactory extends StatefulSessionRemoteProxyFactory
+{
+ @SuppressWarnings("unused")
+ private static final Logger log = Logger.getLogger(StatefulRemoteProxyFactory.class);
+
+ public StatefulRemoteProxyFactory(final String name, final String containerName, final String containerGuid,
+ final JBossSessionBeanMetaData metadata, final ClassLoader classloader, final String url,
+ final Advisor advisor, final String interceptorStackName)
+ {
+ super(name, containerName, containerGuid, metadata, classloader, url, advisor, interceptorStackName);
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulSyncBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulSyncBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulSyncBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,77 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import java.rmi.RemoteException;
+import javax.ejb.EJBException;
+import javax.ejb.SessionSynchronization;
+import javax.ejb.Stateful;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 108925 $
+ */
+ at Stateful
+public class StatefulSyncBean implements SessionSynchronization, StatefulSyncLocal, java.io.Serializable
+{
+ private String state;
+ private String rollbackState;
+ private boolean beforeCalled;
+
+ public boolean isBeforeCalled()
+ {
+ return beforeCalled;
+ }
+
+ public void setBeforeCalled(boolean beforeCalled)
+ {
+ this.beforeCalled = beforeCalled;
+ }
+
+ public String getState()
+ {
+ return state;
+ }
+
+ public void setState(String state)
+ {
+ this.state = state;
+ }
+
+
+ public void afterBegin() throws EJBException, RemoteException
+ {
+ rollbackState = state;
+ }
+
+ public void beforeCompletion() throws EJBException, RemoteException
+ {
+ beforeCalled = true;
+ }
+
+ public void afterCompletion(boolean committed) throws EJBException, RemoteException
+ {
+ if (!committed) state = rollbackState;
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulSyncLocal.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulSyncLocal.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulSyncLocal.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -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.test.cluster.ejb3.stateful;
+
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 108925 $
+ */
+public interface StatefulSyncLocal
+{
+ boolean isBeforeCalled();
+
+ void setBeforeCalled(boolean beforeCalled);
+
+ String getState();
+
+ void setState(String state);
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulTimeout.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulTimeout.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulTimeout.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,35 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface StatefulTimeout
+{
+ void test();
+
+ void remove();
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulTimeoutBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulTimeoutBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulTimeoutBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,49 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import javax.ejb.Remote;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+
+import org.jboss.ejb3.annotation.CacheConfig;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Stateful
+ at Remote(StatefulTimeout.class)
+ at CacheConfig(removalTimeoutSeconds = 1)
+public class StatefulTimeoutBean implements StatefulTimeout
+{
+ private static final Logger log = Logger.getLogger(StatefulTimeoutBean.class);
+
+ public void test()
+ {
+ }
+
+ @Remove
+ public void remove()
+ {
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulTx.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulTx.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulTx.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -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.test.cluster.ejb3.stateful;
+
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 108925 $
+ */
+public interface StatefulTx extends RemoteTx<State>
+{
+ boolean isGlobalTransacted() throws javax.transaction.SystemException;
+
+ boolean isLocalTransacted() throws javax.transaction.SystemException;
+
+ boolean testNewTx() throws javax.transaction.SystemException;
+
+ void testTxRollback();
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulTxBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulTxBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatefulTxBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,84 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import javax.annotation.security.RolesAllowed;
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.transaction.TransactionManager;
+
+import org.jboss.ejb3.annotation.JndiInject;
+import org.jboss.ejb3.annotation.SecurityDomain;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 108925 $
+ */
+ at Stateful
+ at Remote(StatefulTx.class)
+ at TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
+ at SecurityDomain("test")
+public class StatefulTxBean implements StatefulTx
+{
+ private static final Logger log = Logger.getLogger(StatefulTxBean.class);
+
+ @JndiInject(jndiName="java:/TransactionManager") private TransactionManager tm;
+
+ @RolesAllowed("allowed")
+ public boolean isGlobalTransacted() throws javax.transaction.SystemException
+ {
+ return (tm.getTransaction() != null);
+ }
+
+ @TransactionAttribute(TransactionAttributeType.REQUIRED)
+ @RolesAllowed("allowed")
+ public boolean isLocalTransacted() throws javax.transaction.SystemException
+ {
+ return (tm.getTransaction() != null);
+ }
+
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+ @RolesAllowed("allowed")
+ public boolean testNewTx() throws javax.transaction.SystemException
+ {
+ return (tm.getTransaction() != null);
+ }
+
+ @TransactionAttribute(TransactionAttributeType.REQUIRED)
+ @RolesAllowed("allowed")
+ public void testTxRollback()
+ {
+ throw new RuntimeException("test rollback");
+ }
+
+ @TransactionAttribute(value = TransactionAttributeType.MANDATORY)
+ @RolesAllowed("allowed")
+ public State testMandatoryTx(State o)
+ {
+ return o;
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Stateless.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Stateless.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Stateless.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,30 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface Stateless
+{
+ void testInjection() throws Exception;
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatelessBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatelessBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/StatelessBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,54 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import javax.ejb.EJB;
+import javax.ejb.Remote;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.SecurityDomain;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at javax.ejb.Stateless(name="StatelessBean")
+ at RemoteBinding(jndiBinding = "Stateless")
+ at Remote(Stateless.class)
+ at SecurityDomain("test")
+public class StatelessBean implements Stateless
+{
+ private static final Logger log = Logger.getLogger(StatelessBean.class);
+
+ @EJB(beanName="StatefulBean")
+ private Stateful stateful;
+
+ @EJB
+ private ClusteredStateful clusteredStateful;
+
+ public void testInjection() throws Exception
+ {
+ stateful.getState();
+
+ clusteredStateful.getState();
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Tester.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Tester.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/Tester.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,39 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 108925 $
+ */
+public interface Tester
+{
+ void testSessionSynchronization() throws Exception;
+
+ void testRollback1() throws Exception;
+
+ void testRollback2() throws Exception;
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/TesterBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/TesterBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/TesterBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,79 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import javax.annotation.Resource;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionManagementType;
+import javax.naming.InitialContext;
+import javax.transaction.UserTransaction;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 108925 $
+ */
+ at Stateless()
+ at TransactionManagement(TransactionManagementType.BEAN)
+ at Remote(Tester.class)
+public class TesterBean implements Tester
+{
+ @Resource private UserTransaction ut;
+
+ public void testSessionSynchronization() throws Exception
+ {
+ StatefulSyncLocal sfsb = (StatefulSyncLocal)new InitialContext().lookup("StatefulSyncBean/local");
+ sfsb.setState("hello");
+ sfsb.setBeforeCalled(false);
+
+ ut.begin();
+ sfsb.setState("world");
+ ut.rollback();
+
+ if (!sfsb.getState().equals("hello")) throw new RuntimeException("rollback didn't work");
+ if (!sfsb.isBeforeCalled()) throw new RuntimeException("BEFORE WAS NOT CALLED");
+
+ // test new proxy
+
+ sfsb = (StatefulSyncLocal)new InitialContext().lookup("StatefulSyncBean/local");
+ if (sfsb.getState() != null) throw new RuntimeException("State should be null: " + sfsb.getState());
+ }
+
+ public void testRollback1() throws Exception
+ {
+ RemoveTest test = (RemoveTest)new InitialContext().lookup("RemoveTestBean/local");
+ ut.begin();
+ test.callRollbackOnly();
+ ut.rollback();
+ }
+ public void testRollback2() throws Exception
+ {
+ RemoveTest test = (RemoveTest)new InitialContext().lookup("RemoveTestBean/local");
+ ut.begin();
+ ut.setRollbackOnly();
+ test.removeit();
+ ut.rollback();
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/TreeCacheRemovalStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/TreeCacheRemovalStatefulBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/TreeCacheRemovalStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,54 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import javax.annotation.Resource;
+import javax.annotation.Resources;
+import javax.ejb.Local;
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+
+import org.jboss.ejb3.annotation.Cache;
+import org.jboss.ejb3.annotation.CacheConfig;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.SecurityDomain;
+import org.jboss.ejb3.annotation.defaults.RemoteBindingDefaults;
+
+/**
+ * Same as TreeCacheStatefulBean, but configures a removalTimeoutSeconds to
+ * validate metrics when a removal thread is used.
+ *
+ * @author Brian Stansberry
+ */
+ at javax.ejb.Stateful(name = "TreeCacheRemovalStatefulBean")
+ at Remote(Stateful.class)
+ at Local(StatefulLocal.class)
+ at RemoteBinding(jndiBinding = "TreeCacheRemovalStateful", interceptorStack = "RemoteBindingStatefulSessionClientInterceptors", factory = RemoteBindingDefaults.PROXY_FACTORY_STATEFUL_REMOTE)
+ at CacheConfig(name = "jboss.cache:service=EJB3SFSBClusteredCache", maxSize = 1000, idleTimeoutSeconds = 1, removalTimeoutSeconds = 20)
+ at SecurityDomain("test")
+ at Resources(
+{@Resource(name = "jdbc/ds", mappedName = "java:/DefaultDS")})
+ at Cache("StatefulTreeCache")
+public class TreeCacheRemovalStatefulBean extends TreeCacheStatefulBase
+{
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/TreeCacheStatefulBase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/TreeCacheStatefulBase.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/TreeCacheStatefulBase.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,216 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import javax.annotation.Resource;
+import javax.ejb.Init;
+import javax.ejb.PostActivate;
+import javax.ejb.PrePassivate;
+import javax.ejb.Remove;
+import javax.ejb.SessionContext;
+import javax.interceptor.Interceptors;
+import javax.naming.InitialContext;
+
+import org.jboss.ejb3.Container;
+import org.jboss.logging.Logger;
+import org.jboss.serial.io.JBossObjectInputStream;
+import org.jboss.serial.io.JBossObjectOutputStream;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public class TreeCacheStatefulBase implements Stateful
+{
+ private static final Logger log = Logger.getLogger(TreeCacheStatefulBase.class);
+
+ private static int beansRemoved = 0;
+
+ @Resource
+ private SessionContext sessionContext;
+
+ @Resource(mappedName = "java:/DefaultDS")
+ private transient javax.sql.DataSource datasource;
+
+ @Resource(mappedName = "java:/ConnectionFactory")
+ public transient javax.jms.QueueConnectionFactory connectionFactory;
+
+ private String state;
+
+ @Interceptors(MyInterceptor.class)
+ public String getInterceptorState()
+ {
+ throw new RuntimeException("NOT REACHABLE");
+ }
+
+ @Interceptors(MyInterceptor.class)
+ public void setInterceptorState(String param)
+ {
+ throw new RuntimeException("NOT REACHABLE");
+ }
+
+ public boolean testSessionContext()
+ {
+ return sessionContext.isCallerInRole("role");
+ }
+
+ public void testResources() throws Exception
+ {
+ datasource.toString();
+ connectionFactory.toString();
+
+ javax.sql.DataSource ds = (javax.sql.DataSource) new InitialContext().lookup(Container.ENC_CTX_NAME
+ + "/env/jdbc/ds");
+ ds.toString();
+ }
+
+ public String getState() throws Exception
+ {
+ Thread.sleep(1000);
+ return state;
+ }
+
+ public void setState(String state) throws Exception
+ {
+ Thread.sleep(1000);
+ this.state = state;
+ }
+
+ public boolean interceptorAccessed()
+ {
+ return RemoteBindingInterceptor.accessed;
+ }
+
+ public void testThrownException() throws Exception
+ {
+ throw new Exception();
+ }
+
+ public void testExceptionCause() throws Exception
+ {
+ Object o = null;
+ o.toString();
+ }
+
+ @PrePassivate
+ public void passivate()
+ {
+ log.info("************ passivating");
+ wasPassivated = true;
+ }
+
+ @PostActivate
+ public void activate()
+ {
+ log.info("************ activating");
+ }
+
+ private static boolean wasPassivated = false;
+
+ public void testSerializedState(String state)
+ {
+ this.state = state;
+
+ TreeCacheStatefulBase bean = null;
+ try
+ {
+ ObjectOutputStream out;
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ out = new JBossObjectOutputStream(baos, false);
+ out.writeObject(this);
+ out.flush();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+
+ JBossObjectInputStream is = new JBossObjectInputStream(bais);
+ bean = (TreeCacheStatefulBase) is.readObject();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ if (!state.equals(bean.state))
+ throw new RuntimeException("failed to serialize: " + bean.state);
+ }
+
+ public boolean wasPassivated()
+ {
+ return wasPassivated;
+ }
+
+ public void clearPassivated()
+ {
+ wasPassivated = false;
+ }
+
+ @Init
+ public void ejbCreate(Integer state)
+ {
+ this.state = state.toString();
+ }
+
+ @Init
+ public void ejbCreate(State state)
+ {
+ this.state = state.getState();
+ }
+
+ @Init
+ public void ejbCreate(String state)
+ {
+ this.state = state;
+ }
+
+ @Remove
+ public void removeMe()
+ {
+ ++beansRemoved;
+ }
+
+ public int beansRemoved()
+ {
+ return beansRemoved;
+ }
+
+ public void lookupStateful() throws Exception
+ {
+ // FIXME: NYI
+ throw new RuntimeException("NYI");
+ }
+
+ public void testStateful() throws Exception
+ {
+ // FIXME: NYI
+ throw new RuntimeException("NYI");
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/TreeCacheStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/TreeCacheStatefulBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/TreeCacheStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,50 @@
+/*
+ * 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.test.cluster.ejb3.stateful;
+
+import javax.annotation.Resource;
+import javax.annotation.Resources;
+import javax.ejb.Local;
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+
+import org.jboss.ejb3.annotation.Cache;
+import org.jboss.ejb3.annotation.CacheConfig;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.SecurityDomain;
+import org.jboss.ejb3.annotation.defaults.RemoteBindingDefaults;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at javax.ejb.Stateful(name = "TreeCacheStatefulBean")
+ at Remote(Stateful.class)
+ at Local(StatefulLocal.class)
+ at RemoteBinding(jndiBinding = "TreeCacheStateful", interceptorStack = "RemoteBindingStatefulSessionClientInterceptors", factory = RemoteBindingDefaults.PROXY_FACTORY_STATEFUL_REMOTE)
+ at CacheConfig(name = "jboss.cache:service=EJB3SFSBClusteredCache", maxSize = 1000, idleTimeoutSeconds = 1)
+ at SecurityDomain("test")
+ at Resources(
+{@Resource(name = "jdbc/ds", mappedName = "java:/DefaultDS")})
+ at Cache("StatefulTreeCache")
+public class TreeCacheStatefulBean extends TreeCacheStatefulBase
+{
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/BeanMonitor.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/BeanMonitor.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/BeanMonitor.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,67 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base;
+
+import java.rmi.dgc.VMID;
+
+public interface BeanMonitor extends Removable
+{
+ VMID getVMID();
+
+ void monitor(TopLevel topLevel);
+
+ String getDeepNestedId();
+
+ String getLocalDeepNestedId();
+
+ int getParentPassivations();
+
+ int getNestedPassivations();
+
+ int getLocalNestedPassivations();
+
+ int getDeepNestedPassivations();
+
+ int getLocalDeepNestedPassivations();
+
+ int getParentActivations();
+
+ int getNestedActivations();
+
+ int getLocalNestedActivations();
+
+ int getDeepNestedActivations();
+
+ int getLocalDeepNestedActivations();
+
+ boolean removeParent();
+
+ boolean removeNested();
+
+ boolean removeLocalNested();
+
+ boolean removeDeepNested();
+
+ boolean removeLocalDeepNested();
+
+}
\ No newline at end of file
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/BeanMonitorBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/BeanMonitorBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/BeanMonitorBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,303 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base;
+
+import java.rmi.dgc.VMID;
+
+import javax.ejb.Remove;
+
+import org.jboss.logging.Logger;
+
+/**
+ * A BeanMonitorBean.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+public class BeanMonitorBean implements BeanMonitor
+{
+ protected Logger log = Logger.getLogger(getClass());
+
+ protected TopLevel parent;
+ protected MidLevel nested;
+ protected MidLevel localNested;
+ protected DeepNestedStateful deepNested;
+ protected DeepNestedStateful localDeepNested;
+
+ public VMID getVMID()
+ {
+ return VMTracker.VMID;
+ }
+
+ public void monitor(TopLevel topLevel)
+ {
+ this.parent = topLevel;
+ log.debug("parent is " + parent);
+ this.nested = parent.getNested();
+ log.debug("nested is " + nested);
+ this.localNested = parent.getLocalNested();
+ log.debug("localNested is " + localNested);
+ this.deepNested = nested.getDeepNestedStateful();
+ log.debug("deepNested is " + deepNested);
+ this.localDeepNested = localNested.getDeepNestedStateful();
+ log.debug("localDeepNested is " + localDeepNested);
+ }
+
+ public String getDeepNestedId()
+ {
+ try
+ {
+ return deepNested.getInternalId();
+ }
+ catch (Exception e)
+ {
+ log.warn("getDeepNestedId() " + e.getLocalizedMessage(), e);
+ return "ERROR";
+ }
+ }
+
+ public String getLocalDeepNestedId()
+ {
+ try
+ {
+ return localDeepNested.getInternalId();
+ }
+ catch (Exception e)
+ {
+ log.warn("getLocalDeepNestedId() " + e.getLocalizedMessage(), e);
+ return "ERROR";
+ }
+ }
+
+ public int getParentPassivations()
+ {
+ try
+ {
+ return parent.getPrePassivate();
+ }
+ catch (Exception e)
+ {
+ log.warn("getParentPassivations() " + e.getLocalizedMessage(), e);
+ return -1;
+ }
+ }
+
+ public int getNestedPassivations()
+ {
+ try
+ {
+ return nested.getPrePassivate();
+ }
+ catch (Exception e)
+ {
+ log.warn("getNestedPassivations() " + e.getLocalizedMessage(), e);
+ return -1;
+ }
+ }
+
+ public int getLocalNestedPassivations()
+ {
+ try
+ {
+ return localNested.getPrePassivate();
+ }
+ catch (Exception e)
+ {
+ log.warn("getLocalNestedPassivations() " + e.getLocalizedMessage(), e);
+ return -1;
+ }
+ }
+
+ public int getDeepNestedPassivations()
+ {
+ try
+ {
+ return deepNested.getPrePassivate();
+ }
+ catch (Exception e)
+ {
+ log.warn("getDeepNestedPassivations() " + e.getLocalizedMessage(), e);
+ return -1;
+ }
+ }
+
+ public int getLocalDeepNestedPassivations()
+ {
+ try
+ {
+ return localDeepNested.getPrePassivate();
+ }
+ catch (Exception e)
+ {
+ log.warn("getLocalDeepNestedPassivations() " + e.getLocalizedMessage(), e);
+ return -1;
+ }
+ }
+
+ public int getParentActivations()
+ {
+ try
+ {
+ return parent.getPostActivate();
+ }
+ catch (Exception e)
+ {
+ log.warn("getParentActivations() " + e.getLocalizedMessage(), e);
+ return -1;
+ }
+ }
+
+ public int getNestedActivations()
+ {
+ try
+ {
+ return nested.getPostActivate();
+ }
+ catch (Exception e)
+ {
+ log.debug("getNestedActivations() " + e.getLocalizedMessage());
+ return -1;
+ }
+ }
+
+ public int getLocalNestedActivations()
+ {
+ try
+ {
+ return localNested.getPostActivate();
+ }
+ catch (Exception e)
+ {
+ log.warn("getLocalNestedActivations() " + e.getLocalizedMessage(), e);
+ return -1;
+ }
+ }
+
+ public int getDeepNestedActivations()
+ {
+ try
+ {
+ return deepNested.getPostActivate();
+ }
+ catch (Exception e)
+ {
+ log.warn("getDeepNestedActivations() " + e.getLocalizedMessage(), e);
+ return -1;
+ }
+ }
+
+ public int getLocalDeepNestedActivations()
+ {
+ try
+ {
+ return localDeepNested.getPostActivate();
+ }
+ catch (Exception e)
+ {
+ log.debug("getLocalDeepNestedActivations() " + e.getLocalizedMessage());
+ return -1;
+ }
+ }
+
+ public boolean removeParent()
+ {
+ try
+ {
+ parent.remove();
+ return true;
+ }
+ catch (Exception e)
+ {
+ log.warn("removeParent() " + e.getLocalizedMessage(), e);
+ return false;
+ }
+ }
+
+ public boolean removeNested()
+ {
+ try
+ {
+ nested.remove();
+ return true;
+ }
+ catch (Exception e)
+ {
+ log.debug("removeNested() " + e.getLocalizedMessage());
+ return false;
+ }
+ }
+
+ public boolean removeLocalNested()
+ {
+ try
+ {
+ localNested.remove();
+ return true;
+ }
+ catch (Exception e)
+ {
+ log.warn("removeLocalNested() " + e.getLocalizedMessage(), e);
+ return false;
+ }
+ }
+
+ public boolean removeDeepNested()
+ {
+ try
+ {
+ deepNested.remove();
+ return true;
+ }
+ catch (Exception e)
+ {
+ log.debug("removeDeepNested() " + e.getLocalizedMessage());
+ return false;
+ }
+ }
+
+ public boolean removeLocalDeepNested()
+ {
+ try
+ {
+ localDeepNested.remove();
+ return true;
+ }
+ catch (Exception e)
+ {
+ log.warn("removeLocalDeepNested() " + e.getLocalizedMessage(), e);
+ return false;
+ }
+ }
+
+ @Remove
+ public void remove()
+ {
+ log.debug("Being removed");
+ removeParent();
+ removeNested();
+ removeLocalNested();
+ removeDeepNested();
+ removeLocalDeepNested();
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/DeepNestedStateful.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/DeepNestedStateful.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/DeepNestedStateful.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,34 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base;
+
+/**
+ * A nested SFSB that operates at the 3rd level of a tree of beans.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+public interface DeepNestedStateful extends PassivationActivationWatcher
+{
+ String getInternalId();
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/DeepNestedStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/DeepNestedStatefulBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/DeepNestedStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,55 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base;
+
+import javax.ejb.Remove;
+
+import org.jboss.util.id.GUID;
+
+/**
+ * A DeepNestedStatefulBean.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+public class DeepNestedStatefulBean
+ extends PassivationActivationWatcherBean
+ implements DeepNestedStateful
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ private String internalId = new GUID().toString();
+
+ public String getInternalId()
+ {
+ return internalId;
+ }
+
+ @Remove
+ public void remove()
+ {
+ log.debug(internalId + " is being removed");
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/MidLevel.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/MidLevel.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/MidLevel.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,34 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base;
+
+/**
+ * A MidLevel.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+public interface MidLevel extends PassivationActivationWatcher
+{
+ DeepNestedStateful getDeepNestedStateful();
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/PassivationActivationWatcher.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/PassivationActivationWatcher.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/PassivationActivationWatcher.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,38 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base;
+
+/**
+ * Interface for a bean that tracks the number invocations of @PrePassivate
+ * and @PostActivate.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+public interface PassivationActivationWatcher extends Removable
+{
+ int getPostActivate();
+
+ int getPrePassivate();
+
+ void reset();
+}
\ No newline at end of file
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/PassivationActivationWatcherBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/PassivationActivationWatcherBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/PassivationActivationWatcherBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,92 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base;
+
+import java.io.Serializable;
+
+import javax.ejb.PostActivate;
+import javax.ejb.PrePassivate;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Superclass for SFSBs that monitor calls to @PrePassivate and @PostActivate.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+public abstract class PassivationActivationWatcherBean
+ implements Serializable, PassivationActivationWatcher
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ protected Logger log = Logger.getLogger(getClass());
+ private int postActivateCalled = 0;
+ private int prePassivateCalled = 0;
+
+ public PassivationActivationWatcherBean()
+ {
+ super();
+ }
+
+ @PostActivate
+ public void postActivate()
+ {
+ postActivateCalled++;
+ int sysHC = System.identityHashCode(this);
+ log.debug(sysHC + ": Activated -- activate count = " + postActivateCalled );
+ }
+
+ @PrePassivate
+ public void prePassivate()
+ {
+ prePassivateCalled++;
+ int sysHC = System.identityHashCode(this);
+ log.debug(sysHC + ": Passivated -- passivate count = " + prePassivateCalled );
+ }
+
+ public int getPostActivate()
+ {
+ int sysHC = System.identityHashCode(this);
+ log.debug(sysHC + ": getPostActivate() -- activate count = " +
+ postActivateCalled );
+ return postActivateCalled;
+ }
+
+ public int getPrePassivate()
+ {
+ int sysHC = System.identityHashCode(this);
+ log.debug(sysHC + ": getPrePassivate() -- passivate count = " +
+ prePassivateCalled );
+ return prePassivateCalled;
+ }
+
+ public void reset()
+ {
+ int sysHC = System.identityHashCode(this);
+ log.debug(sysHC + "Being reset");
+ prePassivateCalled = 0;
+ postActivateCalled = 0;
+ }
+
+}
\ No newline at end of file
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/Removable.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/Removable.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/Removable.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,34 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base;
+
+/**
+ * An SFSB with a remove method.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+public interface Removable
+{
+ void remove();
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/TopLevel.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/TopLevel.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/TopLevel.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,36 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base;
+
+/**
+ * A TopLevel.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+public interface TopLevel extends PassivationActivationWatcher
+{
+ MidLevel getNested();
+
+ MidLevel getLocalNested();
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/VMTracker.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/VMTracker.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/VMTracker.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,38 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base;
+
+import java.rmi.dgc.VMID;
+
+/**
+ * Provides SLSB access to a static VMID field.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+public interface VMTracker
+{
+ public static final VMID VMID = new VMID();
+
+ VMID getVMID();
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/VMTrackerBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/VMTrackerBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/VMTrackerBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,44 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base;
+
+import java.rmi.dgc.VMID;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+/**
+ * Provides SLSB access to a static VMID (allowing identification of a JVM.)
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+ at Stateless
+ at Remote(VMTracker.class)
+public class VMTrackerBean implements VMTracker
+{
+ public VMID getVMID()
+ {
+ return VMID;
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/NestedBeanMonitor.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/NestedBeanMonitor.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/NestedBeanMonitor.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -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.test.cluster.ejb3.stateful.nested.base.std;
+
+import org.jboss.test.cluster.ejb3.stateful.nested.base.BeanMonitor;
+
+
+/**
+ * SFSB that can monitor a ParentStatefulRemote and its affiliated beans.
+ * Basically an in-VM client that has refs to all the SFSBs in the bean
+ * structure.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+public interface NestedBeanMonitor extends BeanMonitor
+{
+ int incrementParent();
+ int incrementNested();
+ int incrementLocalNested();
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/NestedBeanMonitorBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/NestedBeanMonitorBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/NestedBeanMonitorBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,90 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base.std;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+
+import org.jboss.test.cluster.ejb3.stateful.nested.base.BeanMonitorBean;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.TopLevel;
+
+/**
+ * A NestedBeanMonitorBean.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+ at Stateful
+ at Remote(NestedBeanMonitor.class)
+ at TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
+public class NestedBeanMonitorBean
+ extends BeanMonitorBean
+ implements NestedBeanMonitor
+{
+ public void monitor(TopLevel topLevel)
+ {
+ // Just do a cast to confirm the type
+ super.monitor((ParentStatefulRemote) topLevel);
+ }
+
+ public int incrementParent()
+ {
+ try
+ {
+ return ((ParentStatefulRemote) parent).increment();
+ }
+ catch (Exception e)
+ {
+ log.debug("incrementParent() " + e.getLocalizedMessage());
+ return -1;
+ }
+ }
+
+ public int incrementNested()
+ {
+ try
+ {
+ return ((NestedStateful) nested).increment();
+ }
+ catch (Exception e)
+ {
+ log.debug("incrementNested() " + e.getLocalizedMessage());
+ return -1;
+ }
+ }
+
+ public int incrementLocalNested()
+ {
+ try
+ {
+ return ((NestedStateful) localNested).increment();
+ }
+ catch (Exception e)
+ {
+ log.debug("incrementLocalNested() " + e.getLocalizedMessage());
+ return -1;
+ }
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/NestedStateful.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/NestedStateful.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/NestedStateful.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.test.cluster.ejb3.stateful.nested.base.std;
+
+import java.rmi.dgc.VMID;
+
+import org.jboss.test.cluster.ejb3.stateful.nested.base.MidLevel;
+
+
+/**
+ * Comment
+ *
+ * @author Ben Wang
+ * @version $Revision: 108925 $
+ */
+public interface NestedStateful extends MidLevel
+{
+ VMID getVMID();
+ int increment();
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/NestedStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/NestedStatefulBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/NestedStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.test.cluster.ejb3.stateful.nested.base.std;
+
+import javax.ejb.EJB;
+import javax.ejb.Remove;
+
+import org.jboss.test.cluster.ejb3.stateful.nested.base.DeepNestedStateful;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.PassivationActivationWatcherBean;
+
+/**
+ * Base class for a nested SFSB. Declares no class annotations,
+ * giving subclasses configuration freedom.
+ *
+ * @author Ben Wang
+ * @author Brian Stansberry
+ *
+ * @version $Revision: 108925 $
+ */
+public abstract class NestedStatefulBean extends PassivationActivationWatcherBean
+ implements NestedStateful
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ private int counter = 0;
+
+ @EJB(name="testDeepNestedStateful")
+ private DeepNestedStateful deepNestedStateful;
+
+ public void reset()
+ {
+ super.reset();
+ counter = 0;
+ deepNestedStateful.reset();
+ }
+
+ public int increment()
+ {
+ counter++;
+ log.debug("INCREMENT - counter: " + counter);
+ return counter;
+ }
+
+ @Remove
+ public void remove()
+ {
+ log.debug("Being removed");
+ }
+
+
+ public DeepNestedStateful getDeepNestedStateful()
+ {
+ return deepNestedStateful;
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/OptimizedNestedStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/OptimizedNestedStatefulBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/OptimizedNestedStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.test.cluster.ejb3.stateful.nested.base.std;
+
+import org.jboss.ejb3.cache.Optimized;
+
+/**
+ * NestedStatefulBean subclass that implements Optimized in such a way
+ * that getPrePassivate() and getPostActivate() calls are treated as
+ * non-modifications.
+ *
+ * @author Ben Wang
+ * @author Brian Stansberry
+ *
+ * @version $Revision: 108925 $
+ */
+public abstract class OptimizedNestedStatefulBean
+ extends NestedStatefulBean
+ implements Optimized
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ private boolean modified = true;
+
+
+ public boolean isModified()
+ {
+ boolean answer = modified;
+ modified = true;
+ return answer;
+ }
+
+ @Override
+ public int getPostActivate()
+ {
+ // by default all calls except these passivate/activate checks
+ // are modifications, so set modified to false
+ modified = false;
+ return super.getPostActivate();
+ }
+
+ @Override
+ public int getPrePassivate()
+ {
+ // by default all calls except these passivate/activate checks
+ // are modifications, so set modified to false
+ modified = false;
+ return super.getPrePassivate();
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/ParentStatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/ParentStatefulBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/ParentStatefulBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,129 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.test.cluster.ejb3.stateful.nested.base.std;
+
+import java.rmi.dgc.VMID;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
+import javax.ejb.Remove;
+
+import org.jboss.test.cluster.ejb3.stateful.nested.base.MidLevel;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.PassivationActivationWatcherBean;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.VMTracker;
+
+/**
+ * Parent SFSB that contains nested SFSBs. We don't
+ * annotate it with @Stateful or @CacheConfig so the
+ * subclasses used by the clustered and non-clustered tests
+ * can do that.
+ *
+ * NOTE: EJBTHREE-778 prevents us annotating this class
+ * @Remote(ParentStatefulRemote.class), but we would if we could. Currently
+ * the subclasses need to do it.
+ *
+ * @author Ben Wang
+ * @version $Revision: 108925 $
+ */
+public class ParentStatefulBean
+ extends PassivationActivationWatcherBean
+ implements ParentStatefulRemote
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ private int counter = 0;
+ private int localCounter = 0;
+
+ @EJB(beanName="testNestedStateful")
+ private NestedStateful nested;
+
+ @EJB(beanName="testLocalNestedStateful")
+ private NestedStateful localNested;
+
+ public VMID getVMID()
+ {
+ return VMTracker.VMID;
+ }
+
+ public int increment()
+ {
+ counter = nested.increment();
+
+ log.debug("INCREMENT - counter: " + counter);
+ return counter;
+ }
+
+ public int incrementLocal()
+ {
+ localCounter = localNested.increment();
+
+ log.debug("INCREMENT - localCounter: " + localCounter);
+ return localCounter;
+ }
+
+ /**
+ * Sleep to test
+ * @throws Exception
+ */
+ public void longRunning() throws Exception
+ {
+ log.debug("+++ longRunning() enter ");
+ Thread.sleep(10000);
+ log.debug("+++ longRunning() leave ");
+ }
+
+ public MidLevel getNested()
+ {
+ return nested;
+ }
+
+ public MidLevel getLocalNested()
+ {
+ return localNested;
+ }
+
+ public int getLocalNestedPostActivate()
+ {
+ return localNested.getPostActivate();
+ }
+
+ public int getLocalNestedPrePassivate()
+ {
+ return localNested.getPrePassivate();
+ }
+
+ public void reset()
+ {
+ super.reset();
+ counter = 0;
+ nested.reset();
+ localNested.reset();
+ }
+
+ @Remove
+ public void remove()
+ {
+ log.debug("Being removed");
+ }
+
+ public void setUpFailover(String failover)
+ {
+ // To setup the failover property
+ log.debug("Setting up failover property: " +failover);
+ System.setProperty ("JBossCluster-DoFail", failover);
+ }
+
+ @PostConstruct
+ public void ejbCreate()
+ {
+ }
+
+ // Remote Interface implementation ----------------------------------------------
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/ParentStatefulRemote.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/ParentStatefulRemote.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/std/ParentStatefulRemote.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.test.cluster.ejb3.stateful.nested.base.std;
+
+import java.rmi.dgc.VMID;
+
+import org.jboss.test.cluster.ejb3.stateful.nested.base.TopLevel;
+
+
+/**
+ * Parent sfsb interface
+ *
+ * @author Ben Wang
+ * @author Brian Stansberry
+ * @version $Revision: 108925 $
+ */
+public interface ParentStatefulRemote
+ extends TopLevel
+{
+ VMID getVMID();
+
+ int increment();
+
+ int incrementLocal();
+
+ void longRunning() throws Exception;
+
+ int getLocalNestedPostActivate();
+
+ int getLocalNestedPrePassivate();
+
+ public void setUpFailover(String failover);
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/Contained.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/Contained.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/Contained.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,46 @@
+/*
+* 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.test.cluster.ejb3.stateful.nested.base.xpc;
+
+import org.jboss.test.cluster.ejb3.stateful.nested.base.MidLevel;
+
+
+/**
+ * Comment
+ *
+ * @author Ben Wang
+ * @version $Revision: 108925 $
+ */
+public interface Contained extends MidLevel
+{
+ Customer find(long id);
+
+ void setCustomer(long id);
+
+ Customer getCustomer();
+
+ void updateCustomer();
+
+ void setContainedCustomer();
+
+ boolean checkContainedCustomer();
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/ContainedBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/ContainedBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/ContainedBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,106 @@
+/*
+* 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.test.cluster.ejb3.stateful.nested.base.xpc;
+
+import java.io.Serializable;
+
+import javax.ejb.EJB;
+import javax.ejb.Remove;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+
+import org.jboss.test.cluster.ejb3.stateful.nested.base.DeepNestedStateful;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.PassivationActivationWatcherBean;
+
+/**
+ * Comment
+ *
+ * @author Ben Wang
+ * @version $Revision: 108925 $
+ */
+public class ContainedBean
+ extends PassivationActivationWatcherBean
+ implements Contained, Serializable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ @PersistenceContext(unitName="tempdb",type=PersistenceContextType.EXTENDED)
+ private EntityManager em;
+
+ @EJB(beanName="testDeepNestedContained")
+ private DeepNestedContained deepNestedContained;
+
+ private Customer customer;
+
+ public Customer find(long id)
+ {
+ Customer c = em.find(Customer.class, id);
+ log.trace("customer " + id + " = " + c);
+ return c;
+ }
+
+ public void setCustomer(long id)
+ {
+ customer = find(id);
+ }
+
+ public Customer getCustomer()
+ {
+ return customer;
+ }
+
+ public void updateCustomer()
+ {
+ customer.setName("contained modified");
+ }
+
+ public void setContainedCustomer()
+ {
+ deepNestedContained.setCustomer(customer.getId());
+ }
+
+ public boolean checkContainedCustomer()
+ {
+ return (deepNestedContained.getCustomer() == customer);
+ }
+
+ @Remove
+ public void remove()
+ {
+
+ }
+
+ public DeepNestedStateful getDeepNestedStateful()
+ {
+ return deepNestedContained;
+ }
+
+ public void reset()
+ {
+ super.reset();
+ deepNestedContained.reset();
+ }
+
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/Customer.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/Customer.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/Customer.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,90 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base.xpc;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue; import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * Company customer
+ *
+ * @author Ben Wang
+ */
+ at Entity
+public class Customer implements java.io.Serializable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ long id;
+ String name;
+
+ public
+ Customer()
+ {
+ }
+
+ @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
+ public
+ long getId()
+ {
+ return id;
+ }
+
+ public
+ String getName()
+ {
+ return name;
+ }
+
+ public
+ void setId(long long1)
+ {
+ id = long1;
+ }
+
+ public
+ void setName(String string)
+ {
+ name = string;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+
+ if (obj instanceof Customer)
+ {
+ Customer other = (Customer) obj;
+ String oName = other.name == null ? "" : other.name;
+ return (this.id == other.id)
+ && (oName.equals(this.name));
+
+ }
+
+ return false;
+ }
+
+}
+
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/DeepNestedContained.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/DeepNestedContained.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/DeepNestedContained.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,39 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base.xpc;
+
+import org.jboss.test.cluster.ejb3.stateful.nested.base.DeepNestedStateful;
+
+/**
+ * A DeepNestedContained.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+public interface DeepNestedContained extends DeepNestedStateful
+{
+ Customer find(long id);
+ void setCustomer(long id);
+ Customer getCustomer();
+ void updateCustomer();
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/DeepNestedContainedBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/DeepNestedContainedBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/DeepNestedContainedBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,69 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base.xpc;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+
+import org.jboss.test.cluster.ejb3.stateful.nested.base.DeepNestedStatefulBean;
+
+/**
+ * A DeepNestedContainedBean.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+public class DeepNestedContainedBean
+ extends DeepNestedStatefulBean
+ implements DeepNestedContained
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ @PersistenceContext(unitName="tempdb",type=PersistenceContextType.EXTENDED)
+ private EntityManager em;
+
+ private Customer customer;
+
+ public Customer find(long id)
+ {
+ return em.find(Customer.class, id);
+ }
+
+ public void setCustomer(long id)
+ {
+ customer = find(id);
+ }
+
+ public Customer getCustomer()
+ {
+ return customer;
+ }
+
+ public void updateCustomer()
+ {
+ customer.setName("modified by " + getInternalId());
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/NestedStatelessLocal.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/NestedStatelessLocal.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/NestedStatelessLocal.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,39 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base.xpc;
+
+import org.jboss.test.cluster.ejb3.stateful.nested.base.VMTracker;
+
+
+
+
+/**
+ * comment
+ *
+ * @author Ben Wang
+ */
+public interface NestedStatelessLocal extends VMTracker
+{
+ void update(Customer c);
+
+ void findAndUpdate(long id);
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/NestedStatelessSessionBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/NestedStatelessSessionBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/NestedStatelessSessionBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,62 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base.xpc;
+
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.test.cluster.ejb3.stateful.nested.base.VMTrackerBean;
+
+/**
+ * SLSB that is meant to be nested in a parent SFSB and share
+ * and ExtendedPersistenceContext with it.
+ *
+ * @author Ben Wang
+ * @author Brian Stansberry
+ */
+ at Stateless
+ at Local(NestedStatelessLocal.class)
+public class NestedStatelessSessionBean
+ extends VMTrackerBean
+ implements NestedStatelessLocal
+{
+ @PersistenceContext(unitName="tempdb")
+ private EntityManager em;
+
+ public void update(Customer c)
+ {
+ c.setName("Bill Jr.");
+ }
+
+ public void findAndUpdate(long id)
+ {
+ Customer cust = find(id);
+ cust.setName("stateless modified");
+ }
+
+ public Customer find(long id)
+ {
+ return em.find(Customer.class, id);
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/NestedXPCMonitor.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/NestedXPCMonitor.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/NestedXPCMonitor.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,48 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base.xpc;
+
+import org.jboss.test.cluster.ejb3.stateful.nested.base.BeanMonitor;
+
+/**
+ * A NestedXPCBeanMonitor.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+public interface NestedXPCMonitor extends BeanMonitor
+{
+ Customer find(long id);
+
+ Customer findParent(long id);
+ Customer findNested(long id);
+ Customer findLocalNested(long id);
+ Customer findDeepNested(long id);
+ Customer findLocalDeepNested(long id);
+
+ boolean compareTopToNested(long id);
+ boolean compareTopToLocalNested(long id);
+ boolean compareNestedToLocalNested(long id);
+ boolean compareNestedToDeepNested(long id);
+ boolean compareLocalNestedToLocalDeepNested(long id);
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/NestedXPCMonitorBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/NestedXPCMonitorBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/NestedXPCMonitorBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,234 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base.xpc;
+
+import java.util.HashSet;
+import java.util.Set;
+
+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 org.jboss.test.cluster.ejb3.stateful.nested.base.BeanMonitorBean;
+
+/**
+ * A NestedXPCMonitorBean.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+ at Stateful
+ at Remote(NestedXPCMonitor.class)
+ at TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
+public class NestedXPCMonitorBean
+ extends BeanMonitorBean
+ implements NestedXPCMonitor
+{
+ @PersistenceContext(unitName="tempdb")
+ private EntityManager em;
+
+ private Set<Long> ids = new HashSet<Long>();
+
+ @TransactionAttribute(TransactionAttributeType.REQUIRED)
+ public Customer find(long id)
+ {
+ ids.add(new Long(id));
+ return em.find(Customer.class, id);
+ }
+
+ public boolean compareLocalNestedToLocalDeepNested(long id)
+ {
+ try
+ {
+ Contained midLevel = (Contained) localNested;
+ midLevel.setCustomer(id);
+ midLevel.setContainedCustomer();
+ return midLevel.checkContainedCustomer();
+ }
+ catch (Exception e)
+ {
+ log.debug("compareLocalNestedToDeepNested(): " + e.getLocalizedMessage());
+ }
+ return false;
+ }
+
+ public boolean compareNestedToDeepNested(long id)
+ {
+ try
+ {
+ Contained midLevel = (Contained) nested;
+ midLevel.setCustomer(id);
+ midLevel.setContainedCustomer();
+ return midLevel.checkContainedCustomer();
+ }
+ catch (Exception e)
+ {
+ log.debug("compareNestedToDeepNested(): " + e.getLocalizedMessage());
+ }
+ return false;
+ }
+
+ public boolean compareTopToLocalNested(long id)
+ {
+ try
+ {
+ ShoppingCart cart = (ShoppingCart) parent;
+ cart.setCustomer(id);
+ cart.setContainedCustomer();
+ return cart.checkContainedCustomer();
+ }
+ catch (Exception e)
+ {
+ log.debug("compareTopToLocalNested(): " + e.getLocalizedMessage());
+ }
+ return false;
+ }
+
+ public boolean compareTopToNested(long id)
+ {
+ try
+ {
+ Customer mid = findNested(id);
+ Customer top = findParent(id);
+
+ return (mid != null && mid != top && mid.equals(top)) ;
+ }
+ catch (Exception e)
+ {
+ log.debug("compareTopToNested(): " + e.getLocalizedMessage());
+ }
+ return false;
+ }
+
+ public boolean compareNestedToLocalNested(long id)
+ {
+ try
+ {
+ Customer remote = findNested(id);
+ Customer local = findLocalNested(id);
+
+ return (remote != null && remote.equals(local));
+ }
+ catch (Exception e)
+ {
+ log.debug("compareTopToLocalNested(): " + e.getLocalizedMessage());
+ }
+ return false;
+ }
+
+ @TransactionAttribute(TransactionAttributeType.SUPPORTS)
+ public Customer findDeepNested(long id)
+ {
+ try
+ {
+ return ((DeepNestedContained) deepNested).find(id);
+ }
+ catch (Exception e)
+ {
+ log.debug("findDeepNested(): " + e.getLocalizedMessage());
+ }
+ return null;
+ }
+
+ @TransactionAttribute(TransactionAttributeType.SUPPORTS)
+ public Customer findLocalDeepNested(long id)
+ {
+ try
+ {
+ return ((DeepNestedContained) localDeepNested).find(id);
+ }
+ catch (Exception e)
+ {
+ log.debug("findLocalDeepNested(): " + e.getLocalizedMessage());
+ }
+ return null;
+ }
+
+ @TransactionAttribute(TransactionAttributeType.SUPPORTS)
+ public Customer findLocalNested(long id)
+ {
+ try
+ {
+ return ((Contained) localNested).find(id);
+ }
+ catch (Exception e)
+ {
+ log.debug("findLocalNested(): " + e.getLocalizedMessage());
+ }
+ return null;
+ }
+
+ @TransactionAttribute(TransactionAttributeType.SUPPORTS)
+ public Customer findNested(long id)
+ {
+ try
+ {
+ return ((Contained) nested).find(id);
+ }
+ catch (Exception e)
+ {
+ log.debug("findNested(): " + e.getLocalizedMessage());
+ }
+ return null;
+ }
+
+ @TransactionAttribute(TransactionAttributeType.SUPPORTS)
+ public Customer findParent(long id)
+ {
+ try
+ {
+ return ((ShoppingCart) parent).find(id);
+ }
+ catch (Exception e)
+ {
+ log.debug("findParent(): " + e.getLocalizedMessage());
+ }
+ return null;
+ }
+
+ @Override
+ @TransactionAttribute(TransactionAttributeType.REQUIRED)
+ public void remove()
+ {
+ super.remove();
+
+ for (Long id : ids)
+ {
+ try
+ {
+ Customer c = em.find(Customer.class, id.longValue());
+ if (c != null)
+ em.remove(c);
+ }
+ catch (Exception e)
+ {
+ log.debug("remove(): Problem removing " + id, e);
+ }
+ }
+ }
+
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/ShoppingCart.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/ShoppingCart.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/ShoppingCart.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,64 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base.xpc;
+
+import java.rmi.dgc.VMID;
+
+import org.jboss.test.cluster.ejb3.stateful.nested.base.PassivationActivationWatcher;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.TopLevel;
+
+
+/**
+ * Interface exposed by SFSB used in ExtendedPersistenceContext testing.
+ *
+ * @author Ben Wang
+ * @author Brian Stansberry
+ */
+public interface ShoppingCart
+ extends PassivationActivationWatcher, TopLevel
+{
+ VMID getVMID();
+
+ long createCustomer();
+
+ void update();
+
+ Customer find(long id);
+
+ void update2();
+
+ void update3();
+
+ void never();
+
+ void setCustomer(long id);
+
+ void setContainedCustomer();
+
+ void updateContained();
+
+ void findAndUpdateStateless();
+
+ boolean checkContainedCustomer();
+
+ void setUpFailover(String failover);
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/ShoppingCartBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/ShoppingCartBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/nested/base/xpc/ShoppingCartBean.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,160 @@
+/*
+ * 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.test.cluster.ejb3.stateful.nested.base.xpc;
+
+import java.rmi.dgc.VMID;
+
+import javax.ejb.EJB;
+import javax.ejb.Remove;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+
+import org.jboss.test.cluster.ejb3.stateful.nested.base.MidLevel;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.PassivationActivationWatcherBean;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.VMTracker;
+
+/**
+ * Base SFSB for use in ExtendedPersistenceContext testing.
+ *
+ * @author Ben Wang
+ */
+public class ShoppingCartBean
+ extends PassivationActivationWatcherBean
+ implements ShoppingCart
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ @PersistenceContext(unitName="tempdb",type=PersistenceContextType.EXTENDED)
+ private EntityManager em;
+
+ private Customer customer;
+
+ @EJB(beanName="testShoppingCartContained")
+ private Contained contained;
+
+ @EJB(beanName="testLocalShoppingCartContained")
+ private Contained localContained;
+
+ @EJB
+ private NestedStatelessLocal stateless;
+
+ public VMID getVMID()
+ {
+ return VMTracker.VMID;
+ }
+
+ public MidLevel getLocalNested()
+ {
+ return localContained;
+ }
+
+ public MidLevel getNested()
+ {
+ return contained;
+ }
+
+ public long createCustomer()
+ {
+ customer = new Customer();
+ customer.setName("William");
+ em.persist(customer);
+ System.out.println("********* created *****");
+ return customer.getId();
+ }
+
+ public void setCustomer(long id)
+ {
+ customer = find(id);
+ }
+
+ public void setContainedCustomer()
+ {
+ localContained.setCustomer(customer.getId());
+ }
+
+ public boolean checkContainedCustomer()
+ {
+ return (localContained.getCustomer() == customer);
+ }
+
+ public void updateContained()
+ {
+ localContained.updateCustomer();
+ }
+
+ public void update()
+ {
+ System.out.println("********* update() *****");
+ customer.setName("Bill");
+ }
+ public void update2()
+ {
+ customer.setName("Billy");
+ }
+
+ public void update3()
+ {
+ stateless.update(customer);
+ }
+
+ public void findAndUpdateStateless()
+ {
+ stateless.findAndUpdate(customer.getId());
+ if (!customer.getName().equals("stateless modified"))
+ throw new RuntimeException("stateless didn't get propagated pc");
+ }
+
+ public Customer find(long id)
+ {
+ return em.find(Customer.class, id);
+ }
+
+ @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
+ public void never()
+ {
+ customer.setName("Bob");
+ }
+
+ public void reset()
+ {
+ super.reset();
+ contained.reset();
+ localContained.reset();
+ }
+
+
+ @Remove
+ public void remove()
+ {
+ }
+
+ public void setUpFailover(String failover)
+ {
+ // To setup the failover property
+ log.debug("Setting up failover property: " +failover);
+ System.setProperty ("JBossCluster-DoFail", failover);
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/BaseTestRunner.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/BaseTestRunner.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/BaseTestRunner.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,154 @@
+/*
+ * 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.test.cluster.ejb3.stateful.unit;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ejb.NoSuchEJBException;
+import javax.naming.InitialContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.Removable;
+
+/**
+ * Base class for test runners that can share test functionality between
+ * JBossTestCase subclasses and JBossClusteredTestCase subclasses.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+public class BaseTestRunner
+{
+ protected InitialContext initialContext;
+ protected Set<Removable> removables = new HashSet<Removable>();
+
+ private Logger log;
+ private long sleepTime = 11100L;
+ private int passivationPerInvocation = 0;
+ private int passivationPerSleep = 1;
+
+ public BaseTestRunner(InitialContext context, Logger log)
+ {
+ this.initialContext = context;
+ this.log = log;
+ }
+
+ public void setUp() throws Exception
+ {
+ }
+
+ public void tearDown() throws Exception
+ {
+ // Remove any EJBs so they don't spuriously passivate and
+ // throw off the passivation counts
+ for (Removable removable : removables)
+ {
+ try
+ {
+ removable.remove();
+ }
+ catch (Exception ignored) {}
+ }
+
+ removables.clear();
+ }
+
+ protected InitialContext getInitialContext()
+ {
+ return initialContext;
+ }
+
+ protected Logger getLog()
+ {
+ return log;
+ }
+
+ public long getSleepTime()
+ {
+ return sleepTime;
+ }
+
+ public void setSleepTime(long sleepTime)
+ {
+ this.sleepTime = sleepTime;
+ }
+
+ public void sleep(long time)
+ {
+ try {
+ Thread.sleep(time);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void sleep()
+ {
+ sleep(getSleepTime());
+ }
+
+ public int getPassivationPerInvocation()
+ {
+ return passivationPerInvocation;
+ }
+
+ public void setPassivationPerInvocation(int passivationPerInvocation)
+ {
+ this.passivationPerInvocation = passivationPerInvocation;
+ }
+
+ public int getPassivationPerSleep()
+ {
+ return passivationPerSleep;
+ }
+
+ public void setPassivationPerSleep(int passivationPerSleep)
+ {
+ this.passivationPerSleep = passivationPerSleep;
+ }
+
+ public int getExpectedPassivations(int sleepCycles, int invocations)
+ {
+ return (sleepCycles * passivationPerSleep) +
+ (invocations * passivationPerInvocation);
+ }
+
+ public void addRemovable(Removable bean)
+ {
+ removables.add(bean);
+ }
+
+ public void removeBean(Removable bean)
+ {
+ try
+ {
+ bean.remove();
+ }
+ catch (NoSuchEJBException ignored)
+ {
+ // this is OK; it was already removed
+ }
+ removables.remove(bean);
+ }
+
+}
\ No newline at end of file
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/ExtendedPersistenceUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/ExtendedPersistenceUnitTestCase.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/ExtendedPersistenceUnitTestCase.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,96 @@
+/*
+ * 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.test.cluster.ejb3.stateful.unit;
+
+import junit.framework.Test;
+
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Tests for ExtendedPersistenceContext management.
+ *
+ * This class uses a delegate to execute the tests so the clustered
+ * version of the tests (which derive from a different base class)
+ * can use the same delegate code.
+ *
+ * @author Ben Wang
+ * @version $Id: ExtendedPersistenceUnitTestCase.java 108925 2010-10-26 18:07:35Z pferraro $
+ */
+public class ExtendedPersistenceUnitTestCase extends JBossTestCase
+{
+ private XPCTestRunner runner;
+
+ public ExtendedPersistenceUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(ExtendedPersistenceUnitTestCase.class,
+ "stateful-test.jar");
+ }
+
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ runner = new XPCTestRunner(getInitialContext(), getLog());
+ runner.setUp();
+ // Use a sleep time just a bit longer than twice the bean timeout
+ runner.setSleepTime(2100L);
+ }
+
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ if (runner != null)
+ runner.tearDown();
+ }
+
+
+ public void testBasic() throws Exception
+ {
+ runner.testBasic();
+ }
+
+ public void testDependentLifecycle() throws Exception
+ {
+ runner.testDependentLifecycle();
+ }
+
+ public void testXPCSharing() throws Exception
+ {
+ runner.testXPCSharing();
+ }
+
+ public void testPassivation() throws Exception
+ {
+ runner.testPassivation();
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/MetricsUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/MetricsUnitTestCase.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/MetricsUnitTestCase.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,194 @@
+/*
+ * 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.test.cluster.ejb3.stateful.unit;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+
+import org.jboss.logging.Logger;
+import org.jboss.security.client.SecurityClient;
+import org.jboss.security.client.SecurityClientFactory;
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.cluster.ejb3.stateful.Stateful;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public class MetricsUnitTestCase
+extends JBossTestCase
+{
+ private static final Logger log = Logger.getLogger(MetricsUnitTestCase.class);
+
+ private SecurityClient client = null;
+
+ public MetricsUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ this.client = SecurityClientFactory.getSecurityClient();
+ client.setSimple("somebody", "password");
+ client.login();
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(MetricsUnitTestCase.class, "stateful-test.jar");
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ if(client == null)
+ return;
+ client.logout();
+ client = null;
+
+ super.tearDown();
+ }
+
+ protected void testJmxMetrics(MBeanServerConnection server, String jndiBinding, String objectName) throws Exception
+ {
+ ObjectName testerName = new ObjectName(objectName);
+
+ // Get the start cache size
+ int startCacheSize = (Integer)server.getAttribute(testerName, "CacheSize");
+ int startTotalSize = (Integer)server.getAttribute(testerName, "TotalSize");
+
+ // Establish how many beans are already active
+ int prevCount = (Integer)server.getAttribute(testerName, "CreateCount");
+ System.out.println("prevCount = " + prevCount);
+ assertTrue("can't have negative creation count", prevCount >= 0);
+
+ Stateful stateful = (Stateful)getInitialContext().lookup(jndiBinding);
+ assertNotNull(stateful);
+ stateful.setState("state");
+
+ int createCount = (Integer)server.getAttribute(testerName, "CreateCount");
+ assertEquals(1, createCount - prevCount);
+
+ // Ensure cache is incremented
+ int newCacheSize = (Integer)server.getAttribute(testerName, "CacheSize");
+ assertEquals(startCacheSize+1, newCacheSize);
+
+ int totalSize = (Integer)server.getAttribute(testerName, "TotalSize");
+ assertEquals(startTotalSize+1, totalSize);
+
+ assertEquals("state", stateful.getState());
+ stateful.testSerializedState("state");
+ stateful.clearPassivated();
+ assertEquals(null, stateful.getInterceptorState());
+ stateful.setInterceptorState("hello world");
+ assertFalse(stateful.testSessionContext());
+ Thread.sleep(10 * 1000);
+
+ int cacheSize = (Integer)server.getAttribute(testerName, "CacheSize");
+ assertEquals(0, cacheSize);
+
+ int passivatedCount = (Integer)server.getAttribute(testerName, "PassivatedCount");
+ assertEquals(1, passivatedCount - prevCount);
+ assertTrue(stateful.wasPassivated());
+
+ totalSize = (Integer)server.getAttribute(testerName, "TotalSize");
+ assertEquals(cacheSize + passivatedCount, totalSize);
+
+ assertEquals("state", stateful.getState());
+ assertEquals("hello world", stateful.getInterceptorState());
+
+ passivatedCount = (Integer)server.getAttribute(testerName, "PassivatedCount");
+ assertEquals(0, passivatedCount - prevCount);
+
+ Stateful another = (Stateful)getInitialContext().lookup(jndiBinding);
+ assertEquals(null, another.getInterceptorState());
+ another.setInterceptorState("foo");
+ assertEquals("foo", another.getInterceptorState());
+ assertEquals("hello world", stateful.getInterceptorState());
+
+ assertFalse(stateful.testSessionContext());
+
+ stateful.testResources();
+
+ createCount = (Integer)server.getAttribute(testerName, "CreateCount");
+ assertEquals(2, createCount - prevCount);
+
+ // the injected beans are passivated at this point in time
+
+ cacheSize = (Integer)server.getAttribute(testerName, "CacheSize");
+ assertEquals(2, cacheSize);
+
+ // keep in mind, we're not removing already injected beans
+
+ int removeCount = (Integer)server.getAttribute(testerName, "RemoveCount");
+ assertEquals(0, removeCount);
+
+ another.removeMe();
+ cacheSize = (Integer)server.getAttribute(testerName, "CacheSize");
+ assertEquals(1, cacheSize);
+
+ removeCount = (Integer)server.getAttribute(testerName, "RemoveCount");
+ assertEquals(1, removeCount);
+
+ totalSize = (Integer)server.getAttribute(testerName, "TotalSize");
+ assertEquals(cacheSize + passivatedCount, totalSize);
+
+ stateful.removeMe();
+ cacheSize = (Integer)server.getAttribute(testerName, "CacheSize");
+ assertEquals(0, cacheSize);
+
+ removeCount = (Integer)server.getAttribute(testerName, "RemoveCount");
+ assertEquals(2, removeCount);
+
+ totalSize = (Integer)server.getAttribute(testerName, "TotalSize");
+ assertEquals(cacheSize + passivatedCount, totalSize);
+
+ }
+
+ public void testJmxMetricsStateful() throws Exception
+ {
+ MBeanServerConnection server = getServer();
+
+ // Note: we got one creation in ServiceBean
+
+ testJmxMetrics(server, "Stateful", "jboss.j2ee:jar=stateful-test.jar,name=StatefulBean,service=EJB3");
+ }
+
+ public void testJmxMetricsTreeCacheStateful() throws Exception
+ {
+ MBeanServerConnection server = getServer();
+
+ testJmxMetrics(server, "TreeCacheStateful", "jboss.j2ee:jar=stateful-test.jar,name=TreeCacheStatefulBean,service=EJB3");
+ }
+
+ public void testJmxMetricsTreeCacheRemovalStateful() throws Exception
+ {
+ MBeanServerConnection server = getServer();
+
+ testJmxMetrics(server, "TreeCacheRemovalStateful", "jboss.j2ee:jar=stateful-test.jar,name=TreeCacheRemovalStatefulBean,service=EJB3");
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/NestedBeanTestRunner.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/NestedBeanTestRunner.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/NestedBeanTestRunner.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,493 @@
+/*
+ * 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.test.cluster.ejb3.stateful.unit;
+
+import java.rmi.dgc.VMID;
+
+import javax.naming.InitialContext;
+
+import junit.framework.Assert;
+
+import org.jboss.logging.Logger;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.std.NestedBeanMonitor;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.std.NestedStateful;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.std.ParentStatefulRemote;
+
+/**
+ * Encapsulates the functions needed for tests of nested SFSBs in
+ * a class that can be used either by a JBossTestCase subclass or
+ * a JBossClusteredTestCase subclass.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+public class NestedBeanTestRunner extends BaseTestRunner
+{
+ public NestedBeanTestRunner(InitialContext context, Logger log)
+ {
+ super(context, log);
+ }
+
+
+ public void testBasic()
+ throws Exception
+ {
+ getLog().debug("Running testBasic()");
+ getLog().debug("==================================");
+
+ NestedBeanSet beanSet = getNestedBeanSet();
+ ParentStatefulRemote stateful = beanSet.parent;
+
+ Assert.assertEquals("Remote counter: ", 1, stateful.increment());
+ Assert.assertEquals("Remote counter: ", 2, stateful.increment());
+ Assert.assertEquals("Local counter: ", 1, stateful.incrementLocal());
+ Assert.assertEquals("Local counter: ", 2, stateful.incrementLocal());
+
+ removeBean(stateful);
+
+ getLog().debug("ok");
+ }
+
+ public void testDependentLifecycle()
+ throws Exception
+ {
+ getLog().debug("Running testDependentLifecycle()");
+ getLog().debug("==================================");
+
+ NestedBeanSet beanSet = getNestedBeanSet();
+ ParentStatefulRemote parent = beanSet.parent;
+ NestedStateful nested = beanSet.nested;
+ NestedBeanMonitor monitor = beanSet.monitor;
+
+ Assert.assertEquals("Remote counter (via parent): ", 1, parent.increment());
+
+ String deepId = monitor.getDeepNestedId();
+ Assert.assertNotNull("Got a deepId", deepId);
+ Assert.assertFalse("Got a non-ERROR deepId", "ERROR".equals(deepId));
+ String localDeepId = monitor.getLocalDeepNestedId();
+ Assert.assertNotNull("Got a localDeepId", localDeepId);
+ Assert.assertFalse("Got a non-ERROR localDeepId", "ERROR".equals(localDeepId));
+
+ removeBean(parent);
+
+ // Confirm parent is dead
+ Assert.assertEquals("Remote counter (via dead parent): ", -1, monitor.incrementParent());
+ Assert.assertFalse("parent.remove() fails", monitor.removeParent());
+
+ // Confirm nested beans still work following parent remove
+ Assert.assertEquals("Remote counter (direct):", 2 ,nested.increment());
+ Assert.assertEquals("Local counter (monitor):", 1 , monitor.incrementLocalNested());
+ Assert.assertEquals("Deep nested id", deepId, monitor.getDeepNestedId());
+ Assert.assertEquals("Local deep nested id", localDeepId, monitor.getLocalDeepNestedId());
+
+ // Remove the bottom tier
+ Assert.assertTrue("Local deep nested removed", monitor.removeLocalDeepNested());
+
+ // Confirm it is dead
+ Assert.assertEquals("Local deep nested removed", "ERROR", monitor.getLocalDeepNestedId());
+ Assert.assertFalse("localDeepNested.remove() fails", monitor.removeLocalDeepNested());
+
+ // Confirm other beans still work following parent remove
+ Assert.assertEquals("Remote counter (direct):", 3 ,nested.increment());
+ Assert.assertEquals("Local counter (monitor):", 2 , monitor.incrementLocalNested());
+ Assert.assertEquals("Deep nested id", deepId, monitor.getDeepNestedId());
+
+ // Remove the nested bean
+ removeBean(nested);
+
+ Assert.assertEquals("Remote counter (via monitor): ", -1, monitor.incrementNested());
+ Assert.assertFalse("nested.remove() fails", monitor.removeNested());
+
+ // Confirm other beans still work
+ Assert.assertEquals("Local counter (monitor):", 3 , monitor.incrementLocalNested());
+ Assert.assertEquals("Deep nested id", deepId, monitor.getDeepNestedId());
+
+ // Remove the local nested bean
+ Assert.assertTrue("Local nested removed", monitor.removeLocalNested());
+
+ // Confirm it is dead
+ Assert.assertEquals("Local nested removed", -1, monitor.incrementLocalNested());
+ Assert.assertFalse("localNested.remove() fails", monitor.removeLocalNested());
+
+ // Confirm other beans still work following parent remove
+ Assert.assertEquals("Deep nested id", deepId, monitor.getDeepNestedId());
+
+ // Remove the deep nested bean
+ Assert.assertTrue("Deep removed", monitor.removeDeepNested());
+
+ // Confirm it is dead
+ Assert.assertEquals("Local nested removed", "ERROR", monitor.getDeepNestedId());
+ Assert.assertFalse("deepNested.remove() fails", monitor.removeDeepNested());
+
+ removeBean(monitor);
+
+ getLog().debug("ok");
+
+ }
+
+ public void testStatefulPassivation()
+ throws Exception
+ {
+ getLog().debug("Running testStatefulPassivation()");
+ getLog().debug("==================================");
+
+ NestedBeanSet beanSet = getNestedBeanSet();
+ NestedBeanMonitor monitor = beanSet.monitor;
+ ParentStatefulRemote parent = beanSet.parent;
+ NestedStateful nested = beanSet.nested;
+
+ int parentInv = beanSet.parentInvocations; // 2
+ int nestedInv = beanSet.nestedInvocations; // 1
+
+// Assert.assertEquals("Remote counter: ", 1, parent.increment());
+ Assert.assertEquals("Remote counter: ", 1, monitor.incrementParent());
+ parentInv++; //3
+ nestedInv++; //2
+
+// Assert.assertEquals("Remote counter: ", 2, parent.increment());
+ Assert.assertEquals("Remote counter: ", 2, monitor.incrementParent());
+ parentInv++; //4
+ nestedInv++; //3
+// Assert.assertEquals("Local counter: ", 1, parent.incrementLocal());
+ Assert.assertEquals("Local counter: ", 1, monitor.incrementLocalNested());
+ parentInv++; //5
+// Assert.assertEquals("Local counter: ", 2, parent.incrementLocal());
+ Assert.assertEquals("Local counter: ", 2, monitor.incrementLocalNested());
+ parentInv++; //6
+
+ // How the nested bean behaves depends on whether its context is
+ // contained by the parent bean context, which varies. Here we use
+ // the passivation counts to determine what the situation is and
+ // then use that behavior later to establish correct assertions.
+ int parentPre = monitor.getParentPassivations();
+ Assert.assertEquals("Parent passivate count: ",
+ getExpectedPassivations(0, parentInv),
+ parentPre);
+ parentInv++; //7
+ boolean nestedIsContained = (monitor.getNestedPassivations() == parentPre + 1); // add one because parent.getPrePassivate() added one
+ System.err.println("nestedIsContained = " + nestedIsContained);
+ if (nestedIsContained)
+ {
+ // Above parentInv++ should also have been nestedInv++
+ // plus one more from getNestedBeanSet()
+ nestedInv += 4; //3-7
+ // nested.getPrePassivate() activates the parent, which means
+ // the passivation below will increment the passivate count.
+ // So record that
+ parentInv++; //6-7
+ }
+ // nested.getPrePassivate() activates nested, which means
+ // the passivation below will increment the passivate count.
+ // So record that
+ nestedInv++; //4-8
+
+ sleep(getSleepTime()); // should passivate
+
+ Assert.assertEquals("Parent passivate count: ",
+ getExpectedPassivations(1, parentInv),
+// parent.getPrePassivate());
+ monitor.getParentPassivations());
+ parentInv++; //7-8
+ if (nestedIsContained)
+ {
+ nestedInv++; //4-9
+ }
+ Assert.assertEquals("Parent activate count: ",
+ getExpectedPassivations(1, parentInv),
+// parent.getPostActivate());
+ monitor.getParentActivations());
+ parentInv++; //8-9
+ if (nestedIsContained)
+ {
+ nestedInv++; //4-10
+ }
+ Assert.assertEquals("Remote nested passivate count: ",
+ getExpectedPassivations(1, nestedInv),
+// nested.getPrePassivate());
+ monitor.getNestedPassivations());
+ Assert.assertEquals("Remote nested activate count: ",
+ getExpectedPassivations(1, nestedInv),
+// nested.getPostActivate());
+ monitor.getNestedActivations());
+ Assert.assertEquals("Local nested passivate count: ",
+ getExpectedPassivations(1, parentInv),
+// parent.getLocalNestedPrePassivate());
+ monitor.getLocalNestedPassivations());
+ parentInv++; //9-10
+ if (nestedIsContained)
+ {
+ nestedInv++; //4-11
+ }
+ Assert.assertEquals("Local nested activate count: ",
+ getExpectedPassivations(1, parentInv),
+// parent.getLocalNestedPostActivate());
+ monitor.getLocalNestedActivations());
+ parentInv++; //10-11
+ if (nestedIsContained)
+ {
+ nestedInv++; //4-12
+ }
+
+ // Use the monitor to check the deep nested beans. In a cluster these
+ // are marked not to treat replication as passivation, so we ignore
+ // the number of invocations
+ Assert.assertEquals("Deep nested passivate count: ", 1, monitor.getDeepNestedPassivations());
+ nestedInv++; //5-13
+ if (nestedIsContained)
+ {
+ parentInv++; //10-12
+ }
+ Assert.assertEquals("Deep nested activate count: ", 1, monitor.getDeepNestedActivations());
+ nestedInv++; //6-14
+ if (nestedIsContained)
+ {
+ parentInv++; //10-13
+ }
+ Assert.assertEquals("Local deep nested passivate count: ", 1, monitor.getLocalDeepNestedPassivations());
+ parentInv++; //11-14
+ if (nestedIsContained)
+ {
+ nestedInv++; //6-15
+ }
+ Assert.assertEquals("Local deep nested activate count: ", 1, monitor.getLocalDeepNestedActivations());
+ parentInv++; //12-15
+ if (nestedIsContained)
+ {
+ nestedInv++; //6-16
+ }
+
+// Assert.assertEquals("Remote counter: ", 3, parent.increment());
+ Assert.assertEquals("Remote counter: ", 3, monitor.incrementParent());
+ parentInv++; //13-16
+ nestedInv++; //7-17
+// Assert.assertEquals("Remote counter: ", 4, parent.increment());
+ Assert.assertEquals("Remote counter: ", 4, monitor.incrementParent());
+ parentInv++; //14-17
+ nestedInv++; //8-18
+// Assert.assertEquals("Local counter: ", 3, parent.incrementLocal());
+ Assert.assertEquals("Local counter: ", 3, monitor.incrementLocalNested());
+ parentInv++; //15-18
+ if (nestedIsContained)
+ {
+ nestedInv++; //8-19
+ }
+// Assert.assertEquals("Local counter: ", 4, parent.incrementLocal());
+ Assert.assertEquals("Local counter: ", 4, monitor.incrementLocalNested());
+ parentInv++; //16-19
+ if (nestedIsContained)
+ {
+ nestedInv++; //8-20
+ }
+
+ sleep(getSleepTime()); // should passivate
+
+ Assert.assertEquals("Parent passivate count: ",
+ getExpectedPassivations(2, parentInv),
+// parent.getPrePassivate());
+ monitor.getParentPassivations());
+ parentInv++; //17-20
+ if (nestedIsContained)
+ {
+ nestedInv++; //8-21
+ }
+ Assert.assertEquals("Parent activate count: ",
+ getExpectedPassivations(2, parentInv),
+// parent.getPostActivate());
+ monitor.getParentActivations());
+ parentInv++; //18-21
+ if (nestedIsContained)
+ {
+ nestedInv++; //8-22
+ }
+ Assert.assertEquals("Remote nested passivate count: ",
+ getExpectedPassivations(2, nestedInv),
+// nested.getPrePassivate());
+ monitor.getNestedPassivations());
+ Assert.assertEquals("Remote nested activate count: ",
+ getExpectedPassivations(2, nestedInv),
+// nested.getPostActivate());
+ monitor.getNestedActivations());
+ Assert.assertEquals("Local nested passivate count: ",
+ getExpectedPassivations(2, parentInv),
+// parent.getLocalNestedPrePassivate());
+ monitor.getLocalNestedPassivations());
+ parentInv++; //19-22
+ if (nestedIsContained)
+ {
+ nestedInv++; //8-23
+ }
+ Assert.assertEquals("Local nested activate count: ",
+ getExpectedPassivations(2, parentInv),
+// parent.getLocalNestedPostActivate());
+ monitor.getLocalNestedActivations());
+ parentInv++; //20-23
+ if (nestedIsContained)
+ {
+ nestedInv++; //8-24
+ }
+
+ // Use the monitor to check the deep nested beans.
+ Assert.assertEquals("Deep nested passivate count: ", 2, monitor.getDeepNestedPassivations());
+ nestedInv++; //9-25
+ if (nestedIsContained)
+ {
+ parentInv++; //20-24
+ }
+ Assert.assertEquals("Deep nested activate count: ", 2, monitor.getDeepNestedActivations());
+ nestedInv++; //10-26
+ if (nestedIsContained)
+ {
+ parentInv++; //20-25
+ }
+ Assert.assertEquals("Local deep nested passivate count: ", 2, monitor.getLocalDeepNestedPassivations());
+ parentInv++; //21-26
+ if (nestedIsContained)
+ {
+ nestedInv++; //10-27
+ }
+ Assert.assertEquals("Local deep nested activate count: ", 2, monitor.getLocalDeepNestedActivations());
+ parentInv++; //22-27
+ if (nestedIsContained)
+ {
+ nestedInv++; //10-28
+ }
+
+// Assert.assertEquals("Remote counter: ", 5, parent.increment());
+ Assert.assertEquals("Remote counter: ", 5, monitor.incrementParent());
+ parentInv++; //23-28
+ nestedInv++; //11-29
+// Assert.assertEquals("Remote counter: ", 6, parent.increment());
+ Assert.assertEquals("Remote counter: ", 6, monitor.incrementParent());
+ parentInv++; // 24-29
+ nestedInv++; //12-30
+// Assert.assertEquals("Local counter: ", 5, parent.incrementLocal());
+ Assert.assertEquals("Local counter: ", 5, monitor.incrementLocalNested());
+ parentInv++; //25-30
+ if (nestedIsContained)
+ {
+ nestedInv++; //12-31
+ }
+// Assert.assertEquals("Local counter: ", 6, parent.incrementLocal());
+ Assert.assertEquals("Local counter: ", 6, monitor.incrementLocalNested());
+ parentInv++; //26-31
+ if (nestedIsContained)
+ {
+ nestedInv++; //12-32
+ }
+
+ removeBean(parent);
+ if (nestedIsContained)
+ {
+ nestedInv++; //12-33
+ }
+
+ // Force the nested bean to go through another passivation
+ // to check the activation process can survive the removal
+ // of its parent
+ sleep(getSleepTime());
+
+ // Confirm nested still works following parent remove
+// Assert.assertEquals("Remote counter (direct): ", 7, nested.increment());
+ Assert.assertEquals("Remote counter (direct): ", 7, monitor.incrementNested());
+ nestedInv++; //13-34
+ Assert.assertEquals("Remote nested passivate count: ",
+ getExpectedPassivations(3, nestedInv),
+// nested.getPrePassivate());
+ monitor.getNestedPassivations());
+ Assert.assertEquals("Remote nested activate count: ",
+ getExpectedPassivations(3, nestedInv),
+// nested.getPostActivate());
+ monitor.getNestedActivations());
+
+ removeBean(nested);
+
+ getLog().debug("ok");
+ }
+
+ public NestedBeanSet getNestedBeanSet()
+ throws Exception
+ {
+ // We want a colocated monitor and SFSB to test passivation/destruction
+ // StatelessRemoteBean is not clustered, so once we have it's VMID
+ // we can keep creating SFSBs until we get one we want
+ getLog().debug("Looking up NestedBeanMonitorBean...");
+ NestedBeanMonitor monitor = (NestedBeanMonitor) getInitialContext().lookup("NestedBeanMonitorBean/remote");
+ VMID monitorVM = monitor.getVMID();
+ addRemovable(monitor);
+
+ int parentInv = 0;
+ int nestedInv = 0;
+
+ ParentStatefulRemote parent = null;
+ boolean vmMatch = false;
+ for (int i = 0; i < 20 && !vmMatch; i++)
+ {
+ getLog().debug("Looking up testParentStateful... Attempt " + (i + 1));
+ parent = (ParentStatefulRemote) initialContext.lookup("testParentStateful/remote");
+
+ vmMatch = monitorVM.equals(parent.getVMID());
+ addRemovable(parent);
+ if (!vmMatch)
+ {
+ removeBean(parent);
+ }
+ }
+
+ Assert.assertTrue("Monitor and SFSB in same VM", vmMatch);
+
+ // Reset the parent to initialize all the beans
+ parent.reset();
+
+ // Monitor the parent
+ monitor.monitor(parent);
+
+ // Reset the parent to clean things up
+ parent.reset();
+ parentInv++;
+ nestedInv++;
+
+ NestedStateful nested = (NestedStateful) parent.getNested();
+ parentInv++;
+ addRemovable(nested);
+
+ NestedBeanSet result = new NestedBeanSet();
+ result.monitor = monitor;
+ result.parent = parent;
+ result.nested = nested;
+ result.parentInvocations = parentInv;
+ result.nestedInvocations = nestedInv;
+
+ return result;
+ }
+
+
+
+ public static class NestedBeanSet
+ {
+ public NestedBeanMonitor monitor;
+ public ParentStatefulRemote parent;
+ public NestedStateful nested;
+ public int parentInvocations = 0;
+ public int nestedInvocations = 0;
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/NestedBeanUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/NestedBeanUnitTestCase.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/NestedBeanUnitTestCase.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.test.cluster.ejb3.stateful.unit;
+
+import junit.framework.Test;
+
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Test nested SFSB for repeated passivation
+ *
+ * @author Ben.Wang at jboss.org
+ * @version $Revision: 108925 $
+ */
+public class NestedBeanUnitTestCase extends JBossTestCase
+{
+ private NestedBeanTestRunner runner;
+
+ public NestedBeanUnitTestCase (String name)
+ {
+ super(name);
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(NestedBeanUnitTestCase.class, "stateful-test.jar");
+ }
+
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ runner = new NestedBeanTestRunner(getInitialContext(), getLog());
+ runner.setUp();
+ // Use a sleep time just a bit longer than twice the bean timeout
+ runner.setSleepTime(2100L);
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ if (runner != null)
+ runner.tearDown();
+ }
+
+ public void testBasic()
+ throws Exception
+ {
+ runner.testBasic();
+ }
+
+ public void testDependentLifecycle()
+ throws Exception
+ {
+ runner.testDependentLifecycle();
+ }
+
+ public void testStatefulPassivation()
+ throws Exception
+ {
+ runner.testStatefulPassivation();
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/RemoteUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/RemoteUnitTestCase.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/RemoteUnitTestCase.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,860 @@
+/*
+ * 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.test.cluster.ejb3.stateful.unit;
+
+import java.util.Map;
+import java.util.Random;
+
+import javax.ejb.NoSuchEJBException;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.ClientKernelAbstraction;
+import org.jboss.ejb3.KernelAbstractionFactory;
+import org.jboss.logging.Logger;
+import org.jboss.security.client.SecurityClient;
+import org.jboss.security.client.SecurityClientFactory;
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.cluster.ejb3.stateful.AnnotatedAppException;
+import org.jboss.test.cluster.ejb3.stateful.CheckedApplicationException;
+import org.jboss.test.cluster.ejb3.stateful.ClusteredStateful;
+import org.jboss.test.cluster.ejb3.stateful.ConcurrentStateful;
+import org.jboss.test.cluster.ejb3.stateful.Entity;
+import org.jboss.test.cluster.ejb3.stateful.EntityFacade;
+import org.jboss.test.cluster.ejb3.stateful.ExtendedState;
+import org.jboss.test.cluster.ejb3.stateful.RemoteBindingInterceptor;
+import org.jboss.test.cluster.ejb3.stateful.ServiceRemote;
+import org.jboss.test.cluster.ejb3.stateful.SmallCacheStateful;
+import org.jboss.test.cluster.ejb3.stateful.State;
+import org.jboss.test.cluster.ejb3.stateful.Stateful;
+import org.jboss.test.cluster.ejb3.stateful.Stateful21;
+import org.jboss.test.cluster.ejb3.stateful.StatefulHome;
+import org.jboss.test.cluster.ejb3.stateful.StatefulInvoker;
+import org.jboss.test.cluster.ejb3.stateful.StatefulTimeout;
+import org.jboss.test.cluster.ejb3.stateful.StatefulTx;
+import org.jboss.test.cluster.ejb3.stateful.Stateless;
+import org.jboss.test.cluster.ejb3.stateful.Tester;
+
+/**
+ * Sample client for the jboss container.
+ *
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Id: RemoteUnitTestCase.java 108925 2010-10-26 18:07:35Z pferraro $
+ */
+
+public class RemoteUnitTestCase
+extends JBossTestCase
+{
+ @SuppressWarnings("unused")
+ private static final Logger log = Logger.getLogger(RemoteUnitTestCase.class);
+
+ static boolean deployed = false;
+ static int test = 0;
+
+ public RemoteUnitTestCase(String name)
+ {
+
+ super(name);
+
+ }
+
+ private class ConcurrentInvocation extends Thread
+ {
+ SmallCacheStateful small = null;
+ public Exception ex;
+ private int id;
+
+ public ConcurrentInvocation(int id)
+ {
+ this.id = id;
+ try
+ {
+ small = (SmallCacheStateful)getInitialContext().lookup("SmallCacheStatefulBean/remote");
+ small.setId(id);
+ }
+ catch (Exception e)
+ {
+ }
+ }
+
+ public void run()
+ {
+ for (int i = 0; i < 5; i++)
+ {
+ try
+ {
+ assertEquals(small.doit(id),i);
+ }
+ catch (Exception e)
+ {
+ ex = e;
+ }
+ catch (Error er)
+ {
+ ex = new RuntimeException("Failed assert: " + id, er);
+ }
+ }
+ }
+ }
+
+ private class ConcurrentStatefulTimeoutClient extends Thread
+ {
+ StatefulTimeout sfsb;
+ public Exception ex;
+ private int id;
+ private int wait;
+ public boolean removed = false;
+ public Exception failure = null;
+
+ public ConcurrentStatefulTimeoutClient(int id, int wait) throws Exception
+ {
+ this.id = id;
+ this.wait = wait;
+ sfsb = (StatefulTimeout)getInitialContext().lookup("StatefulClusteredTimeoutBean/remote");
+ }
+
+ public void run()
+ {
+ Random random = new Random(id);
+
+ while (!removed)
+ {
+ try
+ {
+ sfsb.test();
+ int millis = random.nextInt(wait);
+ if (millis <= wait/10)
+ {
+ sfsb.remove();
+ removed = true;
+ System.out.println("Bean has been removed " + id);
+ }
+ else
+ Thread.sleep(millis);
+ }
+ catch (javax.ejb.NoSuchEJBException e)
+ {
+ System.out.println("Bean has timed out " + id);
+ removed = true;
+ }
+ catch (Exception e)
+ {
+ failure = e;
+ log.debug("Concurrent invocation failed on " + sfsb, e);
+ return;
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ serverFound();
+ }
+
+ // Keep this test first so we test everything after a deployment restart
+ public void testJmxName() throws Exception
+ {
+ SecurityClient client = SecurityClientFactory.getSecurityClient();
+ client.setSimple("somebody", "password");
+ client.login();
+
+ Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
+ assertNotNull(stateful);
+ stateful.setState("state");
+ stateful.removeMe();
+
+ ObjectName deployment = new ObjectName("test.ejb3:name=Bill,service=EJB3");
+
+ ClientKernelAbstraction kernel = KernelAbstractionFactory.getClientInstance();
+ kernel.invoke(deployment, "stop", new Object[0], new String[0]);
+ kernel.invoke(deployment, "start", new Object[0], new String[0]);
+
+ stateful = (Stateful)getInitialContext().lookup("Stateful");
+ assertNotNull(stateful);
+ stateful.setState("state");
+ stateful.removeMe();
+ }
+
+ public void testSmallCache() throws Exception
+ {
+ ConcurrentInvocation[] threads = new ConcurrentInvocation[5];
+ for (int i = 0; i < 5; i++) threads[i] = new ConcurrentInvocation(i);
+ for (int i = 0; i < 5; i++) threads[i].start();
+ for (int i = 0; i < 5; i++) threads[i].join();
+ for (int i = 0; i < 5; i++)
+ {
+ if (threads[i].ex != null)
+ {
+ throw new Exception(threads[i].ex);
+ }
+ }
+ }
+
+
+
+ public void testStatefulSynchronization() throws Exception
+ {
+ SecurityClient client = SecurityClientFactory.getSecurityClient();
+ client.setSimple("somebody", "password");
+ client.login();
+
+ Tester test = (Tester) getInitialContext().lookup("TesterBean/remote");
+ test.testSessionSynchronization();
+
+ }
+
+ public void testEJBObject() throws Exception
+ {
+ SecurityClient client = SecurityClientFactory.getSecurityClient();
+ client.setSimple("somebody", "password");
+ client.login();
+
+ StatefulHome home = (StatefulHome)getInitialContext().lookup("StatefulBean/home");
+ assertNotNull(home);
+ javax.ejb.EJBObject stateful = (javax.ejb.EJBObject)home.create();
+ assertNotNull(stateful);
+ }
+
+ public void testStatefulTx() throws Exception
+ {
+ SecurityClient client = SecurityClientFactory.getSecurityClient();
+ client.setSimple("somebody", "password");
+ client.login();
+
+ StatefulTx stateful = (StatefulTx)getInitialContext().lookup("StatefulTxBean/remote");
+ assertNotNull(stateful);
+
+ boolean transacted = stateful.isLocalTransacted();
+ assertTrue(transacted);
+ transacted = stateful.isGlobalTransacted();
+ assertFalse(transacted);
+ transacted = stateful.testNewTx();
+ assertTrue(transacted);
+
+ try
+ {
+ stateful.testTxRollback();
+ fail("should have caught exception");
+ }
+ catch (javax.ejb.EJBException e)
+ {
+ }
+ }
+
+ public void testTemplateInterfaceTx() throws Exception
+ {
+ SecurityClient client = SecurityClientFactory.getSecurityClient();
+ client.setSimple("somebody", "password");
+ client.login();
+
+ StatefulTx stateful = (StatefulTx)getInitialContext().lookup("StatefulTxBean/remote");
+ assertNotNull(stateful);
+
+ try
+ {
+ stateful.testMandatoryTx(new State("test"));
+ fail("should have caught exception");
+ }
+ catch (javax.ejb.EJBTransactionRequiredException e)
+ {
+ }
+ }
+
+ public void testNotSerialableSFSB() throws Exception
+ {
+ SecurityClient client = SecurityClientFactory.getSecurityClient();
+ client.setSimple("somebody", "password");
+ client.login();
+
+ Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
+ assertNotNull(stateful);
+ stateful.setState("state");
+ String state = stateful.getState();
+ assertEquals("state", state);
+ }
+
+ public void testSFSBInit() throws Exception
+ {
+ SecurityClient client = SecurityClientFactory.getSecurityClient();
+ client.setSimple("somebody", "password");
+ client.login();
+
+ StatefulHome home = (StatefulHome)getInitialContext().lookup("StatefulBean/home");
+ assertNotNull(home);
+ ExtendedState state = new ExtendedState("init");
+ Stateful stateful = home.create(state);
+ assertNotNull(stateful);
+ String s = stateful.getState();
+ assertEquals("Extended_init", s);
+ }
+
+ public void testStackTrace() throws Exception
+ {
+ SecurityClient client = SecurityClientFactory.getSecurityClient();
+ client.setSimple("somebody", "password");
+ client.login();
+
+ Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
+ assertNotNull(stateful);
+
+ try
+ {
+ stateful.testThrownException();
+ fail("no exception caught");
+ }
+ catch (Exception e)
+ {
+ StackTraceElement[] stackTrace = e.getStackTrace();
+ assertTrue(stackTrace[stackTrace.length - 1].getClassName().startsWith("org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner"));
+ }
+ }
+
+ public void testExceptionCase() throws Exception
+ {
+ SecurityClient client = SecurityClientFactory.getSecurityClient();
+ client.setSimple("somebody", "password");
+ client.login();
+
+ Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
+ assertNotNull(stateful);
+
+ try
+ {
+ stateful.testExceptionCause();
+ fail("no exception caught");
+ }
+ catch (Exception e)
+ {
+ Throwable cause = e.getCause();
+ assertNotNull(cause);
+ assertEquals(NullPointerException.class.getName(), cause.getClass().getName());
+ }
+ }
+
+ public void testRemoteBindingInterceptorStack() throws Exception
+ {
+ SecurityClient client = SecurityClientFactory.getSecurityClient();
+ client.setSimple("somebody", "password");
+ client.login();
+
+ Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
+ assertNotNull(stateful);
+ assertFalse(stateful.interceptorAccessed());
+ assertTrue(RemoteBindingInterceptor.accessed);
+ }
+
+ public void testUninstantiatedPassivation() throws Exception
+ {
+ SecurityClient client = SecurityClientFactory.getSecurityClient();
+ client.setSimple("somebody", "password");
+ client.login();
+
+ 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 testExtendedPersistencePassivation() throws Exception
+ {
+ EntityFacade stateful = (EntityFacade)getInitialContext().lookup("EntityFacadeBean/remote");
+ Entity entity = null;
+ entity = stateful.createEntity("Kalin");
+
+ //passivate
+ Thread.sleep(10 * 1000);
+
+ MBeanServerConnection server = getServer();
+ ObjectName objectName = new ObjectName("jboss.jca:service=CachedConnectionManager");
+ int inUseConnections = (Integer)server.getAttribute(objectName, "InUseConnections");
+ System.out.println("inUseConnections \n" + inUseConnections);
+ assertEquals(0, inUseConnections);
+
+ //activate
+ entity = stateful.loadEntity(entity.getId());
+
+ inUseConnections = (Integer)server.getAttribute(objectName, "InUseConnections");
+ System.out.println("inUseConnections \n" + inUseConnections);
+ if (inUseConnections != 0)
+ printStats(server);
+ assertEquals(0, inUseConnections);
+
+ entity = stateful.createEntity("Kalin" + entity.getId());
+
+ inUseConnections = (Integer)server.getAttribute(objectName, "InUseConnections");
+ System.out.println("inUseConnections \n" + inUseConnections);
+
+ if (inUseConnections != 0)
+ printStats(server);
+ assertEquals(0, inUseConnections);
+ }
+
+ protected void printStats(MBeanServerConnection server) throws Exception
+ {
+ ObjectName objectName = new ObjectName("jboss.jca:service=CachedConnectionManager");
+ Object[] params = {};
+ String[] sig = {};
+ Map<?, ?> result = (Map<?, ?>)server.invoke(objectName, "listInUseConnections", params, sig);
+ System.out.println(result);
+
+ objectName = new ObjectName("jboss:service=TransactionManager");
+ long activeTransactions = (Long)server.getAttribute(objectName, "TransactionCount");
+ System.out.println("activeTransactions \n" + activeTransactions);
+
+ objectName = new ObjectName("jboss.jca:service=ManagedConnectionPool,name=DefaultDS");
+ long inUseConnectionCount = (Long)server.getAttribute(objectName, "InUseConnectionCount");
+ System.out.println("inUseConnectionCount \n" + inUseConnectionCount);
+
+ long maxConnectionsInUseCount = (Long)server.getAttribute(objectName, "MaxConnectionsInUseCount");
+ System.out.println("maxConnectionsInUseCount \n" + maxConnectionsInUseCount);
+ }
+
+ public void testTimeoutRemoval() throws Exception
+ {
+ StatefulTimeout sfsb = (StatefulTimeout)getInitialContext().lookup("StatefulTimeoutBean/remote");
+ sfsb.test();
+ Thread.sleep(5 * 1000);
+
+ try
+ {
+ sfsb.test();
+ fail("SFSB should have been removed via timeout");
+ } catch (javax.ejb.NoSuchEJBException e)
+ {
+ }
+
+ sfsb = (StatefulTimeout)getInitialContext().lookup("StatefulTimeoutBean2/remote");
+ sfsb.test();
+ Thread.sleep(10 * 1000);
+
+ try
+ {
+ sfsb.test();
+ fail("SFSB should have been removed via timeout");
+ } catch (javax.ejb.NoSuchEJBException e)
+ {
+ }
+ }
+
+ public void testClusteredTimeoutRemoval() throws Exception
+ {
+ StatefulTimeout sfsb = (StatefulTimeout)getInitialContext().lookup("StatefulClusteredTimeoutBean/remote");
+ sfsb.test();
+ Thread.sleep(5 * 1000);
+
+ try
+ {
+ sfsb.test();
+ fail("SFSB should have been removed via timeout");
+ } catch (javax.ejb.NoSuchEJBException e)
+ {
+ }
+
+ sfsb = (StatefulTimeout)getInitialContext().lookup("StatefulClusteredTimeoutBean2/remote");
+ sfsb.test();
+ Thread.sleep(10 * 1000);
+
+ try
+ {
+ sfsb.test();
+ fail("SFSB should have been removed via timeout");
+ } catch (javax.ejb.NoSuchEJBException e)
+ {
+ }
+ }
+
+ public void testConcurrentClusteredTimeoutRemoval() throws Exception
+ {
+ int numThreads = 100;
+ ConcurrentStatefulTimeoutClient[] clients = new ConcurrentStatefulTimeoutClient[numThreads];
+ for (int i = 0 ; i < numThreads ; ++i)
+ {
+ clients[i] = new ConcurrentStatefulTimeoutClient(i, 3000);
+ clients[i].start();
+ }
+
+ Thread.sleep(500);
+ ObjectName objectName = new ObjectName("jboss.j2ee:jar=stateful-test.jar,name=StatefulClusteredTimeoutBean,service=EJB3");
+ MBeanServerConnection server = getServer();
+ int size = (Integer)server.getAttribute(objectName, "TotalSize");
+ assertTrue(size > 0);
+
+ boolean allRemoved = false;
+ while (!allRemoved)
+ {
+ int i = 0;
+ while (i < numThreads && clients[i].removed && clients[i].failure == null)
+ ++i;
+
+ if (i < numThreads && clients[i].failure != null)
+ throw clients[i].failure;
+
+ System.out.println("----- removed " + i);
+
+ if (i == numThreads)
+ allRemoved = true;
+
+ Thread.sleep(5000);
+ }
+
+ size = (Integer)server.getAttribute(objectName, "TotalSize");
+ assertEquals(0, size);
+ }
+
+ public void testPassivation() throws Exception
+ {
+ SecurityClient client = SecurityClientFactory.getSecurityClient();
+ client.setSimple("somebody", "password");
+ client.login();
+
+ System.out.println("testPassivation");
+ Stateless stateless = (Stateless)getInitialContext().lookup("Stateless");
+ stateless.testInjection();
+
+ ServiceRemote service = (ServiceRemote) getInitialContext().lookup("ServiceBean/remote");
+ service.testInjection();
+
+ Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
+ assertNotNull(stateful);
+ stateful.setState("state");
+ assertEquals("state", stateful.getState());
+ stateful.testSerializedState("state");
+ assertEquals(null, stateful.getInterceptorState());
+ stateful.setInterceptorState("hello world");
+ assertFalse(stateful.testSessionContext());
+ Thread.sleep(10 * 1000);
+ assertTrue(stateful.wasPassivated());
+
+ assertEquals("state", stateful.getState());
+ assertEquals("hello world", stateful.getInterceptorState());
+
+ Stateful another = (Stateful)getInitialContext().lookup("Stateful");
+ assertEquals(null, another.getInterceptorState());
+ another.setInterceptorState("foo");
+ assertEquals("foo", another.getInterceptorState());
+ assertEquals("hello world", stateful.getInterceptorState());
+
+ assertFalse(stateful.testSessionContext());
+
+ stateful.testResources();
+
+ stateless.testInjection();
+
+ service.testInjection();
+ }
+
+ public void testClusteredPassivation() throws Exception
+ {
+ SecurityClient client = SecurityClientFactory.getSecurityClient();
+ client.setSimple("somebody", "password");
+ client.login();
+
+ System.out.println("testPassivation");
+ Stateless stateless = (Stateless)getInitialContext().lookup("Stateless");
+ stateless.testInjection();
+
+ ServiceRemote service = (ServiceRemote) getInitialContext().lookup("ServiceBean/remote");
+ service.testInjection();
+
+ ClusteredStateful stateful = (ClusteredStateful)getInitialContext().lookup("ClusteredStateful");
+ assertNotNull(stateful);
+ stateful.setState("state");
+ assertEquals("state", stateful.getState());
+ stateful.testSerializedState("state");
+ assertEquals(null, stateful.getInterceptorState());
+ stateful.setInterceptorState("hello world");
+ assertFalse(stateful.testSessionContext());
+ Thread.sleep(10 * 1000);
+ assertTrue(stateful.wasPassivated());
+
+ assertEquals("state", stateful.getState());
+ assertEquals("hello world", stateful.getInterceptorState());
+
+ Stateful another = (Stateful)getInitialContext().lookup("Stateful");
+ assertEquals(null, another.getInterceptorState());
+ another.setInterceptorState("foo");
+ assertEquals("foo", another.getInterceptorState());
+ assertEquals("hello world", stateful.getInterceptorState());
+
+ assertFalse(stateful.testSessionContext());
+
+ stateful.testResources();
+
+ stateless.testInjection();
+
+ service.testInjection();
+ }
+
+
+ public void testRemove() throws Exception
+ {
+ SecurityClient client = SecurityClientFactory.getSecurityClient();
+ client.setSimple("somebody", "password");
+ client.login();
+
+ Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
+ assertNotNull(stateful);
+
+ int startingRemoveCount = stateful.beansRemoved();
+
+ stateful.removeMe();
+ try
+ {
+ stateful.getState();
+ fail("Bean should have been removed");
+ } catch (NoSuchEJBException e)
+ {
+
+ }
+
+ stateful = (Stateful)getInitialContext().lookup("Stateful");
+ assertNotNull(stateful);
+ stateful.setState("InMyTimeOfDying");
+
+ stateful.removeMe();
+ try
+ {
+ stateful.getState();
+ fail("Bean should have been removed");
+ } catch (NoSuchEJBException e)
+ {
+
+ }
+
+ StatefulHome home = (StatefulHome)getInitialContext().lookup("StatefulBean/home");
+ assertNotNull(home);
+ Stateful21 stateful21 = (Stateful21)home.create();
+ assertNotNull(stateful21);
+ stateful21.removeMe();
+
+ try
+ {
+ stateful.getState();
+ fail("Bean should have been removed");
+ } catch (NoSuchEJBException e)
+ {
+
+ }
+
+ stateful = (Stateful)getInitialContext().lookup("Stateful");
+ int beansRemoved = stateful.beansRemoved();
+ assertEquals(3, beansRemoved - startingRemoveCount);
+ }
+
+ public void testRemoveWithRollback() throws Exception
+ {
+ Tester test = (Tester) getInitialContext().lookup("TesterBean/remote");
+ test.testRollback1();
+ test.testRollback2();
+ }
+
+ public void testConcurrentAccess() throws Exception
+ {
+ ConcurrentStateful stateful = (ConcurrentStateful) new InitialContext().lookup("ConcurrentStatefulBean/remote");
+ stateful.getState();
+
+ StatefulInvoker[] invokers = new StatefulInvoker[2];
+ for (int i = 0; i < 2 ; ++i)
+ {
+ invokers[i] = new StatefulInvoker(stateful);
+ }
+
+ for (StatefulInvoker invoker: invokers)
+ {
+ invoker.start();
+ }
+
+ Thread.sleep(10000);
+
+ for (StatefulInvoker invoker: invokers)
+ {
+ if (invoker.getException() != null)
+ throw invoker.getException();
+ }
+
+ stateful = (ConcurrentStateful) new InitialContext().lookup("Stateful");
+
+ invokers = new StatefulInvoker[2];
+ for (int i = 0; i < 2 ; ++i)
+ {
+ invokers[i] = new StatefulInvoker(stateful);
+ }
+
+ for (StatefulInvoker invoker: invokers)
+ {
+ invoker.start();
+ }
+
+ Thread.sleep(10000);
+
+ boolean wasConcurrentException = false;
+ for (StatefulInvoker invoker: invokers)
+ {
+ if (invoker.getException() != null)
+ wasConcurrentException = true;
+ }
+
+ assertTrue(wasConcurrentException);
+ }
+
+ public void testOverrideConcurrentAccess() throws Exception
+ {
+ ConcurrentStateful stateful = (ConcurrentStateful) new InitialContext().lookup("OverrideConcurrentStateful");
+ stateful.getState();
+
+ StatefulInvoker[] invokers = new StatefulInvoker[2];
+ for (int i = 0; i < 2 ; ++i)
+ {
+ invokers[i] = new StatefulInvoker(stateful);
+ }
+
+ for (StatefulInvoker invoker: invokers)
+ {
+ invoker.start();
+ }
+
+ Thread.sleep(5000);
+
+ boolean wasConcurrentException = false;
+ for (StatefulInvoker invoker: invokers)
+ {
+ if (invoker.getException() != null)
+ wasConcurrentException = true;
+ }
+
+ assertTrue(wasConcurrentException);
+ }
+
+ public void testDestroyException() throws Exception
+ {
+ EntityFacade stateful = (EntityFacade)getInitialContext().lookup("EntityFacadeBean/remote");
+ assertNotNull(stateful);
+ stateful.setThrowRemoveException(EntityFacade.REMOVE_EXCEPTION_TYPE.RUNTIME);
+ stateful.createEntity("Kalin");
+
+ try
+ {
+ stateful.remove();
+ fail("should catch RuntimeException");
+ }
+ catch (RuntimeException e)
+ {
+ System.out.println("*** caught " + e.getMessage());
+ }
+
+ try
+ {
+ stateful.createEntity("Nogo");
+ fail("expected NoSuchEJBException");
+ }
+ catch(NoSuchEJBException e)
+ {
+ // ok
+ }
+
+ stateful = (EntityFacade)getInitialContext().lookup("EntityFacadeBean/remote");
+ assertNotNull(stateful);
+ stateful.setThrowRemoveException(EntityFacade.REMOVE_EXCEPTION_TYPE.CHECKED);
+ stateful.createEntity("Napa");
+
+ try
+ {
+ stateful.remove();
+ fail("should catch RuntimeException");
+ }
+ catch (CheckedApplicationException e)
+ {
+ System.out.println("*** caught " + e.getMessage());
+ }
+
+ stateful.setThrowRemoveException(EntityFacade.REMOVE_EXCEPTION_TYPE.APPLICATION);
+
+ stateful.createEntity("Cabernet");
+
+ try
+ {
+ stateful.removeWithTx();
+ fail("should catch RuntimeException");
+ }
+ catch (AnnotatedAppException e)
+ {
+ System.out.println("*** caught " + e.getMessage());
+ }
+
+ stateful.createEntity("Bailey");
+
+ stateful = (EntityFacade)getInitialContext().lookup("EntityFacadeBean/remote");
+ assertNotNull(stateful);
+ stateful.setThrowRemoveException(EntityFacade.REMOVE_EXCEPTION_TYPE.NONE);
+
+ }
+
+ public void testDestroyExceptionWithTx() throws Exception
+ {
+ EntityFacade stateful = (EntityFacade)getInitialContext().lookup("EntityFacadeBean/remote");
+ stateful.setThrowRemoveException(EntityFacade.REMOVE_EXCEPTION_TYPE.RUNTIME);
+ assertNotNull(stateful);
+ stateful.createEntity("Cabernet");
+
+ try
+ {
+ stateful.removeWithTx();
+ fail("should catch RuntimeException");
+ }
+ catch (RuntimeException e)
+ {
+ System.out.println("*** caught " + e.getMessage());
+ }
+
+ try
+ {
+ stateful.createEntity("Nogo");
+ fail("expected NoSuchEJBException");
+ }
+ catch(NoSuchEJBException e)
+ {
+ // ok
+ }
+
+ stateful = (EntityFacade)getInitialContext().lookup("EntityFacadeBean/remote");
+ stateful.setThrowRemoveException(EntityFacade.REMOVE_EXCEPTION_TYPE.NONE);
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(RemoteUnitTestCase.class, "stateful-test.jar");
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/XPCTestRunner.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/XPCTestRunner.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/ejb3/stateful/unit/XPCTestRunner.java 2010-10-27 18:02:19 UTC (rev 108940)
@@ -0,0 +1,385 @@
+/*
+ * 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.test.cluster.ejb3.stateful.unit;
+
+import java.rmi.dgc.VMID;
+
+import javax.naming.InitialContext;
+
+import junit.framework.Assert;
+
+import org.jboss.logging.Logger;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.xpc.Customer;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.xpc.NestedXPCMonitor;
+import org.jboss.test.cluster.ejb3.stateful.nested.base.xpc.ShoppingCart;
+
+/**
+ * Encapsulates the functions needed for tests of ExtendedPersistenceContext
+ * management by nested SFSBs in a class that can be used either by a
+ * JBossTestCase subclass or a JBossClusteredTestCase subclass.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 108925 $
+ */
+public class XPCTestRunner extends BaseTestRunner
+{
+ public XPCTestRunner(InitialContext context, Logger log)
+ {
+ super(context, log);
+ }
+
+ public void testBasic() throws Exception
+ {
+ BeanSet beanSet = getBeanSet();
+ ShoppingCart cart = beanSet.cart;
+ NestedXPCMonitor monitor = beanSet.monitor;
+
+ Customer customer;
+
+ long id = cart.createCustomer();
+ customer = monitor.find(id);
+ Assert.assertEquals("Stateless has proper initial name",
+ "William", customer.getName());
+ customer = cart.find(id);
+ Assert.assertEquals("ShoppingCart has proper initial name",
+ "William", customer.getName());
+
+ cart.update();
+ customer = monitor.find(id);
+ Assert.assertEquals("Stateless has proper updated name",
+ "Bill", customer.getName());
+ customer = cart.find(id);
+ Assert.assertEquals("ShoppingCart has proper updated name",
+ "Bill", customer.getName());
+
+ cart.update2();
+ customer = monitor.find(id);
+ Assert.assertEquals("Stateless has proper update2() name",
+ "Billy", customer.getName());
+ customer = cart.find(id);
+ Assert.assertEquals("ShoppingCart has proper update2() name",
+ "Billy", customer.getName());
+
+ cart.update3();
+ customer = monitor.find(id);
+ Assert.assertEquals("Stateless has proper update3() name",
+ "Bill Jr.", customer.getName());
+ customer = cart.find(id);
+ Assert.assertEquals("ShoppingCart has proper update3() name",
+ "Bill Jr.", customer.getName());
+
+ removeBean(cart);
+ removeBean(monitor);
+ }
+
+ public void testXPCSharing() throws Exception
+ {
+ getLog().debug("Running testXPCSharing()");
+ getLog().debug("==================================");
+
+ BeanSet beanSet = getBeanSet();
+ ShoppingCart parent = beanSet.cart;
+ NestedXPCMonitor monitor = beanSet.monitor;
+
+ // Confirm the nested beans are there
+ String deepId = monitor.getDeepNestedId();
+ Assert.assertNotNull("Got a deepId", deepId);
+ Assert.assertFalse("Got a non-ERROR deepId", "ERROR".equals(deepId));
+ String localDeepId = monitor.getLocalDeepNestedId();
+ Assert.assertNotNull("Got a localDeepId", localDeepId);
+ Assert.assertFalse("Got a non-ERROR localDeepId", "ERROR".equals(localDeepId));
+
+ long id = parent.createCustomer();
+ Customer customer = parent.find(id);
+ Assert.assertNotNull("Customer created and found on parent", customer);
+
+ parent.setContainedCustomer();
+ Assert.assertTrue("Parent and local contained share customer", parent.checkContainedCustomer());
+
+ Assert.assertTrue("Parent and remote nested do not share ref",
+ monitor.compareTopToNested(id));
+ Assert.assertTrue("Parent and local nested do share ref",
+ monitor.compareTopToLocalNested(id));
+ Assert.assertTrue("Remote nested and local nested do not share a ref",
+ monitor.compareNestedToLocalNested(id));
+ Assert.assertTrue("Remote nested and deepNested share a ref",
+ monitor.compareNestedToDeepNested(id));
+ Assert.assertTrue("Local nested and localDeepNested share a ref",
+ monitor.compareLocalNestedToLocalDeepNested(id));
+
+ // Confirm this survives passivation/activation
+
+ parent.reset();
+
+ sleep(getSleepTime());
+
+ // DeepContained beans ignore replication in their
+ // activation/passivation counters, so we can test them
+ // to confirm activation/passivation
+ Assert.assertEquals("Local deep contained passivated once", 1,
+ monitor.getLocalDeepNestedPassivations());
+ Assert.assertEquals("Local deep contained activated once", 1,
+ monitor.getLocalDeepNestedActivations());
+ Assert.assertEquals("Deep contained passivated once", 1,
+ monitor.getDeepNestedPassivations());
+ Assert.assertEquals("Deep contained activated once", 1,
+ monitor.getDeepNestedActivations());
+
+ Assert.assertTrue("Parent and remote nested do not share ref",
+ monitor.compareTopToNested(id));
+ Assert.assertTrue("Parent and local nested do share ref",
+ monitor.compareTopToLocalNested(id));
+ Assert.assertTrue("Remote nested and local nested do not share a ref",
+ monitor.compareNestedToLocalNested(id));
+ Assert.assertTrue("Remote nested and deepNested share a ref",
+ monitor.compareNestedToDeepNested(id));
+ Assert.assertTrue("Local nested and localDeepNested share a ref",
+ monitor.compareLocalNestedToLocalDeepNested(id));
+
+ removeBean(parent);
+ removeBean(monitor);
+ }
+
+ public void testDependentLifecycle()
+ throws Exception
+ {
+ getLog().debug("Running testDependentLifecycle()");
+ getLog().debug("==================================");
+
+ BeanSet beanSet = getBeanSet();
+ ShoppingCart parent = beanSet.cart;
+ NestedXPCMonitor monitor = beanSet.monitor;
+
+ // Confirm the nested beans are there
+ String deepId = monitor.getDeepNestedId();
+ Assert.assertNotNull("Got a deepId", deepId);
+ Assert.assertFalse("Got a non-ERROR deepId", "ERROR".equals(deepId));
+ String localDeepId = monitor.getLocalDeepNestedId();
+ Assert.assertNotNull("Got a localDeepId", localDeepId);
+ Assert.assertFalse("Got a non-ERROR localDeepId", "ERROR".equals(localDeepId));
+
+ long id = parent.createCustomer();
+ Customer customer = parent.find(id);
+ Assert.assertNotNull("Customer created and found on parent", customer);
+
+ Assert.assertTrue("Parent and remote nested do not share ref",
+ monitor.compareTopToNested(id));
+ Assert.assertTrue("Parent and local nested do share ref",
+ monitor.compareTopToLocalNested(id));
+ Assert.assertTrue("Remote nested and local nested do not share a ref",
+ monitor.compareNestedToLocalNested(id));
+ Assert.assertTrue("Remote nested and deepNested share a ref",
+ monitor.compareNestedToDeepNested(id));
+ Assert.assertTrue("Local nested and localDeepNested share a ref",
+ monitor.compareLocalNestedToLocalDeepNested(id));
+
+ // Remove the parent and see that things still work
+ Assert.assertTrue("Parent removed", monitor.removeParent());
+
+ // Confirm parent is dead
+ Assert.assertFalse("parent.remove() fails", monitor.removeParent());
+
+ Assert.assertTrue("Remote nested and local nested do not share a ref",
+ monitor.compareNestedToLocalNested(id));
+ Assert.assertTrue("Remote nested and deepNested share a ref",
+ monitor.compareNestedToDeepNested(id));
+ Assert.assertTrue("Local nested and localDeepNested share a ref",
+ monitor.compareLocalNestedToLocalDeepNested(id));
+
+ // Remove the bottom tier
+ Assert.assertTrue("Local deep nested removed", monitor.removeLocalDeepNested());
+
+ // Confirm it is dead
+ Assert.assertFalse("localDeepNested.remove() fails", monitor.removeLocalDeepNested());
+
+ // Confirm other beans still work following remove
+ Assert.assertNotNull("Local nested still works", monitor.findLocalNested(id));
+ Assert.assertTrue("Remote nested and local nested do not share a ref",
+ monitor.compareNestedToLocalNested(id));
+ Assert.assertTrue("Remote nested and deepNested share a ref",
+ monitor.compareNestedToDeepNested(id));
+
+ // Remove the nested bean
+ Assert.assertTrue("Remote nested removed", monitor.removeNested());
+
+ // Confirm it is dead
+ Assert.assertFalse("nested.remove() fails", monitor.removeNested());
+
+ // Confirm other beans still work
+ Assert.assertNotNull("Local nested still works", monitor.findLocalNested(id));
+ Assert.assertNotNull("Remote deep nested still works", monitor.findDeepNested(id));
+
+ // Remove the local nested bean
+ Assert.assertTrue("Local nested removed", monitor.removeLocalNested());
+
+ // Confirm it is dead
+ Assert.assertFalse("localNested.remove() fails", monitor.removeLocalNested());
+
+ // Confirm other beans still work following parent remove
+ Assert.assertNotNull("Deep nested not null", monitor.findDeepNested(id));
+
+ // Remove the deep nested bean
+ Assert.assertTrue("Deep removed", monitor.removeDeepNested());
+
+ // Confirm it is dead
+ Assert.assertEquals("Local nested removed", "ERROR", monitor.getDeepNestedId());
+ Assert.assertFalse("deepNested.remove() fails", monitor.removeDeepNested());
+
+ removeBean(monitor);
+
+ getLog().debug("ok");
+
+ }
+
+ public void testPassivation() throws Exception
+ {
+ BeanSet beanSet = getBeanSet();
+ ShoppingCart cart = beanSet.cart;
+ NestedXPCMonitor monitor = beanSet.monitor;
+
+ Customer customer;
+
+ long id = cart.createCustomer();
+ customer = monitor.find(id);
+ Assert.assertEquals("Stateless has proper initial name",
+ "William", customer.getName());
+ customer = cart.find(id);
+ Assert.assertEquals("ShoppingCart has proper initial name",
+ "William", customer.getName());
+
+ cart.update();
+ customer = monitor.find(id);
+ Assert.assertEquals("Stateless has proper updated name",
+ "Bill", customer.getName());
+ customer = cart.find(id);
+ Assert.assertEquals("ShoppingCart has proper updated name",
+ "Bill", customer.getName());
+
+ cart.update2();
+ customer = monitor.find(id);
+ Assert.assertEquals("Stateless has proper update2() name",
+ "Billy", customer.getName());
+ customer = cart.find(id);
+ Assert.assertEquals("ShoppingCart has proper update2() name",
+ "Billy", customer.getName());
+
+ cart.update3();
+ customer = monitor.find(id);
+ Assert.assertEquals("Stateless has proper update3() name",
+ "Bill Jr.", customer.getName());
+ customer = cart.find(id);
+ Assert.assertEquals("ShoppingCart has proper update3() name",
+ "Bill Jr.", customer.getName());
+
+ // Tell the contained bean to get the customer
+ cart.setContainedCustomer();
+
+ // Clear the passivation counts
+ cart.reset();
+
+ sleep(getSleepTime()); // passivation
+
+ Assert.assertEquals("Contained bean was passivated", 1, monitor.getLocalNestedPassivations());
+
+ Assert.assertTrue("Parent and local contained share customer", cart.checkContainedCustomer());
+
+ Assert.assertTrue("Contained bean was activated", monitor.getLocalNestedActivations() > 0);
+
+ cart.findAndUpdateStateless();
+ cart.updateContained();
+
+ customer = monitor.find(id);
+ Assert.assertEquals("contained modified", customer.getName());
+ customer = cart.find(id);
+ Assert.assertEquals("contained modified", customer.getName());
+
+ removeBean(monitor);
+ removeBean(cart);
+ }
+
+ public BeanSet getBeanSet() throws Exception
+ {
+ // We want a colocated monitor and SFSB to test passivation/destruction
+ // NestedXPCMonitorBean is not clustered, so once we have it's VMID
+ // we can keep creating SFSBs until we get one we want
+ NestedXPCMonitor monitor = (NestedXPCMonitor) getInitialContext().lookup("NestedXPCMonitorBean/remote");
+ VMID statelessVM = monitor.getVMID();
+ addRemovable(monitor);
+
+ ShoppingCart cart = null;
+ boolean vmMatch = false;
+ for (int i = 0; i < 10 && !vmMatch; i++)
+ {
+ cart = (ShoppingCart) getInitialContext().lookup("testShoppingCart/remote");
+
+ vmMatch = statelessVM.equals(cart.getVMID());
+ addRemovable(cart);
+ if (!vmMatch)
+ removeBean(cart);
+ }
+
+ Assert.assertTrue("Monitor and SFSB in same VM", vmMatch);
+
+ // Reset the parent to initialize all the beans
+ cart.reset();
+
+ // Monitor the parent
+ monitor.monitor(cart);
+
+ // Reset the parent to clean things up
+ cart.reset();
+
+ BeanSet result = new BeanSet();
+ result.cart = cart;
+ result.monitor = monitor;
+
+ return result;
+ }
+
+ public NestedXPCMonitor getXPCMonitor(InitialContext[] ctxs, VMID vmid)
+ throws Exception
+ {
+ NestedXPCMonitor monitor = null;
+ boolean vmMatch = false;
+ for (int i = 0; i < 10 && !vmMatch; i++)
+ {
+ InitialContext ctx = ctxs[i % ctxs.length];
+ monitor = (NestedXPCMonitor) ctx.lookup("NestedXPCMonitorBean/remote");
+
+ vmMatch = vmid.equals(monitor.getVMID());
+ addRemovable(monitor);
+ if (!vmMatch)
+ removeBean(monitor);
+ }
+
+ Assert.assertTrue("SLSB and SFSB in same VM", vmMatch);
+
+ return monitor;
+ }
+
+ public static class BeanSet
+ {
+ public ShoppingCart cart;
+ public NestedXPCMonitor monitor;
+ }
+}
More information about the jboss-cvs-commits
mailing list