From 82e6916afd99e3375c5177eb85486a8dcda30f75 Mon Sep 17 00:00:00 2001
From: Vikas Saurabh <vsaurabh@adobe.com>
Date: Thu, 11 Dec 2014 04:21:37 +0530
Subject: [PATCH 5/5] OAK-2341: Missed updating expectation of
 PropertyIndexTest with new approximating method

---
 .../oak/plugins/index/property/PropertyIndexTest.java         | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
 mode change 100644 => 100755 oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java

diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
old mode 100644
new mode 100755
index 4536fbf..c9161cf
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
@@ -23,6 +23,7 @@ import static org.apache.jackrabbit.JcrConstants.NT_FILE;
 import static org.apache.jackrabbit.JcrConstants.NT_UNSTRUCTURED;
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NAME;
 import static org.apache.jackrabbit.oak.plugins.index.IndexUtils.createIndexDefinition;
+import static org.apache.jackrabbit.oak.plugins.index.counter.NodeCounterEditor.COUNT_PROPERTY_NAME;
 import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
 import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.JCR_NODE_TYPES;
 import static org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent.INITIAL_CONTENT;
@@ -123,6 +124,7 @@ public class PropertyIndexTest {
                 true, false, ImmutableSet.of("foo"), null);
         // disable the estimation
         index.setProperty("entryCount", -1);
+        builder.setProperty(COUNT_PROPERTY_NAME, (long)MANY * 2, Type.LONG);
         NodeState before = builder.getNodeState();
 
         NodeBuilder path1 = builder.child("path1");
@@ -132,6 +134,7 @@ public class PropertyIndexTest {
             path1.child("n" + i).setProperty("foo", "x" + i % 20);
             path2.child("n" + i).setProperty("foo", "x" + i % 20);
         }
+        path1.setProperty(COUNT_PROPERTY_NAME, (long)MANY, Type.LONG);
         NodeState after = builder.getNodeState();
 
         NodeState indexed = HOOK.processCommit(before, after, CommitInfo.EMPTY);
@@ -144,19 +147,19 @@ public class PropertyIndexTest {
         double cost;
 
         cost = lookup.getCost(f, "foo", PropertyValues.newString("x1"));
-        assertTrue("cost: " + cost, cost >= 6.5 && cost <= 7.5);
+        assertTrue("cost: " + cost, cost >= 7.5 && cost <= 8.5);
 
         cost = lookup.getCost(f, "foo", PropertyValues.newString(
                 Arrays.asList("x1", "x2")));
-        assertTrue("cost: " + cost, cost >= 11.5 && cost <= 12.5);
+        assertTrue("cost: " + cost, cost >= 14.5 && cost <= 15.5);
 
         cost = lookup.getCost(f, "foo", PropertyValues.newString(
                 Arrays.asList("x1", "x2", "x3", "x4", "x5")));
-        assertTrue("cost: " + cost, cost >= 26.5 && cost <= 27.5);
+        assertTrue("cost: " + cost, cost >= 34.5 && cost <= 35.5);
 
         cost = lookup.getCost(f, "foo", PropertyValues.newString(
                 Arrays.asList("x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x0")));
-        assertTrue("cost: " + cost, cost >= 51.5 && cost <= 52.5);
+        assertTrue("cost: " + cost, cost >= 81.5 && cost <= 82.5);
 
         cost = lookup.getCost(f, "foo", null);
         assertTrue("cost: " + cost, cost >= MANY);
-- 
2.1.1

