printSkipList(index);
// testing the exception in case of wrong parameters
String searchFor = "wedontcareaswetesttheexception";
NodeState node = index.getChildNode(searchFor);
ChildNodeEntry entry = new OrderedChildNodeEntry(
searchFor, node);
ChildNodeEntry[] wl = new ChildNodeEntry[0];
ChildNodeEntry item = null;
ChildNodeEntry lane0, lane1, lane2, lane3;
try {
item = store.seek(index,
new OrderedContentMirrorStoreStrategy.PredicateEquals(searchFor), wl);
fail("With a wrong size for the lane it should have raised an exception");
} catch (IllegalArgumentException e) {
// so far so good. It was expected
}
// testing equality
searchFor = n12;
lane3 = new OrderedChildNodeEntry(START, index.getChildNode(START));
lane2 = new OrderedChildNodeEntry(START, index.getChildNode(START));
lane1 = new OrderedChildNodeEntry(START, index.getChildNode(START));
lane0 = new OrderedChildNodeEntry(START, index.getChildNode(START));
entry = new OrderedChildNodeEntry(searchFor,
index.getChildNode(searchFor));
wl = new ChildNodeEntry[OrderedIndex.LANES];
item = store.seek(index,
new OrderedContentMirrorStoreStrategy.PredicateEquals(searchFor), wl);
assertNotNull(wl);
assertEquals(OrderedIndex.LANES, wl.length);
assertEquals("Wrong lane", lane0, wl[0]);
assertEquals("Wrong lane", lane1, wl[1]);
assertEquals("Wrong lane", lane2, wl[2]);
assertEquals("Wrong lane", lane3, wl[3]);
assertEquals("Wrong item returned", entry, item);
searchFor = n08;
lane3 = new OrderedChildNodeEntry(START, index.getChildNode(START));
lane2 = new OrderedChildNodeEntry(n09, index.getChildNode(n09));
lane1 = new OrderedChildNodeEntry(n09, index.getChildNode(n09));
lane0 = new OrderedChildNodeEntry(n09, index.getChildNode(n09));
entry = new OrderedChildNodeEntry(searchFor,
index.getChildNode(searchFor));
wl = new ChildNodeEntry[OrderedIndex.LANES];
item = store.seek(index,
new OrderedContentMirrorStoreStrategy.PredicateEquals(searchFor), wl);
assertNotNull(wl);
assertEquals(OrderedIndex.LANES, wl.length);
assertEquals("Wrong lane", lane0, wl[0]);
assertEquals("Wrong lane", lane1, wl[1]);
assertEquals("Wrong lane", lane2, wl[2]);
assertEquals("Wrong lane", lane3, wl[3]);
assertEquals("Wrong item returned", entry, item);
searchFor = n06;
lane3 = new OrderedChildNodeEntry(START, index.getChildNode(START));
lane2 = new OrderedChildNodeEntry(n09, index.getChildNode(n09));
lane1 = new OrderedChildNodeEntry(n07, index.getChildNode(n07));
lane0 = new OrderedChildNodeEntry(n07, index.getChildNode(n07));
entry = new OrderedChildNodeEntry(searchFor,
index.getChildNode(searchFor));
wl = new ChildNodeEntry[OrderedIndex.LANES];
item = store.seek(index,
new OrderedContentMirrorStoreStrategy.PredicateEquals(searchFor), wl);
assertNotNull(wl);