You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2011/10/09 19:03:58 UTC
svn commit: r1180652 [4/6] - in
/directory/apacheds/branches/one-sub-level-index-removal: ./ all/
benchmarks/ core-annotations/
core-annotations/src/main/java/org/apache/directory/server/core/factory/
core-api/ core-api/src/main/java/org/apache/directo...
Modified: directory/apacheds/branches/one-sub-level-index-removal/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java Sun Oct 9 17:03:52 2011
@@ -506,7 +506,10 @@ public class LdifPartition extends Abstr
if ( !dir.exists() && create )
{
// We have to create the entry if it does not have a parent
- dir.mkdir();
+ if ( !dir.mkdir() )
+ {
+ throw new LdapException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, dir ) );
+ }
}
File ldifFile = new File( parentDir + rdnFileName );
Modified: directory/apacheds/branches/one-sub-level-index-removal/ldif-partition/src/main/resources/ads-2.ldif
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/ldif-partition/src/main/resources/ads-2.ldif?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/ldif-partition/src/main/resources/ads-2.ldif (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/ldif-partition/src/main/resources/ads-2.ldif Sun Oct 9 17:03:52 2011
@@ -1,3 +1,26 @@
+#
+# 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.
+#
+# EXAMPLE.COM is reserved for testing according to this RFC:
+#
+# http://www.rfc-editor.org/rfc/rfc2606.txt
+#
+
# Generated by Apache Directory Studio on 31 July, 2009 12:23:12 AM
# SCHEMA "ADS-2"
Modified: directory/apacheds/branches/one-sub-level-index-removal/ldif-partition/src/main/resources/sample-config.ldif
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/ldif-partition/src/main/resources/sample-config.ldif?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/ldif-partition/src/main/resources/sample-config.ldif (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/ldif-partition/src/main/resources/sample-config.ldif Sun Oct 9 17:03:52 2011
@@ -1,3 +1,26 @@
+#
+# 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.
+#
+# EXAMPLE.COM is reserved for testing according to this RFC:
+#
+# http://www.rfc-editor.org/rfc/rfc2606.txt
+#
+
dn: ou=config
objectClass: organizationalUnit
objectClass: extensibleObject
Modified: directory/apacheds/branches/one-sub-level-index-removal/osgi/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/osgi/pom.xml?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/osgi/pom.xml (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/osgi/pom.xml Sun Oct 9 17:03:52 2011
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-parent</artifactId>
- <version>1.5.8-SNAPSHOT</version>
+ <version>2.0.0-M3-SNAPSHOT</version>
</parent>
<artifactId>apacheds-osgi</artifactId>
<name>ApacheDS OSGi Bundle</name>
Modified: directory/apacheds/branches/one-sub-level-index-removal/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/pom.xml?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/pom.xml (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/pom.xml Sun Oct 9 17:03:52 2011
@@ -24,12 +24,13 @@
<parent>
<groupId>org.apache.directory.project</groupId>
<artifactId>project</artifactId>
- <version>22</version>
+ <version>24</version>
+ <relativePath></relativePath>
</parent>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-parent</artifactId>
- <version>2.0.0-M3-SNAPSHOT</version>
+ <version>2.0.0-M4-SNAPSHOT</version>
<packaging>pom</packaging>
<name>ApacheDS</name>
@@ -44,7 +45,7 @@
<distMgmtSiteUrl>scpexe://people.apache.org/www/directory.apache.org/apacheds/gen-docs/${project.version}/</distMgmtSiteUrl>
<!-- Set versions for depending projects -->
- <org.apache.directory.shared.version>1.0.0-M8-SNAPSHOT</org.apache.directory.shared.version>
+ <org.apache.directory.shared.version>1.0.0-M9-SNAPSHOT</org.apache.directory.shared.version>
<org.apache.directory.checkstyle-configuration.version>0.1</org.apache.directory.checkstyle-configuration.version>
<org.apache.directory.junit.junit-addons.version>0.1</org.apache.directory.junit.junit-addons.version>
<skin.version>1.0.2</skin.version>
@@ -63,24 +64,24 @@
<commons.pool.version>1.5.6</commons.pool.version>
<derby.version>10.8.1.2</derby.version>
<dnsjava.version>2.1.1</dnsjava.version>
- <ehcache.version>2.4.3</ehcache.version>
+ <ehcache.version>2.4.4</ehcache.version>
<jetty.version>6.1.14</jetty.version>
<jug.asl.version>2.0.0.RC1</jug.asl.version>
- <junit.version>4.8.2</junit.version>
+ <junit.version>4.9</junit.version>
<ldapsdk.version>4.1</ldapsdk.version>
<log4j.version>1.2.16</log4j.version>
- <maven.archiver.version>2.4.1</maven.archiver.version>
+ <maven.archiver.version>2.4.2</maven.archiver.version>
<maven.artifact.version>3.0.3</maven.artifact.version>
<maven.plugin.api.version>3.0.3</maven.plugin.api.version>
<maven.project.version>3.0-alpha-2</maven.project.version>
<mina.core.version>2.0.4</mina.core.version>
<plexus.utils.version>3.0</plexus.utils.version>
<quartz.version>1.6.3</quartz.version>
- <slf4j.api.version>1.6.1</slf4j.api.version>
- <slf4j.log4j12.version>1.6.1</slf4j.log4j12.version>
+ <slf4j.api.version>1.6.2</slf4j.api.version>
+ <slf4j.log4j12.version>1.6.2</slf4j.log4j12.version>
<velocity.version>1.7-beta1</velocity.version>
<wrapper.version>3.2.3</wrapper.version>
- <xercesImpl.version>2.9.1</xercesImpl.version>
+ <xercesImpl.version>2.10.0</xercesImpl.version>
<findbugs.annotations.version>1.0.0</findbugs.annotations.version>
</properties>
@@ -143,17 +144,9 @@
<module>hbase-partition</module>
<module>hbase-partition-test</module>
-->
+ <module>installers-maven-plugin</module>
+ <module>installers</module>
</modules>
-
- <profiles>
- <profile>
- <id>installers</id>
- <modules>
- <module>installers-maven-plugin</module>
- <module>installers</module>
- </modules>
- </profile>
- </profiles>
<build>
<pluginManagement>
@@ -170,6 +163,11 @@
</configuration>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.0</version>
+ </plugin>
+ <plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<configuration>
@@ -231,7 +229,7 @@
</goals>
</pluginExecutionFilter>
<action>
- <ignore></ignore>
+ <ignore />
</action>
</pluginExecution>
</pluginExecutions>
@@ -256,6 +254,14 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-descriptor</id>
+ <goals>
+ <goal>attach-descriptor</goal>
+ </goals>
+ </execution>
+ </executions>
<configuration>
<reportPlugins>
<plugin>
Propchange: directory/apacheds/branches/one-sub-level-index-removal/protocol-changepw/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 9 17:03:52 2011
@@ -3,5 +3,5 @@
/directory/apacheds/branches/apacheds-dnfactory-experiment/protocol-changepw:980138-980936
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-changepw:1040956-1043765
/directory/apacheds/branches/milestones/protocol-changepw:1072812-1075328
-/directory/apacheds/trunk/protocol-changepw:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/protocol-changepw:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
/directory/studio/trunk/protocol-changepw:1067786-1067997
Modified: directory/apacheds/branches/one-sub-level-index-removal/protocol-changepw/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/protocol-changepw/pom.xml?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/protocol-changepw/pom.xml (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/protocol-changepw/pom.xml Sun Oct 9 17:03:52 2011
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-parent</artifactId>
- <version>1.5.8-SNAPSHOT</version>
+ <version>2.0.0-M3-SNAPSHOT</version>
</parent>
<artifactId>apacheds-protocol-changepw</artifactId>
Propchange: directory/apacheds/branches/one-sub-level-index-removal/protocol-dhcp/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 9 17:03:52 2011
@@ -3,5 +3,5 @@
/directory/apacheds/branches/apacheds-dnfactory-experiment/protocol-dhcp:980138-980936
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-dhcp:1040956-1043765
/directory/apacheds/branches/milestones/protocol-dhcp:1072812-1075328
-/directory/apacheds/trunk/protocol-dhcp:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/protocol-dhcp:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
/directory/studio/trunk/protocol-dhcp:1067786-1067997
Modified: directory/apacheds/branches/one-sub-level-index-removal/protocol-dhcp/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/protocol-dhcp/pom.xml?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/protocol-dhcp/pom.xml (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/protocol-dhcp/pom.xml Sun Oct 9 17:03:52 2011
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-parent</artifactId>
- <version>2.0.0-M3-SNAPSHOT</version>
+ <version>2.0.0-M4-SNAPSHOT</version>
</parent>
<artifactId>apacheds-protocol-dhcp</artifactId>
Propchange: directory/apacheds/branches/one-sub-level-index-removal/protocol-dns/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 9 17:03:52 2011
@@ -3,5 +3,5 @@
/directory/apacheds/branches/apacheds-dnfactory-experiment/protocol-dns:980138-980936
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-dns:1040956-1043765
/directory/apacheds/branches/milestones/protocol-dns:1072812-1075328
-/directory/apacheds/trunk/protocol-dns:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/protocol-dns:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
/directory/studio/trunk/protocol-dns:1067786-1067997
Modified: directory/apacheds/branches/one-sub-level-index-removal/protocol-dns/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/protocol-dns/pom.xml?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/protocol-dns/pom.xml (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/protocol-dns/pom.xml Sun Oct 9 17:03:52 2011
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-parent</artifactId>
- <version>2.0.0-M3-SNAPSHOT</version>
+ <version>2.0.0-M4-SNAPSHOT</version>
</parent>
<artifactId>apacheds-protocol-dns</artifactId>
Propchange: directory/apacheds/branches/one-sub-level-index-removal/protocol-kerberos/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 9 17:03:52 2011
@@ -3,5 +3,5 @@
/directory/apacheds/branches/apacheds-dnfactory-experiment/protocol-kerberos:980138-980936
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-kerberos:1040956-1043765
/directory/apacheds/branches/milestones/protocol-kerberos:1072812-1075328
-/directory/apacheds/trunk/protocol-kerberos:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/protocol-kerberos:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
/directory/studio/trunk/protocol-kerberos:1067786-1067997
Modified: directory/apacheds/branches/one-sub-level-index-removal/protocol-kerberos/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/protocol-kerberos/pom.xml?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/protocol-kerberos/pom.xml (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/protocol-kerberos/pom.xml Sun Oct 9 17:03:52 2011
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-parent</artifactId>
- <version>2.0.0-M3-SNAPSHOT</version>
+ <version>2.0.0-M4-SNAPSHOT</version>
</parent>
<artifactId>apacheds-protocol-kerberos</artifactId>
Modified: directory/apacheds/branches/one-sub-level-index-removal/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationContext.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationContext.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationContext.java Sun Oct 9 17:03:52 2011
@@ -21,7 +21,6 @@ package org.apache.directory.server.kerb
import org.apache.directory.server.kerberos.kdc.KdcContext;
-import org.apache.directory.server.kerberos.shared.replay.ReplayCache;
import org.apache.directory.server.kerberos.shared.store.PrincipalStoreEntry;
import org.apache.directory.shared.kerberos.components.EncryptionKey;
import org.apache.directory.shared.kerberos.messages.Ticket;
@@ -38,7 +37,6 @@ public class AuthenticationContext exten
private Ticket ticket;
private EncryptionKey clientKey;
- private ReplayCache replayCache;
private PrincipalStoreEntry clientEntry;
private PrincipalStoreEntry serverEntry;
Propchange: directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 9 17:03:52 2011
@@ -5,5 +5,5 @@
/directory/apacheds/branches/apacheds-jdbm/protocol-ldap:1160768-1164080
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-ldap:1040956-1043765
/directory/apacheds/branches/milestones/protocol-ldap:1072812-1075328
-/directory/apacheds/trunk/protocol-ldap:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/protocol-ldap:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
/directory/studio/trunk/protocol-ldap:1067786-1067997
Modified: directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/pom.xml?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/pom.xml (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/pom.xml Sun Oct 9 17:03:52 2011
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-parent</artifactId>
- <version>2.0.0-M3-SNAPSHOT</version>
+ <version>2.0.0-M4-SNAPSHOT</version>
</parent>
<artifactId>apacheds-protocol-ldap</artifactId>
Modified: directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java Sun Oct 9 17:03:52 2011
@@ -20,9 +20,14 @@
package org.apache.directory.server.ldap;
+import org.apache.commons.lang.StringUtils;
import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.shared.ldap.model.csn.Csn;
import org.apache.directory.shared.ldap.model.message.Request;
import org.apache.directory.shared.ldap.model.message.Response;
+import org.apache.directory.shared.util.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Utility methods used by the LDAP protocol service.
@@ -31,6 +36,21 @@ import org.apache.directory.shared.ldap.
*/
public class LdapProtocolUtils
{
+ /** A delimiter for the replicaId */
+ public static final String COOKIE_DELIM = ",";
+
+ /** the prefix for replicaId value */
+ public static final String REPLICA_ID_PREFIX = "rid=";
+
+ private static final int REPLICA_ID_PREFIX_LEN = REPLICA_ID_PREFIX.length();
+
+ /** the prefix for Csn value */
+ public static final String CSN_PREFIX = "csn=";
+
+ private static final int CSN_PREFIX_LEN = CSN_PREFIX.length();
+
+ private static final Logger LOG = LoggerFactory.getLogger( LdapProtocolUtils.class );
+
/**
* Extracts request controls from a request to populate into an
* OperationContext.
@@ -58,4 +78,83 @@ public class LdapProtocolUtils
{
opContext.addRequestControls( opContext.getResponseControls() );
}
+
+
+ public static byte[] createCookie( int replicaId, String csn )
+ {
+ // the syncrepl cookie format (compatible with OpenLDAP)
+ // rid=nn,csn=xxxz
+ String replicaIdStr = StringUtils.leftPad( Integer.toString( replicaId ), 3, '0' );
+ return Strings.getBytesUtf8( REPLICA_ID_PREFIX + replicaIdStr + COOKIE_DELIM + CSN_PREFIX + csn );
+ }
+
+
+ /**
+ * Check the cookie syntax. A cookie must have the following syntax :
+ * { rid={replicaId},csn={CSN} }
+ */
+ public static boolean isValidCookie( String cookieString )
+ {
+ if ( ( cookieString == null ) || ( cookieString.trim().length() == 0 ) )
+ {
+ return false;
+ }
+
+ int pos = cookieString.indexOf( COOKIE_DELIM );
+
+ // position should start from REPLICA_ID_PREFIX_LEN or higher cause a cookie can be
+ // like "rid=0,csn={csn}" or "rid=11,csn={csn}"
+ if ( pos <= REPLICA_ID_PREFIX_LEN )
+ {
+ return false;
+ }
+
+ String replicaId = cookieString.substring( REPLICA_ID_PREFIX_LEN, pos );
+
+ try
+ {
+ Integer.parseInt( replicaId );
+ }
+ catch ( NumberFormatException e )
+ {
+ LOG.debug( "Failed to parse the replica id {}", replicaId );
+ return false;
+ }
+
+ if ( pos == cookieString.length() )
+ {
+ return false;
+ }
+
+ String csnString = cookieString.substring( pos + 1 + CSN_PREFIX_LEN );
+
+ return Csn.isValid( csnString );
+ }
+
+
+ /**
+ * returns the CSN present in cookie
+ *
+ * @param cookieString the cookie
+ * @return
+ */
+ public static String getCsn( String cookieString )
+ {
+ int pos = cookieString.indexOf( COOKIE_DELIM );
+ return cookieString.substring( pos + 1 + CSN_PREFIX_LEN );
+ }
+
+
+ /**
+ * returns the replica id present in cookie
+ *
+ * @param cookieString the cookie
+ * @return
+ */
+ public static int getReplicaId( String cookieString )
+ {
+ String replicaId = cookieString.substring( REPLICA_ID_PREFIX_LEN, cookieString.indexOf( COOKIE_DELIM ) );
+
+ return Integer.parseInt( replicaId );
+ }
}
Modified: directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java Sun Oct 9 17:03:52 2011
@@ -306,7 +306,7 @@ public class LdapServer extends Director
}
}
- private class AdsKeyStore extends KeyStore
+ private static class AdsKeyStore extends KeyStore
{
public AdsKeyStore( KeyStoreSpi keyStoreSpi, Provider provider, String type )
{
Modified: directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.java Sun Oct 9 17:03:52 2011
@@ -106,7 +106,7 @@ public class StartTlsHandler implements
session.getIoSession().write( res );
}
- class ServerX509TrustManager implements X509TrustManager
+ static class ServerX509TrustManager implements X509TrustManager
{
public void checkClientTrusted( X509Certificate[] chain, String authType ) throws CertificateException
{
Modified: directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessageSerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessageSerializer.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessageSerializer.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessageSerializer.java Sun Oct 9 17:03:52 2011
@@ -23,6 +23,7 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import jdbm.helper.Serializer;
@@ -82,7 +83,7 @@ public class ReplicaEventMessageSerializ
ChangeType changeType = replicaEventMessage.getChangeType();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream( baos );
+ ObjectOutput out = new ObjectOutputStream( baos );
// The entry DN
entry.getDn().writeExternal( out );
@@ -126,10 +127,12 @@ public class ReplicaEventMessageSerializ
// The Entry's length
int length = in.readInt();
+
byte[] data = new byte[length];
// The entry itself
- in.read( data );
+ in.readFully( data );
+
Entry entry = ( Entry ) entrySerializer.deserialize( data );
entry.setDn( entryDn );
Modified: directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java Sun Oct 9 17:03:52 2011
@@ -23,6 +23,7 @@ package org.apache.directory.server.ldap
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -38,6 +39,7 @@ import org.apache.directory.ldap.client.
import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.filtering.EntryFilteringCursor;
+import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.ldap.replication.ReplicationConsumerConfig;
import org.apache.directory.server.ldap.replication.SyncreplConfiguration;
import org.apache.directory.shared.ldap.codec.controls.manageDsaIT.ManageDsaITDecorator;
@@ -175,7 +177,10 @@ public class ReplicationConsumerImpl imp
if ( config.isStoreCookieInFile() )
{
File cookieDir = new File( directoryservice.getInstanceLayout().getRunDirectory(), "cookies" );
- cookieDir.mkdir();
+ if ( !cookieDir.mkdir() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, cookieDir ) );
+ }
cookieFile = new File( cookieDir, String.valueOf( config.getReplicaId() ) );
}
@@ -527,7 +532,19 @@ public class ReplicationConsumerImpl imp
*/
public void start()
{
- connect();
+ while ( ! connect() )
+ {
+ try
+ {
+ // try to establish a connection for every 5 seconds
+ Thread.sleep( 5000 );
+ }
+ catch( InterruptedException e )
+ {
+ LOG.warn( "Interrupted while trying to reconnect to the provider {} with user DN", config.getRemoteHost(), config.getReplUserDn() );
+ }
+ }
+
startSync();
}
Propchange: directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 9 17:03:52 2011
@@ -10,4 +10,5 @@
/directory/apacheds/branches/milestones/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java:1072812-1075328
/directory/apacheds/branches/xdbm-refactoring/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java:945827-946347
/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java:498338-580500,1066126-1067785,1068026-1072718,1072800-1075329
+/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java:1163979-1180637
/directory/studio/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java:1067786-1067997
Modified: directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java Sun Oct 9 17:03:52 2011
@@ -26,6 +26,7 @@ import static org.apache.directory.serve
import static org.apache.directory.server.ldap.LdapServer.NO_TIME_LIMIT;
import java.io.File;
+import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.HashMap;
import java.util.List;
@@ -38,6 +39,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.event.NotificationCriteria;
import org.apache.directory.server.core.filtering.EntryFilteringCursor;
import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.server.ldap.LdapProtocolUtils;
import org.apache.directory.server.ldap.LdapServer;
import org.apache.directory.server.ldap.LdapSession;
import org.apache.directory.server.ldap.handlers.SearchAbandonListener;
@@ -54,7 +56,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.extras.controls.syncrepl_impl.SyncInfoValueDecorator;
import org.apache.directory.shared.ldap.extras.controls.syncrepl_impl.SyncStateValueDecorator;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.model.csn.Csn;
import org.apache.directory.shared.ldap.model.entry.Attribute;
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.entry.StringValue;
@@ -104,9 +105,6 @@ public class SyncReplRequestHandler impl
/** A logger for the replication provider */
private static final Logger PROVIDER_LOG = LoggerFactory.getLogger( "PROVIDER_LOG" );
- /** A delimiter for the replicaId */
- public static final String REPLICA_ID_DELIM = ";";
-
/** Tells if the replication handler is already started */
private boolean initialized = false;
@@ -164,7 +162,10 @@ public class SyncReplRequestHandler impl
if ( !syncReplData.exists() )
{
- syncReplData.mkdirs();
+ if ( !syncReplData.mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, syncReplData ) );
+ }
}
replicaUtil = new ReplConsumerManager( dirService );
@@ -245,7 +246,7 @@ public class SyncReplRequestHandler impl
PROVIDER_LOG.debug( "Received a replication request {} with a cookie '{}'", request, cookieString );
LOG.debug( "search request received with the cookie {}", cookieString );
- if ( !isValidCookie( cookieString ) )
+ if ( !LdapProtocolUtils.isValidCookie( cookieString ) )
{
LOG.error( "received a invalid cookie {} from the consumer with session {}", cookieString, session );
PROVIDER_LOG.debug( "received a invalid cookie {} from the consumer with session {}", cookieString, session );
@@ -265,7 +266,7 @@ public class SyncReplRequestHandler impl
}
else
{
- String consumerCsn = getCsn( cookieString );
+ String consumerCsn = LdapProtocolUtils.getCsn( cookieString );
doContentUpdate( session, request, clientMsgLog, consumerCsn );
}
}
@@ -362,7 +363,7 @@ public class SyncReplRequestHandler impl
String lastSentCsn = sendContentFromLog( session, req, replicaLog, consumerCsn );
PROVIDER_LOG.debug( "The latest entry sent to the consumer {} has this CSN : {}", replicaLog.getId(), lastSentCsn );
- byte[] cookie = Strings.getBytesUtf8(replicaLog.getId() + REPLICA_ID_DELIM + lastSentCsn);
+ byte[] cookie = LdapProtocolUtils.createCookie( replicaLog.getId(), lastSentCsn );
if ( refreshNPersist )
{
@@ -462,12 +463,12 @@ public class SyncReplRequestHandler impl
if ( searchDoneResp.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
{
replicaLog.setLastSentCsn( contextCsn );
- byte[] cookie = Strings.getBytesUtf8( replicaLog.getId() + REPLICA_ID_DELIM + contextCsn );
+ byte[] cookie = LdapProtocolUtils.createCookie( replicaLog.getId(), contextCsn );
if ( refreshNPersist ) // refreshAndPersist mode
{
contextCsn = sendContentFromLog( session, request, replicaLog, contextCsn );
- cookie = Strings.getBytesUtf8(replicaLog.getId() + REPLICA_ID_DELIM + contextCsn);
+ cookie = LdapProtocolUtils.createCookie(replicaLog.getId(), contextCsn);
IntermediateResponse intermResp = new IntermediateResponseImpl( request.getMessageId() );
intermResp.setResponseName( SyncInfoValue.OID );
@@ -976,83 +977,15 @@ public class SyncReplRequestHandler impl
/**
- * Check the cookie syntax. A cookie must have the following syntax :
- * <replicaId> [ ';' [ <CSN> ] ]
- */
- private boolean isValidCookie( String cookieString )
- {
- if ( ( cookieString == null ) || ( cookieString.trim().length() == 0 ) )
- {
- return false;
- }
-
- int pos = cookieString.indexOf( REPLICA_ID_DELIM );
-
- // position should start from 1 or higher cause a cookie can be
- // like "0;<csn>" or "11;<csn>"
- if ( pos <= 0 )
- {
- return false;
- }
-
- String replicaId = cookieString.substring( 0, pos );
-
- try
- {
- Integer.parseInt( replicaId );
- }
- catch ( NumberFormatException e )
- {
- LOG.debug( "Failed to parse the replica id {}", replicaId );
- return false;
- }
-
- if ( pos == cookieString.length() )
- {
- return false;
- }
-
- String csnString = cookieString.substring( pos + 1 );
-
- return Csn.isValid( csnString );
- }
-
- /**
- * returns the CSN present in cookie
- *
- * @param cookieString the cookie
- * @return
- */
- private String getCsn( String cookieString )
- {
- int pos = cookieString.indexOf( REPLICA_ID_DELIM );
- return cookieString.substring( pos + 1 );
- }
-
-
- /**
- * returns the replica id present in cookie
- *
- * @param cookieString the cookie
- * @return
- */
- private int getReplicaId( String cookieString )
- {
- String replicaId = cookieString.substring( 0, cookieString.indexOf( REPLICA_ID_DELIM ) );
- return Integer.parseInt( replicaId );
- }
-
-
- /**
* Get the Replica event log from the replica ID found in the cookie
*/
private ReplicaEventLog getReplicaEventLog( String cookieString ) throws Exception
{
ReplicaEventLog replicaLog = null;
- if ( isValidCookie( cookieString ) )
+ if ( LdapProtocolUtils.isValidCookie( cookieString ) )
{
- int clientId = getReplicaId( cookieString );
+ int clientId = LdapProtocolUtils.getReplicaId( cookieString );
replicaLog = replicaLogMap.get( clientId );
}
Modified: directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplSearchListener.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplSearchListener.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplSearchListener.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplSearchListener.java Sun Oct 9 17:03:52 2011
@@ -31,6 +31,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.server.ldap.LdapProtocolUtils;
import org.apache.directory.server.ldap.LdapSession;
import org.apache.directory.server.ldap.replication.ReplicaEventMessage;
import org.apache.directory.shared.ldap.extras.controls.SyncStateTypeEnum;
@@ -76,8 +77,6 @@ public class SyncReplSearchListener impl
/** The consumer configuration */
private final ReplicaEventLog consumerMsgLog;
- private DirectoryService directoryService;
-
/**
* Create a new instance of a consumer listener
@@ -91,10 +90,9 @@ public class SyncReplSearchListener impl
boolean pushInRealTime )
{
this.pushInRealTime = pushInRealTime;
- this.session = session;
+ setSession( session );
setSearchRequest( searchRequest );
this.consumerMsgLog = consumerMsgLog;
- directoryService = session.getLdapServer().getDirectoryService();
}
@@ -105,7 +103,6 @@ public class SyncReplSearchListener impl
public void setSession( LdapSession session )
{
this.session = session;
- directoryService = session.getLdapServer().getDirectoryService();
}
@@ -137,7 +134,7 @@ public class SyncReplSearchListener impl
if ( session != null )
{
// We first remove the Listener from the session's chain
- directoryService.getEventService().removeListener( this );
+ session.getCoreSession().getDirectoryService().getEventService().removeListener( this );
}
/*
@@ -218,7 +215,7 @@ public class SyncReplSearchListener impl
resultEntry.setEntry( entry );
// Create the control which will be added to the response.
- SyncStateValue syncAdd = createControl( directoryService, SyncStateTypeEnum.ADD, entry );
+ SyncStateValue syncAdd = createControl( session.getCoreSession().getDirectoryService(), SyncStateTypeEnum.ADD, entry );
sendResult( resultEntry, entry, EventType.ADD, syncAdd );
}
@@ -261,7 +258,7 @@ public class SyncReplSearchListener impl
resultEntry.setObjectName( entry.getDn() );
resultEntry.setEntry( entry );
- SyncStateValue syncDelete = createControl( directoryService, SyncStateTypeEnum.DELETE, entry );
+ SyncStateValue syncDelete = createControl( session.getCoreSession().getDirectoryService(), SyncStateTypeEnum.DELETE, entry );
sendResult( resultEntry, entry, EventType.DELETE, syncDelete );
}
@@ -296,7 +293,7 @@ public class SyncReplSearchListener impl
resultEntry.setObjectName( modifyContext.getDn() );
resultEntry.setEntry( alteredEntry );
- SyncStateValue syncModify = createControl( directoryService, SyncStateTypeEnum.MODIFY, alteredEntry );
+ SyncStateValue syncModify = createControl( session.getCoreSession().getDirectoryService(), SyncStateTypeEnum.MODIFY, alteredEntry );
sendResult( resultEntry, alteredEntry, EventType.MODIFY, syncModify );
}
@@ -336,7 +333,7 @@ public class SyncReplSearchListener impl
resultEntry.setObjectName( moveContext.getDn() );
resultEntry.setEntry( entry );
- SyncStateValue syncModify = createControl( directoryService, SyncStateTypeEnum.MODDN, entry );
+ SyncStateValue syncModify = createControl( session.getCoreSession().getDirectoryService(), SyncStateTypeEnum.MODDN, entry );
sendResult( resultEntry, entry, null, syncModify );
}
@@ -377,7 +374,7 @@ public class SyncReplSearchListener impl
resultEntry.setObjectName( entry.getDn() );
resultEntry.setEntry( entry );
- SyncStateValue syncModify = createControl( directoryService, SyncStateTypeEnum.MODDN, entry );
+ SyncStateValue syncModify = createControl( session.getCoreSession().getDirectoryService(), SyncStateTypeEnum.MODDN, entry );
sendResult( resultEntry, entry, null, syncModify );
}
@@ -412,7 +409,7 @@ public class SyncReplSearchListener impl
resultEntry.setObjectName( entry.getDn() );
resultEntry.setEntry( entry );
- SyncStateValue syncModify = createControl( directoryService, SyncStateTypeEnum.MODDN, entry );
+ SyncStateValue syncModify = createControl( session.getCoreSession().getDirectoryService(), SyncStateTypeEnum.MODDN, entry );
// In this case, the cookie is different
syncModify.setCookie( getCookie( entry ) );
@@ -453,7 +450,7 @@ public class SyncReplSearchListener impl
{
String csn = entry.get( SchemaConstants.ENTRY_CSN_AT ).getString();
- return Strings.getBytesUtf8( consumerMsgLog.getId() + SyncReplRequestHandler.REPLICA_ID_DELIM + csn );
+ return LdapProtocolUtils.createCookie( consumerMsgLog.getId(), csn );
}
Propchange: directory/apacheds/branches/one-sub-level-index-removal/protocol-ntp/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 9 17:03:52 2011
@@ -3,5 +3,5 @@
/directory/apacheds/branches/apacheds-dnfactory-experiment/protocol-ntp:980138-980936
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-ntp:1040956-1043765
/directory/apacheds/branches/milestones/protocol-ntp:1072812-1075328
-/directory/apacheds/trunk/protocol-ntp:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/protocol-ntp:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
/directory/studio/trunk/protocol-ntp:1067786-1067997
Modified: directory/apacheds/branches/one-sub-level-index-removal/protocol-ntp/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/protocol-ntp/pom.xml?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/protocol-ntp/pom.xml (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/protocol-ntp/pom.xml Sun Oct 9 17:03:52 2011
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-parent</artifactId>
- <version>2.0.0-M3-SNAPSHOT</version>
+ <version>2.0.0-M4-SNAPSHOT</version>
</parent>
<artifactId>apacheds-protocol-ntp</artifactId>
Propchange: directory/apacheds/branches/one-sub-level-index-removal/protocol-shared/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 9 17:03:52 2011
@@ -4,5 +4,5 @@
/directory/apacheds/branches/apacheds-jdbm/protocol-shared:1160768-1164092
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/protocol-shared:1040956-1043765
/directory/apacheds/branches/milestones/protocol-shared:1072812-1075328
-/directory/apacheds/trunk/protocol-shared:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/protocol-shared:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
/directory/studio/trunk/protocol-shared:1067786-1067997
Modified: directory/apacheds/branches/one-sub-level-index-removal/protocol-shared/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/protocol-shared/pom.xml?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/protocol-shared/pom.xml (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/protocol-shared/pom.xml Sun Oct 9 17:03:52 2011
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-parent</artifactId>
- <version>2.0.0-M3-SNAPSHOT</version>
+ <version>2.0.0-M4-SNAPSHOT</version>
</parent>
<name>ApacheDS Protocol Shared</name>
Propchange: directory/apacheds/branches/one-sub-level-index-removal/server-annotations/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 9 17:03:52 2011
@@ -4,5 +4,5 @@
/directory/apacheds/branches/apacheds-jdbm/server-annotations:1160768-1164092
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/server-annotations:1040956-1043765
/directory/apacheds/branches/milestones/server-annotations:1072812-1075328
-/directory/apacheds/trunk/server-annotations:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/server-annotations:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
/directory/studio/trunk/server-annotations:1067786-1067997
Modified: directory/apacheds/branches/one-sub-level-index-removal/server-annotations/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-annotations/pom.xml?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-annotations/pom.xml (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-annotations/pom.xml Sun Oct 9 17:03:52 2011
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-parent</artifactId>
- <version>2.0.0-M3-SNAPSHOT</version>
+ <version>2.0.0-M4-SNAPSHOT</version>
</parent>
<artifactId>apacheds-server-annotations</artifactId>
Propchange: directory/apacheds/branches/one-sub-level-index-removal/server-config/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 9 17:03:52 2011
@@ -6,5 +6,5 @@
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/server-config:1040956-1043765
/directory/apacheds/branches/milestones/server-config:1072812-1075328
/directory/apacheds/branches/server-config-annotations/server-config:1042727-1043868
-/directory/apacheds/trunk/server-config:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/server-config:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
/directory/studio/trunk/server-config:1067786-1067997
Modified: directory/apacheds/branches/one-sub-level-index-removal/server-config/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-config/pom.xml?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-config/pom.xml (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-config/pom.xml Sun Oct 9 17:03:52 2011
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-parent</artifactId>
- <version>2.0.0-M3-SNAPSHOT</version>
+ <version>2.0.0-M4-SNAPSHOT</version>
</parent>
<artifactId>apacheds-server-config</artifactId>
Propchange: directory/apacheds/branches/one-sub-level-index-removal/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 9 17:03:52 2011
@@ -10,5 +10,5 @@
/directory/apacheds/branches/milestones/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java:1072812-1075328
/directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java:1042727-1043868
/directory/apacheds/branches/xdbm-refactoring/default-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java:945827-946347
-/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
/directory/studio/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java:1067786-1067997
Modified: directory/apacheds/branches/one-sub-level-index-removal/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java Sun Oct 9 17:03:52 2011
@@ -35,6 +35,8 @@ import java.util.Map.Entry;
import java.util.Stack;
import java.util.regex.Pattern;
+import javax.management.RuntimeErrorException;
+
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.ldap.schemaextractor.impl.DefaultSchemaLdifExtractor;
import org.apache.directory.shared.ldap.schemaextractor.impl.ResourceMap;
@@ -76,7 +78,10 @@ public class LdifConfigExtractor
if ( !outputDirectory.exists() )
{
LOG.debug( "creating non existing output directory {}", outputDirectory.getAbsolutePath() );
- outputDirectory.mkdir();
+ if ( !outputDirectory.mkdir() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, outputDirectory ) );
+ }
}
File configDirectory = new File( outputDirectory, CONFIG_SUBDIR );
@@ -84,7 +89,10 @@ public class LdifConfigExtractor
if ( !configDirectory.exists() )
{
LOG.debug( "creating non existing config directory {}", configDirectory.getAbsolutePath() );
- configDirectory.mkdir();
+ if ( !configDirectory.mkdir() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, configDirectory ) );
+ }
}
else if ( !overwrite )
{
@@ -124,7 +132,10 @@ public class LdifConfigExtractor
if ( !destination.getParentFile().exists() )
{
- destination.getParentFile().mkdirs();
+ if ( !destination.getParentFile().mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, destination.getParentFile() ) );
+ }
}
if ( !source.getParentFile().exists() )
@@ -172,7 +183,10 @@ public class LdifConfigExtractor
if ( !destination.getParentFile().exists() )
{
- destination.getParentFile().mkdirs();
+ if ( !destination.getParentFile().mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, destination.getParentFile() ) );
+ }
}
FileOutputStream out = new FileOutputStream( destination );
@@ -274,7 +288,11 @@ public class LdifConfigExtractor
if ( !configDir.exists() )
{
LOG.debug( "creating non existing config directory {}", configDir.getAbsolutePath() );
- configDir.mkdir();
+ if ( !configDir.mkdir() )
+ {
+ throw new RuntimeException(
+ new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, configDir ) ) );
+ }
}
else
{
Modified: directory/apacheds/branches/one-sub-level-index-removal/server-config/src/main/java/org/apache/directory/server/config/ReadOnlyConfigurationPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-config/src/main/java/org/apache/directory/server/config/ReadOnlyConfigurationPartition.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-config/src/main/java/org/apache/directory/server/config/ReadOnlyConfigurationPartition.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-config/src/main/java/org/apache/directory/server/config/ReadOnlyConfigurationPartition.java Sun Oct 9 17:03:52 2011
@@ -67,7 +67,7 @@ public class ReadOnlyConfigurationPartit
super( schemaManager );
this.inputStream = inputStream;
id = "config";
-
+
try
{
suffixDn = new Dn( schemaManager, "ou=config" );
@@ -84,11 +84,11 @@ public class ReadOnlyConfigurationPartit
*/
protected void doInit() throws InvalidNameException, Exception
{
- if ( ! initialized )
+ if ( !initialized )
{
// Initializing the wrapped partition
super.doInit();
-
+
// Load LDIF entries
loadLdifEntries();
}
@@ -122,9 +122,8 @@ public class ReadOnlyConfigurationPartit
if ( suffixDn.equals( contextEntry.getDn() ) )
{
addMandatoryOpAt( contextEntry );
-
- AddOperationContext addContext = new AddOperationContext( null, contextEntry );
- super.add( addContext );
+
+ super.add( new AddOperationContext( null, contextEntry ) );
}
else
{
@@ -136,9 +135,8 @@ public class ReadOnlyConfigurationPartit
{
Entry entry = new DefaultEntry( schemaManager, itr.next().getEntry() );
addMandatoryOpAt( entry );
-
- AddOperationContext addContext = new AddOperationContext( null, contextEntry );
- super.add( addContext );
+
+ super.add( new AddOperationContext( null, entry ) );
}
// Closing the reader
@@ -175,7 +173,7 @@ public class ReadOnlyConfigurationPartit
*/
public void add( AddOperationContext arg0 ) throws LdapException
{
- // Not implemented (Read-Only)
+ // Does nothing (Read-Only)
}
@@ -184,7 +182,7 @@ public class ReadOnlyConfigurationPartit
*/
public void delete( Long arg0 ) throws LdapException
{
- // Not implemented (Read-Only)
+ // Does nothing (Read-Only)
}
@@ -193,7 +191,7 @@ public class ReadOnlyConfigurationPartit
*/
public void modify( ModifyOperationContext arg0 ) throws LdapException
{
- // Not implemented (Read-Only)
+ // Does nothing (Read-Only)
}
@@ -202,7 +200,7 @@ public class ReadOnlyConfigurationPartit
*/
public void move( MoveOperationContext arg0 ) throws LdapException
{
- // Not implemented (Read-Only)
+ // Does nothing (Read-Only)
}
@@ -211,7 +209,7 @@ public class ReadOnlyConfigurationPartit
*/
public void moveAndRename( MoveAndRenameOperationContext arg0 ) throws LdapException
{
- // Not implemented (Read-Only)
+ // Does nothing (Read-Only)
}
@@ -220,6 +218,6 @@ public class ReadOnlyConfigurationPartit
*/
public void rename( RenameOperationContext arg0 ) throws LdapException
{
- // Not implemented (Read-Only)
+ // Does nothing (Read-Only)
}
}
Propchange: directory/apacheds/branches/one-sub-level-index-removal/server-config/src/main/resources/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 9 17:03:52 2011
@@ -13,5 +13,5 @@
/directory/apacheds/branches/milestones/server-config/src/main/resources:1072812-1075328
/directory/apacheds/branches/server-config-annotations/server-config/src/main/resources:1042727-1043868
/directory/apacheds/branches/xdbm-refactoring/default-config/src/main/resources:945827-946347
-/directory/apacheds/trunk/server-config/src/main/resources:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/server-config/src/main/resources:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
/directory/studio/trunk/server-config/src/main/resources:1067786-1067997
Propchange: directory/apacheds/branches/one-sub-level-index-removal/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 9 17:03:52 2011
@@ -12,5 +12,5 @@
/directory/apacheds/branches/milestones/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java:1072812-1075328
/directory/apacheds/branches/server-config-annotations/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java:1042727-1043868
/directory/apacheds/branches/xdbm-refactoring/default-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java:945827-946347
-/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
/directory/studio/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java:1067786-1067997
Modified: directory/apacheds/branches/one-sub-level-index-removal/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java Sun Oct 9 17:03:52 2011
@@ -128,10 +128,12 @@ public class ConfigWriterTest
// Reading the original config file
LdifReader ldifReader = new LdifReader( configFile );
List<LdifEntry> originalConfigEntries = new ArrayList<LdifEntry>();
+
while ( ldifReader.hasNext() )
{
originalConfigEntries.add( ldifReader.next() );
}
+
ldifReader.close();
// Getting the list of entries of generated config
Propchange: directory/apacheds/branches/one-sub-level-index-removal/server-integ/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 9 17:03:52 2011
@@ -5,5 +5,5 @@
/directory/apacheds/branches/apacheds-jdbm/server-integ:1160768-1164092
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/server-integ:1040956-1043765
/directory/apacheds/branches/milestones/server-integ:1072812-1075328
-/directory/apacheds/trunk/server-integ:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1164660
+/directory/apacheds/trunk/server-integ:1066126-1067785,1068026-1072718,1072800-1075329,1158399-1180637
/directory/studio/trunk/server-integ:1067786-1067997
Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/pom.xml?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/pom.xml (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/pom.xml Sun Oct 9 17:03:52 2011
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-parent</artifactId>
- <version>2.0.0-M3-SNAPSHOT</version>
+ <version>2.0.0-M4-SNAPSHOT</version>
</parent>
<artifactId>apacheds-server-integ</artifactId>
Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java Sun Oct 9 17:03:52 2011
@@ -84,6 +84,7 @@ public class ServerIntegrationUtils exte
env.put( Context.SECURITY_PRINCIPAL, principalDn );
env.put( Context.SECURITY_CREDENTIALS, password );
env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+
return new InitialLdapContext( env, null );
}
@@ -180,7 +181,7 @@ public class ServerIntegrationUtils exte
}
- public static LDAPConnection getWiredConnection( LdapServer ldapServer ) throws Exception
+ public static LdapConnection getWiredConnection( LdapServer ldapServer ) throws Exception
{
String testServer = System.getProperty( "ldap.test.server", null );
@@ -203,26 +204,108 @@ public class ServerIntegrationUtils exte
int port = Integer.parseInt( System.getProperty( testServer + ".port", Integer.toString( DEFAULT_PORT ) ) );
LOG.debug( testServer + ".port = " + port );
+ LdapConnection conn = new LdapNetworkConnection( host, port );
+ conn.bind( admin, password );
+
+ return conn;
+ }
+
+
+ public static LDAPConnection getNsdkWiredConnection( LdapServer ldapServer ) throws Exception
+ {
+ String testServer = System.getProperty( "ldap.test.server", null );
+
+ if ( testServer == null )
+ {
+ return getNsdkWiredConnection( ldapServer, ServerDNConstants.ADMIN_SYSTEM_DN, "secret" );
+ }
+
+ LOG.debug( "ldap.test.server = " + testServer );
+
+ String admin = System.getProperty( testServer + ".admin", DEFAULT_ADMIN );
+ LOG.debug( testServer + ".admin = " + admin );
+
+ String password = System.getProperty( testServer + ".password", DEFAULT_PASSWORD );
+ LOG.debug( testServer + ".password = " + password );
+
+ String host = System.getProperty( testServer + ".host", DEFAULT_HOST );
+ LOG.debug( testServer + ".host = " + host );
+
+ int port = Integer.parseInt( System.getProperty( testServer + ".port", Integer.toString( DEFAULT_PORT ) ) );
+ LOG.debug( testServer + ".port = " + port );
+
LDAPConnection conn = new LDAPConnection();
conn.connect( 3, host, port, admin, password );
+
return conn;
}
- public static LDAPConnection getWiredConnection( LdapServer ldapServer, String principalDn, String password )
+ /**
+ * Gets a LDAP connection instance on a server, authenticating a user.
+ *
+ * @param ldapServer The server we want to connect to
+ * @param principalDn The user's DN
+ * @param password The user's password
+ * @return A LdapConnection instance if we got one
+ * @throws Exception If the connection cannot be created
+ */
+ public static LdapConnection getWiredConnection( LdapServer ldapServer, String principalDn, String password )
throws Exception
{
- LDAPConnection conn = new LDAPConnection();
- conn.connect( 3, "localhost", ldapServer.getPort(), principalDn, password );
- return conn;
+ LdapConnection connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+ connection.bind( principalDn, password );
+
+ return connection;
}
- public static LdapConnection getClientApiConnection( LdapServer ldapServer ) throws Exception
+ /**
+ * Gets a LDAP connection instance on a server. We won't bind on the server.
+ *
+ * @param ldapServer The server we want to connect to
+ * @return A LdapConnection instance if we got one
+ * @throws Exception If the connection cannot be created
+ */
+ public static LdapConnection getLdapConnection( LdapServer ldapServer ) throws Exception
{
- LdapConnection conn = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
- conn.bind( ServerDNConstants.ADMIN_SYSTEM_DN, "secret" );
- return conn;
+ LdapConnection connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+
+ return connection;
+ }
+
+
+ /**
+ * Gets a LDAP connection instance on a server, authenticating a user.
+ *
+ * @param ldapServer The server we want to connect to
+ * @param principalDn The user's DN
+ * @param password The user's password
+ * @return A LdapConnection instance if we got one
+ * @throws Exception If the connection cannot be created
+ */
+ public static LDAPConnection getNsdkWiredConnection( LdapServer ldapServer, String principalDn, String password )
+ throws Exception
+ {
+ LDAPConnection connection = new LDAPConnection();
+ connection.connect( 3, "localhost", ldapServer.getPort(), principalDn, password );
+
+ return connection;
}
+
+ /**
+ * Gets a LDAP connection instance on a server. We will bind as Admin
+ *
+ * @param ldapServer The server we want to connect to
+ * @return A LdapConnection instance if we got one
+ * @throws Exception If the connection cannot be created
+ */
+ public static LdapConnection getAdminConnection( LdapServer ldapServer ) throws Exception
+ {
+ LdapConnection connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+ connection.bind( ServerDNConstants.ADMIN_SYSTEM_DN, "secret" );
+
+ return connection;
+ }
}
Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/add/AddAliasIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/add/AddAliasIT.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/add/AddAliasIT.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/add/AddAliasIT.java Sun Oct 9 17:03:52 2011
@@ -20,7 +20,7 @@
package org.apache.directory.server.operations.add;
-import static org.apache.directory.server.integ.ServerIntegrationUtils.getClientApiConnection;
+import static org.apache.directory.server.integ.ServerIntegrationUtils.getAdminConnection;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@@ -59,7 +59,7 @@ public class AddAliasIT extends Abstract
{
try
{
- conn = getClientApiConnection( getLdapServer() );
+ conn = getAdminConnection( getLdapServer() );
conn.setTimeOut( -1L );
conn.add( new DefaultEntry(
@@ -97,7 +97,7 @@ public class AddAliasIT extends Abstract
{
try
{
- conn = getClientApiConnection( getLdapServer() );
+ conn = getAdminConnection( getLdapServer() );
conn.setTimeOut( -1L );
conn.add( new DefaultEntry(
@@ -164,7 +164,7 @@ public class AddAliasIT extends Abstract
{
try
{
- conn = getClientApiConnection( getLdapServer() );
+ conn = getAdminConnection( getLdapServer() );
conn.setTimeOut( -1L );
conn.add( new DefaultEntry(
Modified: directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java?rev=1180652&r1=1180651&r2=1180652&view=diff
==============================================================================
--- directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java (original)
+++ directory/apacheds/branches/one-sub-level-index-removal/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java Sun Oct 9 17:03:52 2011
@@ -20,7 +20,7 @@
package org.apache.directory.server.operations.add;
-import static org.apache.directory.server.integ.ServerIntegrationUtils.getClientApiConnection;
+import static org.apache.directory.server.integ.ServerIntegrationUtils.getAdminConnection;
import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredConnection;
import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContext;
import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContextThrowOnRefferal;
@@ -51,17 +51,6 @@ import javax.naming.directory.SearchResu
import javax.naming.ldap.LdapContext;
import javax.naming.ldap.LdapName;
-import netscape.ldap.LDAPAttribute;
-import netscape.ldap.LDAPAttributeSet;
-import netscape.ldap.LDAPConnection;
-import netscape.ldap.LDAPConstraints;
-import netscape.ldap.LDAPControl;
-import netscape.ldap.LDAPEntry;
-import netscape.ldap.LDAPException;
-import netscape.ldap.LDAPResponse;
-import netscape.ldap.LDAPResponseListener;
-import netscape.ldap.LDAPSearchConstraints;
-
import org.apache.directory.ldap.client.api.LdapConnection;
import org.apache.directory.ldap.client.api.LdapNetworkConnection;
import org.apache.directory.server.annotations.CreateLdapServer;
@@ -94,7 +83,13 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.exception.LdapNoSuchAttributeException;
import org.apache.directory.shared.ldap.model.exception.LdapOperationException;
import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
+import org.apache.directory.shared.ldap.model.message.AddRequest;
+import org.apache.directory.shared.ldap.model.message.AddRequestImpl;
+import org.apache.directory.shared.ldap.model.message.AddResponse;
+import org.apache.directory.shared.ldap.model.message.Control;
import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
+import org.apache.directory.shared.ldap.model.message.controls.ManageDsaITImpl;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.util.Strings;
import org.junit.Test;
@@ -289,7 +284,7 @@ public class AddIT extends AbstractLdapT
@Test
public void testAddEntryWithTwoDescriptions() throws Exception
{
- LdapConnection con = getClientApiConnection( getLdapServer() );
+ LdapConnection con = getAdminConnection( getLdapServer() );
String dn = "cn=Kate Bush," + BASE;
Entry kate = new DefaultEntry( dn );
@@ -329,7 +324,7 @@ public class AddIT extends AbstractLdapT
@Test
public void testAddEntryWithTwoDescriptionsVariant() throws Exception
{
- LdapConnection con = getClientApiConnection( getLdapServer() );
+ LdapConnection con = getAdminConnection( getLdapServer() );
String dn = "cn=Kate Bush," + BASE;
Entry kate = new DefaultEntry( dn );
@@ -369,7 +364,7 @@ public class AddIT extends AbstractLdapT
@Test
public void testAddEntryWithTwoDescriptionsSecondVariant() throws Exception
{
- LdapConnection con = getClientApiConnection( getLdapServer() );
+ LdapConnection con = getAdminConnection( getLdapServer() );
String dn = "cn=Kate Bush," + BASE;
Entry kate = new DefaultEntry( dn );
@@ -701,39 +696,26 @@ public class AddIT extends AbstractLdapT
@Test
public void testOnReferralWithManageDsaITControl() throws Exception
{
- LDAPConnection conn = getWiredConnection( getLdapServer() );
- LDAPConstraints constraints = new LDAPSearchConstraints();
- constraints.setClientControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
- constraints.setServerControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
- conn.setConstraints( constraints );
+ LdapConnection conn = getWiredConnection( getLdapServer() );
- // add success
- LDAPAttributeSet attrSet = new LDAPAttributeSet();
- attrSet.add( new LDAPAttribute( "objectClass", "organizationalUnit" ) );
- attrSet.add( new LDAPAttribute( "ou", "UnderReferral" ) );
- LDAPEntry entry = new LDAPEntry( "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system", attrSet );
+ AddRequest addRequest = new AddRequestImpl();
+ ManageDsaIT manageDSAIT = new ManageDsaITImpl();
+ manageDSAIT.setCritical( true );
+ addRequest.addControl( manageDSAIT );
- try
- {
- conn.add( entry, constraints );
- fail();
- }
- catch ( LDAPException le )
- {
- assertEquals( ResultCodeEnum.REFERRAL.getValue(), le.getLDAPResultCode() );
- }
+ // add success
+ Entry entry = new DefaultEntry( "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system",
+ "objectClass", "organizationalUnit",
+ "ou", "UnderReferral" );
+
+ addRequest.setEntry( entry );
- try
- {
- conn.read( "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system", ( LDAPSearchConstraints ) constraints );
- fail();
- }
- catch ( LDAPException le )
- {
+ AddResponse addResponse = conn.add( addRequest );
+ assertEquals( ResultCodeEnum.REFERRAL, addResponse.getLdapResult().getResultCode() );
- }
+ assertNull( conn.lookup( "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system", new Control[]{ manageDSAIT } ) );
- conn.disconnect();
+ conn.close();
}
@@ -796,28 +778,26 @@ public class AddIT extends AbstractLdapT
{
LOG.debug( "" );
- LDAPConnection conn = getWiredConnection( getLdapServer() );
- LDAPConstraints constraints = new LDAPConstraints();
- conn.setConstraints( constraints );
+ LdapConnection conn = getWiredConnection( getLdapServer() );
+
+ AddRequest addRequest = new AddRequestImpl();
// referrals failure
- LDAPAttributeSet attrSet = new LDAPAttributeSet();
- attrSet.add( new LDAPAttribute( "objectClass", "organizationalUnit" ) );
- attrSet.add( new LDAPAttribute( "ou", "UnderReferral" ) );
- LDAPEntry entry = new LDAPEntry( "ou=UnderReferral,ou=Computers,uid=akarasuluref,ou=users,ou=system", attrSet );
-
- LDAPResponseListener listener = conn.add( entry, null, constraints );
- LDAPResponse response = listener.getResponse();
- assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
-
- assertEquals( "ldap://localhost:10389/ou=UnderReferral,ou=Computers,uid=akarasulu,ou=users,ou=system", response
- .getReferrals()[0] );
- assertEquals( "ldap://foo:10389/ou=UnderReferral,ou=Computers,uid=akarasulu,ou=users,ou=system", response
- .getReferrals()[1] );
- assertEquals( "ldap://bar:10389/ou=UnderReferral,ou=Computers,uid=akarasulu,ou=users,ou=system", response
- .getReferrals()[2] );
+ Entry entry = new DefaultEntry(
+ "ou=UnderReferral,ou=Computers,uid=akarasuluref,ou=users,ou=system",
+ "objectClass", "organizationalUnit",
+ "ou", "UnderReferral" );
+ addRequest.setEntry( entry );
+
+ AddResponse addResponse = conn.add( addRequest );
- conn.disconnect();
+ assertEquals( ResultCodeEnum.REFERRAL, addResponse.getLdapResult().getResultCode() );
+
+ assertTrue( addResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://localhost:10389/ou=UnderReferral,ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
+ assertTrue( addResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://foo:10389/ou=UnderReferral,ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
+ assertTrue( addResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://bar:10389/ou=UnderReferral,ou=Computers,uid=akarasulu,ou=users,ou=system" ) );
+
+ conn.close();
}
@@ -829,31 +809,30 @@ public class AddIT extends AbstractLdapT
@Test
public void testOnReferral() throws Exception
{
- LDAPConnection conn = getWiredConnection( getLdapServer() );
- LDAPConstraints constraints = new LDAPConstraints();
- constraints.setReferrals( false );
- conn.setConstraints( constraints );
+ LdapConnection conn = getWiredConnection( getLdapServer() );
+
+ AddRequest addRequest = new AddRequestImpl();
+ ManageDsaIT manageDSAIT = new ManageDsaITImpl();
+ manageDSAIT.setCritical( true );
+ //addRequest.addControl( manageDSAIT );
// referrals failure
+ Entry entry = new DefaultEntry(
+ "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system",
+ "objectClass", "organizationalUnit",
+ "ou", "UnderReferral" );
+
+ addRequest.setEntry( entry );
+
+ AddResponse addResponse = conn.add( addRequest );
+
+ assertEquals( ResultCodeEnum.REFERRAL, addResponse.getLdapResult().getResultCode() );
- LDAPAttributeSet attrSet = new LDAPAttributeSet();
- attrSet.add( new LDAPAttribute( "objectClass", "organizationalUnit" ) );
- attrSet.add( new LDAPAttribute( "ou", "UnderReferral" ) );
- LDAPEntry entry = new LDAPEntry( "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system", attrSet );
-
- LDAPResponseListener listener = null;
- LDAPResponse response = null;
- listener = conn.add( entry, null, constraints );
- response = listener.getResponse();
-
- assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
-
- assertEquals( "ldap://localhost:10389/ou=UnderReferral,uid=akarasulu,ou=users,ou=system", response
- .getReferrals()[0] );
- assertEquals( "ldap://foo:10389/ou=UnderReferral,uid=akarasulu,ou=users,ou=system", response.getReferrals()[1] );
- assertEquals( "ldap://bar:10389/ou=UnderReferral,uid=akarasulu,ou=users,ou=system", response.getReferrals()[2] );
+ assertTrue( addResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://localhost:10389/ou=UnderReferral,uid=akarasulu,ou=users,ou=system" ) );
+ assertTrue( addResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://foo:10389/ou=UnderReferral,uid=akarasulu,ou=users,ou=system" ) );
+ assertTrue( addResponse.getLdapResult().getReferral().getLdapUrls().contains( "ldap://bar:10389/ou=UnderReferral,uid=akarasulu,ou=users,ou=system" ) );
- conn.disconnect();
+ conn.close();
}
@@ -1272,7 +1251,7 @@ public class AddIT extends AbstractLdapT
@Test
public void testAddEntryUUIDAndCSNAttributes() throws Exception
{
- LdapConnection con = getClientApiConnection( getLdapServer() );
+ LdapConnection con = getAdminConnection( getLdapServer() );
String dn = "cn=Kate Bush," + BASE;
Entry entry = new DefaultEntry( dn );
@@ -1396,7 +1375,7 @@ public class AddIT extends AbstractLdapT
@Test
public void testAddEntryNonExistingAT() throws Exception
{
- LdapConnection connection = ServerIntegrationUtils.getClientApiConnection( getLdapServer() );
+ LdapConnection connection = getAdminConnection( getLdapServer() );
Dn dn = new Dn( "cn=Kate Bush," + BASE );
@@ -1432,7 +1411,7 @@ public class AddIT extends AbstractLdapT
@Test( expected = LdapOperationException.class )
public void testAddEntryNonExistingOC() throws Exception
{
- LdapConnection connection = ServerIntegrationUtils.getClientApiConnection( getLdapServer() );
+ LdapConnection connection = getAdminConnection( getLdapServer() );
Dn dn = new Dn( "cn=Kate Bush," + BASE );
@@ -1454,7 +1433,7 @@ public class AddIT extends AbstractLdapT
@Test( expected = LdapException.class )
public void testAddEntry100KData() throws Exception
{
- LdapConnection connection = ServerIntegrationUtils.getClientApiConnection( getLdapServer() );
+ LdapConnection connection = getAdminConnection( getLdapServer() );
int size = 100*1024;
byte[] dataBytes = new byte[size];