directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject [directory-server] 02/02: Merge branch 'master' of https://gitbox.apache.org/repos/asf/directory-server
Date Tue, 01 Jan 2019 11:17:44 GMT
This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git

commit d9f4e8d2c63594055114d266a3f73f444d224261
Merge: f28f4aa 4e8a2e6
Author: Emmanuel Lecharny <elecharny@apache.org>
AuthorDate: Tue Jan 1 12:16:27 2019 +0100

    Merge branch 'master' of
    https://gitbox.apache.org/repos/asf/directory-server
    
    # Conflicts:
    #	server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java
    
    o Fixed some issues in the transaction handler
    o Don't close the connection in the exceptionCaught method, it's done
    later. That allow the NoD message to be sent to the client
    
    o Fixed the replication test failures

 .../core/api/LdapCoreSessionConnectionTest.java    |   1 -
 .../core/operations/search/SortedSearchIT.java     |   2 +-
 core/src/checkstyle/suppressions.xml               |   1 +
 .../server/core/security/TlsKeyGenerator.java      | 101 +----
 .../kerberos/client/KdcConnectionTest.java         |   6 +-
 .../src/test/resources/log4j.properties            |   2 +-
 .../shared/client/api/LdapApiIntegrationUtils.java |   1 -
 .../template/LdapConnectionTemplateTest.java       |   1 -
 .../client/api/CertificateValidationTest.java      | 442 +++++++++++++++++++++
 .../shared/client/api/LdapConnectionPoolTest.java  |  42 +-
 .../shared/client/api/LdapConnectionTest.java      |  39 +-
 .../api/LightweightLdapConnectionPoolTest.java     |   4 -
 .../shared/client/api/ServerSchemaLoaderTest.java  |   1 -
 .../api/operations/ClientAddRequestTest.java       |   2 -
 .../api/operations/bind/SimpleBindRequestTest.java |   1 -
 .../search/AnonymousClientSearchRequestTest.java   |   1 -
 .../operations/search/OperationWithIndexTest.java  |   1 -
 .../directory/server/ldap/LdapProtocolHandler.java |   6 +-
 .../handlers/extended/EndTransactionHandler.java   |   6 +
 .../handlers/extended/StartTransactionHandler.java |   6 +
 .../ldap/replication/SyncReplConfiguration.java    |   2 +-
 .../consumer/ReplicationConsumerImpl.java          |   5 +-
 .../provider/SyncReplRequestHandler.java           |   2 +-
 .../src/test/java/MultiThreadedReadWriteTest.java  |   1 -
 .../server/operations/add/AddAliasIT.java          |   3 -
 .../directory/server/operations/add/AddIT.java     |  10 +-
 .../AddingEntriesWithSpecialCharactersInRDNIT.java |   1 -
 .../server/operations/bind/DelegatedAuthIT.java    |   2 -
 .../operations/bind/DelegatedAuthOverSslIT.java    |   1 -
 .../operations/bind/DelegatedAuthOverTlsIT.java    |   1 -
 .../server/operations/bind/SaslBindIT.java         |   3 -
 .../server/operations/bind/SimpleBindIT.java       |   1 -
 .../server/operations/extended/PwdModifyIT.java    |   6 -
 .../server/operations/extended/WhoAmIIT.java       |   2 -
 .../directory/server/operations/ldapsdk/AddIT.java |   1 +
 .../server/operations/lookup/LookupIT.java         |   2 -
 .../server/operations/modify/ModifyAddIT.java      |   2 -
 .../server/operations/modifydn/ModifyRdnIT.java    |   2 -
 .../server/operations/search/PagedSearchIT.java    |   3 +
 .../operations/search/PersistentSearchApiIT.java   |   4 +-
 .../server/operations/search/SearchIT.java         | 122 +++++-
 .../server/operations/search/SearchPerfIT.java     |   3 +-
 .../server/operations/search/SortedSearchIT.java   |   3 +-
 .../directory/server/ppolicy/PasswordPolicyIT.java |  18 -
 .../server/replication/ClientInitialRefreshIT.java |  91 ++---
 .../replication/ClientServerReplicationIT.java     |  10 +
 .../server/replication/MockSyncReplConsumer.java   |  27 +-
 .../replication/StaleEventLogDetectionIT.java      |  15 +
 .../apache/directory/server/ssl/KeyStoreIT.java    |   9 +-
 49 files changed, 741 insertions(+), 277 deletions(-)

diff --cc core-integ/src/test/java/org/apache/directory/server/core/operations/search/SortedSearchIT.java
index 4b74cdb,4b74cdb..66f4ab7
--- a/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SortedSearchIT.java
+++ b/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SortedSearchIT.java
@@@ -365,7 -365,7 +365,7 @@@ public class SortedSearchIT extends Abs
      public void testSortByDn() throws Exception
      {
          sk.setAttributeTypeDesc( "entryDn" );
--        sk.setMatchingRuleId( "2.5.13.1" );
++        sk.setMatchingRuleId( SchemaConstants.DISTINGUISHED_NAME_MATCH_MR_OID );
          SearchCursor cursor = connection.search( req );
  
          List<Entry> actualOrder = new ArrayList<Entry>();
diff --cc protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
index 82d98b6,c4d0223..7bc588e
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
@@@ -245,8 -246,8 +245,8 @@@ class LdapProtocolHandler extends Demux
          LOG.warn( "Unexpected exception forcing session to close: sending disconnect notice
to client.", cause );
  
          session.write( NoticeOfDisconnect.PROTOCOLERROR );
--        LdapSession ldapSession = this.ldapServer.getLdapSessionManager().removeLdapSession(
session );
--        cleanUpSession( ldapSession );
--        session.closeNow();
++        session.closeOnFlush();
++        //LdapSession ldapSession = this.ldapServer.getLdapSessionManager().removeLdapSession(
session );
++        //cleanUpSession( ldapSession );
      }
  }
diff --cc protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/EndTransactionHandler.java
index d2580c5,ab30426..619f96b
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/EndTransactionHandler.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/EndTransactionHandler.java
@@@ -79,6 -80,6 +79,12 @@@ public class EndTransactionHandler impl
  
          EndTransactionResponse endTransactionResponse = new EndTransactionResponseImpl(
req.getMessageId() );
  
++        // Store the StartTransaction request name in the response, to be able to
++        // encode the response properly.
++        // Kurt Zeilenga should have set a responseName to make it easier to 
++        // implement in RFC 5805 :/
++        endTransactionResponse.setResponseName( EndTransactionRequest.EXTENSION_OID );
++
          // write the response
          session.getIoSession().write( endTransactionResponse );
      }
diff --cc protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTransactionHandler.java
index b64f5b2,b64f5b2..a630004
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTransactionHandler.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTransactionHandler.java
@@@ -80,6 -80,6 +80,12 @@@ public class StartTransactionHandler im
  
          StartTransactionResponse startTransactionResponse = new StartTransactionResponseImpl(

                  req.getMessageId(), Conversion.convertToByteArray( transactionId ) );
++        
++        // Store the StartTransaction request name in the response, to be able to
++        // encode the response properly.
++        // Kurt Zeilenga should have set a responseName to make it easier to 
++        // implement in RFC 5805 :/
++        startTransactionResponse.setResponseName( StartTransactionRequest.EXTENSION_OID
);
  
          // write the response
          session.getIoSession().write( startTransactionResponse );
diff --cc protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
index 37759c5,4bb1954..0ba592b
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
@@@ -1358,7 -1360,7 +1357,7 @@@ public class ReplicationConsumerImpl im
          // the ENTRY_DN_AT must be in the attribute list, otherwise sorting fails
          req.addAttributes( SchemaConstants.ENTRY_DN_AT );
  
--        SortKey sk = new SortKey( SchemaConstants.ENTRY_DN_AT, "2.5.13.1" );
++        SortKey sk = new SortKey( SchemaConstants.ENTRY_DN_AT, SchemaConstants.DISTINGUISHED_NAME_MATCH_MR_OID
);
          SortRequest ctrl = new SortRequestImpl();
          ctrl.addSortKey( sk );
          req.addControl( ctrl );
@@@ -1427,7 -1429,7 +1426,7 @@@
              // the ENTRY_DN_AT must be in the attribute list, otherwise sorting fails
              req.addAttributes( SchemaConstants.ENTRY_DN_AT );
  
--            SortKey sk = new SortKey( SchemaConstants.ENTRY_DN_AT, "2.5.13.1" );
++            SortKey sk = new SortKey( SchemaConstants.ENTRY_DN_AT, SchemaConstants.DISTINGUISHED_NAME_MATCH_MR_OID
);
  
              SortRequest ctrl = new SortRequestImpl();
              ctrl.addSortKey( sk );
diff --cc protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java
index 154ab4c,0edac1f..9c63f1a
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java
@@@ -497,7 -498,7 +497,7 @@@ public class SyncReplRequestHandler imp
              .debug( "Adding sort control to sort the entries by entryDn attribute to preserve
order of insertion" );
          SortKey sk = new SortKey( SchemaConstants.ENTRY_DN_AT );
          // matchingrule for "entryDn"
--        sk.setMatchingRuleId( "2.5.13.1" );
++        sk.setMatchingRuleId( SchemaConstants.DISTINGUISHED_NAME_MATCH_MR_OID );
          sk.setReverseOrder( true );
  
          ctrl = new SortRequestImpl();
diff --cc server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
index 35aeebe,8aedb55..ab3236f
--- a/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
@@@ -1183,9 -1183,9 +1183,11 @@@ public class AddIT extends AbstractLdap
              if ( connection.isConnected() )
              {
                  // Race condition:
--                // Upon NoticeOfDisconnection the API sends an abandon request but does
not immediately close the connection.
--                // So at this point it is not guaranteed that the connnection is already
closed.
--                // TODO: This is just a workaround, better check the connection for any
outstanding abandon requests
++                // Upon NoticeOfDisconnection the API sends an abandon request but does
not 
++                // immediately close the connection.
++                // So at this point it is not guaranteed that the connection is already
closed.
++                // TODO: This is just a workaround, better check the connection for any

++                // outstanding abandon requests
                  Thread.sleep( 1000 );
              }
              assertFalse( connection.isConnected() );
diff --cc server-integ/src/test/java/org/apache/directory/server/operations/extended/PwdModifyIT.java
index 7dd5397,dfe769e..3023496
--- a/server-integ/src/test/java/org/apache/directory/server/operations/extended/PwdModifyIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/extended/PwdModifyIT.java
@@@ -28,10 -28,14 +28,9 @@@ import static org.junit.Assert.assertNo
  import static org.junit.Assert.assertNotNull;
  import static org.junit.Assert.assertNull;
  
 -import org.apache.directory.api.ldap.codec.api.LdapApiService;
--import org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory;
 -import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequest;
  import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyErrorEnum;
 -import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequestImpl;
  import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponse;
  import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponseImpl;
 -import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyResponseDecorator;
  import org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyRequest;
  import org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyRequestImpl;
  import org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyResponse;
diff --cc server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/AddIT.java
index d068660,d068660..cc3490e
--- a/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/AddIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/AddIT.java
@@@ -1200,6 -1200,6 +1200,7 @@@ public class AddIT extends AbstractLdap
              }
              assertFalse( connection.isConnected() );
          }
++        connection.close();
      }
  
  
diff --cc server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java
index d3e174f,c28ea18..c13c835
--- a/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java
@@@ -1174,5 -1174,5 +1174,8 @@@ public class PagedSearchIT extends Abst
  
          assertEquals( 4, loop );
          checkResults( results, 10 );
++
++        // And close the connection
++        closeConnection( ctx );
      }
  }
diff --cc server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchApiIT.java
index 7811358,52035d5..514a0e1
--- a/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchApiIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchApiIT.java
@@@ -616,9 -619,9 +616,7 @@@ public class PersistentSearchApiIT exte
  
          PSearchListener( PersistentSearch persistentSearch )
          {
-             LdapApiService codec = getLdapServer().getDirectoryService().getLdapCodecService();
-             
-             this.persistentSearch = ( PersistentSearch ) codec.getRequestControlFactories().get(
PersistentSearch.OID ).newControl();
 -            CodecControl<? extends Control> wrapped =
 -                getLdapServer().getDirectoryService().getLdapCodecService().newRequestControl(
persistentSearch );
 -            this.persistentSearch = ( PersistentSearchDecorator ) wrapped;
++            this.persistentSearch = persistentSearch;
          }
  
  
diff --cc server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
index dfa5a1f,dfa5a1f..49797db
--- a/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
@@@ -205,9 -205,9 +205,6 @@@ import org.junit.runner.RunWith
  public class SearchIT extends AbstractLdapTestUnit
  {
      private static final String BASE = "ou=system";
--
--    //public static LdapServer getLdapServer();
--
      private static final String RDN = "cn=Tori Amos";
      private static final String RDN2 = "cn=Rolling-Stones";
      private static final String HEATHER_RDN = "cn=Heather Nova";
@@@ -237,7 -237,7 +234,6 @@@
              0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00, ( byte ) 0x8a, 0x00, (
byte ) 0xb5, ( byte ) 0xe3,
              ( byte ) 0xff, ( byte ) 0xd9, };
  
--
      /**
       * Creation of required attributes of a person entry.
       */
@@@ -287,6 -287,6 +283,7 @@@
          assertNotNull( sr );
          assertFalse( enm.hasMore() );
          assertEquals( "cn=Kate Bush", sr.getName() );
++        enm.close();
  
          enm = ctx.search( "", "(&(cn=Kate Bush)(userCertificate={0}))", new Object[]
              { certData }, controls );
@@@ -295,6 -295,6 +292,7 @@@
          assertNotNull( sr );
          assertFalse( enm.hasMore() );
          assertEquals( "cn=Kate Bush", sr.getName() );
++        enm.close();
  
          enm = ctx.search( "", "(userCertificate=\\34\\56\\4E\\5F)", controls );
          assertTrue( enm.hasMore() );
@@@ -318,6 -318,6 +316,9 @@@
          assertEquals( 4, count );
          assertFalse( enm.hasMore() );
          assertEquals( 0, expected.size() );
++        
++        enm.close();
++        ctx.close();
      }
  
  
@@@ -357,6 -357,6 +358,9 @@@
              NamingEnumeration<SearchResult> result = ctx.search( "ou=system", "(objectClass=*)",
controls );
  
              assertTrue( result.hasMore() );
++            
++            result.close();
++            ctx.close();
          }
          catch ( InvalidNameException ine )
          {
@@@ -395,6 -395,6 +399,8 @@@
              assertEquals( "cn=Janis Joplin,ou=system", entry.getName() );
  
              assertFalse( result.hasMore() );
++            result.close();
++            ctx.close();
          }
          catch ( InvalidNameException ine )
          {
@@@ -418,15 -418,15 +424,18 @@@
          LdapContext ctx = ( LdapContext ) getWiredContext( getLdapServer() ).lookup( BASE
);
          SearchControls controls = new SearchControls();
          controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
--        NamingEnumeration<SearchResult> ii = ctx.search( "", filter, controls );
++        NamingEnumeration<SearchResult> searchResults = ctx.search( "", filter, controls
);
  
          // collect all results
          HashSet<String> results = new HashSet<String>();
--        while ( ii.hasMore() )
++        while ( searchResults.hasMore() )
          {
--            SearchResult result = ii.next();
++            SearchResult result = searchResults.next();
              results.add( result.getName() );
          }
++        
++        searchResults.close();
++        ctx.close();
  
          return results;
      }
@@@ -494,6 -494,6 +503,9 @@@
                  assertNotNull( sn );
                  assertTrue( sn.contains( "Ferry" ) );
              }
++            
++            enm.close();
++            ctx.close();
          }
          catch ( Exception e )
          {
@@@ -524,72 -524,72 +536,93 @@@
  
          results = ctx.search( RDN2, "(cn=*)", ctls );
          assertTrue( results.hasMore() );
++        results.close();
  
          // Search for all entries ending by Amos
          results = ctx.search( RDN, "(cn=*Amos)", ctls );
          assertTrue( results.hasMore() );
++        results.close();
  
          results = ctx.search( RDN2, "(cn=*Amos)", ctls );
          assertFalse( results.hasMore() );
++        results.close();
  
          // Search for all entries ending by amos
          results = ctx.search( RDN, "(cn=*amos)", ctls );
          assertTrue( results.hasMore() );
++        results.close();
  
          results = ctx.search( RDN2, "(cn=*amos)", ctls );
          assertFalse( results.hasMore() );
++        results.close();
  
          // Search for all entries starting by Tori
          results = ctx.search( RDN, "(cn=Tori*)", ctls );
          assertTrue( results.hasMore() );
++        results.close();
  
          results = ctx.search( RDN2, "(cn=Tori*)", ctls );
          assertFalse( results.hasMore() );
++        results.close();
  
          // Search for all entries starting by tori
          results = ctx.search( RDN, "(cn=tori*)", ctls );
          assertTrue( results.hasMore() );
++        results.close();
  
          results = ctx.search( RDN2, "(cn=tori*)", ctls );
          assertFalse( results.hasMore() );
++        results.close();
  
          // Search for all entries containing ori
          results = ctx.search( RDN, "(cn=*ori*)", ctls );
          assertTrue( results.hasMore() );
++        results.close();
  
          results = ctx.search( RDN2, "(cn=*ori*)", ctls );
          assertFalse( results.hasMore() );
++        results.close();
  
          // Search for all entries containing o and i
          results = ctx.search( RDN, "(cn=*o*i*)", ctls );
          assertTrue( results.hasMore() );
++        results.close();
  
          results = ctx.search( RDN2, "(cn=*o*i*)", ctls );
          assertTrue( results.hasMore() );
++        results.close();
  
          // Search for all entries containing o, space and o
          results = ctx.search( RDN, "(cn=*o* *o*)", ctls );
          assertTrue( results.hasMore() );
++        results.close();
  
          results = ctx.search( RDN2, "(cn=*o* *o*)", ctls );
          assertFalse( results.hasMore() );
++        results.close();
  
          results = ctx.search( RDN2, "(cn=*o*-*o*)", ctls );
          assertTrue( results.hasMore() );
++        results.close();
  
          // Search for all entries starting by To and containing A
          results = ctx.search( RDN, "(cn=To*A*)", ctls );
          assertTrue( results.hasMore() );
++        results.close();
  
          results = ctx.search( RDN2, "(cn=To*A*)", ctls );
          assertFalse( results.hasMore() );
++        results.close();
  
          // Search for all entries ending by os and containing ri
          results = ctx.search( RDN, "(cn=*ri*os)", ctls );
          assertTrue( results.hasMore() );
++        results.close();
  
          results = ctx.search( RDN2, "(cn=*ri*os)", ctls );
          assertFalse( results.hasMore() );
++        results.close();
++        ctx.close();
      }
  
  
@@@ -658,6 -658,6 +691,7 @@@
          SearchResult result = results.next();
          assertNotNull( result );
          assertFalse( results.hasMore() );
++        results.close();
  
          NamingEnumeration<? extends Attribute> attrs = result.getAttributes().getAll();
  
@@@ -670,6 -670,6 +704,8 @@@
  
          assertNotNull( result.getAttributes().get( "objectClasses" ) );
          assertEquals( 1, result.getAttributes().size() );
++        attrs.close();
++        ctx.close();
      }
  
  
@@@ -743,7 -743,7 +779,9 @@@
              fail( "entry " + rdn + " not found" );
          }
  
++        result.close();
          ctx.destroySubcontext( rdn );
++        ctx.close();
      }
  
  
@@@ -779,8 -779,8 +817,10 @@@
          {
              fail( "entry " + rdn + " not found" );
          }
--
++        
++        result.close();
          ctx.destroySubcontext( rdn );
++        ctx.close();
      }
  
  
@@@ -818,6 -818,6 +858,8 @@@
  
          assertEquals( "expected results size of", 1, results.size() );
          assertTrue( results.contains( "cn=anyBodyAdd" ) );
++        enm.close();
++        ctx.close();
      }
  
  
@@@ -852,7 -852,7 +894,9 @@@
              assertTrue( sn.contains( "Bush" ) );
          }
  
++        enm.close();
          ctx.destroySubcontext( rdn );
++        ctx.close();
      }
  
  
@@@ -906,7 -906,7 +950,9 @@@
              fail( "Entry not found:" + nameInNamespace );
          }
  
++        enm.close();
          ctx.destroySubcontext( rdn );
++        ctx.close();
      }
  
  
@@@ -940,6 -940,6 +986,9 @@@
                  }
              }
          }
++        
++        res.close();
++        ctx.close();
      }
  
  
@@@ -967,6 -967,6 +1016,9 @@@
  
          // ensure that no other value was found
          assertFalse( res.hasMore() );
++        
++        res.close();
++        ctx.close();
      }
  
  
@@@ -996,6 -996,6 +1048,8 @@@
          assertNotNull( attrs.get( "cn" ) );
          assertEquals( 1, attrs.get( "cn" ).size() );
          assertEquals( "Tori Amos", attrs.get( "cn" ).get() );
++        res.close();
++        ctx.close();
      }
  
  
@@@ -1028,6 -1028,6 +1082,8 @@@
          assertNotNull( attrs.get( "sn" ) );
          assertEquals( 1, attrs.get( "sn" ).size() );
          assertEquals( "Amos", attrs.get( "sn" ).get() );
++        res.close();
++        ctx.close();
      }
  
  
@@@ -1062,6 -1062,6 +1118,8 @@@
          assertNotNull( attrs.get( "cn" ) );
          assertEquals( 1, attrs.get( "cn" ).size() );
          assertEquals( "Tori Amos", attrs.get( "cn" ).get() );
++        res.close();
++        ctx.close();
      }
  
  
@@@ -1096,6 -1096,6 +1154,8 @@@
          assertNotNull( attrs.get( "cn" ) );
          assertEquals( 1, attrs.get( "cn" ).size() );
          assertEquals( "Tori Amos", attrs.get( "cn" ).get() );
++        res.close();
++        ctx.close();
      }
  
  
@@@ -1153,6 -1153,6 +1213,9 @@@
          assertNotNull( attrs.get( "c-l" ) );
          assertEquals( 1, attrs.get( "c-l" ).size() );
          assertEquals( "Munich", attrs.get( "c-l" ).get() );
++        
++        res.close();
++        ctx.close();
      }
  
  
@@@ -1187,6 -1187,6 +1250,8 @@@
          assertNotNull( attrs.get( "userCertificate" ) );
          assertNull( attrs.get( "createtimestamp" ) );
          assertNull( attrs.get( "creatorsname" ) );
++        res.close();
++        ctx.close();
      }
  
  
@@@ -1227,6 -1227,6 +1292,9 @@@
          assertNotNull( attrs.get( "subschemaSubentry" ) );
          assertNotNull( attrs.get( "nbChildren" ) );
          assertNotNull( attrs.get( "nbSubordinates" ) );
++        
++        res.close();
++        ctx.close();
      }
  
  
@@@ -1256,6 -1256,6 +1324,9 @@@
          assertEquals( 1, attrs.size() );
          assertNotNull( attrs.get( "nbChildren" ) );
          assertNull( attrs.get( "nbSubordinates" ) );
++        
++        res.close();
++        ctx.close();
      }
  
  
@@@ -1285,6 -1285,6 +1356,9 @@@
          assertEquals( 1, attrs.size() );
          assertNotNull( attrs.get( "nbSubordinates" ) );
          assertNull( attrs.get( "nbChildren" ) );
++        
++        res.close();
++        ctx.close();
      }
  
  
@@@ -1338,6 -1338,6 +1412,7 @@@
          long t001 = System.currentTimeMillis();
          
          System.out.println( "Delta without children(2) = " + ( t001 - t000 ) );
++        ctx.close();
      }
  
  
@@@ -1378,6 -1378,6 +1453,8 @@@
          assertNotNull( attrs.get( "subschemaSubentry" ) );
          assertNotNull( attrs.get( "nbChildren" ) );
          assertNotNull( attrs.get( "nbSubordinates" ) );
++        res.close();
++        ctx.close();
      }
  
  
@@@ -1396,6 -1396,6 +1473,8 @@@
          {
              assertTrue( true );
          }
++        
++        ctx.close();
      }
  
  
@@@ -1416,6 -1416,6 +1495,8 @@@
          {
              assertTrue( true );
          }
++        
++        ctx.close();
      }
  
  
@@@ -1449,6 -1449,6 +1530,7 @@@
          }
  
          result.close();
++        ctx.close();
      }
  
  
@@@ -1482,6 -1482,6 +1564,7 @@@
          }
  
          result.close();
++        ctx.close();
      }
  
  
@@@ -1500,6 -1500,6 +1583,7 @@@
  
          NamingEnumeration<SearchResult> result = ctx.search( HEATHER_RDN, FILTER,
ctls );
          result.close();
++        ctx.close();
      }
  
  
@@@ -1518,6 -1518,6 +1602,7 @@@
  
          NamingEnumeration<SearchResult> result = ctx.search( HEATHER_RDN, FILTER,
ctls );
          result.close();
++        ctx.close();
      }
  
  
@@@ -1535,6 -1535,6 +1620,7 @@@
  
          NamingEnumeration<SearchResult> result = ctx.search( HEATHER_RDN, FILTER,
ctls );
          result.close();
++        ctx.close();
      }
  
  
@@@ -1597,6 -1597,6 +1683,7 @@@
          }
  
          result.close();
++        ctx.close();
      }
  
  
@@@ -1633,7 -1633,7 +1720,10 @@@
              assertEquals( 1, attrs.get( "cn" ).size() );
              assertEquals( "jimbean", attrs.get( "cn" ).get() );
              assertFalse( res.hasMore() );
++            res.close();
          }
++        
++        ctx.close();
      }
  
  
@@@ -1665,6 -1665,6 +1755,8 @@@
          {
              assertTrue( true );
          }
++        
++        ctx.close();
      }
  
  
@@@ -1698,6 -1698,6 +1790,8 @@@
          assertTrue( res.hasMore() );
          assertEquals( "x*y*z*", res.next().getAttributes().get( "cn" ).get() );
          assertFalse( res.hasMore() );
++        res.close();
++        ctx.close();
      }
  
  
@@@ -1741,24 -1741,24 +1835,29 @@@
          assertTrue( res.hasMore() );
          assertEquals( "groupOfNames", res.next().getAttributes().get( "cn" ).get() );
          assertFalse( res.hasMore() );
++        res.close();
  
          // search with escaped filter value
          res = ctx.search( "", "(member=uid=r\\c3\\a9dacteur1,ou=system)", controls );
          assertTrue( res.hasMore() );
          assertEquals( "groupOfNames", res.next().getAttributes().get( "cn" ).get() );
          assertFalse( res.hasMore() );
++        res.close();
  
          // search with unicode filter value
          res = ctx.search( "", "(uniqueMember=uid=r\u00e9dacteur1,ou=system)", controls );
          assertTrue( res.hasMore() );
          assertEquals( "groupOfUniqueNames", res.next().getAttributes().get( "cn" ).get()
);
          assertFalse( res.hasMore() );
++        res.close();
  
          // search with escaped filter value
          res = ctx.search( "", "(uniqueMember=uid=r\\c3\\a9dacteur1,ou=system)", controls
);
          assertTrue( res.hasMore() );
          assertEquals( "groupOfUniqueNames", res.next().getAttributes().get( "cn" ).get()
);
          assertFalse( res.hasMore() );
++        res.close();
++        ctx.close();
      }
  
  
@@@ -1788,6 -1788,6 +1887,7 @@@
          }
  
          result.close();
++        ctx.close();
      }
  
  
@@@ -1867,6 -1867,6 +1967,8 @@@
          SearchResult entry = result.next();
  
          assertEquals( "Kim Wilde", entry.getAttributes().get( "cn" ).get() );
++        result.close();
++        ctx.close();
      }
  
  
@@@ -1927,6 -1927,6 +2029,7 @@@
          }
  
          assertTrue( newCount < count );
++        cursor.close();
          connection.close();
      }
  
@@@ -1946,6 -1946,6 +2049,7 @@@
          SearchResult sr = result.next();
          assertNotNull( sr );
          assertEquals( "Kim Wilde", sr.getAttributes().get( "cn" ).get() );
++        result.close();
  
          // Now check with another version of the filter
          result = ctx.search( "cn=Kim Wilde,ou=system",
@@@ -1955,6 -1955,6 +2059,8 @@@
          sr = result.next();
          assertNotNull( sr );
          assertEquals( "Kim Wilde", sr.getAttributes().get( "cn" ).get() );
++        result.close();
++        ctx.close();
      }
  
      
diff --cc server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java
index 1ffe180,a76fefa..aa4d884
--- a/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java
@@@ -575,5 -573,5 +573,6 @@@ public class SearchPerfIT extends Abstr
          Long deltaWarmed = ( t1 - t00 );
          System.out.println( "Delta : " + deltaWarmed + "( " + ( ( ( nbIterations - 50000
) * 1000 ) / deltaWarmed )
              + " per s ) /" + ( t1 - t0 ) + ", count : " + count );
++        connection.close();
      }
  }
diff --cc server-integ/src/test/java/org/apache/directory/server/operations/search/SortedSearchIT.java
index c52ef5a,5f43084..a117a1f
--- a/server-integ/src/test/java/org/apache/directory/server/operations/search/SortedSearchIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/search/SortedSearchIT.java
@@@ -368,7 -367,7 +367,7 @@@ public class SortedSearchIT extends Abs
      public void testSortByDn() throws Exception
      {
          sk.setAttributeTypeDesc( "entryDn" );
--        sk.setMatchingRuleId( "2.5.13.1" );
++        sk.setMatchingRuleId( SchemaConstants.DISTINGUISHED_NAME_MATCH_MR_OID );
          SearchCursor cursor = con.search( req );
  
          List<Entry> actualOrder = new ArrayList<Entry>();
diff --cc server-integ/src/test/java/org/apache/directory/server/replication/ClientInitialRefreshIT.java
index 275c5a5,a526127..bb811f9
--- a/server-integ/src/test/java/org/apache/directory/server/replication/ClientInitialRefreshIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/replication/ClientInitialRefreshIT.java
@@@ -61,6 -62,7 +62,8 @@@ import org.junit.After
  import org.junit.AfterClass;
  import org.junit.Before;
  import org.junit.BeforeClass;
++import org.junit.Ignore;
+ import org.junit.Rule;
  import org.junit.Test;
  
  
@@@ -69,8 -71,11 +72,12 @@@
   *
   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
   */
++//@Ignore
  public class ClientInitialRefreshIT
  {
+     @Rule
+     public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.NOT_THREADSAFE
);
+ 
      private static LdapServer providerServer;
  
      private static SchemaManager schemaManager;
@@@ -162,12 -167,12 +169,6 @@@
      {
          DirectoryService provDirService = DSAnnotationProcessor.getDirectoryService();
          
--        // Load the replication controls
--        LdapApiService codec = provDirService.getLdapCodecService();
--        codec.registerRequestControl( new SyncRequestValueFactory( codec ) );
--        codec.registerResponseControl( new SyncDoneValueFactory( codec ) );
--        codec.registerResponseControl( new SyncStateValueFactory( codec ) );
--
          providerServer = ServerAnnotationProcessor.getLdapServer( provDirService );
  
          providerServer.setReplicationReqHandler( new SyncReplRequestHandler() );
diff --cc server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java
index a4717bd,a462207..cc8d791
--- a/server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java
+++ b/server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java
@@@ -217,7 -222,6 +217,7 @@@ public class MockSyncReplConsumer imple
              if ( connection == null )
              {
                  connection = new LdapNetworkConnection( providerHost, port );
-                 connection.setTimeOut( -1L );
++                connection.setTimeOut( 10000L );
  
                  if ( config.isUseTls() )
                  {
@@@ -396,20 -400,24 +396,13 @@@
      /**
       * {@inheritDoc}
       */
--    public void handleSyncInfo( IntermediateResponse syncInfoResp )
++    public void handleSyncInfo( SyncInfoValue syncInfoValue )
      {
          try
          {
              LOG.debug( "............... inside handleSyncInfo ..............." );
  
--            byte[] syncInfoBytes = syncInfoResp.getResponseValue();
 -            LOG.debug( "received intermediate response: " + syncInfoResp );
--
--            if ( syncInfoBytes == null )
--            {
 -                LOG.debug( "received null sync info");
--                return;
--            }
--
-             SyncInfoValue syncInfoValue = new SyncInfoValueFactory().newResponse( syncInfoBytes
);
 -            SyncInfoValueDecorator decorator = new SyncInfoValueDecorator( ldapCodecService
);
 -            SyncInfoValue syncInfoValue = ( SyncInfoValue ) decorator.decode( syncInfoBytes
);
+             LOG.debug( "received sync info: " + syncInfoValue );
  
              byte[] cookie = syncInfoValue.getCookie();
  
@@@ -691,7 -699,7 +684,7 @@@
              }
              else if ( resp instanceof IntermediateResponse )
              {
--                handleSyncInfo( ( IntermediateResponse ) resp );
++                handleSyncInfo( ( SyncInfoValue ) resp );
              }
  
              resp = sf.get();


Mime
View raw message