[jboss-cvs] JBossAS SVN: r78112 - in trunk/testsuite/src: main/org/jboss/test/security/test and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 5 18:02:27 EDT 2008


Author: anil.saldhana at jboss.com
Date: 2008-09-05 18:02:27 -0400 (Fri, 05 Sep 2008)
New Revision: 78112

Modified:
   trunk/testsuite/src/main/org/jboss/test/security/ejb/RunAsMDB.java
   trunk/testsuite/src/main/org/jboss/test/security/ejb/RunAsPropagationMDB.java
   trunk/testsuite/src/main/org/jboss/test/security/ejb/RunAsWithRolesMDB.java
   trunk/testsuite/src/main/org/jboss/test/security/test/EJBSpecUnitTestCase.java
   trunk/testsuite/src/resources/security-spec/META-INF/ejb-jar.xml
Log:
JBAS-5054: fix the EJBSpecUnitTestCase

Modified: trunk/testsuite/src/main/org/jboss/test/security/ejb/RunAsMDB.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/security/ejb/RunAsMDB.java	2008-09-05 22:00:30 UTC (rev 78111)
+++ trunk/testsuite/src/main/org/jboss/test/security/ejb/RunAsMDB.java	2008-09-05 22:02:27 UTC (rev 78112)
@@ -21,15 +21,14 @@
   */
 package org.jboss.test.security.ejb;
 
+import javax.ejb.EJBException;
 import javax.ejb.MessageDrivenBean;
 import javax.ejb.MessageDrivenContext;
-import javax.ejb.EJBException;
+import javax.jms.Message;
 import javax.jms.MessageListener;
-import javax.jms.Message;
 import javax.jms.Queue;
 import javax.jms.QueueConnection;
 import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueReceiver;
 import javax.jms.QueueSender;
 import javax.jms.QueueSession;
 import javax.jms.Session;
@@ -82,6 +81,7 @@
 
    public void onMessage(Message message)
    {
+      log.error("RunAsMDB enter onMessage");
       Queue replyTo = null;
       try
       {
@@ -95,10 +95,11 @@
       }
       catch(Throwable e)
       {
-         log.debug("failed", e);
+         log.error("RunAsMDB onMessage failed", e);
          if( replyTo != null )
             sendReply(replyTo, "Failed, ex="+e.getMessage());
       }
+      log.error("RunAsMDB onMessage Success");
    }
    private void sendReply(Queue replyTo, String info)
    {
@@ -119,7 +120,7 @@
       }
       catch(Exception e)
       {
-         log.error("Failed to send reply", e);
+         log.error("RunAsMDB:Failed to send reply", e);
       }
    }
 }

Modified: trunk/testsuite/src/main/org/jboss/test/security/ejb/RunAsPropagationMDB.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/security/ejb/RunAsPropagationMDB.java	2008-09-05 22:00:30 UTC (rev 78111)
+++ trunk/testsuite/src/main/org/jboss/test/security/ejb/RunAsPropagationMDB.java	2008-09-05 22:02:27 UTC (rev 78112)
@@ -82,6 +82,7 @@
 
    public void onMessage(Message message)
    {
+      log.error("RunAsPropagationMDB: onMessage enter");
       Queue replyTo = null;
       try
       {
@@ -95,10 +96,11 @@
       }
       catch(Throwable e)
       {
-         log.debug("failed", e);
+         log.debug("RunAsPropagationMDB failed", e);
          if( replyTo != null )
             sendReply(replyTo, "Failed, ex="+e.getMessage());
       }
+      log.error("RunAsPropagationMDB: onMessage exit");
    }
    private void sendReply(Queue replyTo, String info)
    {
@@ -119,7 +121,7 @@
       }
       catch(Exception e)
       {
-         log.error("Failed to send reply", e);
+         log.error("RunAsPropagationMDB: Failed to send reply", e);
       }
    }
 }

Modified: trunk/testsuite/src/main/org/jboss/test/security/ejb/RunAsWithRolesMDB.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/security/ejb/RunAsWithRolesMDB.java	2008-09-05 22:00:30 UTC (rev 78111)
+++ trunk/testsuite/src/main/org/jboss/test/security/ejb/RunAsWithRolesMDB.java	2008-09-05 22:02:27 UTC (rev 78112)
@@ -86,6 +86,7 @@
 
    public void onMessage(Message message)
    {
+      log.error("RunAsWithRolesMDB onMessage enter");
       Queue replyTo = null;
       try
       {
@@ -106,7 +107,7 @@
       }
       catch(Throwable e)
       {
-         log.debug("failed", e);
+         log.error("RunAsWithRolesMDB onMessage:failed", e);
          if( replyTo != null )
          {
             StringWriter sw = new StringWriter();
@@ -115,6 +116,7 @@
             sendReply(replyTo, "Failed, ex=\n"+sw.toString());
          }
       }
+      log.error("RunAsWithRolesMDB onMessage exit");
    }
    private void sendReply(Queue replyTo, String info)
    {
@@ -135,7 +137,7 @@
       }
       catch(Exception e)
       {
-         log.error("Failed to send reply", e);
+         log.error("RunAsWithRolesMDB:Failed to send reply", e);
       }
    }
 }

Modified: trunk/testsuite/src/main/org/jboss/test/security/test/EJBSpecUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/security/test/EJBSpecUnitTestCase.java	2008-09-05 22:00:30 UTC (rev 78111)
+++ trunk/testsuite/src/main/org/jboss/test/security/test/EJBSpecUnitTestCase.java	2008-09-05 22:02:27 UTC (rev 78112)
@@ -594,10 +594,10 @@
     * Test that an MDB with a run-as identity is able to access secure EJBs that require the identity.
     */
    public void testMDBRunAs() throws Exception
-   {
-      // fail("FIXME");
+   { 
       log.debug("Running test testMDBRunAs");
-      this.logout();
+      this.logout(); 
+      Thread.sleep(1000);
       QueueConnectionFactory queueFactory = (QueueConnectionFactory) getInitialContext().lookup(QUEUE_FACTORY);
       Queue queA = (Queue) getInitialContext().lookup("queue/QueueA");
       Queue queB = (Queue) getInitialContext().lookup("queue/QueueB");
@@ -645,9 +645,9 @@
     */
    public void testMDBDeepRunAs() throws Exception
    {
-      fail("FIXME"); // JBAS-5054 - testMDBRunAs, testMDBDeepRunAs, testRunAsWithRoles affect each other
       log.debug("Running test testMDBDeepRunAs");
       this.logout();
+      Thread.sleep(1000);
       QueueConnectionFactory queueFactory = (QueueConnectionFactory) getInitialContext().lookup(QUEUE_FACTORY);
       Queue queD = (Queue) getInitialContext().lookup("queue/QueueD");
       Queue queB = (Queue) getInitialContext().lookup("queue/QueueB");
@@ -694,7 +694,6 @@
     */
    public void testRunAsWithRoles() throws Exception
    {
-      fail("FIXME"); // JBAS-5054 - testMDBRunAs, testMDBDeepRunAs, testRunAsWithRoles affect each other 
       log.debug("Running test testRunAsWithRoles");
       this.logout();
       QueueConnectionFactory queueFactory = (QueueConnectionFactory) getInitialContext().lookup(QUEUE_FACTORY);
@@ -830,7 +829,6 @@
     */
    public void testStress() throws Exception
    {
-      // fail("FIXME");
       log.debug("+++ testStress");
       int count = Integer.getInteger("jbosstest.threadcount", 2).intValue();
       int iterations = 10;
@@ -870,7 +868,6 @@
     */
    public void testStressNoJaasCache() throws Exception
    {
-      // fail("FIXME");
       log.info("+++ testStressNoJaasCache, domain=spec-test");
       // Disable caching for the spec-test domain
       MBeanServerConnection conn = getServer();

Modified: trunk/testsuite/src/resources/security-spec/META-INF/ejb-jar.xml
===================================================================
--- trunk/testsuite/src/resources/security-spec/META-INF/ejb-jar.xml	2008-09-05 22:00:30 UTC (rev 78111)
+++ trunk/testsuite/src/resources/security-spec/META-INF/ejb-jar.xml	2008-09-05 22:02:27 UTC (rev 78112)
@@ -289,7 +289,10 @@
          <security-role-ref>
             <role-name>InternalRole</role-name>
             <role-link>InternalRole</role-link>
-         </security-role-ref>
+         </security-role-ref> 
+         <security-identity>
+            <use-caller-identity />
+         </security-identity>
       </session>
       <session>
          <description>A caller bean that is called by the </description>




More information about the jboss-cvs-commits mailing list