directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r894527 - in /directory/apacheds/branches/apacheds-schema: server-annotations/ server-annotations/src/main/java/org/apache/directory/server/ server-annotations/src/main/java/org/apache/directory/server/annotations/ server-annotations/src/ma...
Date Wed, 30 Dec 2009 00:54:41 GMT
Author: elecharny
Date: Wed Dec 30 00:54:40 2009
New Revision: 894527

URL: http://svn.apache.org/viewvc?rev=894527&view=rev
Log:
o Added a reference to core-annotations into server-annotations
o Moved some classes into a newly created factory package
o Added a test for a standalone creation of a DS with partition

Added:
    directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/factory/
    directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/factory/DefaultLdapServerFactory.java
      - copied, changed from r894422, directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/DefaultLdapServerFactory.java
    directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/factory/LdapServerFactory.java
      - copied, changed from r894422, directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/LdapServerFactory.java
    directory/apacheds/branches/apacheds-schema/server-annotations/src/test/
    directory/apacheds/branches/apacheds-schema/server-annotations/src/test/java/
    directory/apacheds/branches/apacheds-schema/server-annotations/src/test/java/org/
    directory/apacheds/branches/apacheds-schema/server-annotations/src/test/java/org/apache/
    directory/apacheds/branches/apacheds-schema/server-annotations/src/test/java/org/apache/directory/
    directory/apacheds/branches/apacheds-schema/server-annotations/src/test/java/org/apache/directory/server/
    directory/apacheds/branches/apacheds-schema/server-annotations/src/test/java/org/apache/directory/server/factory/
    directory/apacheds/branches/apacheds-schema/server-annotations/src/test/java/org/apache/directory/server/factory/DirectoryServiceAnnotationTest.java
    directory/apacheds/branches/apacheds-schema/server-annotations/src/test/resources/
    directory/apacheds/branches/apacheds-schema/server-annotations/src/test/resources/log4j.properties
Removed:
    directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/DefaultLdapServerFactory.java
    directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/LdapServerFactory.java
Modified:
    directory/apacheds/branches/apacheds-schema/server-annotations/pom.xml
    directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/annotations/CreateLdapServer.java
    directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java

Modified: directory/apacheds/branches/apacheds-schema/server-annotations/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/server-annotations/pom.xml?rev=894527&r1=894526&r2=894527&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/server-annotations/pom.xml (original)
+++ directory/apacheds/branches/apacheds-schema/server-annotations/pom.xml Wed Dec 30 00:54:40
2009
@@ -43,6 +43,12 @@
 
     <dependency>
       <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-core-annotations</artifactId>
+      <version>${pom.version}</version>
+    </dependency>  
+
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
       <artifactId>apacheds-ldif-partition</artifactId>
       <version>${pom.version}</version>
     </dependency>  

Modified: directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/annotations/CreateLdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/annotations/CreateLdapServer.java?rev=894527&r1=894526&r2=894527&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/annotations/CreateLdapServer.java
(original)
+++ directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/annotations/CreateLdapServer.java
Wed Dec 30 00:54:40 2009
@@ -26,7 +26,7 @@
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
-import org.apache.directory.server.DefaultLdapServerFactory;
+import org.apache.directory.server.factory.DefaultLdapServerFactory;
 
 
 /**

Copied: directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/factory/DefaultLdapServerFactory.java
(from r894422, directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/DefaultLdapServerFactory.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/factory/DefaultLdapServerFactory.java?p2=directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/factory/DefaultLdapServerFactory.java&p1=directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/DefaultLdapServerFactory.java&r1=894422&r2=894527&rev=894527&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/DefaultLdapServerFactory.java
(original)
+++ directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/factory/DefaultLdapServerFactory.java
Wed Dec 30 00:54:40 2009
@@ -17,7 +17,7 @@
  *  under the License.
  *
  */
-package org.apache.directory.server;
+package org.apache.directory.server.factory;
 
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.partition.Partition;

Copied: directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/factory/LdapServerFactory.java
(from r894422, directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/LdapServerFactory.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/factory/LdapServerFactory.java?p2=directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/factory/LdapServerFactory.java&p1=directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/LdapServerFactory.java&r1=894422&r2=894527&rev=894527&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/LdapServerFactory.java
(original)
+++ directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/factory/LdapServerFactory.java
Wed Dec 30 00:54:40 2009
@@ -17,7 +17,7 @@
  *  under the License.
  *
  */
-package org.apache.directory.server;
+package org.apache.directory.server.factory;
 
 import org.apache.directory.server.ldap.LdapServer;
 

Added: directory/apacheds/branches/apacheds-schema/server-annotations/src/test/java/org/apache/directory/server/factory/DirectoryServiceAnnotationTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/server-annotations/src/test/java/org/apache/directory/server/factory/DirectoryServiceAnnotationTest.java?rev=894527&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-schema/server-annotations/src/test/java/org/apache/directory/server/factory/DirectoryServiceAnnotationTest.java
(added)
+++ directory/apacheds/branches/apacheds-schema/server-annotations/src/test/java/org/apache/directory/server/factory/DirectoryServiceAnnotationTest.java
Wed Dec 30 00:54:40 2009
@@ -0,0 +1,133 @@
+/*
+ *   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.factory;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.annotations.ContextEntry;
+import org.apache.directory.server.core.annotations.CreateDS;
+import org.apache.directory.server.core.annotations.CreateIndex;
+import org.apache.directory.server.core.annotations.CreatePartition;
+import org.apache.directory.server.core.factory.DSAnnotationProcessor;
+import org.apache.directory.server.core.partition.Partition;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.junit.Test;
+
+
+/**
+ * Test the creation of a DS using a factory.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+@CreateDS( name = "classDS" )
+public class DirectoryServiceAnnotationTest
+{
+    @Test
+    public void testCreateDS() throws Exception
+    {
+        DirectoryService service = DSAnnotationProcessor.getDirectoryService();
+        
+        assertTrue( service.isStarted() );
+        assertEquals( "classDS", service.getInstanceId() );
+        
+        service.shutdown();
+        FileUtils.deleteDirectory( service.getWorkingDirectory() );
+    }
+
+
+    @Test
+    @CreateDS( name = "methodDS" )
+    public void testCreateMethodDS() throws Exception
+    {
+        DirectoryService service = DSAnnotationProcessor.getDirectoryService();
+        
+        assertTrue( service.isStarted() );
+        assertEquals( "methodDS", service.getInstanceId() );
+        
+        service.shutdown();
+        FileUtils.deleteDirectory( service.getWorkingDirectory() );
+    }
+    
+    
+    @Test
+    @CreateDS( 
+        name = "MethodDSWithPartition",
+        partitions =
+        {
+            @CreatePartition(
+                name = "example",
+                suffix = "dc=example,dc=com",
+                contextEntry = @ContextEntry( 
+                    entryLdif =
+                        "dn: dc=example,dc=com\n" +
+                        "dc: example\n" +
+                        "objectClass: top\n" +
+                        "objectClass: domain\n\n" ),
+                indexes = 
+                {
+                    @CreateIndex( attribute = "objectClass" ),
+                    @CreateIndex( attribute = "dc" ),
+                    @CreateIndex( attribute = "ou" ),
+                } )
+        } )
+    public void testCreateMethodDSWithPartition() throws Exception
+    {
+        DirectoryService service = DSAnnotationProcessor.getDirectoryService();
+        
+        assertTrue( service.isStarted() );
+        assertEquals( "MethodDSWithPartition", service.getInstanceId() );
+        
+        Set<String> expectedNames = new HashSet<String>();
+        
+        expectedNames.add( "example" );
+        expectedNames.add( "schema" );
+        
+        assertEquals( 2, service.getPartitions().size() );
+        
+        for ( Partition partition : service.getPartitions() )
+        {
+            assertTrue( expectedNames.contains( partition.getId() ) );
+            
+            if ( "example".equalsIgnoreCase( partition.getId() ) )
+            {
+                assertTrue( partition.isInitialized() );
+                assertEquals( "dc=example,dc=com", partition.getSuffixDn().getUpName() );
+            }
+            else if ( "schema".equalsIgnoreCase( partition.getId() ) )
+            {
+                assertTrue( partition.isInitialized() );
+                assertEquals( "ou=schema", partition.getSuffixDn().getUpName() );
+            }
+        }
+        
+        assertTrue( service.getAdminSession().exists( new LdapDN( "dc=example,dc=com" ) )
);
+
+        service.shutdown();
+        FileUtils.deleteDirectory( service.getWorkingDirectory() );
+    }
+}

Added: directory/apacheds/branches/apacheds-schema/server-annotations/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/server-annotations/src/test/resources/log4j.properties?rev=894527&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-schema/server-annotations/src/test/resources/log4j.properties
(added)
+++ directory/apacheds/branches/apacheds-schema/server-annotations/src/test/resources/log4j.properties
Wed Dec 30 00:54:40 2009
@@ -0,0 +1,22 @@
+#############################################################################
+#    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.
+#############################################################################
+log4j.rootCategory=OFF, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
+

Modified: directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java?rev=894527&r1=894526&r2=894527&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
(original)
+++ directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
Wed Dec 30 00:54:40 2009
@@ -23,12 +23,12 @@
 import java.util.UUID;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.directory.server.DefaultLdapServerFactory;
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.factory.DSAnnotationProcessor;
 import org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory;
 import org.apache.directory.server.core.factory.DirectoryServiceFactory;
+import org.apache.directory.server.factory.DefaultLdapServerFactory;
 import org.junit.Ignore;
 import org.junit.runner.Description;
 import org.junit.runner.notification.RunNotifier;



Mime
View raw message