[jboss-cvs] JBossAS SVN: r79613 - in projects/ejb3/trunk: core/src/main/java/org/jboss/ejb3/common/spi and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 16 22:14:42 EDT 2008


Author: ALRubinger
Date: 2008-10-16 22:14:42 -0400 (Thu, 16 Oct 2008)
New Revision: 79613

Modified:
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/common/spi/ErrorCodes.java
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1025/unit/FailLocalRemoteNotSpecifiedUnitTestCase.java
Log:
[EJBTHREE-1025][EJBTHREE-1241] Fix and make for a more stable check in the test

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java	2008-10-17 01:26:02 UTC (rev 79612)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java	2008-10-17 02:14:42 UTC (rev 79613)
@@ -71,6 +71,7 @@
 import org.jboss.ejb3.annotation.SecurityDomain;
 import org.jboss.ejb3.annotation.defaults.PoolDefaults;
 import org.jboss.ejb3.aop.BeanContainer;
+import org.jboss.ejb3.common.spi.ErrorCodes;
 import org.jboss.ejb3.deployers.JBoss5DependencyPolicy;
 import org.jboss.ejb3.injection.InjectionInvocation;
 import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
@@ -652,13 +653,15 @@
    
    /**
     * Ensures that the bean does not implement any one interface as both @Local and @Remote
+    * 
+    * EJBTHREE-1025
     *
     * @throws EJBException If the bean does implements any one interface as both @Local and @Remote
     */
    protected void checkForDuplicateLocalAndRemoteInterfaces() throws EJBException
    {
       // Initialize issue used in Error Message
-      String issue = "(EJBTHREE-1025)";
+      String issue = "[" + ErrorCodes.ERROR_CODE_EJBTHREE1025 + "]";
 
       // Obtain annotations, if found
       Local local = (Local) resolveAnnotation(Local.class);

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/common/spi/ErrorCodes.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/common/spi/ErrorCodes.java	2008-10-17 01:26:02 UTC (rev 79612)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/common/spi/ErrorCodes.java	2008-10-17 02:14:42 UTC (rev 79613)
@@ -35,4 +35,6 @@
     * Error Codes
     */
    String ERROR_CODE_EJBTHREE751 = "EJBTHREE-751";
+   
+   String ERROR_CODE_EJBTHREE1025 = "EJBTHREE-1025";
 }

Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1025/unit/FailLocalRemoteNotSpecifiedUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1025/unit/FailLocalRemoteNotSpecifiedUnitTestCase.java	2008-10-17 01:26:02 UTC (rev 79612)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1025/unit/FailLocalRemoteNotSpecifiedUnitTestCase.java	2008-10-17 02:14:42 UTC (rev 79613)
@@ -23,7 +23,7 @@
 
 import junit.framework.Test;
 
-import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.ejb3.common.spi.ErrorCodes;
 import org.jboss.test.JBossTestCase;
 
 /**
@@ -55,29 +55,32 @@
    public void testDeploymentFailure() throws Exception
    {
 
-      // Define expected exception
-      Class exceptionExpected = DeploymentException.class;
+      // Define expected message
+      String expectedErrorCode = ErrorCodes.ERROR_CODE_EJBTHREE1025;
 
       try
       {
          redeploy("ejbthree1025.jar");
-         fail("Should throw " + exceptionExpected.getName());
+         fail("Should throw exception with" + expectedErrorCode);
       }
       catch (Exception e)
       {
          // Ensure expected error is thrown
-         if (e.getClass().equals(exceptionExpected))
+         String errorMessage = e.getCause().getMessage();
+         if (errorMessage.contains(expectedErrorCode))
          {
             // Log Success for clarity
-            log.info("testDeploymentFailure SUCCESS; \"" + exceptionExpected.getName()
+            log.info("testDeploymentFailure SUCCESS; \"" + expectedErrorCode
                   + "\" received as expected for illegal construct");
             return;
          }
 
          // Proper exception was not thrown
          log.error(e);
-         fail("Exception received, " + e.getClass().getName() + ", was not expected : " + exceptionExpected.getName());
+         fail("Exception received, " + e + ", did not have expected error code " + expectedErrorCode);
 
       }
+
+      fail("Deployment should not have suceeded.");
    }
 }




More information about the jboss-cvs-commits mailing list