You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2014/03/18 16:12:55 UTC
svn commit: r1578949 [3/3] - in /jackrabbit/oak/trunk/oak-core/src:
main/java/org/apache/jackrabbit/oak/plugins/document/
main/java/org/apache/jackrabbit/oak/plugins/document/cache/
main/java/org/apache/jackrabbit/oak/plugins/document/memory/ main/java...
Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexQueryTest.java?rev=1578949&r1=1578948&r2=1578949&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexQueryTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexQueryTest.java Tue Mar 18 15:12:53 2014
@@ -77,7 +77,7 @@ public class OrderedPropertyIndexQueryTe
/**
* Query the index for retrieving all the entries
- *
+ *
* @throws CommitFailedException
* @throws ParseException
* @throws RepositoryException
@@ -106,7 +106,7 @@ public class OrderedPropertyIndexQueryTe
/**
* test the index for returning the items related to a single key
- *
+ *
* @throws CommitFailedException
* @throws ParseException
*/
@@ -125,7 +125,7 @@ public class OrderedPropertyIndexQueryTe
// getting the middle of the random list of nodes.
ValuePathTuple searchfor = nodes.get(NUMBER_OF_NODES / 2);
-
+
Map<String, PropertyValue> filter = ImmutableMap.of(ORDERED_PROPERTY,
PropertyValues.newString(searchfor.getValue()));
String query = "SELECT * FROM [%s] WHERE %s=$%s";
@@ -138,10 +138,10 @@ public class OrderedPropertyIndexQueryTe
setTravesalEnabled(true);
}
-
+
/**
* test the range query in case of '>' condition
- *
+ *
* @throws CommitFailedException
* @throws ParseException
*/
@@ -178,11 +178,11 @@ public class OrderedPropertyIndexQueryTe
setTravesalEnabled(true);
}
-
+
/**
* test the range query in case of '>=' condition
- * @throws CommitFailedException
- * @throws ParseException
+ * @throws CommitFailedException
+ * @throws ParseException
*/
@Test @Ignore("Disabling for now. Integration with OAK-622 and prioritising.")
public void queryGreaterEqualThan() throws CommitFailedException, ParseException {
@@ -221,10 +221,10 @@ public class OrderedPropertyIndexQueryTe
/**
* test the range query in case of '<' condition
- *
+ *
* in this case as we're ascending we're expecting an empty resultset with the proper
* provider. not the lowcost one.
- * @throws Exception
+ * @throws Exception
*/
@Test @Ignore("Disabling for now. Integration with OAK-622 and prioritising.")
public void queryLessThan() throws Exception {
@@ -259,10 +259,10 @@ public class OrderedPropertyIndexQueryTe
/**
* test the range query in case of '<=' condition
- *
+ *
* in this case as we're ascending we're expecting an empty resultset with the proper
* provider. not the lowcost one.
- * @throws Exception
+ * @throws Exception
*/
@Test @Ignore("Disabling for now. Integration with OAK-622 and prioritising.")
public void queryLessEqualThan() throws Exception {
@@ -295,7 +295,7 @@ public class OrderedPropertyIndexQueryTe
setTravesalEnabled(true);
}
-
+
@Test
public void queryAllEntriesWithOrderBy() throws CommitFailedException, ParseException, RepositoryException {
setTravesalEnabled(false);
@@ -346,7 +346,7 @@ public class OrderedPropertyIndexQueryTe
setTravesalEnabled(true);
}
-
+
@Test
public void planOderByNoWhere() throws IllegalArgumentException, RepositoryException,
CommitFailedException {
@@ -388,7 +388,7 @@ public class OrderedPropertyIndexQueryTe
assertEquals(ORDERED_PROPERTY, oe.getPropertyName());
assertEquals(QueryIndex.OrderEntry.Order.ASCENDING, oe.getOrder());
}
-
+
@Test
public void queryOrderByNonIndexedProperty() throws CommitFailedException, ParseException {
setTravesalEnabled(false);
@@ -456,16 +456,16 @@ public class OrderedPropertyIndexQueryTe
assertNotNull(plans);
assertEquals(0, plans.size());
}
-
+
/**
* tests the output of a plan where the query is asked with where conditions that are not indexed
* but the ORDER BY are on the indexed property
- *
+ *
* eg: SELECT * FROM [nt:base] WHERE pinned=1 ORDER BY lastModified
- *
- * @throws RepositoryException
- * @throws IllegalArgumentException
- * @throws CommitFailedException
+ *
+ * @throws RepositoryException
+ * @throws IllegalArgumentException
+ * @throws CommitFailedException
*/
@Test
public void planOrderAndWhereMixed() throws IllegalArgumentException, RepositoryException, CommitFailedException {
@@ -489,7 +489,7 @@ public class OrderedPropertyIndexQueryTe
final String nodeTypeName = JcrConstants.NT_BASE;
FilterImpl filter = createFilter(indexed, nodeTypeName);
filter.restrictProperty("somethingNotIndexed", Operator.EQUAL, PropertyValues.newLong(1L));
-
+
List<QueryIndex.OrderEntry> sortOrder = ImmutableList.of(createOrderEntry(
ORDERED_PROPERTY, order));
@@ -503,16 +503,16 @@ public class OrderedPropertyIndexQueryTe
assertEquals(QueryIndex.OrderEntry.Order.ASCENDING, p.getSortOrder()
.get(0).getOrder());
}
-
+
/**
* query the index in case of mixed situation
- *
+ *
* eg: SELECT * FROM [nt:base] WHERE pinned=1 ORDER BY lastModified
- *
- * @throws RepositoryException
- * @throws IllegalArgumentException
- * @throws CommitFailedException
- * @throws ParseException
+ *
+ * @throws RepositoryException
+ * @throws IllegalArgumentException
+ * @throws CommitFailedException
+ * @throws ParseException
*/
@Test
public void queryOrderAndWhereMixed() throws IllegalArgumentException, RepositoryException, CommitFailedException, ParseException {
@@ -530,14 +530,14 @@ public class OrderedPropertyIndexQueryTe
String where = "wholetthedogsout";
String value = "woof-woof-woof-woof";
-
+
// let's set the property that will have to be queried only on 2 nodes
Tree t = root.getTree(nodes.get(0).getPath());
t.setProperty(where, value);
t = root.getTree(nodes.get(1).getPath());
t.setProperty(where, value);
root.commit();
-
+
// querying
Iterator<? extends ResultRow> results;
String query = String.format(
Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java?rev=1578949&r1=1578948&r2=1578949&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java Tue Mar 18 15:12:53 2014
@@ -60,7 +60,7 @@ public class PropertyIndexTest {
private static final EditorHook HOOK = new EditorHook(
new IndexUpdateProvider(new PropertyIndexEditorProvider()));
-
+
@Test
public void costEstimation() throws Exception {
NodeState root = INITIAL_CONTENT;
@@ -84,14 +84,14 @@ public class PropertyIndexTest {
// Query the index
PropertyIndexLookup lookup = new PropertyIndexLookup(indexed);
double cost;
-
+
cost = lookup.getCost(f, "foo", PropertyValues.newString("x1"));
assertTrue("cost: " + cost, cost >= 6.5 && cost <= 7.5);
-
+
cost = lookup.getCost(f, "foo", PropertyValues.newString(
Arrays.asList("x1", "x2")));
assertTrue("cost: " + cost, cost >= 11.5 && cost <= 12.5);
-
+
cost = lookup.getCost(f, "foo", PropertyValues.newString(
Arrays.asList("x1", "x2", "x3", "x4", "x5")));
assertTrue("cost: " + cost, cost >= 26.5 && cost <= 27.5);
@@ -128,7 +128,7 @@ public class PropertyIndexTest {
// threshold for estimation (PropertyIndexLookup.MAX_COST) is at 100
int nodes = 101;
int levels = 12;
-
+
NodeBuilder data = builder;
for (int i = 0; i < levels; i++) {
data = data.child("l" + i);
Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/ValuePathTuple.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/ValuePathTuple.java?rev=1578949&r1=1578948&r2=1578949&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/ValuePathTuple.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/ValuePathTuple.java Tue Mar 18 15:12:53 2014
@@ -21,7 +21,7 @@ import com.google.common.base.Predicate;
/**
* convenience orderable object that represents a tuple of values and paths
- *
+ *
* where the values are the indexed keys from the index and the paths are the path which hold the
* key
*/
@@ -33,16 +33,16 @@ public class ValuePathTuple implements C
* convenience Predicate for easing the testing
*/
public static class GreaterThanPredicate implements Predicate<ValuePathTuple> {
- /**
- * the value for comparison
+ /**
+ * the value for comparison
*/
private String value;
-
+
/**
* whether we should include the value in the result
*/
private boolean include;
-
+
public GreaterThanPredicate(String value) {
this.value = value;
}
@@ -58,13 +58,13 @@ public class ValuePathTuple implements C
|| (include && value.equals(arg0.getValue()));
}
};
-
+
public static class LessThanPredicate implements Predicate<ValuePathTuple> {
- /**
- * the value for comparison
+ /**
+ * the value for comparison
*/
private String value;
-
+
/**
* whether we should include the value in the result
*/
@@ -84,9 +84,9 @@ public class ValuePathTuple implements C
return (value.compareTo(arg0.getValue()) > 0)
|| (include && value.equals(arg0.getValue()));
}
-
+
}
-
+
ValuePathTuple(String value, String path) {
this.value = value;
this.path = path;
Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/ValuePathTupleTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/ValuePathTupleTest.java?rev=1578949&r1=1578948&r2=1578949&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/ValuePathTupleTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/ValuePathTupleTest.java Tue Mar 18 15:12:53 2014
@@ -93,14 +93,14 @@ public class ValuePathTupleTest {
assertEquals("f", filtered.next().getValue());
assertFalse(filtered.hasNext());
}
-
+
@Test
public void lessThanPredicate() {
List<ValuePathTuple> data = ImmutableList.of(
new ValuePathTuple("a", "foobar"),
- new ValuePathTuple("b", "foobar"),
+ new ValuePathTuple("b", "foobar"),
new ValuePathTuple("c", "foobar"),
- new ValuePathTuple("d", "foobar"),
+ new ValuePathTuple("d", "foobar"),
new ValuePathTuple("e", "foobar"),
new ValuePathTuple("f", "foobar"));
Iterator<ValuePathTuple> filtered = Iterables.filter(data,
@@ -111,13 +111,13 @@ public class ValuePathTupleTest {
assertEquals("c", filtered.next().getValue());
assertEquals("d", filtered.next().getValue());
assertFalse(filtered.hasNext());
-
+
data = ImmutableList.of(
new ValuePathTuple("f", "foobar"),
new ValuePathTuple("e", "foobar"),
- new ValuePathTuple("d", "foobar"),
+ new ValuePathTuple("d", "foobar"),
new ValuePathTuple("c", "foobar"),
- new ValuePathTuple("b", "foobar"),
+ new ValuePathTuple("b", "foobar"),
new ValuePathTuple("a", "foobar")
);
filtered = Iterables.filter(data,
@@ -129,14 +129,14 @@ public class ValuePathTupleTest {
assertEquals("a", filtered.next().getValue());
assertFalse(filtered.hasNext());
}
-
+
@Test
public void lessThanEqualPredicate() {
List<ValuePathTuple> data = ImmutableList.of(
new ValuePathTuple("a", "foobar"),
- new ValuePathTuple("b", "foobar"),
+ new ValuePathTuple("b", "foobar"),
new ValuePathTuple("c", "foobar"),
- new ValuePathTuple("d", "foobar"),
+ new ValuePathTuple("d", "foobar"),
new ValuePathTuple("e", "foobar"),
new ValuePathTuple("f", "foobar"));
Iterator<ValuePathTuple> filtered = Iterables.filter(data,
Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategyTest.java?rev=1578949&r1=1578948&r2=1578949&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategyTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategyTest.java Tue Mar 18 15:12:53 2014
@@ -48,7 +48,7 @@ public class ContentMirrorStoreStrategyT
* <li>
* adds a few levels of nodes, nodes with an even index will have the
* 'match' property set</li>
- *
+ *
* <li>
* pruning in this case means that whatever path that doesn't have a 'match'
* property is considered dead weight and should be removed from the index</li>
@@ -132,7 +132,7 @@ public class ContentMirrorStoreStrategyT
IndexStoreStrategy store = new ContentMirrorStoreStrategy();
NodeState root = EMPTY_NODE;
NodeBuilder indexMeta = root.builder();
- NodeBuilder index = indexMeta.child(INDEX_CONTENT_NODE_NAME);
+ NodeBuilder index = indexMeta.child(INDEX_CONTENT_NODE_NAME);
store.update(index, "a", EMPTY, KEY);
store.update(index, "b", EMPTY, KEY);
Assert.assertTrue(
Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStorageStrategyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStorageStrategyTest.java?rev=1578949&r1=1578948&r2=1578949&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStorageStrategyTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStorageStrategyTest.java Tue Mar 18 15:12:53 2014
@@ -64,13 +64,13 @@ public class OrderedContentMirrorStorage
/**
* checks that the fist item/key is inserted with an empty property 'next'
- *
+ *
* expected structure:
- *
+ *
* <code>
* :index : {
* :start : { :next=n0 },
- * n0 : {
+ * n0 : {
* :next=,
* foo : {
* bar: { match=true}
@@ -110,14 +110,14 @@ public class OrderedContentMirrorStorage
/**
* test the saving of 2 new keys that comes already ordered
- *
+ *
* final state of the index will be
- *
+ *
* <code>
* :index : {
* :start : { :next=n0 },
* n0 : { :next=n1 },
- * n1 : { :next= }
+ * n1 : { :next= }
* }
* </code>
*/
@@ -132,7 +132,7 @@ public class OrderedContentMirrorStorage
NodeBuilder node = null;
// first node arrives
- store.update(index, path, EMPTY_KEY_SET, newHashSet(n0));
+ store.update(index, path, EMPTY_KEY_SET, newHashSet(n0));
node = index.getChildNode(START);
assertTrue(":index should have :start", node.exists());
@@ -143,7 +143,7 @@ public class OrderedContentMirrorStorage
assertEquals("n0 should point nowhere at this stage", "", node.getString(NEXT));
// second node arrives
- store.update(index, path, EMPTY_KEY_SET, newHashSet(n1));
+ store.update(index, path, EMPTY_KEY_SET, newHashSet(n1));
node = index.getChildNode(START);
assertTrue(":index should still have :start", node.exists());
@@ -174,7 +174,7 @@ public class OrderedContentMirrorStorage
/**
* test the iteration of the index with 2 shuffled items
- *
+ *
* <code>
* :index : {
* :start : { :next=n1 },
@@ -202,7 +202,7 @@ public class OrderedContentMirrorStorage
Iterable<ChildNodeEntry> children = (Iterable<ChildNodeEntry>) store.getChildNodeEntries(indexState);
assertNotNull("The iterable cannot be null", children);
- assertEquals("Expecting 2 items in the index", 2, Iterators.size(children.iterator()));
+ assertEquals("Expecting 2 items in the index", 2, Iterators.size(children.iterator()));
// ensuring the right sequence
ChildNodeEntry entry = null;
@@ -222,7 +222,7 @@ public class OrderedContentMirrorStorage
/**
* test the iteration of the index with 2 shuffled items without the :start
* node
- *
+ *
* <code>
* :index : {
* :start : { :next=n1 },
@@ -270,7 +270,7 @@ public class OrderedContentMirrorStorage
/**
* test the iteration of the index with 2 shuffled items including the
* :start node as first
- *
+ *
* <code>
* :index : {
* :start : { :next=n1 },
@@ -299,7 +299,7 @@ public class OrderedContentMirrorStorage
Iterable<ChildNodeEntry> children = (Iterable<ChildNodeEntry>) store.getChildNodeEntries(indexState, true);
assertNotNull("The iterable cannot be null", children);
- assertEquals("Expecting 3 items in the index", 3, Iterators.size(children.iterator()));
+ assertEquals("Expecting 3 items in the index", 3, Iterators.size(children.iterator()));
// ensuring the right sequence
ChildNodeEntry entry = null;
@@ -323,7 +323,7 @@ public class OrderedContentMirrorStorage
/**
* test the iteration over an empty list when the :start is required. In
* this case :start should always be returned
- *
+ *
* <code>
* :index : {
* :start : { :next= }
@@ -374,9 +374,9 @@ public class OrderedContentMirrorStorage
/**
* test the insert of two shuffled items
- *
+ *
* Building final a structure like
- *
+ *
* <code>
* :index : {
* :start : { :next=n1 },
@@ -384,23 +384,23 @@ public class OrderedContentMirrorStorage
* n1 : { :next=n0 }
* }
* </code>
- *
+ *
* where:
- *
+ *
* <code>
* Stage 1
* =======
- *
+ *
* :index : {
* :start : { :next = n0 },
* n0 : {
- * :next =
+ * :next =
* }
* }
- *
+ *
* Stage 2
* =======
- *
+ *
* :index : {
* :start : { :next = n1 },
* n0 : {
@@ -442,9 +442,9 @@ public class OrderedContentMirrorStorage
/**
* test the insert of shuffled items
- *
+ *
* Building a final structure like
- *
+ *
* <code>
* {
* :start : { :next = n1 },
@@ -459,42 +459,42 @@ public class OrderedContentMirrorStorage
* }
* }
* </code>
- *
+ *
* where:
- *
+ *
* <code>
* Stage 1
* =======
- *
+ *
* {
* :start : { :next = n0 },
* n0 : {
- * :next =
+ * :next =
* }
* }
- *
+ *
* Stage 2
* =======
- *
+ *
* {
* :start : { :next = n1 },
* n0 : { :next = },
* n1 : { :next = n0 }
* }
- *
+ *
* Stage 3
* =======
- *
+ *
* {
* :start : { :next = n1 },
* n0 : { :next = },
* n1 : { :next = n2 },
* n2 : { :next = n0 }
* }
- *
+ *
* Stage 4
* =======
- *
+ *
* {
* :start : { :next = n1 },
* n0 : { :next = n3 },
@@ -545,13 +545,13 @@ public class OrderedContentMirrorStorage
* perform a test where the index gets updated if an already existent
* node/key gets updated by changing the key and the key contains only 1
* item.
- *
+ *
* Where the second key is greater than the first.
- *
+ *
* <code>
* Stage 1
* =======
- *
+ *
* :index : {
* :start { :next = n0 },
* n0 : {
@@ -563,10 +563,10 @@ public class OrderedContentMirrorStorage
* }
* }
* }
- *
+ *
* Stage 2
* =======
- *
+ *
* :index : {
* :start : { :next = n1 },
* n1 : {
@@ -629,12 +629,12 @@ public class OrderedContentMirrorStorage
* <p>
* find a previous item given a key in an index with 1 element only
* </p>
- *
+ *
* <p>
* <i>it relies on the functionality of the store.update() for creating the
* index</i>
* </p>
- *
+ *
* <code>
* :index {
* :start : { :next=n0 },
@@ -662,16 +662,16 @@ public class OrderedContentMirrorStorage
/**
* test the use case where a document change the indexed property. For
* example document that change author.
- *
+ *
* <p>
* <i>it relies on the functionality of the store.update() for creating the
* index</i>
* </p>
- *
+ *
* <code>
* Stage 1
* =======
- *
+ *
* :index : {
* :start : { :next = n0 },
* n0 : {
@@ -682,10 +682,10 @@ public class OrderedContentMirrorStorage
* }
* }
* }
- *
+ *
* Stage 2
* =======
- *
+ *
* :index : {
* :start : { :next = n0 },
* n0 : {
@@ -776,16 +776,16 @@ public class OrderedContentMirrorStorage
/**
* test when a document is deleted and is the only one under the indexed key
- *
+ *
* <p>
* <i>it relies on the functionality of the store.update() for creating the
* index</i>
* </p>
- *
+ *
* <code>
* Stage 1
* =======
- *
+ *
* :index : {
* :start : { :next = n0 },
* n0 : {
@@ -793,10 +793,10 @@ public class OrderedContentMirrorStorage
* sampledoc : { match = true }
* }
* }
- *
+ *
* Stage 2
* =======
- *
+ *
* :index : {
* :start : { :next = }
* }
@@ -825,16 +825,16 @@ public class OrderedContentMirrorStorage
/**
* test when the document is deleted but there're still some documents left
* under the indexed key
- *
+ *
* <p>
* <i>it relies on the functionality of the store.update() for creating the
* index</i>
* </p>
- *
+ *
* <code>
* Stage 1
* =======
- *
+ *
* :index : {
* :start : { :next = n0 },
* n0 : {
@@ -843,10 +843,10 @@ public class OrderedContentMirrorStorage
* doc2 : { match=true }
* }
* }
- *
+ *
* Stage 2
* =======
- *
+ *
* :index : {
* :start : { :next = n0 },
* n0 : {
@@ -887,16 +887,16 @@ public class OrderedContentMirrorStorage
/**
* test when the only document is deleted from an indexed key but there're
* still some keys left in the index
- *
+ *
* <p>
* <i>it relies on the functionality of the store.update() for creating the
* index</i>
* </p>
- *
+ *
* <code>
* Stage 1
* =======
- *
+ *
* :index : {
* :start : { :next = n1 },
* n0 : {
@@ -918,10 +918,10 @@ public class OrderedContentMirrorStorage
* }
* }
* }
- *
+ *
* Stage 2
* =======
- *
+ *
* :index : {
* :start : { :next = n1 },
* n0 : {
@@ -937,7 +937,7 @@ public class OrderedContentMirrorStorage
* }
* }
* }
- *
+ *
* </code>
*/
@Test
@@ -984,12 +984,12 @@ public class OrderedContentMirrorStorage
assertTrue(index.getChildNode(n1).getChildNode(subNodes[0]).hasChildNode(subNodes[1]));
assertTrue(index.getChildNode(n1).getChildNode(subNodes[0]).getChildNode(subNodes[1]).getBoolean("match"));
}
-
+
/**
* <p>test the insertion of 2 already ordered items</p>
- *
+ *
* <p>expected</p>
- *
+ *
* <code>
* :index : {
* :start : { :next=n0 },
@@ -1013,42 +1013,42 @@ public class OrderedContentMirrorStorage
assertTrue("n1 should point nowhere",
Strings.isNullOrEmpty(index.getChildNode(n1).getString(NEXT)));
}
-
+
/**
* Tests the insert of 4 items that will always have to be added at the beginning of the list.
* Just to simulate the use-case of lastModified DESC.
- *
+ *
* <code>
* Stage 1
* =======
- *
+ *
* :index : {
* :start : { :next=n0 },
* n0 : { :next= }
* }
- *
+ *
* Stage 2
* =======
- *
+ *
* :index : {
* :start : { :next=n1 },
* n0 : { :next= },
* n1 : { :next=n0 }
* }
- *
+ *
* Stage 3
* =======
- *
+ *
* :index : {
* :start : { :next=n2 },
* n0 : { :next= },
* n1 : { :next=n0 },
* n2 : { :next=n1 }
* }
- *
+ *
* Stage 4
* =======
- *
+ *
* :index : {
* :start : { :next=n3 },
* n0 : { :next= },
@@ -1097,30 +1097,30 @@ public class OrderedContentMirrorStorage
assertTrue("n0 should point nowhere",
Strings.isNullOrEmpty(index.getChildNode(n0).getString(NEXT)));
}
-
+
/**
* test finding a previous item in a descending ordered index.
- *
+ *
* <code>
* Stage 1
* =======
- *
+ *
* :index {
* :start : { :next=n0 },
* n0 : { :next= }
* }
- *
+ *
* findPrevious(n0)=:start
- *
+ *
* Stage 2
* =======
- *
+ *
* :index {
* :start : { :next=n1 },
* n0 : { :next= }
* n1 : { :next=n0 }
* }
- *
+ *
* findPrevious(n0)=n1;
* </code>
*/
@@ -1133,14 +1133,14 @@ public class OrderedContentMirrorStorage
NodeState indexState;
NodeState previous;
NodeState node;
-
+
//Stage 1
store.update(index, "/a/b", EMPTY_KEY_SET, newHashSet(n0));
indexState = index.getNodeState();
node = indexState.getChildNode(n0);
previous = indexState.getChildNode(START);
assertEquals(previous, store.findPrevious(indexState, node).getNodeState());
-
+
//Stage 2
store.update(index, "/a/b", EMPTY_KEY_SET, newHashSet(n1));
indexState = index.getNodeState();
@@ -1148,13 +1148,13 @@ public class OrderedContentMirrorStorage
previous = indexState.getChildNode(n1);
assertEquals(previous, store.findPrevious(indexState, node).getNodeState());
}
-
+
/**
* test the insert of 1 item in a descending order index. it should not really matter but just
* checking we don't break anything
- *
+ *
* expecting
- *
+ *
* <code>
* :index : {
* :start : { :next = n0 },
@@ -1174,19 +1174,19 @@ public class OrderedContentMirrorStorage
assertTrue("the first node should point nowhere",
Strings.isNullOrEmpty(index.getChildNode(n0).getString(NEXT)));
}
-
+
/**
* test the insert of 4 shuffled items in a descending ordered index
- *
+ *
* expected:
- *
+ *
* <code>
* :index : {
* :start : { :next= n1},
- * n0 : { :next= n3},
- * n1 : { :next= n2},
- * n2: { :next= n0},
- * n3 : { :next= },
+ * n0 : { :next= n3},
+ * n1 : { :next= n2},
+ * n2: { :next= n0},
+ * n3 : { :next= },
* }
* </code>
*/
@@ -1209,11 +1209,11 @@ public class OrderedContentMirrorStorage
assertEquals("n2 should point to n1", n0, index.getChildNode(n2).getString(NEXT));
assertTrue("n3 should point nowhere",
Strings.isNullOrEmpty(index.getChildNode(n3).getString(NEXT)));
- }
-
+ }
+
/**
* test the iteration of the descending index with 2 shuffled items
- *
+ *
* <code>
* :index : {
* :start : { :next=n1 },
@@ -1266,9 +1266,9 @@ public class OrderedContentMirrorStorage
final String testDescendingName = "testdescending";
final int numberOfNodes = 1000;
final int maxNodeCount = 100;
-
+
NodeBuilder builder = EmptyNodeState.EMPTY_NODE.builder();
-
+
IndexUtils.createIndexDefinition(builder.child(IndexConstants.INDEX_DEFINITIONS_NAME),
testAscendingName, false, ImmutableList.of(orderedProperty), null, OrderedIndex.TYPE,
ImmutableMap.<String, String> of());
@@ -1280,25 +1280,25 @@ public class OrderedContentMirrorStorage
.getChildNode(testAscendingName).child(IndexConstants.INDEX_CONTENT_NODE_NAME);
NodeBuilder descendingContent = builder.getChildNode(IndexConstants.INDEX_DEFINITIONS_NAME)
.getChildNode(testDescendingName).child(IndexConstants.INDEX_CONTENT_NODE_NAME);
-
+
// adding some content under the index
for (int i = 0; i < numberOfNodes; i++) {
store.update(ascendingContent, "/foo/bar", EMPTY_KEY_SET, newHashSet("x" + NF.format(i)));
descendingStore.update(descendingContent, "/foo/bar", EMPTY_KEY_SET, newHashSet("x" + NF.format(i)));
}
-
+
assertEquals("wrong number of nodes encountered", numberOfNodes,
Iterables.size(store.getChildNodeEntries(ascendingContent.getNodeState())));
assertEquals("wrong number of nodes encountered", numberOfNodes,
Iterables.size(descendingStore.getChildNodeEntries(descendingContent.getNodeState())));
NodeState ascendingMeta = builder.getChildNode(IndexConstants.INDEX_DEFINITIONS_NAME)
- .getChildNode(testAscendingName).getNodeState();
+ .getChildNode(testAscendingName).getNodeState();
NodeState descendingMeta = builder.getChildNode(IndexConstants.INDEX_DEFINITIONS_NAME)
- .getChildNode(testDescendingName).getNodeState();
+ .getChildNode(testDescendingName).getNodeState();
Filter.PropertyRestriction pr = null;
-
+
// equality
String value = "x" + NF.format(11);
pr = new Filter.PropertyRestriction();
@@ -1320,7 +1320,7 @@ public class OrderedContentMirrorStorage
assertTrue(store.count(ascendingMeta, pr, maxNodeCount) > 0);
assertEquals(store.count(ascendingMeta, pr, maxNodeCount),
descendingStore.count(descendingMeta, pr, maxNodeCount));
-
+
// '>'
pr = new Filter.PropertyRestriction();
pr.first = PropertyValues.newString(value);
@@ -1353,7 +1353,7 @@ public class OrderedContentMirrorStorage
// code
assertTrue(descendingStore.count(descendingMeta, pr, maxNodeCount) > 0);
assertEquals(0, store.count(ascendingMeta, pr, maxNodeCount));
-
+
// when no conditions has been asked but just an ORDER BY
pr = null;
assertTrue(store.count(ascendingMeta, pr, maxNodeCount) > 0);
Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/MapRecordTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/MapRecordTest.java?rev=1578949&r1=1578948&r2=1578949&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/MapRecordTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/MapRecordTest.java Tue Mar 18 15:12:53 2014
@@ -63,7 +63,7 @@ public class MapRecordTest {
+ " _3j.cfe, _3j.cfs, _b.fdx, _b.fdt, _3g_1.del, _3k.si,"
+ " _3l.cfe, _3l.cfs, segments_33, _3f_1.del, _3h.cfe,"
+ " _3h.cfs, _b_4.del, _3f.cfe, _3f.cfs, _3g.cfe, _3g.cfs"));
-
+
for (String name : beforeNames) {
builder.setChildNode(name);
}