[jboss-cvs] JBossAS SVN: r61143 - in trunk/ejb3/src/test/org/jboss/ejb3/test/stateful: unit and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Mar 6 08:56:23 EST 2007
Author: wolfc
Date: 2007-03-06 08:56:23 -0500 (Tue, 06 Mar 2007)
New Revision: 61143
Modified:
trunk/ejb3/src/test/org/jboss/ejb3/test/stateful/EntityFacadeBean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/stateful/StatefulBean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/RemoteUnitTestCase.java
Log:
Merged from branch 4.2
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/stateful/EntityFacadeBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/stateful/EntityFacadeBean.java 2007-03-06 12:37:58 UTC (rev 61142)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/stateful/EntityFacadeBean.java 2007-03-06 13:56:23 UTC (rev 61143)
@@ -95,7 +95,8 @@
{
log.info("************ destroying");
// throw RuntimeException
- Object o = null;
- o.getClass();
+// Object o = null;
+// o.getClass();
+ throw new RuntimeException("From destroy");
}
}
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/stateful/StatefulBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/stateful/StatefulBean.java 2007-03-06 12:37:58 UTC (rev 61142)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/stateful/StatefulBean.java 2007-03-06 13:56:23 UTC (rev 61143)
@@ -110,8 +110,10 @@
public void testResources() throws Exception
{
- datasource.toString();
- connectionFactory.toString();
+ 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();
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/RemoteUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/RemoteUnitTestCase.java 2007-03-06 12:37:58 UTC (rev 61142)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/RemoteUnitTestCase.java 2007-03-06 13:56:23 UTC (rev 61143)
@@ -587,8 +587,20 @@
}
catch (RuntimeException e)
{
+ assertEquals("java.lang.RuntimeException: From destroy", e.getMessage());
}
+ try
+ {
+ stateful.createEntity("Nogo");
+ fail("expected NoSuchEJBException");
+ }
+ catch(NoSuchEJBException e)
+ {
+ // okay
+ }
+
+ /* Wolf: the stateful is discarded
stateful.createEntity("Cabernet");
try
@@ -601,7 +613,34 @@
}
stateful.createEntity("Bailey");
+ */
+ }
+ public void testDestroyExceptionWithTx() throws Exception
+ {
+ EntityFacade stateful = (EntityFacade)getInitialContext().lookup("EntityFacadeBean/remote");
+ assertNotNull(stateful);
+ stateful.createEntity("Cabernet");
+
+ try
+ {
+ stateful.removeWithTx();
+ fail("should catch RuntimeException");
+ }
+ catch (RuntimeException e)
+ {
+ assertEquals("java.lang.RuntimeException: From destroy", e.getMessage());
+ }
+
+ try
+ {
+ stateful.createEntity("Nogo");
+ fail("expected NoSuchEJBException");
+ }
+ catch(NoSuchEJBException e)
+ {
+ // okay
+ }
}
public static Test suite() throws Exception
More information about the jboss-cvs-commits
mailing list