directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r209415 - in /directory/sandbox/trunk/asn1-new-codec/src: java/org/apache/asn1/ldap/pojo/ExtendedResponse.java test/org/apache/asn1/ldap/codec/ExtendedResponseTest.java
Date Wed, 06 Jul 2005 06:31:54 GMT
Author: elecharny
Date: Tue Jul  5 23:31:52 2005
New Revision: 209415

URL: http://svn.apache.org/viewcvs?rev=209415&view=rev
Log:
- Added a toString() method
- polished the code

Modified:
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/ExtendedResponse.java
    directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ExtendedResponseTest.java

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/ExtendedResponse.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/ExtendedResponse.java?rev=209415&r1=209414&r2=209415&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/ExtendedResponse.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/ExtendedResponse.java
Tue Jul  5 23:31:52 2005
@@ -42,7 +42,7 @@
     //~ Constructors -------------------------------------------------------------------------------
 
     /**
-     * Creates a new ExtendedRequest object.
+     * Creates a new ExtendedResponse object.
      */
     public ExtendedResponse()
     {
@@ -89,5 +89,31 @@
     public void setResponse( OctetString response )
     {
         this.response = response;
+    }
+    
+    /**
+     * Get a String representation of an ExtendedResponse
+     *
+     * @return An ExtendedResponse String 
+     */
+    public String toString()
+    {
+
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( "    Extended Response\n" );
+        sb.append( super.toString() );
+        
+        if ( name != null )
+        {
+            sb.append( "        Response name :'").append( name.toString() ).append( "'\n"
);
+        }
+
+        if ( response != null )
+        {
+            sb.append( "        Response :'").append( response.toString() ).append( "'\n"
);
+        }
+
+        return sb.toString();
     }
 }

Modified: directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ExtendedResponseTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ExtendedResponseTest.java?rev=209415&r1=209414&r2=209415&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ExtendedResponseTest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ExtendedResponseTest.java
Tue Jul  5 23:31:52 2005
@@ -79,9 +79,10 @@
 
         stream.flip();
 
-        // Allocate a ExtendedResponse Container
+        // Allocate a LdapMessage Container
         IAsn1Container ldapMessageContainer = new LdapMessageContainer();
 
+        // Decode the ExtendedResponse PDU
         try
         {
             ldapDecoder.decode( stream, ldapMessageContainer );
@@ -92,6 +93,7 @@
             Assert.fail( de.getMessage() );
         }
     	
+        // Check the decoded ExtendedResponse PDU
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         ExtendedResponse extendedResponse      = message.getExtendedResponse();
 
@@ -133,9 +135,10 @@
 
         stream.flip();
 
-        // Allocate a ExtendedResponse Container
+        // Allocate a LdapMessage Container
         IAsn1Container ldapMessageContainer = new LdapMessageContainer();
 
+        // Decode the ExtendedResponse PDU
         try
         {
             ldapDecoder.decode( stream, ldapMessageContainer );
@@ -146,6 +149,7 @@
             Assert.fail( de.getMessage() );
         }
     	
+        // Check the decoded ExtendedResponse PDU
         LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
         ExtendedResponse extendedResponse      = message.getExtendedResponse();
 



Mime
View raw message