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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Jan 11 13:37:45 EST 2009


Author: ALRubinger
Date: 2009-01-11 13:37:44 -0500 (Sun, 11 Jan 2009)
New Revision: 82757

Modified:
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/invoker/unit/InvokerTestCase.java
Log:
[EJBTHREE-1241][EJBTHREE-1675] Make "invoker" test fail instead of error

Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/invoker/unit/InvokerTestCase.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/invoker/unit/InvokerTestCase.java	2009-01-11 10:40:27 UTC (rev 82756)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/invoker/unit/InvokerTestCase.java	2009-01-11 18:37:44 UTC (rev 82757)
@@ -21,13 +21,19 @@
  */
 package org.jboss.ejb3.test.invoker.unit;
 
+import java.lang.reflect.UndeclaredThrowableException;
 import java.util.Properties;
+
 import javax.naming.InitialContext;
+import javax.naming.NamingException;
 
+import junit.framework.Test;
+import junit.framework.TestCase;
+
 import org.jboss.ejb3.test.invoker.StatelessRemote;
 import org.jboss.logging.Logger;
+import org.jboss.remoting.transport.http.WebServerError;
 import org.jboss.test.JBossTestCase;
-import junit.framework.Test;
 
 /**
  * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
@@ -41,23 +47,43 @@
    {
       super(name);
    }
- 
+
    public void testHttp() throws Exception
    {
       Properties props = new Properties();
-      props.put("java.naming.factory.initial", "org.jboss.naming.HttpNamingContextFactory"); 
+      props.put("java.naming.factory.initial", "org.jboss.naming.HttpNamingContextFactory");
       props.put("java.naming.provider.url", "http://localhost:8080/invoker/JNDIFactory");
       props.put("java.naming.factory.url.pkgs", "org.jboss.naming");
       InitialContext jndiContext = new InitialContext(props);
       //InitialContext jndiContext = new InitialContext();
-      
-      StatelessRemote stateless = (StatelessRemote)jndiContext.lookup("StatelessHttp");
+
+      StatelessRemote stateless = null;
+      try
+      {
+         stateless = (StatelessRemote) jndiContext.lookup("StatelessHttp");
+      }
+      catch (NamingException ne)
+      {
+         Throwable namingCause = ne.getCause();
+         if (namingCause != null && namingCause instanceof UndeclaredThrowableException)
+         {
+            Throwable undeclaredCause = namingCause.getCause();
+            if (undeclaredCause != null && undeclaredCause instanceof WebServerError)
+            {
+               String error = "Test failed due to problem w/ remoting transport";
+               log.error(error + " :" + undeclaredCause);
+               TestCase.fail(error);
+            }
+         }
+      }
       assertNotNull(stateless);
-      
-      try 
+
+      try
       {
-      assertEquals("echo", stateless.echo("echo"));
-      } catch (Exception e){
+         assertEquals("echo", stateless.echo("echo"));
+      }
+      catch (Exception e)
+      {
          e.printStackTrace();
       }
    }




More information about the jboss-cvs-commits mailing list