You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/02/04 18:56:15 UTC
svn commit: r906583 - in /directory/clients/ldap/trunk:
ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/
ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/
ldap-client-test/src/test/java/org/apache/directory/...
Author: elecharny
Date: Thu Feb 4 17:56:15 2010
New Revision: 906583
URL: http://svn.apache.org/viewvc?rev=906583&view=rev
Log:
o Removed traces
o Thrown an exception when trying to use the tree delete and it's not available on the server
o Small code cleanup here and there
Modified:
directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractMessage.java
directory/clients/ldap/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java
Modified: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java?rev=906583&r1=906582&r2=906583&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java (original)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java Thu Feb 4 17:56:15 2010
@@ -1398,11 +1398,8 @@
}
else
{
- if ( response instanceof SearchResultEntry )
- {
- searchResponses.add( response );
- }
- else if ( response instanceof SearchResultReference )
+ if ( ( response instanceof SearchResultEntry ) ||
+ ( response instanceof SearchResultReference ) )
{
searchResponses.add( response );
}
@@ -1627,6 +1624,7 @@
futureMap.remove( delResp.getMessageId() );
DeleteListener delListener = ( DeleteListener ) listenerMap.remove( delResp.getMessageId() );
+
if ( delListener != null )
{
delListener.entryDeleted( this, delResp );
@@ -1635,6 +1633,7 @@
{
addToRespQueueAndRemoveQueueRef( messageId, delResp );
}
+
break;
case LdapConstants.EXTENDED_RESPONSE:
@@ -2143,7 +2142,10 @@
}
else
{
- return deleteRecursive( dn, null, null );
+ String msg = "The subtreeDelete control (1.2.840.113556.1.4.805) is not supported by the server\n" +
+ " The deletion has been aborted";
+ LOG.error( msg );
+ throw new LdapException( msg );
}
}
@@ -2170,7 +2172,10 @@
}
else
{
- return deleteRecursive( ldapDn, null, null );
+ String msg = "The subtreeDelete control (1.2.840.113556.1.4.805) is not supported by the server\n" +
+ " The deletion has been aborted";
+ LOG.error( msg );
+ throw new LdapException( msg );
}
}
catch ( InvalidNameException e )
@@ -2231,7 +2236,7 @@
if ( cursor == null )
{
cursor = search( dn.getName(), "(objectClass=*)", SearchScope.ONELEVEL, ( String[] ) null );
- LOG.debug( "putting curosr for {}", dn.getName() );
+ LOG.debug( "putting cursor for {}", dn.getName() );
cursorMap.put( dn, cursor );
}
@@ -2858,11 +2863,10 @@
supportedControls = new ArrayList<String>();
EntryAttribute attr = rootDSE.get( SchemaConstants.SUPPORTED_CONTROL_AT );
- Iterator<Value<?>> itr = attr.getAll();
-
- while ( itr.hasNext() )
+
+ for (Value<?> value:attr)
{
- supportedControls.add( ( String ) itr.next().get() );
+ supportedControls.add( value.getString() );
}
return supportedControls;
Modified: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractMessage.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractMessage.java?rev=906583&r1=906582&r2=906583&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractMessage.java (original)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractMessage.java Thu Feb 4 17:56:15 2010
@@ -157,7 +157,7 @@
*/
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append( "LdapMessage\n" );
sb.append( " message Id : " ).append( messageId ).append( '\n' );
Modified: directory/clients/ldap/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java?rev=906583&r1=906582&r2=906583&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java (original)
+++ directory/clients/ldap/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java Thu Feb 4 17:56:15 2010
@@ -103,10 +103,10 @@
private CoreSession session;
+
@Before
public void setup() throws Exception
{
- System.out.println( "Setup -------" );
connection = new LdapConnection( "localhost", ldapServer.getPort() );
LdapDN bindDn = new LdapDN( "uid=admin,ou=system" );
@@ -127,7 +127,6 @@
if ( connection != null )
{
connection.close();
- System.out.println( "Shutdown -------" );
}
}
catch( Exception ioe )
@@ -235,17 +234,15 @@
}
};
- DeleteResponse response = ( DeleteResponse ) deleteChildrenMethod.invoke( connection, dn, null, listener );
-
- assertNull( response );
-
- int numDNs = 5; // total number of entries expected to be deleted
- while( count.get() != numDNs )
+ try
{
- Thread.sleep( 1000 );
+ connection.deleteTree( dn );
+ fail();
+ }
+ catch ( LdapException le )
+ {
+ assertTrue( true );
}
-
- assertFalse( session.exists( dn ) );
}
@@ -256,8 +253,8 @@
assertTrue( session.exists( dn ) );
- final Semaphore lock = new Semaphore(1);
- lock.acquire();
+ final Semaphore delLock = new Semaphore(1);
+ delLock.acquire();
DeleteResponse response = connection.delete( new DeleteRequest( dn ), new DeleteListener()
{
@@ -265,11 +262,11 @@
{
assertNotNull( response );
assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
- lock.release();
+ delLock.release();
}
});
- lock.acquire();
+ delLock.acquire();
assertNull( response );
assertFalse( session.exists( dn ) );
}