From 05875933ae6929bc8e53f366ce116f2fc431fd46 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Fri, 27 Jul 2007 21:06:35 +0000
Subject: [PATCH] These set of changes implement VLV and filter capability to OpenDS:

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestVerifyJob.java |   92 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 92 insertions(+), 0 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestVerifyJob.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestVerifyJob.java
index fe22ecd..6b57090 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestVerifyJob.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestVerifyJob.java
@@ -373,6 +373,53 @@
     }
   }
 
+  /**
+   * Runs clean verify against the testvlvindex VLV index
+   * after adding various errors to each of these index files.
+   * @throws Exception if the error count is not equal to 6.
+   */
+  @Test() public void testCleanVLV() throws Exception {
+    String indexName = "testvlvindex";
+    preTest(4);
+    eContainer.sharedLock.lock();
+    try
+    {
+      VLVIndex vlvIndex = eContainer.getVLVIndex(indexName);
+
+      // Add an incorrectly ordered values.
+      SortValuesSet svs =
+          vlvIndex.getSortValuesSet(null, 0, new AttributeValue[3]);
+      long id = svs.getEntryIDs()[0];
+      Entry entry = eContainer.getID2Entry().get(null, new EntryID(id));
+
+      SortValuesSet svs2 = svs.split(2);
+      svs2.add(id, vlvIndex.getSortValues(entry));
+
+      // Add an invalid ID
+      svs2.add(1000, vlvIndex.getSortValues(entry));
+
+      // Muck up the values of another ID
+      id = svs.getEntryIDs()[0];
+      entry = eContainer.getID2Entry().get(null, new EntryID(id));
+      AttributeValue[] values = vlvIndex.getSortValues(entry);
+      AttributeValue[] badValues = new AttributeValue[values.length];
+      System.arraycopy(values, 1, badValues, 0, values.length - 1);
+      badValues[badValues.length-1] = values[0];
+      svs.remove(id, values);
+      svs.add(id, badValues);
+
+      vlvIndex.putSortValuesSet(null, svs);
+      vlvIndex.putSortValuesSet(null, svs2);
+      performBECleanVerify("vlv." + indexName, 3);
+    }
+    finally
+    {
+      eContainer.sharedLock.unlock();
+    }
+
+  }
+
+
   /*
      * Begin complete verify index tests. As described above, these are
      * tests that cursor through the id2entry database and validate
@@ -631,6 +678,51 @@
     }
   }
 
+  /**
+   * Runs complete verify against the testvlvindex VLV index
+   * after adding various errors to each of these index files.
+   * @throws Exception if the error count is not equal to 6.
+   */
+  @Test() public void testVerifyVLV() throws Exception {
+    String indexName = "testvlvindex";
+    preTest(4);
+    eContainer.sharedLock.lock();
+    try
+    {
+      VLVIndex vlvIndex = eContainer.getVLVIndex(indexName);
+
+      // Remove an ID
+      SortValuesSet svs =
+          vlvIndex.getSortValuesSet(null, 0, new AttributeValue[3]);
+      long id = svs.getEntryIDs()[0];
+      Entry entry = eContainer.getID2Entry().get(null, new EntryID(id));
+      svs.remove(id, vlvIndex.getSortValues(entry));
+
+      // Add an incorrectly ordered values.
+      SortValuesSet svs2 = svs.split(2);
+      svs2.add(1000, vlvIndex.getSortValues(entry));
+
+      // Muck up the values of another ID
+      id = svs.getEntryIDs()[0];
+      entry = eContainer.getID2Entry().get(null, new EntryID(id));
+      AttributeValue[] values = vlvIndex.getSortValues(entry);
+      AttributeValue[] badValues = new AttributeValue[values.length];
+      System.arraycopy(values, 1, badValues, 0, values.length - 1);
+      badValues[badValues.length-1] = values[0];
+      svs.remove(id, values);
+      svs.add(id, badValues);
+
+      vlvIndex.putSortValuesSet(null, svs);
+      vlvIndex.putSortValuesSet(null, svs2);
+      performBECompleteVerify("vlv." + indexName, 3);
+    }
+    finally
+    {
+      eContainer.sharedLock.unlock();
+    }
+
+  }
+
   /* Various tests not either clean or complete */
 
 

--
Gitblit v1.10.0