Author: otis
Date: Thu Sep  7 22:38:25 2006
New Revision: 441382

URL: http://svn.apache.org/viewvc?view=rev&rev=441382
Log:
- NUTCH-354, Stefan's unit test - it passes

Modified:
    lucene/nutch/trunk/src/test/org/apache/nutch/crawl/TestMapWritable.java

Modified: 
lucene/nutch/trunk/src/test/org/apache/nutch/crawl/TestMapWritable.java
URL: 
http://svn.apache.org/viewvc/lucene/nutch/trunk/src/test/org/apache/nutch/crawl/TestMapWritable.java?view=diff&rev=441382&r1=441381&r2=441382
==============================================================================
--- lucene/nutch/trunk/src/test/org/apache/nutch/crawl/TestMapWritable.java 
(original)
+++ lucene/nutch/trunk/src/test/org/apache/nutch/crawl/TestMapWritable.java Thu 
Sep  7 22:38:25 2006
@@ -180,6 +180,31 @@
     assertEquals(before, after);
   }
 
+  public void testRecycling() throws Exception {
+    UTF8 value = new UTF8("value");
+    UTF8 key1 = new UTF8("a");
+    UTF8 key2 = new UTF8("b");
+
+    MapWritable writable = new MapWritable();
+    writable.put(key1, value);
+    assertEquals(writable.get(key1), value);
+    assertNull(writable.get(key2));
+
+    DataOutputBuffer dob = new DataOutputBuffer();
+    writable.write(dob);
+    writable.clear();
+    writable.put(key1, value);
+    writable.put(key2, value);
+    assertEquals(writable.get(key1), value);
+    assertEquals(writable.get(key2), value);
+
+    DataInputBuffer dib = new DataInputBuffer();
+    dib.reset(dob.getData(), dob.getLength());
+    writable.readFields(dib);
+    assertEquals(writable.get(key1), value);
+    assertNull(writable.get(key2));
+  }
+
   public static void main(String[] args) throws Exception {
     TestMapWritable writable = new TestMapWritable();
     writable.testPerformance();



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nutch-cvs mailing list
Nutch-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nutch-cvs

Reply via email to