[jboss-cvs] JBossAS SVN: r80561 - in projects/naming/trunk/jnpserver/src: main/java/org/jnp/server and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Nov 5 13:56:29 EST 2008


Author: scott.stark at jboss.org
Date: 2008-11-05 13:56:29 -0500 (Wed, 05 Nov 2008)
New Revision: 80561

Added:
   projects/naming/trunk/jnpserver/src/test/java/org/jnp/test/SecurityUtil.java
   projects/naming/trunk/jnpserver/src/test/resources/org/jnp/test/NamingMCUnitTest#testInjectedSecurityManager.xml
Modified:
   projects/naming/trunk/jnpserver/src/main/java/org/jnp/interfaces/NamingContext.java
   projects/naming/trunk/jnpserver/src/main/java/org/jnp/server/NamingBeanImpl.java
   projects/naming/trunk/jnpserver/src/main/java/org/jnp/server/NamingServer.java
   projects/naming/trunk/jnpserver/src/test/java/org/jnp/test/NamingMCUnitTest.java
   projects/naming/trunk/jnpserver/src/test/java/org/jnp/test/NamingServerSecurityManagerUnitTest.java
   projects/naming/trunk/jnpserver/src/test/resources/log4j.xml
Log:
JBNAME-21, add the ability to inject the SecurityManager

Modified: projects/naming/trunk/jnpserver/src/main/java/org/jnp/interfaces/NamingContext.java
===================================================================
--- projects/naming/trunk/jnpserver/src/main/java/org/jnp/interfaces/NamingContext.java	2008-11-05 18:55:33 UTC (rev 80560)
+++ projects/naming/trunk/jnpserver/src/main/java/org/jnp/interfaces/NamingContext.java	2008-11-05 18:56:29 UTC (rev 80561)
@@ -149,6 +149,14 @@
     * will be made.
     */ 
    public static final String JNP_MAX_RETRIES = "jnp.maxRetries";
+   /**
+    * The Naming instance to use for the root Context creation
+    */ 
+   public static final String JNP_NAMING_INSTANCE = "jnp.namingInstance";
+   /**
+    * The name to associate with Naming instance to use for the root Context
+    */ 
+   public static final String JNP_NAMING_INSTANCE_NAME = "jnp.namingInstanceName";
 
    /**
     * The default discovery multicast information
@@ -290,12 +298,16 @@
       }
       catch (IOException e)
       {
+         if(log.isTraceEnabled())
+            log.trace("Failed to retrieve stub from server " + hostKey, e);
          NamingException ex = new CommunicationException("Failed to retrieve stub from server " + hostKey);
          ex.setRootCause(e);
          throw ex;
       }
       catch (Exception e)
       {
+         if(log.isTraceEnabled())
+            log.trace("Failed to connect server " + hostKey, e);
          NamingException ex = new CommunicationException("Failed to connect to server " + hostKey);
          ex.setRootCause(e);
          throw ex;

Modified: projects/naming/trunk/jnpserver/src/main/java/org/jnp/server/NamingBeanImpl.java
===================================================================
--- projects/naming/trunk/jnpserver/src/main/java/org/jnp/server/NamingBeanImpl.java	2008-11-05 18:55:33 UTC (rev 80560)
+++ projects/naming/trunk/jnpserver/src/main/java/org/jnp/server/NamingBeanImpl.java	2008-11-05 18:56:29 UTC (rev 80561)
@@ -54,6 +54,8 @@
    protected boolean UseGlobalService = true;
    /** The plugin for the manager which dispatches EventContext events to listeners */
    private EventMgr eventMgr;
+   /** The SecurityManager */
+   private SecurityManager securityMgr;
 
    // Static --------------------------------------------------------
    public static void main(String[] args)
@@ -99,6 +101,15 @@
       this.eventMgr = eventMgr;
    }
 
+   public SecurityManager getSecurityMgr()
+   {
+      return securityMgr;
+   }
+   public void setSecurityMgr(SecurityManager securityMgr)
+   {
+      this.securityMgr = securityMgr;
+   }
+
    /**
     * Util method for possible override.
     *
@@ -107,7 +118,7 @@
     */
    protected Naming createServer() throws Exception
    {
-      return new NamingServer(null, null, eventMgr);
+      return new NamingServer(null, null, eventMgr, securityMgr);
    }
 
    /**

Modified: projects/naming/trunk/jnpserver/src/main/java/org/jnp/server/NamingServer.java
===================================================================
--- projects/naming/trunk/jnpserver/src/main/java/org/jnp/server/NamingServer.java	2008-11-05 18:55:33 UTC (rev 80560)
+++ projects/naming/trunk/jnpserver/src/main/java/org/jnp/server/NamingServer.java	2008-11-05 18:56:29 UTC (rev 80561)
@@ -77,6 +77,7 @@
    private transient EventListeners listeners;
    /** The manager for EventContext listeners */
    private transient EventMgr eventMgr;
+   private transient SecurityManager secMgr;
    private transient boolean trace;
 
    // Static --------------------------------------------------------
@@ -92,20 +93,26 @@
    public NamingServer(Name prefix, NamingServer parent)
       throws NamingException
    {
-      this(null, null, null);   
+      this(prefix, parent, null);   
    }
    public NamingServer(Name prefix, NamingServer parent, EventMgr eventMgr)
       throws NamingException
    {
+      this(prefix, parent, eventMgr, null);  
+   }
+   public NamingServer(Name prefix, NamingServer parent, EventMgr eventMgr,
+         SecurityManager secMgr)
+      throws NamingException
+   {
       if (prefix == null)
          prefix = parser.parse("");
       this.prefix = prefix;      
       this.parent = parent;
       this.eventMgr = eventMgr;
+      this.secMgr = secMgr;
       this.trace = log.isTraceEnabled();
    }
 
-
    // Public --------------------------------------------------------
 
    // NamingListener registration
@@ -205,7 +212,7 @@
             {
                Name fullName = (Name) prefix.clone();
                fullName.addAll(name);
-               SecurityManager sm = System.getSecurityManager();
+               SecurityManager sm = getSecurityManager();
                if(sm != null)
                {
                   JndiPermission perm = new JndiPermission(fullName, JndiPermission.BIND);
@@ -268,7 +275,7 @@
          }
          else
          {
-            SecurityManager sm = System.getSecurityManager();
+            SecurityManager sm = getSecurityManager();
             Name fullName = (Name) prefix.clone();
             String comp = name.get(0);
             fullName.add(comp);
@@ -341,7 +348,7 @@
 //            System.out.println("unbind "+name+"="+getBinding(name));
             if (getBinding(name) != null)
             {
-               SecurityManager sm = System.getSecurityManager();
+               SecurityManager sm = getSecurityManager();
                Name fullName = (Name) prefix.clone();
                fullName.addAll(name);
                if(sm != null)
@@ -371,7 +378,7 @@
 		Object result;
       if (name.isEmpty())
       {
-         SecurityManager sm = System.getSecurityManager();
+         SecurityManager sm = getSecurityManager();
          if(sm != null)
          {
             JndiPermission perm = new JndiPermission(prefix, JndiPermission.LOOKUP);
@@ -413,7 +420,7 @@
          // Get object to return
          if (name.get(0).equals(""))
          {
-            SecurityManager sm = System.getSecurityManager();
+            SecurityManager sm = getSecurityManager();
             if(sm != null)
             {
                JndiPermission perm = new JndiPermission(prefix, JndiPermission.LOOKUP);
@@ -424,7 +431,7 @@
          else
          {
 //            System.out.println("lookup "+name);
-            SecurityManager sm = System.getSecurityManager();
+            SecurityManager sm = getSecurityManager();
             Name fullName = (Name)(prefix.clone());
             fullName.addAll(name);
             if(sm != null)
@@ -452,7 +459,7 @@
    {
       if (name.isEmpty())
       {
-         SecurityManager sm = System.getSecurityManager();
+         SecurityManager sm = getSecurityManager();
          if(sm != null)
          {
             JndiPermission perm = new JndiPermission(prefix, JndiPermission.LIST);
@@ -501,7 +508,7 @@
    {
       if (name.isEmpty())
       {
-         SecurityManager sm = System.getSecurityManager();
+         SecurityManager sm = getSecurityManager();
          if(sm != null)
          {
             JndiPermission perm = new JndiPermission(prefix, JndiPermission.LIST_BINDINGS);
@@ -618,7 +625,7 @@
          {
             Name fullName = (Name) prefix.clone();
             fullName.addAll(name);
-            SecurityManager sm = System.getSecurityManager();
+            SecurityManager sm = getSecurityManager();
             if(sm != null)
             {
                JndiPermission perm = new JndiPermission(fullName, JndiPermission.CREATE_SUBCONTEXT);
@@ -782,5 +789,11 @@
    {
       return table.remove(name.get(0));
    }
-   
+
+   private SecurityManager getSecurityManager()
+   {
+      if(secMgr == null)
+         secMgr = System.getSecurityManager();
+      return secMgr;
+   }
 }

Modified: projects/naming/trunk/jnpserver/src/test/java/org/jnp/test/NamingMCUnitTest.java
===================================================================
--- projects/naming/trunk/jnpserver/src/test/java/org/jnp/test/NamingMCUnitTest.java	2008-11-05 18:55:33 UTC (rev 80560)
+++ projects/naming/trunk/jnpserver/src/test/java/org/jnp/test/NamingMCUnitTest.java	2008-11-05 18:56:29 UTC (rev 80561)
@@ -23,15 +23,24 @@
 
 import java.math.BigInteger;
 import java.net.InetAddress;
+import java.security.Permission;
+import java.util.HashSet;
+import java.util.List;
 import java.util.Properties;
 
+import javax.naming.Context;
 import javax.naming.InitialContext;
+import javax.naming.spi.InitialContextFactory;
 
 import junit.framework.Test;
 
 import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.beans.metadata.api.model.InjectOption;
+import org.jboss.naming.JndiPermission;
 import org.jboss.test.kernel.junit.MicrocontainerTest;
+import org.jnp.interfaces.NamingContext;
 import org.jnp.interfaces.TimedSocketFactory;
+import org.jnp.test.support.QueueSecurityManager;
 
 /**
  * Test bootstraping the naming service using the mc
@@ -47,6 +56,8 @@
    }
    /** */
    private InitialContext ctx;
+   private QueueSecurityManager qsm;
+   private InitialContextFactory ctxFactory;
 
    /**
     * 
@@ -69,6 +80,16 @@
    {
       this.ctx = ctx;
    }
+   @Inject(bean="QueueSecurityManager", option=InjectOption.OPTIONAL)
+   public void setQueueSecurityManager(QueueSecurityManager qsm)
+   {
+      this.qsm = qsm;
+   }
+   @Inject(bean="InitialContextFactory#3", option=InjectOption.OPTIONAL)
+   public void setCtxFactory(InitialContextFactory ctxFactory)
+   {
+      this.ctxFactory = ctxFactory;
+   }
 
    /**
     * Validate that a NamingBeanImpl mc bean is accessible via the
@@ -150,6 +171,95 @@
    }
 
    /**
+    * Test two Naming instances with one LocalOnlyContextFactory using
+    * the NamingContext.local instance, and the other using the non-global
+    * Naming instance that was injected.
+    * @throws Exception
+    */
+   public void testMultipleLocalOnlyContextFactory()
+      throws Exception
+   {
+      // The InitialContextFactory
+      assertNotNull(ctx);
+      validateCtx(ctx);
+
+      // The InitialContextFactory#2
+      Properties env = new Properties();
+      env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory");
+      env.setProperty("java.naming.factory.url", "org.jboss.naming:org.jnp.interfaces");
+      env.setProperty(NamingContext.JNP_NAMING_INSTANCE_NAME, "testLocaNamingBeanImpl#2");
+      InitialContext ic = new InitialContext(env);
+
+      // Validate the second naming context bindings created by JndiBindings#2
+      Integer i2 = (Integer) ic.lookup("ints/2");
+      assertEquals("ints/1", new Integer(2), i2);
+      String s2 = (String) ic.lookup("strings/2");
+      assertEquals("strings/2", "String2", s2);
+      BigInteger bi2 = (BigInteger) ic.lookup("bigint/2");
+      assertEquals("bigint/2", new BigInteger("987654321"), bi2);
+      Properties envp = (Properties) ic.lookup("env-props");
+      Properties expected = new Properties();
+      expected.setProperty("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory#2");
+      expected.setProperty("java.naming.factory.url", "factory#2");
+      assertEquals("env-props", expected, envp);
+
+      // The InitialContextFactory#3
+      assertNotNull(ctxFactory);
+      // Validate the third naming context bindings created by JndiBindings#3
+      Context ctx3 = ctxFactory.getInitialContext(null);
+      Integer i3 = (Integer) ctx3.lookup("ints/3");
+      assertEquals("ints/1", new Integer(3), i3);
+      String s3 = (String) ctx3.lookup("strings/3");
+      assertEquals("strings/3", "String3", s3);
+      BigInteger bi3 = (BigInteger) ctx3.lookup("bigint/3");
+      assertEquals("bigint/2", new BigInteger("333333333"), bi3);
+      Properties envp3 = (Properties) ctx3.lookup("env-props");
+      Properties expected3 = new Properties();
+      expected3.setProperty("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory#3");
+      expected3.setProperty("java.naming.factory.url", "factory#3");
+      assertEquals("env-props", expected3, envp3);
+   }
+
+   public void testInjectedSecurityManager()
+      throws Exception
+   {
+      qsm.clearPerms();
+
+      HashSet<JndiPermission> expectedPerms = new HashSet<JndiPermission>();
+      // expected doOps() permissions
+      expectedPerms.add(new JndiPermission("path1", "createSubcontext"));
+      expectedPerms.add(new JndiPermission("path1", "lookup"));
+      expectedPerms.add(new JndiPermission("path1", "list"));
+      expectedPerms.add(new JndiPermission("path1", "listBindings"));
+      expectedPerms.add(new JndiPermission("path1/x", "bind"));
+      expectedPerms.add(new JndiPermission("path1/x", "rebind"));
+      expectedPerms.add(new JndiPermission("path1/x", "unbind"));
+      expectedPerms.add(new JndiPermission("path1", "unbind"));
+      SecurityUtil.doOps(ctx);
+      // expected doBadOps() permissions
+      expectedPerms.add(new JndiPermission("path2", "createSubcontext"));
+      expectedPerms.add(new JndiPermission("path1x", "createSubcontext"));
+      expectedPerms.add(new JndiPermission("path1x", "rebind"));
+      expectedPerms.add(new JndiPermission("path1x", "lookup"));
+      expectedPerms.add(new JndiPermission("path1x", "list"));
+      expectedPerms.add(new JndiPermission("path1x", "listBindings"));
+      expectedPerms.add(new JndiPermission("path1x/x", "bind"));
+      expectedPerms.add(new JndiPermission("path1x/x", "rebind"));
+      expectedPerms.add(new JndiPermission("path1x", "unbind"));
+      SecurityUtil.doBadOps(ctx, false);
+
+      List<Permission> perms = qsm.getPerms();
+      for(Permission p : perms)
+      {
+         if(p instanceof JndiPermission)
+         {
+            System.out.println(p);
+            assertTrue(p+" is in expectedPerms", expectedPerms.contains(p));
+         }
+      }
+   }
+
+   /**
     * 
     * @param ic
     * @throws Exception

Modified: projects/naming/trunk/jnpserver/src/test/java/org/jnp/test/NamingServerSecurityManagerUnitTest.java
===================================================================
--- projects/naming/trunk/jnpserver/src/test/java/org/jnp/test/NamingServerSecurityManagerUnitTest.java	2008-11-05 18:55:33 UTC (rev 80560)
+++ projects/naming/trunk/jnpserver/src/test/java/org/jnp/test/NamingServerSecurityManagerUnitTest.java	2008-11-05 18:56:29 UTC (rev 80561)
@@ -24,13 +24,11 @@
 import java.io.FilePermission;
 import java.io.SerializablePermission;
 import java.lang.reflect.ReflectPermission;
-import java.security.AccessControlException;
 import java.security.Permission;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Properties;
 
-import javax.naming.Context;
 import javax.naming.InitialContext;
 
 import junit.framework.TestCase;
@@ -167,108 +165,14 @@
       doBadOps(false);  
    }
 
-   /**
-    * Naming ops that should succeed.
-    * @throws Exception
-    */
    protected void doOps()
       throws Exception
    {
-      ic.createSubcontext("path1");
-      Object p1 = ic.lookup("path1");
-      ic.list("path1");
-      ic.listBindings("path1");
-      ic.bind("path1/x", "x.bind");
-      ic.rebind("path1/x", "x.rebind");
-      ic.unbind("path1/x");
-      ic.unbind("path1");
+      SecurityUtil.doOps(ic);
    }
-   /**
-    * Naming ops that should fail.
-    * @throws Exception
-    */
    protected void doBadOps(boolean expectFailure)
       throws Exception
    {
-      try
-      {
-         ic.createSubcontext("path2");
-         if(expectFailure)
-            fail("Was able to create path2 subcontext");
-      }
-      catch(AccessControlException e)
-      {
-         System.out.println(e);
-      }
-      Context path1x = ic.createSubcontext("path1x");
-      try
-      {
-         if(expectFailure)
-         {
-            ic.rebind("path1x", "path1x.rebind");
-            fail("Was able to rebind path1x subcontext");
-         }
-      }
-      catch(AccessControlException e)
-      {
-         System.out.println(e);
-      }
-      
-      try
-      {
-         ic.lookup("path1x");
-         if(expectFailure)
-            fail("Was able to lookup path1x subcontext");
-      }
-      catch(AccessControlException e)
-      {
-         System.out.println(e);
-      }
-
-      try
-      {
-         ic.list("path1x");
-         if(expectFailure)
-            fail("Was able to list path1x subcontext");
-      }
-      catch(AccessControlException e)
-      {
-         System.out.println(e);
-      }
-
-      try
-      {
-         ic.listBindings("path1x");
-         if(expectFailure)
-            fail("Was able to listBindings path1x subcontext");
-      }
-      catch(AccessControlException e)
-      {
-         System.out.println(e);
-      }
-
-      try
-      {
-         ic.bind("path1x/x", "x.bind");
-         if(expectFailure)
-            fail("Was able to bind path1x/x");
-      }
-      catch(AccessControlException e)
-      {
-         System.out.println(e);
-      }
-
-      try
-      {
-         ic.rebind("path1x/x", "x.rebind");
-         if(expectFailure)
-            fail("Was able to rebind path1x/x");
-      }
-      catch(AccessControlException e)
-      {
-         System.out.println(e);
-      }
-
-      ic.unbind("path1x");
+      SecurityUtil.doBadOps(ic, expectFailure);
    }
 }

Added: projects/naming/trunk/jnpserver/src/test/java/org/jnp/test/SecurityUtil.java
===================================================================
--- projects/naming/trunk/jnpserver/src/test/java/org/jnp/test/SecurityUtil.java	                        (rev 0)
+++ projects/naming/trunk/jnpserver/src/test/java/org/jnp/test/SecurityUtil.java	2008-11-05 18:56:29 UTC (rev 80561)
@@ -0,0 +1,146 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.jnp.test;
+
+import java.security.AccessControlException;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import junit.framework.AssertionFailedError;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class SecurityUtil
+{
+   /**
+    * Naming ops that should succeed.
+    * @throws Exception
+    */
+   static void doOps(InitialContext ic)
+      throws Exception
+   {
+      ic.createSubcontext("path1");
+      Object p1 = ic.lookup("path1");
+      ic.list("path1");
+      ic.listBindings("path1");
+      ic.bind("path1/x", "x.bind");
+      ic.rebind("path1/x", "x.rebind");
+      ic.unbind("path1/x");
+      ic.unbind("path1");
+   }
+   /**
+    * Naming ops that should fail.
+    * @throws Exception
+    */
+   static void doBadOps(InitialContext ic, boolean expectFailure)
+      throws Exception
+   {
+      try
+      {
+         ic.createSubcontext("path2");
+         if(expectFailure)
+            fail("Was able to create path2 subcontext");
+      }
+      catch(AccessControlException e)
+      {
+         System.out.println(e);
+      }
+      Context path1x = ic.createSubcontext("path1x");
+      try
+      {
+         if(expectFailure)
+         {
+            ic.rebind("path1x", "path1x.rebind");
+            fail("Was able to rebind path1x subcontext");
+         }
+      }
+      catch(AccessControlException e)
+      {
+         System.out.println(e);
+      }
+      
+      try
+      {
+         ic.lookup("path1x");
+         if(expectFailure)
+            fail("Was able to lookup path1x subcontext");
+      }
+      catch(AccessControlException e)
+      {
+         System.out.println(e);
+      }
+
+      try
+      {
+         ic.list("path1x");
+         if(expectFailure)
+            fail("Was able to list path1x subcontext");
+      }
+      catch(AccessControlException e)
+      {
+         System.out.println(e);
+      }
+
+      try
+      {
+         ic.listBindings("path1x");
+         if(expectFailure)
+            fail("Was able to listBindings path1x subcontext");
+      }
+      catch(AccessControlException e)
+      {
+         System.out.println(e);
+      }
+
+      try
+      {
+         ic.bind("path1x/x", "x.bind");
+         if(expectFailure)
+            fail("Was able to bind path1x/x");
+      }
+      catch(AccessControlException e)
+      {
+         System.out.println(e);
+      }
+
+      try
+      {
+         ic.rebind("path1x/x", "x.rebind");
+         if(expectFailure)
+            fail("Was able to rebind path1x/x");
+      }
+      catch(AccessControlException e)
+      {
+         System.out.println(e);
+      }
+
+      ic.unbind("path1x");
+   }
+
+   static void fail(String message)
+   {
+      throw new AssertionFailedError(message);
+   }
+}

Modified: projects/naming/trunk/jnpserver/src/test/resources/log4j.xml
===================================================================
--- projects/naming/trunk/jnpserver/src/test/resources/log4j.xml	2008-11-05 18:55:33 UTC (rev 80560)
+++ projects/naming/trunk/jnpserver/src/test/resources/log4j.xml	2008-11-05 18:56:29 UTC (rev 80561)
@@ -19,7 +19,7 @@
         </layout>
     </appender>
     
-    <category name="org.jnp.server">
+    <category name="org.jnp">
         <priority value="TRACE"/>
     </category>
     

Added: projects/naming/trunk/jnpserver/src/test/resources/org/jnp/test/NamingMCUnitTest#testInjectedSecurityManager.xml
===================================================================
--- projects/naming/trunk/jnpserver/src/test/resources/org/jnp/test/NamingMCUnitTest#testInjectedSecurityManager.xml	                        (rev 0)
+++ projects/naming/trunk/jnpserver/src/test/resources/org/jnp/test/NamingMCUnitTest#testInjectedSecurityManager.xml	2008-11-05 18:56:29 UTC (rev 80561)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_2_0.xsd"
+    xmlns="urn:jboss:bean-deployer:2.0">
+
+    <bean name="InitialContextFactory" class="org.jboss.naming.InitialContextFactoryBean">
+        <property name="env">
+            <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+                <entry>
+                    <key>java.naming.factory.initial</key>
+                    <value>org.jnp.interfaces.LocalOnlyContextFactory</value>
+                </entry>
+                <entry>
+                    <key>java.naming.factory.url</key>
+                    <value>org.jboss.naming:org.jnp.interfaces</value>
+                </entry>
+            </map>
+        </property>
+        <depends>testInjectedSecurityManager</depends>
+    </bean>
+    <bean name="JndiBindings" class="org.jboss.naming.BindingsInitializer">
+        <property name="ctx">
+            <inject bean="InitialContextFactory" property="ctx"/>
+        </property>
+        <property name="bindings">
+            <map keyClass="java.lang.String">
+                <entry>
+                    <key>ints/1</key>
+                    <value class="java.lang.Integer">1</value>
+                </entry>
+                <entry>
+                    <key>strings/1</key>
+                    <value class="java.lang.String">String1</value>
+                </entry>
+                <entry>
+                    <key>bigint/1</key>
+                    <value class="java.math.BigInteger">123456789</value>
+                </entry>
+                <entry>
+                    <key>env-props</key>
+                    <value>
+                        <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+                            <entry>
+                                <key>java.naming.factory.initial</key>
+                                <value>org.jnp.interfaces.LocalOnlyContextFactory</value>
+                            </entry>
+                            <entry>
+                                <key>java.naming.factory.url</key>
+                                <value>org.jboss.naming:org.jnp.interfaces</value>
+                            </entry>
+                        </map>
+                    </value>
+                </entry>
+            </map>
+        </property>
+    </bean>
+
+    <bean name="QueueSecurityManager" class="org.jnp.test.support.QueueSecurityManager">
+        
+    </bean>
+
+    <bean name="testInjectedSecurityManager" class="org.jnp.server.NamingBeanImpl">
+        <!-- Install this bean as the global JVM NamingServer -->
+        <property name="installGlobalService">true</property>
+        <property name="useGlobalService">false</property>
+        <!-- Set the SecurityManager to use -->
+        <property name="securityMgr"><inject bean="QueueSecurityManager"/></property>
+    </bean>
+</deployment>




More information about the jboss-cvs-commits mailing list