directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1778694 - /directory/apacheds/branches/apacheds-value/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java
Date Sat, 14 Jan 2017 01:22:07 GMT
Author: elecharny
Date: Sat Jan 14 01:22:06 2017
New Revision: 1778694

URL: http://svn.apache.org/viewvc?rev=1778694&view=rev
Log:
Fixed a failing test

Modified:
    directory/apacheds/branches/apacheds-value/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java

Modified: directory/apacheds/branches/apacheds-value/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java?rev=1778694&r1=1778693&r2=1778694&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java
(original)
+++ directory/apacheds/branches/apacheds-value/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java
Sat Jan 14 01:22:06 2017
@@ -35,6 +35,7 @@ import javax.naming.directory.SearchResu
 import javax.naming.ldap.LdapContext;
 
 import org.apache.directory.api.ldap.model.exception.LdapException;
+import org.apache.directory.api.ldap.model.exception.LdapNoPermissionException;
 import org.apache.directory.api.ldap.model.exception.LdapOperationException;
 import org.apache.directory.api.ldap.model.message.CompareRequest;
 import org.apache.directory.api.ldap.model.message.CompareRequestImpl;
@@ -46,7 +47,6 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.util.Network;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.LdapNetworkConnection;
-import org.apache.directory.ldap.client.api.exception.InvalidConnectionException;
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.annotations.ApplyLdifs;
@@ -260,14 +260,16 @@ public class CompareIT extends AbstractL
      * anonymous
      * @throws LdapException
      */
-    @Test(expected = InvalidConnectionException.class)
+    @Test(expected = LdapNoPermissionException.class)
     public void testCompareWithoutAuthentication() throws LdapException, Exception
     {
         getLdapServer().getDirectoryService().setAllowAnonymousAccess( false );
-        LdapConnection conn = new LdapNetworkConnection( Network.LOOPBACK_HOSTNAME, getLdapServer().getPort()
);
-
-        conn.compare( "uid=admin,ou=system", "uid", "admin" );
-        fail( "Compare success without authentication" );
+        
+        try ( LdapConnection conn = new LdapNetworkConnection( Network.LOOPBACK_HOSTNAME,
getLdapServer().getPort() ) )
+        {
+            conn.compare( "uid=admin,ou=system", "uid", "admin" );
+            fail( "Compare success without authentication" );
+        }
     }
 
 



Mime
View raw message