diff options
| author | reger <reger18@arcor.de> | 2014-07-06 20:41:26 +0200 |
|---|---|---|
| committer | reger <reger18@arcor.de> | 2014-07-06 20:41:26 +0200 |
| commit | 1f2eba977ddbc41bdd2d2434e8a61badd9c110a6 (patch) | |
| tree | 9ba462ce6338fafa74d0136909007d7fe98a9491 /test | |
| parent | 2ba394333f00c9d3c99de68ce2fe58d5539da6cc (diff) | |
add test case for Records (used in HostBalancer)
- simulating seek error (http://mantis.tokeek.de/view.php?id=411)
Diffstat (limited to 'test')
| -rw-r--r-- | test/net/yacy/kelondro/io/RecordsTest.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/test/net/yacy/kelondro/io/RecordsTest.java b/test/net/yacy/kelondro/io/RecordsTest.java new file mode 100644 index 000000000..6b49e5a47 --- /dev/null +++ b/test/net/yacy/kelondro/io/RecordsTest.java @@ -0,0 +1,52 @@ +
+package net.yacy.kelondro.io;
+
+import java.io.File;
+import net.yacy.cora.document.encoding.ASCII;
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+
+public class RecordsTest {
+
+ final String tesDir = "test/DATA/INDEX/QUEUE";
+
+ /**
+ * Test of cleanLast method, of class Records.
+ */
+ @Test
+ public void testCleanLast_byteArr_int() throws Exception {
+
+ File tablefile = new File(tesDir, "test.stack");
+
+ byte[] b = ASCII.getBytes("testDataString");
+ Records rec = new Records(tablefile, b.length);
+
+ rec.add(b, 0); // add some data
+
+ for (int i = 0; i < 5; i++) { // multiple cleanlast
+ rec.cleanLast(b, 0);
+ }
+ assertEquals(0,rec.size());
+ rec.close();
+ }
+
+ /**
+ * Test of cleanLast method, of class Records.
+ */
+ @Test
+ public void testCleanLast() throws Exception {
+
+ File tablefile = new File (tesDir,"test.stack");
+
+ byte[] b = ASCII.getBytes("testdata");
+ Records rec = new Records(tablefile, b.length);
+
+ rec.add(b, 0); // add data
+ for (int i = 0; i < 5; i++) { // multiple cleanLast
+ rec.cleanLast();
+ }
+ assertEquals(0,rec.size());
+ rec.close();
+ }
+}
|
