directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1026758 - in /directory/apacheds/branches/apacheds-config/server-config/src: main/java/org/apache/directory/server/config/beans/ test/java/org/apache/directory/server/config/ test/resources/
Date Sun, 24 Oct 2010 11:03:20 GMT
Author: elecharny
Date: Sun Oct 24 11:03:19 2010
New Revision: 1026758

URL: http://svn.apache.org/viewvc?rev=1026758&view=rev
Log:
o Added the test for the ChangePassword config
o Fixed some typoes

Added:
    directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
    directory/apacheds/branches/apacheds-config/server-config/src/test/resources/changePasswordServer.ldif
Modified:
    directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/ChangePasswordServerBean.java
    directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/HttpServerBean.java
    directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/DhcpServerConfigReaderTest.java
    directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/DnsServerConfigReaderTest.java
    directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
    directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
    directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/NtpServerConfigReaderTest.java

Modified: directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/ChangePasswordServerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/ChangePasswordServerBean.java?rev=1026758&r1=1026757&r2=1026758&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/ChangePasswordServerBean.java
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/ChangePasswordServerBean.java
Sun Oct 24 11:03:19 2010
@@ -117,6 +117,20 @@ public class ChangePasswordServerBean ex
 
     
     /**
+     * Initialize the encryptionTypes set
+     * 
+     * @param krbEncryptionTypes the encryptionTypes to set
+     */
+    public void addkrbencryptiontypes( String... krbEncryptionTypes )
+    {
+        for ( String encryptionType:krbEncryptionTypes )
+        {
+            this.krbencryptiontypes.add( encryptionType );
+        }
+    }
+
+
+    /**
      * @return the krbPrimaryRealm
      */
     public String getKrbPrimaryRealm()
@@ -215,8 +229,8 @@ public class ChangePasswordServerBean ex
         
         sb.append( tabs ).append( "ChangePasswordServer :\n" );
         sb.append( super.toString( tabs ) );
-        sb.append( tabs ).append( "  change password service principal : " ).append( chgpwdserviceprincipal
).append( '\n' );
-        sb.append( tabs ).append( "  KRB primary realm : " ).append( krbprimaryrealm ).append(
'\n' );
+        sb.append( toString( tabs, "  change password service principal", chgpwdserviceprincipal
) );
+        sb.append( toString( tabs, "  KRB primary realm", krbprimaryrealm ) );
         
         if ( ( krbencryptiontypes != null ) && ( krbencryptiontypes.size() != 0 )
)
         {
@@ -228,10 +242,10 @@ public class ChangePasswordServerBean ex
             }
         }
         
-        sb.append( tabs ).append( "  change password policy category count : " ).append(
chgpwdpolicycategorycount ).append( '\n' );
-        sb.append( tabs ).append( "  change password policy password length : " ).append(
chgpwdpolicypasswordlength ).append( '\n' );
-        sb.append( tabs ).append( "  change password policy token size : " ).append( chgpwdpolicytokensize
).append( '\n' );
-        sb.append( tabs ).append( "  KRB allowable clock skew : " ).append( krballowableclockskew
).append( '\n' );
+        sb.append( toString( tabs, "  change password policy category count", chgpwdpolicycategorycount
) );
+        sb.append( toString( tabs, "  change password policy password length", chgpwdpolicypasswordlength
) );
+        sb.append( toString( tabs, "  change password policy token size", chgpwdpolicytokensize
) );
+        sb.append( toString( tabs, "  KRB allowable clock skew", krballowableclockskew )
);
         sb.append( toString( tabs, "  KRB empty addresses allowed", krbemptyaddressesallowed
) );
 
         return sb.toString();

Modified: directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/HttpServerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/HttpServerBean.java?rev=1026758&r1=1026757&r2=1026758&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/HttpServerBean.java
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/HttpServerBean.java
Sun Oct 24 11:03:19 2010
@@ -59,4 +59,28 @@ public class HttpServerBean extends Serv
     {
         this.httpconffile = httpConfFile;
     }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String toString( String tabs )
+    {
+        StringBuilder sb = new StringBuilder();
+        
+        sb.append( tabs ).append( "HttpServer :\n" );
+        sb.append( super.toString( tabs + "  " ) );
+        sb.append(  toString( tabs, "  http configuration file", httpconffile ) );
+
+        return sb.toString();
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String toString()
+    {
+        return toString( "" );
+    }
 }

Added: directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java?rev=1026758&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
(added)
+++ directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
Sun Oct 24 11:03:19 2010
@@ -0,0 +1,118 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you 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.directory.server.config;
+
+
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.directory.junit.tools.Concurrent;
+import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.server.config.beans.ChangePasswordServerBean;
+import org.apache.directory.server.config.beans.ConfigBean;
+import org.apache.directory.server.core.partition.ldif.SingleFileLdifPartition;
+import org.apache.directory.shared.ldap.name.DN;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.loader.ldif.LdifSchemaLoader;
+import org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManager;
+import org.apache.directory.shared.ldap.schema.registries.SchemaLoader;
+import org.apache.directory.shared.ldap.util.LdapExceptionUtils;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * Test class for ConfigPartitionReader
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+@RunWith(ConcurrentJunitRunner.class)
+@Concurrent()
+public class ChangePasswordConfigReaderTest
+{
+    private static File workDir = new File( System.getProperty( "java.io.tmpdir" ) + "/server-work"
);
+
+    private static SchemaManager schemaManager;
+
+
+    @BeforeClass
+    public static void readConfig() throws Exception
+    {
+        File workDir = new File( System.getProperty( "java.io.tmpdir" ) + "/server-work"
);
+        FileUtils.deleteDirectory( workDir );
+        workDir.mkdir();
+
+        String workingDirectory = workDir.getPath();
+        // Extract the schema on disk (a brand new one) and load the registries
+        File schemaRepository = new File( workingDirectory, "schema" );
+        
+        if ( schemaRepository.exists() )
+        {
+            FileUtils.deleteDirectory( schemaRepository );
+        }
+
+        SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory
) );
+        extractor.extractOrCopy();
+
+        SchemaLoader loader = new LdifSchemaLoader( schemaRepository );
+        schemaManager = new DefaultSchemaManager( loader );
+
+        // We have to load the schema now, otherwise we won't be able
+        // to initialize the Partitions, as we won't be able to parse 
+        // and normalize their suffix DN
+        schemaManager.loadAllEnabled();
+
+        List<Throwable> errors = schemaManager.getErrors();
+
+        if ( errors.size() != 0 )
+        {
+            throw new Exception( "Schema load failed : " + LdapExceptionUtils.printErrors(
errors ) );
+        }
+    }
+
+
+    @Test
+    public void testChangePasswordServer() throws Exception
+    {
+        File configDir = new File( workDir, "changePasswordServer" ); // could be any directory,
cause the config is now in a single file
+        String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "changePasswordServer.ldif",
true );
+
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( configFile
);
+        configPartition.setId( "config" );
+        configPartition.setSuffix( new DN( "ou=config" ) );
+        configPartition.setSchemaManager( schemaManager );
+        
+        configPartition.initialize();
+        ConfigPartitionReader cpReader = new ConfigPartitionReader( configPartition, workDir
);
+        
+        ConfigBean configBean = cpReader.readConfig( new DN( "ou=servers,ads-directoryServiceId=default,ou=config"
), ConfigSchemaConstants.ADS_CHANGE_PASSWORD_SERVER_OC.getValue() );
+
+        assertNotNull( configBean );
+        ChangePasswordServerBean changePasswordServerBean = (ChangePasswordServerBean)configBean.getDirectoryServiceBeans().get(
0 );
+        assertNotNull( changePasswordServerBean );
+    }
+}

Modified: directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/DhcpServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/DhcpServerConfigReaderTest.java?rev=1026758&r1=1026757&r2=1026758&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/DhcpServerConfigReaderTest.java
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/DhcpServerConfigReaderTest.java
Sun Oct 24 11:03:19 2010
@@ -97,7 +97,7 @@ public class DhcpServerConfigReaderTest
 
 
     @Test
-    public void testDhcpService() throws Exception
+    public void testDhcpServer() throws Exception
     {
         File configDir = new File( workDir, "dhcpserver" ); // could be any directory, cause
the config is now in a single file
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "dhcpserver.ldif",
true );

Modified: directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/DnsServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/DnsServerConfigReaderTest.java?rev=1026758&r1=1026757&r2=1026758&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/DnsServerConfigReaderTest.java
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/DnsServerConfigReaderTest.java
Sun Oct 24 11:03:19 2010
@@ -95,7 +95,7 @@ public class DnsServerConfigReaderTest
 
 
     @Test
-    public void testNtpService() throws Exception
+    public void testDnsServer() throws Exception
     {
         File configDir = new File( workDir, "dnsserver" ); // could be any directory, cause
the config is now in a single file
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "dnsserver.ldif",
true );

Modified: directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java?rev=1026758&r1=1026757&r2=1026758&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
Sun Oct 24 11:03:19 2010
@@ -96,7 +96,7 @@ public class KerberosServerConfigReaderT
 
 
     @Test
-    public void testDhcpService() throws Exception
+    public void testKerberosServer() throws Exception
     {
         File configDir = new File( workDir, "kerberosserver" ); // could be any directory,
cause the config is now in a single file
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "kerberosserver.ldif",
true );

Modified: directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java?rev=1026758&r1=1026757&r2=1026758&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
Sun Oct 24 11:03:19 2010
@@ -96,7 +96,7 @@ public class LdapServerConfigReaderTest
 
 
     @Test
-    public void testDhcpService() throws Exception
+    public void testLdapServer() throws Exception
     {
         File configDir = new File( workDir, "ldapserver" ); // could be any directory, cause
the config is now in a single file
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "ldapserver.ldif",
true );

Modified: directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/NtpServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/NtpServerConfigReaderTest.java?rev=1026758&r1=1026757&r2=1026758&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/NtpServerConfigReaderTest.java
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/NtpServerConfigReaderTest.java
Sun Oct 24 11:03:19 2010
@@ -95,7 +95,7 @@ public class NtpServerConfigReaderTest
 
 
     @Test
-    public void testNtpService() throws Exception
+    public void testNtpServer() throws Exception
     {
         File configDir = new File( workDir, "ntpserver" ); // could be any directory, cause
the config is now in a single file
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "ntpserver.ldif",
true );

Added: directory/apacheds/branches/apacheds-config/server-config/src/test/resources/changePasswordServer.ldif
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/test/resources/changePasswordServer.ldif?rev=1026758&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/test/resources/changePasswordServer.ldif
(added)
+++ directory/apacheds/branches/apacheds-config/server-config/src/test/resources/changePasswordServer.ldif
Sun Oct 24 11:03:19 2010
@@ -0,0 +1,89 @@
+version: 1
+dn: ou=config
+ou: config
+objectclass: top
+objectclass: organizationalUnit
+
+dn: ads-directoryServiceId=default,ou=config
+objectclass: top
+objectclass: ads-directoryService
+ads-directoryserviceid: default
+ads-dsreplicaid: 1
+ads-dssyncperiodmillis: 15000
+ads-dsmaxpdusize: 2000000
+ads-dsallowanonymousaccess: true
+ads-dsaccesscontrolenabled: false
+ads-dsdenormalizeopattrsenabled: false
+ads-servers: changepasswordserver
+ads-servers: dns
+ads-servers: httpserver
+ads-servers: kerberos
+ads-servers: ldapserver
+ads-servers: ntp
+ads-partitions: example
+ads-partitions: system
+ads-interceptors: aciAuthorizationInterceptor
+ads-interceptors: authenticationInterceptor
+ads-interceptors: collectiveAttributeInterceptor
+ads-interceptors: defaultAuthorizationInterceptor
+ads-interceptors: eventInterceptor
+ads-interceptors: exceptionInterceptor
+ads-interceptors: keyderivationinterceptor
+ads-interceptors: normalizationInterceptor
+ads-interceptors: operationalAttributeInterceptor
+ads-interceptors: passwordpolicyinterceptor
+ads-interceptors: referralInterceptor
+ads-interceptors: schemaInterceptor
+ads-interceptors: subentryInterceptor
+ads-interceptors: triggerInterceptor
+ads-enabled: true
+
+dn: ou=servers,ads-directoryServiceId=default,ou=config
+ou: servers
+objectclass: organizationalUnit
+objectclass: top
+
+dn: ads-serverId=changePasswordServer,ou=servers,ads-directoryServiceId=default,ou=config
+objectclass: top
+objectclass: ads-server
+objectclass: ads-dsBasedServer
+objectclass: ads-changePasswordServer
+ads-serverId: changePasswordServer
+description: a ChangePassword server instance
+ads-krbAllowableClockSkew: 1000
+ads-krbEmptyAddressesAllowed: TRUE
+ads-krbEncryptionTypes: MD5
+ads-krbEncryptionTypes: SHA1
+ads-krbEncryptionTypes: GSSAPI
+ads-krbPrimaryRealm: EXAMPLE.COM
+ads-chgPwdPolicyCategoryCount: 2
+ads-chgPwdPolicyPasswordLength: 2
+ads-chgPwdPolicyTokenSize: 2
+ads-chgPwdServicePrincipal: uid=admin
+
+dn: ou=transports,ads-serverId=changePasswordServer,ou=servers,ads-directoryServiceId=default,ou=config
+ou: transports
+objectclass: organizationalUnit
+objectclass: top
+
+dn: ads-transportid=ldap1,ou=transports,ads-serverId=changePasswordServer,ou=servers,ads-directoryServiceId=default,ou=config
+ads-systemport: 10389
+ads-transportenablessl: false
+ads-transportbacklog: 50
+ads-transportnbthreads: 8
+ads-transportaddress: 0.0.0.0
+ads-transportid: ldap1
+objectclass: ads-transport
+objectclass: ads-tcpTransport
+objectclass: top
+ads-enabled: true
+
+dn: ads-transportid=ldaps,ou=transports,ads-serverId=changePasswordServer,ou=servers,ads-directoryServiceId=default,ou=config
+ads-systemport: 10636
+ads-transportenablessl: true
+ads-transportaddress: localhost
+ads-transportid: ldaps
+objectclass: ads-transport
+objectclass: ads-tcpTransport
+objectclass: top
+ads-enabled: true



Mime
View raw message