directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r111398 - in incubator/directory/eve/trunk/dib/src: java/org/apache/eve/jndi test/org/apache/eve/jndi
Date Thu, 09 Dec 2004 15:59:47 GMT
Author: akarasulu
Date: Thu Dec  9 07:59:45 2004
New Revision: 111398

URL: http://svn.apache.org/viewcvs?view=rev&rev=111398
Log:
Commit changes ...

 o changed names of env property contants to not have EVE_ which is redundant
 o frontend passthru environment property is implemented
 o added cludge to be able to get test case for frontend passthru working
 o added test case



Added:
   incubator/directory/eve/trunk/dib/src/test/org/apache/eve/jndi/FrontendPassthruTest.java
Modified:
   incubator/directory/eve/trunk/dib/src/java/org/apache/eve/jndi/EnvKeys.java
   incubator/directory/eve/trunk/dib/src/java/org/apache/eve/jndi/EveContextFactory.java
   incubator/directory/eve/trunk/dib/src/test/org/apache/eve/jndi/AbstractJndiTest.java

Modified: incubator/directory/eve/trunk/dib/src/java/org/apache/eve/jndi/EnvKeys.java
Url: http://svn.apache.org/viewcvs/incubator/directory/eve/trunk/dib/src/java/org/apache/eve/jndi/EnvKeys.java?view=diff&rev=111398&p1=incubator/directory/eve/trunk/dib/src/java/org/apache/eve/jndi/EnvKeys.java&r1=111397&p2=incubator/directory/eve/trunk/dib/src/java/org/apache/eve/jndi/EnvKeys.java&r2=111398
==============================================================================
--- incubator/directory/eve/trunk/dib/src/java/org/apache/eve/jndi/EnvKeys.java	(original)
+++ incubator/directory/eve/trunk/dib/src/java/org/apache/eve/jndi/EnvKeys.java	Thu Dec  9
07:59:45 2004
@@ -36,7 +36,7 @@
 
 
     // ------------------------------------------------------------------------
-    // Properties for
+    // Properties for setting working directory, schemas and allowing anon binds
     // ------------------------------------------------------------------------
 
     /** bootstrap prop: path to eve's working directory - relative or absolute */
@@ -47,10 +47,18 @@
     public static final String DISABLE_ANONYMOUS = "eve.disable.anonymous";
 
 
+    // ------------------------------------------------------------------------
+    // Properties for protocol/network settings
+    // ------------------------------------------------------------------------
+
     /** key used to disable the networking layer (wire protocol) */
     public static final String DISABLE_PROTOCOL = "eve.net.disable.protocol";
-    public static final String EVE_LDAP_PORT = "eve.net.ldap.port";
-    public static final String EVE_LDAPS_PORT = "eve.net.ldaps.port";
+    /** key used to hold the frontend to use rather than creating one */
+    public static final String PASSTHRU = "eve.net.passthru";
+    /** key for port setting for ldap requests beside default 389 */
+    public static final String LDAP_PORT = "eve.net.ldap.port";
+    /** key for port setting for secure ldap requests besides default 636 */
+    public static final String LDAPS_PORT = "eve.net.ldaps.port";
 
     // ------------------------------------------------------------------------
     // Properties for partition configuration

Modified: incubator/directory/eve/trunk/dib/src/java/org/apache/eve/jndi/EveContextFactory.java
Url: http://svn.apache.org/viewcvs/incubator/directory/eve/trunk/dib/src/java/org/apache/eve/jndi/EveContextFactory.java?view=diff&rev=111398&p1=incubator/directory/eve/trunk/dib/src/java/org/apache/eve/jndi/EveContextFactory.java&r1=111397&p2=incubator/directory/eve/trunk/dib/src/java/org/apache/eve/jndi/EveContextFactory.java&r2=111398
==============================================================================
--- incubator/directory/eve/trunk/dib/src/java/org/apache/eve/jndi/EveContextFactory.java
(original)
+++ incubator/directory/eve/trunk/dib/src/java/org/apache/eve/jndi/EveContextFactory.java
Thu Dec  9 07:59:45 2004
@@ -81,18 +81,17 @@
  */
 public class EveContextFactory implements InitialContextFactory
 {
-    /** the default LDAP port to use */
-    private static final int LDAP_PORT = 389;
-    /** default path to working directory if WKDIR_ENV property is not set */
-    public static final String DEFAULT_WKDIR = "eve";
-
-    // for convenience
     private static final String TYPE = Context.SECURITY_AUTHENTICATION;
     private static final String CREDS = Context.SECURITY_CREDENTIALS;
     private static final String PRINCIPAL = Context.SECURITY_PRINCIPAL;
     private static final String ADMIN = SystemPartition.ADMIN_PRINCIPAL;
     private static final Name ADMIN_NAME = SystemPartition.getAdminDn();
 
+    /** the default LDAP port to use */
+    private static final int LDAP_PORT = 389;
+    /** default path to working directory if WKDIR_ENV property is not set */
+    public static final String DEFAULT_WKDIR = "eve-work";
+
     /** default schema classes for the SCHEMAS_ENV property if not set */
     private static final String[] DEFAULT_SCHEMAS = new String[]
     {
@@ -534,22 +533,36 @@
 
     private void startUpWireProtocol() throws NamingException
     {
-        try
+        if ( initialEnv.containsKey( EnvKeys.PASSTHRU ) )
         {
-            fe = ( DefaultFrontend ) new DefaultFrontendFactory().create();
+            fe = ( DefaultFrontend ) initialEnv.get( EnvKeys.PASSTHRU );
+
+            if ( fe != null )
+            {
+                initialEnv.put( EnvKeys.PASSTHRU, "Handoff Succeeded!" );
+            }
         }
-        catch ( Exception e )
+
+
+        if ( fe == null )
         {
-            String msg = "Failed to initialize the frontend subsystem!";
-            NamingException ne = new EveConfigurationException( msg );
-            ne.setRootCause( e );
-            ne.setResolvedName( new LdapName( ( String ) initialEnv.get( Context.PROVIDER_URL
) ) );
-            throw ne;
+            try
+            {
+                fe = ( DefaultFrontend ) new DefaultFrontendFactory().create();
+            }
+            catch ( Exception e )
+            {
+                String msg = "Failed to initialize the frontend subsystem!";
+                NamingException ne = new EveConfigurationException( msg );
+                ne.setRootCause( e );
+                ne.setResolvedName( new LdapName( ( String ) initialEnv.get( Context.PROVIDER_URL
) ) );
+                throw ne;
+            }
         }
 
         proto = new LdapProtocolProvider( ( Hashtable) initialEnv.clone(), fe.getEventRouter()
);
 
-        int port = PropertiesUtils.get( initialEnv, EnvKeys.EVE_LDAP_PORT, LDAP_PORT );
+        int port = PropertiesUtils.get( initialEnv, EnvKeys.LDAP_PORT, LDAP_PORT );
         srvEntry = new InetServiceEntry( proto.getName(), port, proto, TransportTypeEnum.TCP
);
         ( ( DefaultInetServicesDatabase ) fe.getInetServicesDatabase()).addEntry( srvEntry
);
 

Modified: incubator/directory/eve/trunk/dib/src/test/org/apache/eve/jndi/AbstractJndiTest.java
Url: http://svn.apache.org/viewcvs/incubator/directory/eve/trunk/dib/src/test/org/apache/eve/jndi/AbstractJndiTest.java?view=diff&rev=111398&p1=incubator/directory/eve/trunk/dib/src/test/org/apache/eve/jndi/AbstractJndiTest.java&r1=111397&p2=incubator/directory/eve/trunk/dib/src/test/org/apache/eve/jndi/AbstractJndiTest.java&r2=111398
==============================================================================
--- incubator/directory/eve/trunk/dib/src/test/org/apache/eve/jndi/AbstractJndiTest.java	(original)
+++ incubator/directory/eve/trunk/dib/src/test/org/apache/eve/jndi/AbstractJndiTest.java	Thu
Dec  9 07:59:45 2004
@@ -63,7 +63,7 @@
         super.setUp();
         doDelete( new File( "target" + File.separator + "eve" ) );
 
-        extras.put( EnvKeys.EVE_LDAP_PORT,
+        extras.put( EnvKeys.LDAP_PORT,
                 String.valueOf( AvailablePortFinder.getNextAvailable( 1024 ) ) );
 
         setSysRoot( "uid=admin,ou=system", "secret" );

Added: incubator/directory/eve/trunk/dib/src/test/org/apache/eve/jndi/FrontendPassthruTest.java
Url: http://svn.apache.org/viewcvs/incubator/directory/eve/trunk/dib/src/test/org/apache/eve/jndi/FrontendPassthruTest.java?view=auto&rev=111398
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/dib/src/test/org/apache/eve/jndi/FrontendPassthruTest.java
Thu Dec  9 07:59:45 2004
@@ -0,0 +1,68 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.eve.jndi;
+
+
+import javax.naming.NamingException;
+
+import org.apache.seda.DefaultFrontend;
+import org.apache.seda.DefaultFrontendFactory;
+
+
+/**
+ * Tests to make sure the frontend passthru property actually works.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class FrontendPassthruTest extends AbstractJndiTest
+{
+    DefaultFrontend fe;
+
+
+    protected void setUp() throws Exception
+    {
+        if ( getName().equals( "testUsePassthru" ) )
+        {
+            fe = ( DefaultFrontend ) new DefaultFrontendFactory().create();
+            super.extras.put( EnvKeys.PASSTHRU, fe );
+        }
+
+        super.setUp();
+    }
+
+
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+        fe = null;
+    }
+
+
+    public void testUsePassthru() throws NamingException
+    {
+        assertTrue( sysRoot.getEnvironment().containsKey( EnvKeys.PASSTHRU ) );
+        assertEquals( String.class, sysRoot.getEnvironment().get( EnvKeys.PASSTHRU ).getClass()
);
+        assertEquals( "Handoff Succeeded!", sysRoot.getEnvironment().get( EnvKeys.PASSTHRU
) );
+    }
+
+
+    public void testDoNotUsePassthru() throws NamingException
+    {
+        assertFalse( sysRoot.getEnvironment().containsKey( EnvKeys.PASSTHRU ) );
+    }
+}

Mime
View raw message