directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r124853 - /incubator/directory/dns/trunk/core/src/test/org/apache/dns/DnsTestCase.java
Date Tue, 11 Jan 2005 00:50:25 GMT
Author: erodriguez
Date: Mon Jan 10 16:50:24 2005
New Revision: 124853

URL: http://svn.apache.org/viewcvs?view=rev&rev=124853
Log:
Added more detailed print statement to base DNS test case for debugging.
Modified:
   incubator/directory/dns/trunk/core/src/test/org/apache/dns/DnsTestCase.java

Modified: incubator/directory/dns/trunk/core/src/test/org/apache/dns/DnsTestCase.java
Url: http://svn.apache.org/viewcvs/incubator/directory/dns/trunk/core/src/test/org/apache/dns/DnsTestCase.java?view=diff&rev=124853&p1=incubator/directory/dns/trunk/core/src/test/org/apache/dns/DnsTestCase.java&r1=124852&p2=incubator/directory/dns/trunk/core/src/test/org/apache/dns/DnsTestCase.java&r2=124853
==============================================================================
--- incubator/directory/dns/trunk/core/src/test/org/apache/dns/DnsTestCase.java	(original)
+++ incubator/directory/dns/trunk/core/src/test/org/apache/dns/DnsTestCase.java	Mon Jan 10
16:50:24 2005
@@ -24,9 +24,11 @@
 import junit.framework.TestCase;
 
 import org.apache.dns.messages.DnsMessage;
+import org.apache.dns.records.QuestionRecord;
+import org.apache.dns.records.ResourceRecord;
 
 
-public class DnsTestCase extends TestCase
+public abstract class DnsTestCase extends TestCase
 {
 	private static final int MINIMUM_DNS_DATAGRAM_SIZE = 576;
 	
@@ -44,6 +46,34 @@
 		System.out.println( message.getAnswerCount() );
 		System.out.println( message.getAuthorityCount() );
 		System.out.println( message.getAdditionalCount() );
+		
+		QuestionRecord[] questions = message.getQuestionRecords();
+		printQuestionRecords( questions );
+		
+		ResourceRecord[] records = message.getAnswerRecords();
+		printResourceRecords( records );
+		
+		records = message.getAuthorityRecords();
+		printResourceRecords( records );
+		
+		records = message.getAdditionalRecords();
+		printResourceRecords( records );
+	}
+	
+	protected void printQuestionRecords( QuestionRecord[] records )
+	{
+		for ( int ii = 0; ii < records.length; ii++ )
+		{
+			System.out.println( records[ ii ] );
+		}
+	}
+	
+	protected void printResourceRecords( ResourceRecord[] records )
+	{
+		for ( int ii = 0; ii < records.length; ii++ )
+		{
+			System.out.println( records[ ii ] );
+		}
 	}
 	
     protected ByteBuffer getByteBufferFromFile( String file ) throws IOException
@@ -60,6 +90,7 @@
         }
         
         is.close();
+        
         return ByteBuffer.wrap( bytes );
     }
 }

Mime
View raw message