[jboss-cvs] JBossAS SVN: r87745 - projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1346/unit.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Apr 23 21:07:49 EDT 2009


Author: bstansberry at jboss.com
Date: 2009-04-23 21:07:49 -0400 (Thu, 23 Apr 2009)
New Revision: 87745

Modified:
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1346/unit/DisableClusteredAnnotationUnitTestCase.java
Log:
[EJBTHREE-1346] Treat anticipated error conditions as failures, not errors

Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1346/unit/DisableClusteredAnnotationUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1346/unit/DisableClusteredAnnotationUnitTestCase.java	2009-04-24 00:36:22 UTC (rev 87744)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1346/unit/DisableClusteredAnnotationUnitTestCase.java	2009-04-24 01:07:49 UTC (rev 87745)
@@ -26,6 +26,7 @@
 
 import javax.naming.Context;
 import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
 
 import junit.framework.Test;
 
@@ -71,7 +72,15 @@
       // Connect to the server0 JNDI
       InitialContext ctx = getInitialContext(0);
 
-      DisableClusteredAnnotationRemote stateful = (DisableClusteredAnnotationRemote) ctx.lookup("DisableClusteredAnnotationStateful/remote");
+      DisableClusteredAnnotationRemote stateful = null;      
+      try
+      {
+         stateful = (DisableClusteredAnnotationRemote) ctx.lookup("DisableClusteredAnnotationStateful/remote");
+      }
+      catch (NameNotFoundException nnfe)
+      {
+         fail(nnfe.getMessage());
+      }
 
       NodeAnswer node1 = stateful.getNodeState ();
       getLog ().debug ("Node 1 ID: " +node1);
@@ -92,9 +101,17 @@
    {
       InitialContext ctx = getInitialContext(0);
 
-      DisableClusteredAnnotationRemote stateless = 
-         (DisableClusteredAnnotationRemote) ctx.lookup("DisableClusteredAnnotationStateless/remote");
+      DisableClusteredAnnotationRemote stateless = null;
       
+      try
+      {
+         stateless = (DisableClusteredAnnotationRemote) ctx.lookup("DisableClusteredAnnotationStateless/remote");
+      }
+      catch (NameNotFoundException nnfe)
+      {
+         fail(nnfe.getMessage());
+      }
+      
       NodeAnswer node1 = stateless.getNodeState();
       assertNotNull(node1);
       getLog ().debug ("Node 1 ID: " +node1);
@@ -104,4 +121,22 @@
          assertEquals(node1, stateless.getNodeState());
       }
    }
+
+   @Override
+   public void testServerFound() throws Exception
+   {      
+      // The superclass throws an exception, but we want this
+      // to be a failure, not an error
+      try
+      {
+         super.testServerFound();
+      }
+      catch (Exception e)
+      {
+         // Use assertNull to get the stack trace in the test report
+         assertNull("Deployment had no exceptions", e);
+      }
+   }
+   
+   
 }




More information about the jboss-cvs-commits mailing list