You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ps...@apache.org on 2005/11/25 18:58:12 UTC

svn commit: r348990 - /directory/naming/trunk/naming-config/src/test/org/apache/naming/config/XmlConfiguratorTest.java

Author: psteitz
Date: Fri Nov 25 09:58:09 2005
New Revision: 348990

URL: http://svn.apache.org/viewcvs?rev=348990&view=rev
Log:
Added test case verifying jndi url lookup works with default (0.8) config.

Modified:
    directory/naming/trunk/naming-config/src/test/org/apache/naming/config/XmlConfiguratorTest.java

Modified: directory/naming/trunk/naming-config/src/test/org/apache/naming/config/XmlConfiguratorTest.java
URL: http://svn.apache.org/viewcvs/directory/naming/trunk/naming-config/src/test/org/apache/naming/config/XmlConfiguratorTest.java?rev=348990&r1=348989&r2=348990&view=diff
==============================================================================
--- directory/naming/trunk/naming-config/src/test/org/apache/naming/config/XmlConfiguratorTest.java (original)
+++ directory/naming/trunk/naming-config/src/test/org/apache/naming/config/XmlConfiguratorTest.java Fri Nov 25 09:58:09 2005
@@ -208,6 +208,19 @@
         checkDs((DataSource) ctx.lookup("jndi:global/java:comp/env/jdbc/pool")); 
     }
     
+    /* Verify that jndi: urls work with default config, using default context name and root */
+    public void testJNDIDefault() throws Exception {
+        XmlConfigurator.loadConfiguration(getClass().getResourceAsStream("/test-jndi.xml"));
+        Hashtable env = new Hashtable();
+        env.put(Context.INITIAL_CONTEXT_FACTORY,
+        "org.apache.naming.NamingContextFactory");
+        env.put(Context.URL_PKG_PREFIXES, "org.apache.naming");
+        env.put(NamingContextFactory.NAME, "global"); //name attribute 
+        Context ctx = new InitialContext(env);
+        String defaultName = NamingContextFactory.DEFAULT_NAME;
+        checkDs((DataSource) ctx.lookup("jndi:" + defaultName + "/java:comp/env/jdbc/pool"));       
+    }
+    
     /**
      * Tests ldap links.  To activate, change the name to "testLdapLinks" and
      *