Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 61922 invoked from network); 30 Dec 2009 00:55:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 30 Dec 2009 00:55:05 -0000 Received: (qmail 9026 invoked by uid 500); 30 Dec 2009 00:55:05 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 8969 invoked by uid 500); 30 Dec 2009 00:55:05 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 8960 invoked by uid 99); 30 Dec 2009 00:55:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Dec 2009 00:55:05 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Dec 2009 00:55:03 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 67EC723889B8; Wed, 30 Dec 2009 00:54:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091230005441.67EC723889B8@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 @@ org.apache.directory.server + apacheds-core-annotations + ${pom.version} + + + + org.apache.directory.server apacheds-ldif-partition ${pom.version} 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 Apache Directory Project + * @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 expectedNames = new HashSet(); + + 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;