directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1026965 - in /directory: apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/ apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/ apacheds/bra...
Date Mon, 25 Oct 2010 08:10:42 GMT
Author: elecharny
Date: Mon Oct 25 08:10:42 2010
New Revision: 1026965

URL: http://svn.apache.org/viewvc?rev=1026965&view=rev
Log:
Added code to process httpServer config

Added:
    directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
    directory/apacheds/branches/apacheds-config/server-config/src/test/resources/httpServer.ldif
Modified:
    directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/HttpServerBean.java
    directory/shared/branches/shared-config/ldap-schema/src/main/resources/schema/ou=schema/cn=adsconfig/ou=attributetypes/m-oid=1.3.6.1.4.1.18060.0.4.1.2.840.ldif
    directory/shared/branches/shared-config/ldap-schema/src/main/resources/schema/ou=schema/cn=adsconfig/ou=objectclasses/m-oid=1.3.6.1.4.1.18060.0.4.1.3.804.ldif

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=1026965&r1=1026964&r2=1026965&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
Mon Oct 25 08:10:42 2010
@@ -19,6 +19,10 @@
  */
 package org.apache.directory.server.config.beans;
 
+import java.util.ArrayList;
+import java.util.List;
+
+
 
 
 /**
@@ -30,6 +34,9 @@ public class HttpServerBean extends Serv
 {
     /** The configuration file */
     private String httpconffile;
+    
+    /** The list of supported web apps */
+    private List<HttpWebAppBean> httpwebapps = new ArrayList<HttpWebAppBean>();
 
     /**
      * Create a new HttpServerBean instance
@@ -59,7 +66,37 @@ public class HttpServerBean extends Serv
     {
         this.httpconffile = httpConfFile;
     }
+
+    
+    /**
+     * @return the httpWebApps
+     */
+    public List<HttpWebAppBean> getExtendedOps()
+    {
+        return httpwebapps;
+    }
+
+    
+    /**
+     * @param httpWebApps the httpWebApps to set
+     */
+    public void setExtendedOps( List<HttpWebAppBean> httpWebApps )
+    {
+        this.httpwebapps = httpWebApps;
+    }
+
     
+    /**
+     * @param httpWebApps the httpWebApps to add
+     */
+    public void addExtendedOps( HttpWebAppBean... httpWebApps )
+    {
+        for ( HttpWebAppBean httpWebApp : httpWebApps )
+        {   
+            this.httpwebapps.add( httpWebApp );
+        }
+    }
+
     
     /**
      * {@inheritDoc}
@@ -71,6 +108,16 @@ public class HttpServerBean extends Serv
         sb.append( tabs ).append( "HttpServer :\n" );
         sb.append( super.toString( tabs + "  " ) );
         sb.append(  toString( tabs, "  http configuration file", httpconffile ) );
+        
+        if ( ( httpwebapps != null ) && ( httpwebapps.size() > 0 ) )
+        {
+            sb.append( tabs ).append( "  web applications :\n" );
+            
+            for ( HttpWebAppBean httpWebApp : httpwebapps )
+            {
+                sb.append( httpWebApp.toString( tabs + "    " ) );
+            }
+        }
 
         return sb.toString();
     }

Added: directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java?rev=1026965&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
(added)
+++ directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
Mon Oct 25 08:10:42 2010
@@ -0,0 +1,117 @@
+/*
+ *   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.ConfigBean;
+import org.apache.directory.server.config.beans.HttpServerBean;
+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 HttpServerConfigReaderTest
+{
+    private static SchemaManager schemaManager;
+
+    private static File workDir = new File( System.getProperty( "java.io.tmpdir" ) + "/server-work"
);
+
+
+    @BeforeClass
+    public static void readConfig() throws Exception
+    {
+        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 testHttpServer() throws Exception
+    {
+        File configDir = new File( workDir, "httpServer" ); // could be any directory, cause
the config is now in a single file
+        String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "httpServer.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_HTTP_SERVER_OC.getValue() );
+
+        assertNotNull( configBean );
+        HttpServerBean httpServerBean = (HttpServerBean)configBean.getDirectoryServiceBeans().get(
0 );
+        assertNotNull( httpServerBean );
+    }
+}

Added: directory/apacheds/branches/apacheds-config/server-config/src/test/resources/httpServer.ldif
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/test/resources/httpServer.ldif?rev=1026965&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/test/resources/httpServer.ldif
(added)
+++ directory/apacheds/branches/apacheds-config/server-config/src/test/resources/httpServer.ldif
Mon Oct 25 08:10:42 2010
@@ -0,0 +1,83 @@
+version: 1
+dn: ou=config
+ou: config
+objectclass: top
+objectclass: organizationalUnit
+
+dn: ads-directoryServiceId=default,ou=config
+objectclass: top
+objectclass: ads-base
+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=httpServer,ou=servers,ads-directoryServiceId=default,ou=config
+objectclass: top
+objectclass: ads-base
+objectclass: ads-server
+objectclass: ads-httpServer
+ads-serverId: httpServer
+description: HTTP server
+ads-httpConfFile: test.conf
+
+dn: ou=transports,ads-serverId=httpServer,ou=servers,ads-directoryServiceId=default,ou=config
+ou: transports
+objectclass: organizationalUnit
+objectclass: top
+
+dn: ads-transportid=http-tcp,ou=transports,ads-serverId=httpServer,ou=servers,ads-directoryServiceId=default,ou=config
+objectclass: top
+objectclass: ads-base
+objectclass: ads-transport
+objectclass: ads-tcpTransport
+ads-transportid: ntp-http
+ads-systemport: 123
+ads-transportenablessl: false
+ads-transportbacklog: 50
+ads-transportnbthreads: 8
+ads-transportaddress: 0.0.0.0
+ads-enabled: true
+
+dn: ads-transportid=http-udp,ou=transports,ads-serverId=httpServer,ou=servers,ads-directoryServiceId=default,ou=config
+objectclass: top
+objectclass: ads-base
+objectclass: ads-transport
+objectclass: ads-udpTransport
+ads-transportid: ntp-http
+ads-transportaddress: localhost
+ads-systemport: 456
+ads-transportenablessl: true
+ads-enabled: true

Modified: directory/shared/branches/shared-config/ldap-schema/src/main/resources/schema/ou=schema/cn=adsconfig/ou=attributetypes/m-oid=1.3.6.1.4.1.18060.0.4.1.2.840.ldif
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap-schema/src/main/resources/schema/ou%3Dschema/cn%3Dadsconfig/ou%3Dattributetypes/m-oid%3D1.3.6.1.4.1.18060.0.4.1.2.840.ldif?rev=1026965&r1=1026964&r2=1026965&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap-schema/src/main/resources/schema/ou=schema/cn=adsconfig/ou=attributetypes/m-oid=1.3.6.1.4.1.18060.0.4.1.2.840.ldif
(original)
+++ directory/shared/branches/shared-config/ldap-schema/src/main/resources/schema/ou=schema/cn=adsconfig/ou=attributetypes/m-oid=1.3.6.1.4.1.18060.0.4.1.2.840.ldif
Mon Oct 25 08:10:42 2010
@@ -4,7 +4,7 @@ dn: m-oid=1.3.6.1.4.1.18060.0.4.1.2.840,
 objectclass: top
 objectclass: metaTop
 objectclass: metaAttributeType
-m-name: ads-webApps
+m-name: ads-httpWebApps
 m-oid: 1.3.6.1.4.1.18060.0.4.1.2.840
 m-description: The references to the web applications
 m-syntax: 1.3.6.1.4.1.1466.115.121.1.44

Modified: directory/shared/branches/shared-config/ldap-schema/src/main/resources/schema/ou=schema/cn=adsconfig/ou=objectclasses/m-oid=1.3.6.1.4.1.18060.0.4.1.3.804.ldif
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap-schema/src/main/resources/schema/ou%3Dschema/cn%3Dadsconfig/ou%3Dobjectclasses/m-oid%3D1.3.6.1.4.1.18060.0.4.1.3.804.ldif?rev=1026965&r1=1026964&r2=1026965&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap-schema/src/main/resources/schema/ou=schema/cn=adsconfig/ou=objectclasses/m-oid=1.3.6.1.4.1.18060.0.4.1.3.804.ldif
(original)
+++ directory/shared/branches/shared-config/ldap-schema/src/main/resources/schema/ou=schema/cn=adsconfig/ou=objectclasses/m-oid=1.3.6.1.4.1.18060.0.4.1.3.804.ldif
Mon Oct 25 08:10:42 2010
@@ -7,9 +7,9 @@ objectclass: metaObjectClass
 m-name: ads-httpServer
 m-oid: 1.3.6.1.4.1.18060.0.4.1.3.804
 m-description: integrated jetty http server
-m-supobjectclass: ads-base
+m-supobjectclass: ads-server
 createtimestamp: 20100116052129Z
 creatorsname: 0.9.2342.19200300.100.1.1=admin,2.5.4.11=system
 entrycsn: 20100116105129.573000Z#000000#000#000000
 m-may: ads-httpConfFile
-m-may: ads-webApps
+m-may: ads-httpwebApps



Mime
View raw message