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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 9 17:26:44 EDT 2008


Author: mmoyses
Date: 2008-10-09 17:26:44 -0400 (Thu, 09 Oct 2008)
New Revision: 79309

Modified:
   trunk/server/src/main/org/jboss/ejb/EjbModule.java
   trunk/testsuite/src/main/org/jboss/test/security/test/authorization/XACMLEJBIntegrationUnitTest.java
Log:
JBAS-6067: remove XACML policy when undeploying

Modified: trunk/server/src/main/org/jboss/ejb/EjbModule.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/EjbModule.java	2008-10-09 20:59:55 UTC (rev 79308)
+++ trunk/server/src/main/org/jboss/ejb/EjbModule.java	2008-10-09 21:26:44 UTC (rev 79309)
@@ -564,6 +564,8 @@
       ListIterator iter = containerOrdering.listIterator(containerOrdering.size());
       // Unregister the permissions with the JACC layer
       String contextID = appMetaData.getJaccContextID();
+      if (contextID == null)
+         contextID = deploymentUnit.getSimpleName();
       //Unregister any xacml policies
       if (this.policyRegistration != null)
       {

Modified: trunk/testsuite/src/main/org/jboss/test/security/test/authorization/XACMLEJBIntegrationUnitTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/security/test/authorization/XACMLEJBIntegrationUnitTest.java	2008-10-09 20:59:55 UTC (rev 79308)
+++ trunk/testsuite/src/main/org/jboss/test/security/test/authorization/XACMLEJBIntegrationUnitTest.java	2008-10-09 21:26:44 UTC (rev 79309)
@@ -113,7 +113,42 @@
       bean.remove();
       logout();
    }
+   
+   /** Test that redeploying the deployment unit does not add
+    * another policy. In other words, checks if undeploying removes the policy.
+    * Does exactly what testMethodAccess() do.
+    */
+   public void testJBAS6067() throws Exception
+   {
+      undeploy(getResourceURL(login_config)); 
+      undeploy("xacml-ejb.jar");
+      deploy("xacml-ejb.jar"); 
+      deploy(getResourceURL(login_config));
+      
+      log.debug("+++ testJBAS6067");
+      login();
+      Object obj = getInitialContext().lookup("spec.StatelessSession");
+      obj = PortableRemoteObject.narrow(obj, StatelessSessionHome.class);
+      StatelessSessionHome home = (StatelessSessionHome) obj;
+      log.debug("Found StatelessSessionHome");
+      StatelessSession bean = home.create();
+      log.debug("Created spec.StatelessSession");
+      log.debug("Bean.echo('Hello') -> "+bean.echo("Hello"));
 
+      try
+      {
+         // This should not be allowed
+         bean.noop();
+         fail("Was able to call StatelessSession.noop");
+      }
+      catch(RemoteException e)
+      {
+         log.debug("StatelessSession.noop failed as expected");
+      }
+      bean.remove();
+      logout();
+   }
+
    /** Login as user scott using the conf.name login config or
   'spec-test' if conf.name is not defined.
     */




More information about the jboss-cvs-commits mailing list