[jboss-cvs] JBossAS SVN: r74539 - in projects/metadata/trunk/src: test/java/org/jboss/test/metadata and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jun 13 12:14:11 EDT 2008


Author: emuckenhuber
Date: 2008-06-13 12:14:10 -0400 (Fri, 13 Jun 2008)
New Revision: 74539

Added:
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta56/
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta56/unit/
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta56/unit/EnvironmentTestCase.java
   projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbmeta56/
   projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbmeta56/unit/
   projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbmeta56/unit/EnvironmentTestCase_testEnv.xml
   projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbmeta56/unit/jboss.xml
Modified:
   projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/spec/EnterpriseBeanMetaData.java
Log:
[JBMETA-56] merge environment group

Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/spec/EnterpriseBeanMetaData.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/spec/EnterpriseBeanMetaData.java	2008-06-13 14:52:38 UTC (rev 74538)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/spec/EnterpriseBeanMetaData.java	2008-06-13 16:14:10 UTC (rev 74539)
@@ -321,7 +321,12 @@
    {
       if (jndiEnvironmentRefsGroup == null)
          throw new IllegalArgumentException("Null jndiEnvironmentRefsGroup");
-      this.jndiEnvironmentRefsGroup = (EnvironmentRefsGroupMetaData) jndiEnvironmentRefsGroup;
+      
+      EnvironmentRefsGroupMetaData env = (EnvironmentRefsGroupMetaData) jndiEnvironmentRefsGroup;
+      if(this.jndiEnvironmentRefsGroup != null)
+         this.jndiEnvironmentRefsGroup.merge(env, null, "", "", false);
+      else
+         this.jndiEnvironmentRefsGroup = env;
    }
 
    /**

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta56/unit/EnvironmentTestCase.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta56/unit/EnvironmentTestCase.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta56/unit/EnvironmentTestCase.java	2008-06-13 16:14:10 UTC (rev 74539)
@@ -0,0 +1,148 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.metadata.jbmeta56.unit;
+
+import org.jboss.metadata.ejb.jboss.JBoss50DTDMetaData;
+import org.jboss.metadata.ejb.jboss.JBoss50MetaData;
+import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanMetaData;
+import org.jboss.metadata.ejb.spec.EjbJar20MetaData;
+import org.jboss.metadata.ejb.spec.EjbJar21MetaData;
+import org.jboss.metadata.ejb.spec.EjbJar2xMetaData;
+import org.jboss.metadata.ejb.spec.MessageDrivenBeanMetaData;
+import org.jboss.metadata.javaee.spec.EJBLocalReferenceMetaData;
+import org.jboss.metadata.javaee.spec.EJBLocalReferencesMetaData;
+import org.jboss.metadata.javaee.spec.EJBReferenceType;
+import org.jboss.metadata.javaee.spec.EJBReferencesMetaData;
+import org.jboss.metadata.javaee.spec.ResourceAuthorityType;
+import org.jboss.metadata.javaee.spec.ResourceReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ResourceReferencesMetaData;
+import org.jboss.test.metadata.ejb.AbstractEJBEverythingTest;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class EnvironmentTestCase extends AbstractEJBEverythingTest
+{
+
+   public static SchemaBindingResolver initResolver()
+   {
+      DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+      resolver.addClassBindingForLocation("ejb-jar_2_0.dtd", EjbJar20MetaData.class);
+      resolver.addClassBindingForLocation("ejb-jar_2_1.xsd", EjbJar21MetaData.class);
+      resolver.addClassBindingForLocation("jboss_3_0.dtd", JBoss50DTDMetaData.class);
+      resolver.addClassBindingForLocation("jboss_3_2.dtd", JBoss50DTDMetaData.class);
+      resolver.addClassBindingForLocation("jboss_4_0.dtd", JBoss50DTDMetaData.class);
+      resolver.addClassBindingForLocation("jboss_4_2.dtd", JBoss50DTDMetaData.class);
+      resolver.addClassBindingForLocation("jboss_5_0.dtd", JBoss50DTDMetaData.class);
+      resolver.addClassBindingForLocation("jboss_5_0.xsd", JBoss50MetaData.class);
+      // Set the JBoss50DTDMetaData class as the default for the jboss root element
+      resolver.addClassBindingForLocation("jboss", JBoss50DTDMetaData.class);
+      // Workaround wildard resolution slowness
+      resolver.addClassBinding("http://www.jboss.com/xml/ns/javaee", JBoss50MetaData.class);
+      return resolver;
+   }
+
+   public EnvironmentTestCase(String name)
+   {
+      super(name);
+   }
+
+   protected EjbJar20MetaData unmarshal() throws Exception
+   {
+      return unmarshal(EjbJar20MetaData.class);
+   }
+
+   public void asdftestEnv() throws Exception
+   {
+      EjbJar2xMetaData ejbJarMetaData = unmarshal();
+
+      assertNotNull(ejbJarMetaData);
+      
+      MessageDrivenBeanMetaData runMdb = (MessageDrivenBeanMetaData) ejbJarMetaData.getEnterpriseBean("RunAsMDB"); 
+      
+      MessageDrivenBeanMetaData deepMdb = (MessageDrivenBeanMetaData) ejbJarMetaData.getEnterpriseBean("DeepRunAsMDB"); 
+      
+   }
+   
+   public void test() throws Exception
+   {
+      EjbJar20MetaData ejbJarMetaData = unmarshal("EnvironmentTestCase_testEnv.xml", EjbJar20MetaData.class, null);
+      assertNotNull(ejbJarMetaData);
+      
+      JBoss50DTDMetaData jbossMetaData = unmarshal("jboss.xml", JBoss50DTDMetaData.class, null);
+      assertNotNull(jbossMetaData);
+      jbossMetaData.merge(null, ejbJarMetaData);
+      JBossMessageDrivenBeanMetaData runMdb = (JBossMessageDrivenBeanMetaData) jbossMetaData.getEnterpriseBean("RunAsMDB"); 
+      asserRunMdb(runMdb);
+      
+      JBossMessageDrivenBeanMetaData deepMdb = (JBossMessageDrivenBeanMetaData) jbossMetaData.getEnterpriseBean("DeepRunAsMDB"); 
+      assertDeepMdb(deepMdb);
+   }
+   
+   private void asserRunMdb(JBossMessageDrivenBeanMetaData runMdb)
+   {
+      assertNotNull(runMdb);
+      assertNotNull(runMdb.getJndiEnvironmentRefsGroup());
+      
+      EJBLocalReferencesMetaData localReferences = runMdb.getJndiEnvironmentRefsGroup().getEjbLocalReferences();
+      assertNull(localReferences);
+      
+      EJBReferencesMetaData references = runMdb.getJndiEnvironmentRefsGroup().getEjbReferences();
+      assertNotNull(references);
+
+      ResourceReferencesMetaData resources = runMdb.getJndiEnvironmentRefsGroup().getResourceReferences();
+      assertNotNull(resources);
+      assertEquals(1, resources.size());
+      ResourceReferenceMetaData resource = resources.get("jms/QueFactory");
+      assertNotNull(resource);
+      assertEquals("javax.jms.QueueConnectionFactory", resource.getType());
+      assertEquals(ResourceAuthorityType.Container, resource.getResAuth());
+   }
+   
+   private void assertDeepMdb(JBossMessageDrivenBeanMetaData deepMdb)
+   {
+      assertNotNull(deepMdb);
+      assertNotNull(deepMdb.getJndiEnvironmentRefsGroup());
+      
+      EJBLocalReferencesMetaData localReferences = deepMdb.getJndiEnvironmentRefsGroup().getEjbLocalReferences();
+      assertNotNull(localReferences);
+      assertEquals(1, localReferences.size());
+      
+      EJBLocalReferenceMetaData localReference = localReferences.get("ejb/CalledSessionLocalHome");
+      assertNotNull(localReference);
+      assertEquals(EJBReferenceType.Entity, localReference.getEjbRefType());
+      assertEquals("org.jboss.test.security.interfaces.CalledSessionLocal", localReference.getLocal());
+      assertEquals("org.jboss.test.security.interfaces.CalledSessionLocalHome", localReference.getLocalHome());
+      assertEquals("Level1MDBCallerBean", localReference.getLink());
+      
+      ResourceReferencesMetaData resources = deepMdb.getJndiEnvironmentRefsGroup().getResourceReferences();
+      assertNotNull(resources);
+      assertEquals(1, resources.size());
+      ResourceReferenceMetaData resource = resources.get("jms/QueFactory");
+      assertNotNull(resource);
+      assertEquals("javax.jms.QueueConnectionFactory", resource.getType());
+      assertEquals(ResourceAuthorityType.Container, resource.getResAuth());
+   }
+}

Added: projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbmeta56/unit/EnvironmentTestCase_testEnv.xml
===================================================================
--- projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbmeta56/unit/EnvironmentTestCase_testEnv.xml	                        (rev 0)
+++ projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbmeta56/unit/EnvironmentTestCase_testEnv.xml	2008-06-13 16:14:10 UTC (rev 74539)
@@ -0,0 +1,1030 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE ejb-jar PUBLIC
+      "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
+      "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
+
+<ejb-jar>
+   <display-name>SecurityTests</display-name>
+   <enterprise-beans>
+      <session>
+         <description>A secured project repository stateful session bean</description>
+         <ejb-name>ProjRepository</ejb-name>
+         <home>org.jboss.test.security.interfaces.ProjRepositoryHome</home>
+         <remote>org.jboss.test.security.interfaces.ProjRepository</remote>
+         <ejb-class>org.jboss.test.security.ejb.project.ProjRepositoryBean</ejb-class>
+         <session-type>Stateful</session-type>
+         <transaction-type>Container</transaction-type>
+      </session>
+      <session>
+         <description>A secured project repository stateful session bean</description>
+         <ejb-name>StatefulSession</ejb-name>
+         <home>org.jboss.test.security.interfaces.StatefulSessionHome</home>
+         <remote>org.jboss.test.security.interfaces.StatefulSession</remote>
+         <ejb-class>org.jboss.test.security.ejb.StatefulSessionBean</ejb-class>
+         <session-type>Stateful</session-type>
+         <transaction-type>Container</transaction-type>
+      </session>
+
+      <session>
+         <description>A secured trival echo session bean</description>
+         <ejb-name>UncheckedSession</ejb-name>
+         <home>org.jboss.test.security.interfaces.StatelessSessionHome</home>
+         <remote>org.jboss.test.security.interfaces.StatelessSession</remote>
+         <local-home>org.jboss.test.security.interfaces.StatelessSessionLocalHome</local-home>
+         <local>org.jboss.test.security.interfaces.StatelessSessionLocal</local>
+         <ejb-class>org.jboss.test.security.ejb.UncheckedSessionBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <security-role-ref>
+            <role-name>EchoCaller</role-name>
+            <role-link>Echo</role-link>
+         </security-role-ref>
+      </session>
+      <session>
+         <description>A deployment of UncheckedSessionBean that requires the Echo
+         security role for the echo method and unchecked for the rest. Its method
+         permission for the echo method is defined before the unchecked methods. 
+         </description>
+         <ejb-name>UncheckedSessionRemoteFirst</ejb-name>
+         <home>org.jboss.test.security.interfaces.StatelessSessionHome</home>
+         <remote>org.jboss.test.security.interfaces.StatelessSession</remote>
+         <local-home>org.jboss.test.security.interfaces.StatelessSessionLocalHome</local-home>
+         <local>org.jboss.test.security.interfaces.StatelessSessionLocal</local>
+         <ejb-class>org.jboss.test.security.ejb.UncheckedSessionBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <security-role-ref>
+            <role-name>EchoCaller</role-name>
+            <role-link>Echo</role-link>
+         </security-role-ref>
+      </session>
+      <session>
+         <description>A deployment of UncheckedSessionBean that requires the Echo
+         security role for the echo method and unchecked for the rest. Its method
+         permission for the echo method is defined after the unchecked methods. 
+         </description>
+         <ejb-name>UncheckedSessionRemoteLast</ejb-name>
+         <home>org.jboss.test.security.interfaces.StatelessSessionHome</home>
+         <remote>org.jboss.test.security.interfaces.StatelessSession</remote>
+         <local-home>org.jboss.test.security.interfaces.StatelessSessionLocalHome</local-home>
+         <local>org.jboss.test.security.interfaces.StatelessSessionLocal</local>
+         <ejb-class>org.jboss.test.security.ejb.UncheckedSessionBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <security-role-ref>
+            <role-name>EchoCaller</role-name>
+            <role-link>Echo</role-link>
+         </security-role-ref>
+      </session>
+
+      <session>
+         <description>A secured trival echo session bean</description>
+         <ejb-name>StatelessSession</ejb-name>
+         <home>org.jboss.test.security.interfaces.StatelessSessionHome</home>
+         <remote>org.jboss.test.security.interfaces.StatelessSession</remote>
+         <local-home>org.jboss.test.security.interfaces.StatelessSessionLocalHome</local-home>
+         <local>org.jboss.test.security.interfaces.StatelessSessionLocal</local>
+         <ejb-class>org.jboss.test.security.ejb.StatelessSessionBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <!-- Use the 'EchoCaller' role name in the bean code to test role linking
+         with use of isCallerInRole().
+         -->
+         <security-role-ref>
+            <role-name>EchoCaller</role-name>
+            <role-link>Echo</role-link>
+         </security-role-ref>
+      </session>
+      <session>
+         <description>A secured trival echo session bean</description>
+         <ejb-name>StatelessSessionInDomain</ejb-name>
+         <home>org.jboss.test.security.interfaces.StatelessSessionHome</home>
+         <remote>org.jboss.test.security.interfaces.StatelessSession</remote>
+         <local-home>org.jboss.test.security.interfaces.StatelessSessionLocalHome</local-home>
+         <local>org.jboss.test.security.interfaces.StatelessSessionLocal</local>
+         <ejb-class>org.jboss.test.security.ejb.StatelessSessionBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <!-- Use the 'EchoCaller' role name in the bean code to test role linking
+         with use of isCallerInRole().
+         -->
+         <security-role-ref>
+            <role-name>EchoCaller</role-name>
+            <role-link>Echo</role-link>
+         </security-role-ref>
+      </session>
+
+      <session>
+         <description>A secured echo session bean that calls a StatelessSessionLocal
+            when its invokeEcho method is called.
+         </description>
+         <ejb-name>CallerBean</ejb-name>
+         <home>org.jboss.test.security.interfaces.CalledSessionHome</home>
+         <remote>org.jboss.test.security.interfaces.CalledSession</remote>
+         <ejb-class>org.jboss.test.security.ejb.CallerBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <ejb-local-ref>
+            <description></description>
+            <ejb-ref-name>ejb/local/CalleeHome</ejb-ref-name>
+            <ejb-ref-type>Session</ejb-ref-type>
+            <local-home>org.jboss.test.security.interfaces.StatelessSessionLocalHome</local-home>
+            <local>org.jboss.test.security.interfaces.StatelessSessionLocal</local>
+            <ejb-link>CalleeBean</ejb-link>
+         </ejb-local-ref>
+         <security-role-ref>
+            <role-name>EchoCaller</role-name>
+            <role-link>Echo</role-link>
+         </security-role-ref>
+      </session>
+      <session>
+         <description>A secured echo session bean that calls its CalledSessionLocalHome
+            ejb-local-ref link invokeEcho method to test identity propagation.
+            testRunAsSFSB
+               CallerFacadeBean-testRunAsSFSB.invokeEcho()
+                  CallerFacadeTargetSFSB.invokeEcho()
+                     CallerFacadeTargetCallee.echo()
+         </description>
+         <ejb-name>CallerFacadeBean-testRunAsSFSB</ejb-name>
+         <home>org.jboss.test.security.interfaces.CalledSessionHome</home>
+         <remote>org.jboss.test.security.interfaces.CalledSession</remote>
+         <ejb-class>org.jboss.test.security.ejb.CallerFacadeBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <ejb-local-ref>
+            <description></description>
+            <ejb-ref-name>ejb/CalledSessionLocalHome</ejb-ref-name>
+            <ejb-ref-type>Session</ejb-ref-type>
+            <local-home>org.jboss.test.security.interfaces.CalledSessionLocalHome</local-home>
+            <local>org.jboss.test.security.interfaces.CalledSessionLocal</local>
+            <ejb-link>CallerFacadeTargetSFSB</ejb-link>
+         </ejb-local-ref>
+      </session>
+      <session>
+         <description>A secured echo session bean that calls its SessionLocalHome
+            ejb-local-ref link invokeEcho method to test identity propagation.
+         </description>
+         <ejb-name>CallerFacadeTargetSFSB</ejb-name>
+         <local-home>org.jboss.test.security.interfaces.CalledSessionLocalHome</local-home>
+         <local>org.jboss.test.security.interfaces.CalledSessionLocal</local>
+         <ejb-class>org.jboss.test.security.ejb.FacadeTargetBean</ejb-class>
+         <session-type>Stateful</session-type>
+         <transaction-type>Container</transaction-type>
+         <ejb-local-ref>
+            <description></description>
+            <ejb-ref-name>ejb/local/StatelessSessionLocalHome</ejb-ref-name>
+            <ejb-ref-type>Session</ejb-ref-type>
+            <local-home>org.jboss.test.security.interfaces.StatelessSessionLocalHome</local-home>
+            <local>org.jboss.test.security.interfaces.StatelessSessionLocal</local>
+            <ejb-link>CallerFacadeTargetCallee</ejb-link>
+         </ejb-local-ref>
+         <security-role-ref>
+            <role-name>EchoCaller</role-name>
+            <role-link>EchoLocal</role-link>
+         </security-role-ref>
+         <security-identity>
+            <description>Use a role that is not assigned to any users to
+               access restricted server side functionallity</description>
+            <run-as>
+               <role-name>InternalRole</role-name>
+            </run-as>
+         </security-identity>
+      </session>
+      <session>
+         <description>A secured echo session bean that is called by CallerFacadeTarget*
+         </description>
+         <ejb-name>CallerFacadeTargetCallee</ejb-name>
+         <local-home>org.jboss.test.security.interfaces.StatelessSessionLocalHome</local-home>
+         <local>org.jboss.test.security.interfaces.StatelessSessionLocal</local>
+         <ejb-class>org.jboss.test.security.ejb.CalleeBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <security-role-ref>
+            <role-name>EchoCaller</role-name>
+            <role-link>EchoLocal</role-link>
+         </security-role-ref>
+      </session>
+
+      <session>
+         <description>A secured echo session bean that calls a StatelessSessionLocal
+            when its invokeEcho method is called, and calls another CalledSession
+            invokeEcho when its callEcho method is called. This uses a run-as
+            role of InternalRole to test propagation of this role.
+            Level1CallerBean.callEcho()
+              + Level2CallerBean.invokeEcho()
+                + Level3CalleeBean.echo()
+         </description>
+         <ejb-name>Level1CallerBean</ejb-name>
+         <home>org.jboss.test.security.interfaces.CalledSessionHome</home>
+         <remote>org.jboss.test.security.interfaces.CalledSession</remote>
+         <ejb-class>org.jboss.test.security.ejb.CallerBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <ejb-ref>
+            <description>Another CallerBean used to test run-as propagation</description>
+            <ejb-ref-name>ejb/CallerHome</ejb-ref-name>
+            <ejb-ref-type>Session</ejb-ref-type>
+            <home>org.jboss.test.security.interfaces.CalledSessionHome</home>
+            <remote>org.jboss.test.security.interfaces.CalledSession</remote>
+            <ejb-link>Level2CallerBean</ejb-link>
+         </ejb-ref>
+         <ejb-local-ref>
+            <description></description>
+            <ejb-ref-name>ejb/local/CalleeHome</ejb-ref-name>
+            <ejb-ref-type>Session</ejb-ref-type>
+            <local-home>org.jboss.test.security.interfaces.StatelessSessionLocalHome</local-home>
+            <local>org.jboss.test.security.interfaces.StatelessSessionLocal</local>
+            <ejb-link>CalleeBean</ejb-link>
+         </ejb-local-ref>
+         <security-role-ref>
+            <role-name>EchoCaller</role-name>
+            <role-link>Echo</role-link>
+         </security-role-ref>
+         <security-role-ref>
+            <role-name>InternalRole</role-name>
+            <role-link>InternalRole</role-link>
+         </security-role-ref>
+         <security-identity>
+            <run-as>
+               <role-name>InternalRole</role-name>
+            </run-as>
+         </security-identity>
+      </session>
+      <session>
+         <description>A secured echo session bean that calls a StatelessSessionLocal
+            when its invokeEcho method is called, and calls another CalledSession
+            invokeEcho when its callEcho method is called. This uses a run-as
+            role of InternalRole to test propagation of this role.
+            DeepRunAsMDB
+              + Level1CallerBean.callEcho()
+                + Level2CallerBean.invokeEcho()
+                  + Level3CalleeBean.echo()
+         </description>
+         <ejb-name>Level1MDBCallerBean</ejb-name>
+         <local-home>org.jboss.test.security.interfaces.CalledSessionLocalHome</local-home>
+         <local>org.jboss.test.security.interfaces.CalledSessionLocal</local>
+         <ejb-class>org.jboss.test.security.ejb.CallerBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <ejb-local-ref>
+            <description>Another CallerBean used to test run-as propagation</description>
+            <ejb-ref-name>ejb/CallerHome</ejb-ref-name>
+            <ejb-ref-type>Session</ejb-ref-type>
+            <local-home>org.jboss.test.security.interfaces.CalledSessionLocalHome</local-home>
+            <local>org.jboss.test.security.interfaces.CalledSessionLocal</local>
+            <ejb-link>Level2CallerBean</ejb-link>
+         </ejb-local-ref>
+         <ejb-local-ref>
+            <description></description>
+            <ejb-ref-name>ejb/local/CalleeHome</ejb-ref-name>
+            <ejb-ref-type>Session</ejb-ref-type>
+            <local-home>org.jboss.test.security.interfaces.StatelessSessionLocalHome</local-home>
+            <local>org.jboss.test.security.interfaces.StatelessSessionLocal</local>
+            <ejb-link>CalleeBean</ejb-link>
+         </ejb-local-ref>
+         <security-role-ref>
+            <role-name>EchoCaller</role-name>
+            <role-link>Echo</role-link>
+         </security-role-ref>
+         <security-role-ref>
+            <role-name>InternalRole</role-name>
+            <role-link>InternalRole</role-link>
+         </security-role-ref>
+      </session>
+      <session>
+         <description>A caller bean that is called by the </description>
+         <ejb-name>Level2CallerBean</ejb-name>
+         <home>org.jboss.test.security.interfaces.CalledSessionHome</home>
+         <remote>org.jboss.test.security.interfaces.CalledSession</remote>
+         <local-home>org.jboss.test.security.interfaces.CalledSessionLocalHome</local-home>
+         <local>org.jboss.test.security.interfaces.CalledSessionLocal</local>
+         <ejb-class>org.jboss.test.security.ejb.CallerBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <ejb-local-ref>
+            <description></description>
+            <ejb-ref-name>ejb/local/CalleeHome</ejb-ref-name>
+            <ejb-ref-type>Session</ejb-ref-type>
+            <local-home>org.jboss.test.security.interfaces.StatelessSessionLocalHome</local-home>
+            <local>org.jboss.test.security.interfaces.StatelessSessionLocal</local>
+            <ejb-link>Level3CalleeBean</ejb-link>
+         </ejb-local-ref>
+         <security-role-ref>
+            <role-name>EchoCaller</role-name>
+            <role-link>Echo</role-link>
+         </security-role-ref>
+         <security-role-ref>
+            <role-name>InternalRole</role-name>
+            <role-link>InternalRole</role-link>
+         </security-role-ref>
+         <security-identity>
+            <use-caller-identity />
+         </security-identity>
+      </session>
+      <session>
+         <description>A secured echo session bean that is called by CallerBean
+         </description>
+         <ejb-name>CalleeBean</ejb-name>
+         <local-home>org.jboss.test.security.interfaces.StatelessSessionLocalHome</local-home>
+         <local>org.jboss.test.security.interfaces.StatelessSessionLocal</local>
+         <ejb-class>org.jboss.test.security.ejb.CalleeBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <security-role-ref>
+            <role-name>EchoCaller</role-name>
+            <role-link>Echo</role-link>
+         </security-role-ref>
+      </session>
+      <session>
+         <description>A secured echo session bean that is called by CallerBean
+         </description>
+         <ejb-name>Level3CalleeBean</ejb-name>
+         <local-home>org.jboss.test.security.interfaces.StatelessSessionLocalHome</local-home>
+         <local>org.jboss.test.security.interfaces.StatelessSessionLocal</local>
+         <ejb-class>org.jboss.test.security.ejb.CalleeBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <security-role-ref>
+            <role-name>EchoCaller</role-name>
+            <role-link>Echo</role-link>
+         </security-role-ref>
+      </session>
+
+      <session>
+         <description>A secured trival echo session bean that calls
+            getCallerPrincpal in ejbCreate</description>
+         <ejb-name>SecureCreateSession</ejb-name>
+         <home>org.jboss.test.security.interfaces.StatelessSessionHome</home>
+         <remote>org.jboss.test.security.interfaces.StatelessSession</remote>
+         <ejb-class>org.jboss.test.security.ejb.StatelessSessionBean4</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+      </session>
+
+      <session>
+         <description>A secured trival echo session bean</description>
+         <ejb-name>org/jboss/test/security/ejb/StatelessSession_test</ejb-name>
+         <home>org.jboss.test.security.interfaces.StatelessSessionHome</home>
+         <remote>org.jboss.test.security.interfaces.StatelessSession</remote>
+         <ejb-class>org.jboss.test.security.ejb.StatelessSessionBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <!-- Use the 'EchoCaller' role name in the bean code to test role linking
+         with use of isCallerInRole().
+         -->
+         <security-role-ref>
+            <role-name>EchoCaller</role-name>
+            <role-link>Echo</role-link>
+         </security-role-ref>
+      </session>
+
+      <session>
+         <description>A secured trival echo session bean that uses Entity</description>
+         <ejb-name>StatelessSession2</ejb-name>
+         <home>org.jboss.test.security.interfaces.StatelessSessionHome</home>
+         <remote>org.jboss.test.security.interfaces.StatelessSession</remote>
+         <ejb-class>org.jboss.test.security.ejb.StatelessSessionBean2</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <ejb-ref>
+            <ejb-ref-name>ejb/Entity</ejb-ref-name>
+            <ejb-ref-type>Entity</ejb-ref-type>
+            <home>org.jboss.test.security.interfaces.EntityHome</home>
+            <remote>org.jboss.test.security.interfaces.Entity</remote>
+            <ejb-link>Entity</ejb-link>
+         </ejb-ref>
+         <ejb-ref>
+            <ejb-ref-name>ejb/Session</ejb-ref-name>
+            <ejb-ref-type>Session</ejb-ref-type>
+            <home>org.jboss.test.security.interfaces.StatelessSessionHome</home>
+            <remote>org.jboss.test.security.interfaces.StatelessSession</remote>
+            <ejb-link>StatelessSession</ejb-link>
+         </ejb-ref>
+      </session>
+
+      <session>
+         <description>A secured trival echo session bean that uses PrivateEntity,
+            StatelessSession and itself via a runAs identity</description>
+         <ejb-name>RunAsStatelessSession</ejb-name>
+         <home>org.jboss.test.security.interfaces.StatelessSessionHome</home>
+         <remote>org.jboss.test.security.interfaces.StatelessSession</remote>
+         <ejb-class>org.jboss.test.security.ejb.StatelessSessionBean3</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <ejb-ref>
+            <ejb-ref-name>ejb/Entity</ejb-ref-name>
+            <ejb-ref-type>Entity</ejb-ref-type>
+            <home>org.jboss.test.security.interfaces.EntityHome</home>
+            <remote>org.jboss.test.security.interfaces.Entity</remote>
+            <ejb-link>PrivateEntity</ejb-link>
+         </ejb-ref>
+         <ejb-ref>
+            <ejb-ref-name>ejb/Session</ejb-ref-name>
+            <ejb-ref-type>Session</ejb-ref-type>
+            <home>org.jboss.test.security.interfaces.StatelessSessionHome</home>
+            <remote>org.jboss.test.security.interfaces.StatelessSession</remote>
+            <ejb-link>StatelessSession</ejb-link>
+         </ejb-ref>
+         <security-identity>
+            <description>Use a role that is not assigned to any users to
+               access restricted server side functionallity</description>
+            <run-as>
+               <role-name>InternalRole</role-name>
+            </run-as>
+         </security-identity>
+      </session>
+
+      <session>
+         <description>An unsecured trival echo session bean</description>
+         <ejb-name>UnsecureStatelessSession</ejb-name>
+         <home>org.jboss.test.security.interfaces.StatelessSessionHome</home>
+         <remote>org.jboss.test.security.interfaces.StatelessSession</remote>
+         <ejb-class>org.jboss.test.security.ejb.StatelessSessionBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+      </session>
+      <session>
+         <description>An unsecured trival echo session bean type 2</description>
+         <ejb-name>UnsecureStatelessSession2</ejb-name>
+         <home>org.jboss.test.security.interfaces.StatelessSessionHome</home>
+         <remote>org.jboss.test.security.interfaces.StatelessSession</remote>
+         <ejb-class>org.jboss.test.security.ejb.StatelessSessionBean2</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <ejb-ref>
+            <ejb-ref-name>ejb/Entity</ejb-ref-name>
+            <ejb-ref-type>Entity</ejb-ref-type>
+            <home>org.jboss.test.security.interfaces.EntityHome</home>
+            <remote>org.jboss.test.security.interfaces.Entity</remote>
+            <ejb-link>Entity</ejb-link>
+         </ejb-ref>
+         <ejb-ref>
+            <ejb-ref-name>ejb/Session</ejb-ref-name>
+            <ejb-ref-type>Session</ejb-ref-type>
+            <home>org.jboss.test.security.interfaces.StatelessSessionHome</home>
+            <remote>org.jboss.test.security.interfaces.StatelessSession</remote>
+            <ejb-link>StatelessSession</ejb-link>
+         </ejb-ref>
+      </session>
+
+      <session>
+         <description>A secured session bean that validates the </description>
+         <ejb-name>UserInRoleContextSession</ejb-name>
+         <home>org.jboss.test.security.interfaces.SecurityContextHome</home>
+         <remote>org.jboss.test.security.interfaces.SecurityContext</remote>
+         <ejb-class>org.jboss.test.security.ejb.SecurityContextBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <ejb-ref>
+            <ejb-ref-name>ejb/CalledBean</ejb-ref-name>
+            <ejb-ref-type>Session</ejb-ref-type>
+            <home>org.jboss.test.security.interfaces.SecurityContextHome</home>
+            <remote>org.jboss.test.security.interfaces.SecurityContext</remote>
+            <ejb-link>UserInRoleContextSessionTarget</ejb-link>
+         </ejb-ref>
+      </session>
+      <session>
+         <ejb-name>UserInRoleContextSessionTarget</ejb-name>
+         <home>org.jboss.test.security.interfaces.SecurityContextHome</home>
+         <remote>org.jboss.test.security.interfaces.SecurityContext</remote>
+         <ejb-class>org.jboss.test.security.ejb.SecurityContextBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+      </session>
+
+      <session>
+        <description>A stateless session echo bean facade</description>
+        <ejb-name>PublicSessionFacade</ejb-name>
+        <home>org.jboss.test.security.ejb.jbas1852.SessionFacadeHome</home>
+        <remote>org.jboss.test.security.ejb.jbas1852.SessionFacade</remote>
+        <ejb-class>org.jboss.test.security.ejb.jbas1852.PublicSessionFacade</ejb-class>
+        <session-type>Stateless</session-type>
+        <transaction-type>Container</transaction-type>
+        <ejb-ref>
+          <ejb-ref-name>ejb/TargetEJB</ejb-ref-name>
+          <ejb-ref-type>Session</ejb-ref-type>
+          <home>org.jboss.test.security.ejb.jbas1852.SessionHome</home>
+          <remote>org.jboss.test.security.ejb.jbas1852.Session</remote>
+          <ejb-link>PublicSession</ejb-link>
+        </ejb-ref>
+        <security-role-ref>
+          <role-name>EchoUser</role-name>
+          <role-link>Echo</role-link>
+        </security-role-ref>
+        <security-identity>
+           <use-caller-identity />
+        </security-identity>
+      </session>
+     <session>
+       <description>A trival stateless session echo bean</description>
+       <ejb-name>PublicSession</ejb-name>
+       <home>org.jboss.test.security.ejb.jbas1852.SessionHome</home>
+       <remote>org.jboss.test.security.ejb.jbas1852.Session</remote>
+       <ejb-class>org.jboss.test.security.ejb.jbas1852.PublicSessionBean</ejb-class>
+       <session-type>Stateless</session-type>
+       <transaction-type>Container</transaction-type>
+       <ejb-ref>
+         <ejb-ref-name>ejb/PrivateSession</ejb-ref-name>
+         <ejb-ref-type>Session</ejb-ref-type>
+         <home>org.jboss.test.security.ejb.jbas1852.SessionHome</home>
+         <remote>org.jboss.test.security.ejb.jbas1852.Session</remote>
+         <ejb-link>PrivateSession</ejb-link>
+       </ejb-ref>
+       <security-role-ref>
+         <role-name>EchoUser</role-name>
+         <role-link>Echo</role-link>
+       </security-role-ref>
+       <security-identity>
+         <run-as>
+           <role-name>InternalUser</role-name>
+         </run-as>
+       </security-identity>
+     </session>
+     <session>
+       <description>A trival stateful session echo bean</description>
+       <ejb-name>PrivateSession</ejb-name>
+       <home>org.jboss.test.security.ejb.jbas1852.SessionHome</home>
+       <remote>org.jboss.test.security.ejb.jbas1852.Session</remote>
+       <ejb-class>org.jboss.test.security.ejb.jbas1852.PrivateSessionBean</ejb-class>
+       <session-type>Stateful</session-type>
+       <transaction-type>Container</transaction-type>
+       <security-role-ref>
+         <role-name>InternalUser</role-name>
+         <role-link>InternalUser</role-link>
+       </security-role-ref>
+     </session>
+
+      <entity>
+         <description>A trival echo entity bean</description>
+         <ejb-name>Entity</ejb-name>
+         <home>org.jboss.test.security.interfaces.EntityHome</home>
+         <remote>org.jboss.test.security.interfaces.Entity</remote>
+         <ejb-class>org.jboss.test.security.ejb.EntityBeanImpl</ejb-class>
+         <persistence-type>Bean</persistence-type>
+         <prim-key-class>java.lang.String</prim-key-class>
+         <reentrant>False</reentrant>
+      </entity>
+      <entity>
+         <description>A trival echo entity bean that should only be
+            accessible via other beans</description>
+         <ejb-name>PrivateEntity</ejb-name>
+         <home>org.jboss.test.security.interfaces.EntityHome</home>
+         <remote>org.jboss.test.security.interfaces.Entity</remote>
+         <ejb-class>org.jboss.test.security.ejb.EntityBeanImpl</ejb-class>
+         <persistence-type>Bean</persistence-type>
+         <prim-key-class>java.lang.String</prim-key-class>
+         <reentrant>False</reentrant>
+         <security-role-ref>
+            <role-name>InternalRole</role-name>
+            <role-link>InternalRole</role-link>
+         </security-role-ref>
+      </entity>
+
+      <message-driven>
+         <description>An mdb that access an entity bean as InternalUser</description>
+         <ejb-name>RunAsMDB</ejb-name>
+         <ejb-class>org.jboss.test.security.ejb.RunAsMDB</ejb-class>
+         <transaction-type>Container</transaction-type>
+         <message-driven-destination>
+            <destination-type>javax.jms.Queue</destination-type>
+            <subscription-durability>NonDurable</subscription-durability>
+         </message-driven-destination>
+         <ejb-ref>
+            <ejb-ref-name>ejb/Entity</ejb-ref-name>
+            <ejb-ref-type>Entity</ejb-ref-type>
+            <home>org.jboss.test.security.interfaces.EntityHome</home>
+            <remote>org.jboss.test.security.interfaces.Entity</remote>
+            <ejb-link>PrivateEntity</ejb-link>
+         </ejb-ref>
+         <security-identity>
+            <description>Use a role that is not assigned to any users to
+               access restricted server side functionallity</description>
+            <run-as>
+               <role-name>InternalRole</role-name>
+            </run-as>
+         </security-identity>
+         <resource-ref>
+            <description>Default QueueFactory</description>
+            <res-ref-name>jms/QueFactory</res-ref-name>
+            <res-type>javax.jms.QueueConnectionFactory</res-type>
+            <res-auth>Container</res-auth>
+         </resource-ref>
+      </message-driven>
+      <message-driven>
+         <description>An mdb that access an entity bean as InternalUser to
+         test propagation of the run-as role through several levels</description>
+         <ejb-name>DeepRunAsMDB</ejb-name>
+         <ejb-class>org.jboss.test.security.ejb.RunAsPropagationMDB</ejb-class>
+         <transaction-type>Container</transaction-type>
+         <message-driven-destination>
+            <destination-type>javax.jms.Queue</destination-type>
+            <subscription-durability>NonDurable</subscription-durability>
+         </message-driven-destination>
+         <ejb-local-ref>
+            <ejb-ref-name>ejb/CalledSessionLocalHome</ejb-ref-name>
+            <ejb-ref-type>Entity</ejb-ref-type>
+            <local-home>org.jboss.test.security.interfaces.CalledSessionLocalHome</local-home>
+            <local>org.jboss.test.security.interfaces.CalledSessionLocal</local>
+            <ejb-link>Level1MDBCallerBean</ejb-link>
+         </ejb-local-ref>
+         <security-identity>
+            <description>Use a role that is not assigned to any users to
+               access restricted server side functionallity</description>
+            <run-as>
+               <role-name>InternalRole</role-name>
+            </run-as>
+         </security-identity>
+         <resource-ref>
+            <description>Default QueueFactory</description>
+            <res-ref-name>jms/QueFactory</res-ref-name>
+            <res-type>javax.jms.QueueConnectionFactory</res-type>
+            <res-auth>Container</res-auth>
+         </resource-ref>
+      </message-driven>
+      <message-driven>
+         <description>An mdb that access a session bean with multiple roles</description>
+         <ejb-name>RunAsWithRolesMDB</ejb-name>
+         <ejb-class>org.jboss.test.security.ejb.RunAsWithRolesMDB</ejb-class>
+         <transaction-type>Container</transaction-type>
+         <message-driven-destination>
+            <destination-type>javax.jms.Queue</destination-type>
+            <subscription-durability>NonDurable</subscription-durability>
+         </message-driven-destination>
+         <ejb-ref>
+            <ejb-ref-name>ejb/ProjRepository</ejb-ref-name>
+            <ejb-ref-type>Session</ejb-ref-type>
+            <home>org.jboss.test.security.interfaces.ProjRepositoryHome</home>
+            <remote>org.jboss.test.security.interfaces.ProjRepository</remote>
+            <ejb-link>ProjRepository</ejb-link>
+         </ejb-ref>
+         <security-identity>
+            <description>Use a role that is not assigned to any users to
+               access restricted server side functionallity. This needs to be
+               augmented with additional roles by the jboss.xml
+               security-identity element.
+            </description>
+            <run-as>
+               <role-name>InternalRole</role-name>
+            </run-as>
+         </security-identity>
+         <resource-ref>
+            <description>Default QueueFactory</description>
+            <res-ref-name>jms/QueFactory</res-ref-name>
+            <res-type>javax.jms.QueueConnectionFactory</res-type>
+            <res-auth>Container</res-auth>
+         </resource-ref>
+      </message-driven>
+   </enterprise-beans>
+
+   <assembly-descriptor>
+      <security-role>
+         <description>The role required to invoke the echo method</description>
+         <role-name>Echo</role-name>
+      </security-role>
+      <security-role>
+         <description>The role required to invoke the echo method using the
+            StatelessSessionLocal interface</description>
+         <role-name>EchoLocal</role-name>
+      </security-role>
+      <security-role>
+         <description>The role used to prevent access to the PrivateEntity
+            bean from external users.
+         </description>
+         <role-name>InternalRole</role-name>
+      </security-role>
+      <security-role>
+         <role-name>ProjectAdmin</role-name>
+      </security-role>
+      <security-role>
+         <role-name>CreateFolder</role-name>
+      </security-role>
+      <security-role>
+         <role-name>DeleteFolder</role-name>
+      </security-role>
+      <security-role>
+         <role-name>Role1</role-name>
+      </security-role>
+      <security-role>
+         <role-name>Role2</role-name>
+      </security-role>
+
+      <!-- Define remote interface methods before the unchecked methods -->
+      <method-permission>
+         <role-name>Echo</role-name>
+         <method>
+            <ejb-name>UncheckedSessionRemoteFirst</ejb-name>
+            <method-intf>Remote</method-intf>
+            <method-name>echo</method-name>
+         </method>
+      </method-permission>
+      <method-permission>
+         <role-name>InternalRole</role-name>
+         <method>
+            <ejb-name>UncheckedSessionRemoteFirst</ejb-name>
+            <method-intf>Remote</method-intf>
+            <method-name>excluded</method-name>
+         </method>
+      </method-permission>
+      <method-permission>
+         <unchecked/>
+         <method>
+            <ejb-name>UncheckedSessionRemoteFirst</ejb-name>
+            <method-name>*</method-name>
+         </method>
+         <method>
+            <ejb-name>UserInRoleContextSessionTarget</ejb-name>
+            <method-name>*</method-name>
+         </method>
+      </method-permission>
+
+      <!-- Define unchecked methods before the remote interface methods -->
+      <method-permission>
+         <unchecked/>
+         <method>
+            <ejb-name>UncheckedSessionRemoteLast</ejb-name>
+            <method-name>*</method-name>
+         </method>
+      </method-permission>
+      <method-permission>
+         <role-name>Echo</role-name>
+         <method>
+            <ejb-name>UncheckedSessionRemoteLast</ejb-name>
+            <method-intf>Remote</method-intf>
+            <method-name>echo</method-name>
+         </method>
+      </method-permission>
+      <method-permission>
+         <role-name>InternalRole</role-name>
+         <method>
+            <ejb-name>UncheckedSessionRemoteLast</ejb-name>
+            <method-intf>Remote</method-intf>
+            <method-name>excluded</method-name>
+         </method>
+      </method-permission>
+
+      <!-- Anyone can access the unchecked() method of the StatelessSession bean -->
+      <method-permission>
+         <unchecked/>
+         <method>
+            <ejb-name>StatelessSession</ejb-name>
+            <method-name>unchecked</method-name>
+         </method>
+
+         <method>
+            <ejb-name>UncheckedSession</ejb-name>
+            <method-name>create</method-name>
+         </method>
+         <method>
+            <ejb-name>UncheckedSession</ejb-name>
+            <method-name>unchecked</method-name>
+         </method>
+      </method-permission>
+
+      <!-- The methods the Echo role can access -->
+      <method-permission>
+         <role-name>Echo</role-name>
+
+         <method>
+            <ejb-name>StatelessSession</ejb-name>
+            <method-name>create</method-name>
+         </method>
+         <method>
+            <ejb-name>StatelessSession</ejb-name>
+            <method-name>remove</method-name>
+         </method>
+         <method>
+            <ejb-name>StatelessSession</ejb-name>
+            <method-name>echo</method-name>
+         </method>
+         <method>
+            <ejb-name>StatelessSession</ejb-name>
+            <method-name>npeError</method-name>
+         </method>
+
+         <method>
+            <ejb-name>StatefulSession</ejb-name>
+            <method-intf>Home</method-intf>
+            <method-name>create</method-name>
+         </method>
+         <method>
+            <ejb-name>StatefulSession</ejb-name>
+            <method-intf>Home</method-intf>
+            <method-name>remove</method-name>
+         </method>
+         <method>
+            <ejb-name>StatefulSession</ejb-name>
+            <method-intf>Remote</method-intf>
+            <method-name>*</method-name>
+         </method>
+         <method>
+            <ejb-name>CallerBean</ejb-name>
+            <method-name>*</method-name>
+         </method>
+         <method>
+            <ejb-name>CallerFacadeBean-testRunAsSFSB</ejb-name>
+            <method-name>*</method-name>
+         </method>
+         <method>
+            <ejb-name>Level1CallerBean</ejb-name>
+            <method-name>*</method-name>
+         </method>
+
+         <method>
+            <ejb-name>org/jboss/test/security/ejb/StatelessSession_test</ejb-name>
+            <method-name>*</method-name>
+         </method>
+
+         <method>
+            <ejb-name>SecureCreateSession</ejb-name>
+            <method-name>*</method-name>
+         </method>
+
+         <method>
+            <ejb-name>StatelessSession2</ejb-name>
+            <method-name>*</method-name>
+         </method>
+
+         <method>
+            <ejb-name>Entity</ejb-name>
+            <method-name>*</method-name>
+         </method>
+
+         <method>
+            <ejb-name>RunAsStatelessSession</ejb-name>
+            <method-name>create</method-name>
+         </method>
+         <method>
+            <ejb-name>RunAsStatelessSession</ejb-name>
+            <method-name>remove</method-name>
+         </method>
+         <method>
+            <ejb-name>RunAsStatelessSession</ejb-name>
+            <method-name>echo</method-name>
+         </method>
+         <method>
+            <ejb-name>RunAsStatelessSession</ejb-name>
+            <method-name>forward</method-name>
+         </method>
+         <method>
+            <ejb-name>RunAsStatelessSession</ejb-name>
+            <method-name>noop</method-name>
+         </method>
+         <method>
+            <ejb-name>StatelessSessionInDomain</ejb-name>
+            <method-name>*</method-name>
+         </method>
+      </method-permission>
+
+      <!-- The methods the EchoLocal role can access -->
+      <method-permission>
+         <role-name>EchoLocal</role-name>
+
+         <method>
+            <ejb-name>CalleeBean</ejb-name>
+            <method-intf>LocalHome</method-intf>
+            <method-name>create</method-name>
+         </method>
+         <method>
+            <ejb-name>CalleeBean</ejb-name>
+            <method-intf>Local</method-intf>
+            <method-name>echo</method-name>
+         </method>
+         <method>
+            <ejb-name>CallerFacadeTargetSFSB</ejb-name>
+            <method-name>*</method-name>
+         </method>
+      </method-permission>
+
+      <!-- The methods the InternalRole role can access -->
+      <method-permission>
+         <role-name>InternalRole</role-name>
+
+         <method>
+            <ejb-name>PrivateEntity</ejb-name>
+            <method-name>*</method-name>
+         </method>
+
+         <method>
+            <ejb-name>RunAsStatelessSession</ejb-name>
+            <method-name>excluded</method-name>
+         </method>
+         <method>
+            <ejb-name>Level1MDBCallerBean</ejb-name>
+            <method-name>*</method-name>
+         </method>
+         <method>
+            <ejb-name>Level2CallerBean</ejb-name>
+            <method-name>*</method-name>
+         </method>
+         <method>
+            <ejb-name>Level3CalleeBean</ejb-name>
+            <method-name>*</method-name>
+         </method>
+         <method>
+            <ejb-name>CallerFacadeTargetCallee</ejb-name>
+            <method-name>*</method-name>
+         </method>
+      </method-permission>
+
+      <method-permission>
+         <role-name>ProjectUser</role-name>
+         <method>
+            <ejb-name>ProjRepository</ejb-name>
+            <method-name>*</method-name>
+         </method>
+      </method-permission>
+      <method-permission>
+         <role-name>ProjectAdmin</role-name>
+         <method>
+            <ejb-name>ProjRepository</ejb-name>
+            <method-intf>Home</method-intf>
+            <method-name>*</method-name>
+         </method>
+         <method>
+            <ejb-name>ProjRepository</ejb-name>
+            <method-intf>Remote</method-intf>
+            <method-name>remove</method-name>
+         </method>
+      </method-permission>
+      <method-permission>
+         <role-name>CreateFolder</role-name>
+         <method>
+            <ejb-name>ProjRepository</ejb-name>
+            <method-intf>Remote</method-intf>
+            <method-name>createFolder</method-name>
+         </method>
+         <method>
+            <ejb-name>ProjRepository</ejb-name>
+            <method-intf>Remote</method-intf>
+            <method-name>createItem</method-name>
+         </method>
+      </method-permission>
+      <method-permission>
+         <role-name>DeleteFolder</role-name>
+         <method>
+            <ejb-name>ProjRepository</ejb-name>
+            <method-intf>Remote</method-intf>
+            <method-name>deleteFolder</method-name>
+         </method>
+         <method>
+            <ejb-name>ProjRepository</ejb-name>
+            <method-intf>Remote</method-intf>
+            <method-name>deleteItem</method-name>
+         </method>
+      </method-permission>
+
+      <method-permission>
+         <role-name>Role1</role-name>
+         <method>
+            <ejb-name>UserInRoleContextSession</ejb-name>
+            <method-name>*</method-name>
+         </method>
+      </method-permission>
+      <method-permission>
+         <role-name>Role2</role-name>
+         <method>
+            <ejb-name>UserInRoleContextSession</ejb-name>
+            <method-name>*</method-name>
+         </method>
+      </method-permission>
+
+      <method-permission>
+        <role-name>Echo</role-name>
+         <method>
+           <ejb-name>PublicSession</ejb-name>
+           <method-name>*</method-name>
+         </method>
+         <method>
+           <ejb-name>PublicSessionFacade</ejb-name>
+           <method-name>*</method-name>
+         </method>
+      </method-permission>
+      <method-permission>
+        <role-name>InternalUser</role-name>
+        <method>
+          <ejb-name>PrivateSession</ejb-name>
+          <method-name>*</method-name>
+        </method>
+      </method-permission>
+
+      <!-- No one can access the excluded() method of the
+          StatelessSession and StatelessSession2 beans -->
+      <exclude-list>
+         <description>A method that no one can access in this deployment</description>
+         <method>
+            <ejb-name>StatelessSession</ejb-name>
+            <method-name>excluded</method-name>
+         </method>
+         <method>
+            <ejb-name>StatelessSession2</ejb-name>
+            <method-name>excluded</method-name>
+         </method>
+         <method>
+            <ejb-name>StatelessSessionInDomain</ejb-name>
+            <method-name>excluded</method-name>
+         </method>
+      </exclude-list>
+
+   </assembly-descriptor>
+
+</ejb-jar>

Added: projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbmeta56/unit/jboss.xml
===================================================================
--- projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbmeta56/unit/jboss.xml	                        (rev 0)
+++ projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbmeta56/unit/jboss.xml	2008-06-13 16:14:10 UTC (rev 74539)
@@ -0,0 +1,216 @@
+<?xml version="1.0"?>
+<!DOCTYPE jboss PUBLIC
+   "-//JBoss//DTD JBOSS 4.0//EN"
+   "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
+
+<!-- The jboss.xml descriptor for the security-spec.jar ejb unit.
+This descriptor redefines the JNDI names of the beans in the ejb-jar.xml
+descriptor so that there is no conflict with the security.jar deployment.
+-->
+<jboss>
+   <security-domain>java:/jaas/spec-test</security-domain>
+   <unauthenticated-principal>nobody</unauthenticated-principal>
+
+   <enterprise-beans>
+      <entity>
+         <ejb-name>Entity</ejb-name>
+         <jndi-name>spec.Entity</jndi-name>
+      </entity>
+      <entity>
+         <ejb-name>PrivateEntity</ejb-name>
+         <jndi-name>spec.PrivateEntity</jndi-name>
+      </entity>
+      <session>
+         <ejb-name>StatefulSession</ejb-name>
+         <jndi-name>spec.StatefulSession</jndi-name>
+         <configuration-name>Standard Stateful SessionBean</configuration-name>
+      </session>
+      <session>
+         <ejb-name>StatelessSession</ejb-name>
+         <jndi-name>spec.StatelessSession</jndi-name>
+         <configuration-name>Standard Stateless SessionBean</configuration-name>
+      </session>
+      <session>
+         <ejb-name>UncheckedSession</ejb-name>
+         <jndi-name>spec.UncheckedSession</jndi-name>
+         <configuration-name>Standard Stateless SessionBean</configuration-name>
+      </session>
+      <session>
+         <ejb-name>UncheckedSessionRemoteFirst</ejb-name>
+         <jndi-name>spec.UncheckedSessionRemoteFirst</jndi-name>
+         <configuration-name>Standard Stateless SessionBean</configuration-name>
+      </session>
+      <session>
+         <ejb-name>UncheckedSessionRemoteLast</ejb-name>
+         <jndi-name>spec.UncheckedSessionRemoteLast</jndi-name>
+         <configuration-name>Standard Stateless SessionBean</configuration-name>
+      </session>
+      <session>
+         <ejb-name>StatelessSessionInDomain</ejb-name>
+         <jndi-name>spec.StatelessSessionInDomain</jndi-name>
+         <configuration-name>Domain Stateless SessionBean</configuration-name>
+      </session>
+      <session>
+         <ejb-name>CallerBean</ejb-name>
+         <jndi-name>spec.CallerBean</jndi-name>
+      </session>
+      <session>
+         <ejb-name>CallerFacadeBean-testRunAsSFSB</ejb-name>
+         <jndi-name>spec.CallerFacadeBean-testRunAsSFSB</jndi-name>
+      </session>
+      <session>
+         <ejb-name>CallerFacadeTargetSFSB</ejb-name>
+         <jndi-name>spec.CallerFacadeTargetSFSB</jndi-name>
+      </session>
+      <session>
+        <ejb-name>Level1CallerBean</ejb-name>
+        <jndi-name>spec.Level1CallerBean</jndi-name>
+      </session>
+      <session>
+        <ejb-name>Level2CallerBean</ejb-name>
+        <jndi-name>spec.Level2CallerBean</jndi-name>
+      </session>
+      <session>
+        <ejb-name>Level3CalleeBean</ejb-name>
+        <jndi-name>spec.Level3CalleeBean</jndi-name>
+      </session>
+      <session>
+         <ejb-name>SecureCreateSession</ejb-name>
+         <jndi-name>spec.SecureCreateSession</jndi-name>
+      </session>
+      <session>
+         <ejb-name>org/jboss/test/security/ejb/StatelessSession_test</ejb-name>
+         <jndi-name>spec.StatelessSession_test</jndi-name>
+      </session>
+      <session>
+         <ejb-name>StatelessSession2</ejb-name>
+         <jndi-name>spec.StatelessSession2</jndi-name>
+         <ejb-ref>
+            <ejb-ref-name>ejb/Entity</ejb-ref-name>
+            <jndi-name>spec.Entity</jndi-name>
+         </ejb-ref>
+         <ejb-ref>
+            <ejb-ref-name>ejb/Session</ejb-ref-name>
+            <jndi-name>spec.StatelessSession</jndi-name>
+         </ejb-ref>
+      </session>
+      <session>
+         <ejb-name>RunAsStatelessSession</ejb-name>
+         <jndi-name>spec.RunAsStatelessSession</jndi-name>
+         <configuration-name>Standard Stateless SessionBean</configuration-name>
+         <ejb-ref>
+            <ejb-ref-name>ejb/Entity</ejb-ref-name>
+            <jndi-name>spec.PrivateEntity</jndi-name>
+         </ejb-ref>
+         <ejb-ref>
+            <ejb-ref-name>ejb/Session</ejb-ref-name>
+            <jndi-name>spec.StatelessSession</jndi-name>
+         </ejb-ref>
+      </session>
+      <session>
+         <ejb-name>UnsecureStatelessSession</ejb-name>
+         <jndi-name>spec.UnsecureStatelessSession</jndi-name>
+         <configuration-name>Unsecure Stateless SessionBean</configuration-name>
+      </session>
+      <session>
+         <ejb-name>UnsecureStatelessSession2</ejb-name>
+         <jndi-name>spec.UnsecureStatelessSession2</jndi-name>
+         <configuration-name>Unsecure Stateless SessionBean</configuration-name>
+         <ejb-ref>
+            <ejb-ref-name>ejb/Entity</ejb-ref-name>
+            <jndi-name>spec.Entity</jndi-name>
+         </ejb-ref>
+         <ejb-ref>
+            <ejb-ref-name>ejb/Session</ejb-ref-name>
+            <jndi-name>spec.StatelessSession</jndi-name>
+         </ejb-ref>
+      </session>
+      <session>
+         <ejb-name>UserInRoleContextSession</ejb-name>
+         <jndi-name>spec.UserInRoleContextSession</jndi-name>
+      </session>
+      <session>
+         <ejb-name>UserInRoleContextSessionTarget</ejb-name>
+         <jndi-name>spec.UserInRoleContextSessionTarget</jndi-name>
+         <configuration-name>Domain2 Stateless SessionBean</configuration-name>
+      </session>
+
+      <session>
+         <ejb-name>PublicSessionFacade</ejb-name>
+         <jndi-name>spec.PublicSessionFacade</jndi-name>
+      </session>
+      <session>
+         <ejb-name>PublicSession</ejb-name>
+         <jndi-name>spec.PublicSession</jndi-name>
+      </session>
+      <session>
+         <ejb-name>PrivateSession</ejb-name>
+         <jndi-name>spec.PrivateSession</jndi-name>
+      </session>
+
+      <message-driven>
+         <ejb-name>RunAsMDB</ejb-name>
+         <destination-jndi-name>queue/QueueA</destination-jndi-name>
+         <resource-ref>
+            <res-ref-name>jms/QueFactory</res-ref-name>
+            <jndi-name>ConnectionFactory</jndi-name>
+         </resource-ref>
+      </message-driven>
+      <message-driven>
+         <ejb-name>RunAsWithRolesMDB</ejb-name>
+         <destination-jndi-name>queue/QueueC</destination-jndi-name>
+         <security-identity>
+            <run-as-principal>RunAsWithRolesMDBPrincipal</run-as-principal>
+         </security-identity>
+         <resource-ref>
+            <res-ref-name>jms/QueFactory</res-ref-name>
+            <jndi-name>ConnectionFactory</jndi-name>
+         </resource-ref>
+      </message-driven>
+      <message-driven>
+         <ejb-name>DeepRunAsMDB</ejb-name>
+         <destination-jndi-name>queue/QueueD</destination-jndi-name>
+         <security-identity>
+            <run-as-principal>InternalUser</run-as-principal>
+         </security-identity>
+         <resource-ref>
+            <res-ref-name>jms/QueFactory</res-ref-name>
+            <jndi-name>ConnectionFactory</jndi-name>
+         </resource-ref>
+      </message-driven>
+
+   </enterprise-beans>
+
+   <assembly-descriptor>
+      <security-role>
+         <role-name>ProjectAdmin</role-name>
+         <principal-name>RunAsWithRolesMDBPrincipal</principal-name>
+      </security-role>
+      <security-role>
+         <role-name>CreateFolder</role-name>
+         <principal-name>RunAsWithRolesMDBPrincipal</principal-name>
+      </security-role>
+      <security-role>
+         <role-name>DeleteFolder</role-name>
+         <principal-name>RunAsWithRolesMDBPrincipal</principal-name>
+      </security-role>
+   </assembly-descriptor>
+
+   <container-configurations>
+      <!-- A stateless session config that is not secured -->
+      <container-configuration extends="Standard Stateless SessionBean">
+         <container-name>Unsecure Stateless SessionBean</container-name>
+         <security-domain/>
+      </container-configuration>
+      <!-- A stateless session config that uses the spec-test-domain -->
+      <container-configuration extends="Standard Stateless SessionBean">
+         <container-name>Domain Stateless SessionBean</container-name>
+         <security-domain>java:/jaas/spec-test-domain</security-domain>
+      </container-configuration>
+      <!-- A stateless session config that uses the spec-test-domain2 -->
+      <container-configuration extends="Standard Stateless SessionBean">
+         <container-name>Domain2 Stateless SessionBean</container-name>
+         <security-domain>java:/jaas/spec-test-domain2</security-domain>
+      </container-configuration>
+   </container-configurations>
+</jboss>




More information about the jboss-cvs-commits mailing list