You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2009/07/27 18:54:37 UTC

svn commit: r798215 - in /directory: apacheds/trunk/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/operations/ shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/

Author: kayyagari
Date: Mon Jul 27 16:54:36 2009
New Revision: 798215

URL: http://svn.apache.org/viewvc?rev=798215&view=rev
Log:
o added convenient methods for extended operation
o modified test case to use newly created methods

Modified:
    directory/apacheds/trunk/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientExtendedRequestTest.java
    directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java

Modified: directory/apacheds/trunk/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientExtendedRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientExtendedRequestTest.java?rev=798215&r1=798214&r2=798215&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientExtendedRequestTest.java (original)
+++ directory/apacheds/trunk/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientExtendedRequestTest.java Mon Jul 27 16:54:36 2009
@@ -70,9 +70,7 @@
     @Test
     public void testExtended() throws Exception
     {
-        ExtendedRequest extendedRequest = new ExtendedRequest( StartTlsRequest.OID );
-        
-        ExtendedResponse response = connection.extended( extendedRequest, null );
+        ExtendedResponse response = connection.extended( StartTlsRequest.OID );
         assertNotNull( response );
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
     }

Modified: directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java?rev=798215&r1=798214&r2=798215&view=diff
==============================================================================
--- directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java (original)
+++ directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java Mon Jul 27 16:54:36 2009
@@ -2436,6 +2436,67 @@
     
     
     /**
+     * @see #extended(OID, byte[])
+     */
+    public ExtendedResponse extended( String oid ) throws LdapException
+    {
+        return extended( oid, null );
+    }
+
+    
+    /**
+     * @see #extended(OID, byte[])
+     */
+    public ExtendedResponse extended( String oid, byte[] value ) throws LdapException
+    {
+        try
+        {
+            return extended( new OID( oid ), value );
+        }
+        catch( DecoderException e )
+        {
+            LOG.error( "Failed to decode the OID {}", oid );
+            throw new LdapException( e );
+        }
+    }
+    
+    
+    /**
+     * @see #extended(OID, byte[])
+     */
+    public ExtendedResponse extended( OID oid ) throws LdapException
+    {
+        return extended( oid, null );
+    }
+    
+
+    /**
+     * sends a extended operation request to the server with the given OID and value
+     * 
+     * @param oid the object identifier of the extended operation
+     * @param value value to be used by the extended operation, can be a null value 
+     * @return extended operation's response
+     * @throws LdapException
+     */
+    public ExtendedResponse extended( OID oid, byte[] value ) throws LdapException
+    {
+        ExtendedRequest extRequest = new ExtendedRequest( oid );
+        extRequest.setValue( value );
+        
+        return extended( extRequest );
+    }
+
+    
+    /**
+     * @see #extended(ExtendedRequest, ExtendedListener) 
+     */
+    public ExtendedResponse extended( ExtendedRequest extendedRequest ) throws LdapException
+    {
+        return extended( extendedRequest, null );
+    }
+    
+    
+    /**
      * requests the server to perform an extended operation based on the given request.
      * 
      * @param extendedRequest the object containing the details of the extended operation to be performed