public abstract class AbstractTupleCursorTestCase extends TestCase2
ITupleCursor
test suites.TestCase2.MyProperties, TestCase2.RandomType
_randomType, log
Constructor and Description |
---|
AbstractTupleCursorTestCase() |
AbstractTupleCursorTestCase(String arg0) |
Modifier and Type | Method and Description |
---|---|
static void |
assertEquals(ITuple expected,
ITuple actual)
Compares two tuples for equality based on their data (flags, keys,
values, deleted marker, and version timestamp).
|
protected void |
doBaseCaseTest(AbstractBTree btree)
Test helper tests first(), last(), next(), prior(), and seek() given a
B+Tree that has been pre-populated with some known tuples.
|
protected void |
doEmptyIndexTest(AbstractBTree btree)
Test helper tests for fence posts when the index is empty
|
protected void |
doOneTupleTest(AbstractBTree btree)
Test helper for fence posts when there is only a single tuple.
|
protected void |
doReverseTraversalTest(AbstractBTree btree)
Unit test for reverse traversal under a variety of edge cases.
|
protected BTree |
getBaseCaseBTree()
Return a B+Tree populated with data for
doBaseCaseTest(AbstractBTree) . |
protected BTree |
getOneTupleBTree()
Creates, populates and returns a
BTree for
doOneTupleTest(AbstractBTree) |
protected BTree |
getReverseTraversalBTree()
Return a B+Tree populated with data for
doReverseTraversalTest(AbstractBTree) . |
protected ITupleCursor2<String> |
newCursor(AbstractBTree btree)
Create an appropriate cursor instance for the given B+Tree.
|
protected abstract ITupleCursor2<String> |
newCursor(AbstractBTree btree,
int flags,
byte[] fromKey,
byte[] toKey)
Create an appropriate cursor instance for the given B+Tree.
|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEqualsWithinUlps, assertSameArray, assertSameArray, assertSameBigDecimal, assertSameBigDecimal, assertSameBigInteger, assertSameBigInteger, assertSameIterator, assertSameIterator, assertSameIteratorAnyOrder, assertSameIteratorAnyOrder, assertSameValue, assertSameValue, assertZeroUlps, assertZeroUlps, fail, getInnerCause, getNormalInt, getProjectBuildPath, getProperties, getRandomObject, getRandomObject, getRandomOrder, getRandomString, getTestInputStream, getTestResource, getTestResource, getUlps, getUlps, isDEBUG, isDEBUG, isINFO, isINFO, isInnerCause, logProperties
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
public AbstractTupleCursorTestCase()
public AbstractTupleCursorTestCase(String arg0)
arg0
- protected abstract ITupleCursor2<String> newCursor(AbstractBTree btree, int flags, byte[] fromKey, byte[] toKey)
btree
- flags
- fromKey
- toKey
- ITupleCursor
for that B+Tree.protected ITupleCursor2<String> newCursor(AbstractBTree btree)
btree
- protected BTree getBaseCaseBTree()
doBaseCaseTest(AbstractBTree)
.protected void doBaseCaseTest(AbstractBTree btree)
btree
- The B+Tree.getBaseCaseBTree()
protected BTree getReverseTraversalBTree()
doReverseTraversalTest(AbstractBTree)
.
Note: this unit test is setup to create a B+Tree with 2 leaves and a root node. This allows us to test the edge case where reverse traversal begins with a key that is LTE the first key in the 2nd leaf.
Note: This unit test does not work for the IndexSegment
because
the IndexSegmentBuilder
will fill up each leaf in turn, so the
first leaf winds up with 3 tuples and the second with only 2 rather than
it being the other way around.
protected void doReverseTraversalTest(AbstractBTree btree)
(10,Bryan) (20,Mike) and (30,James) (40,Amy) (50,Mary)This allows us to test the edge case where reverse traversal begins with a key that is LTE the first key in the 2nd leaf.
btree
- protected void doEmptyIndexTest(AbstractBTree btree)
Note: this test can not be written for an IndexSegment
since you
can't have an empty IndexSegment
.
btree
- An empty B+Tree.protected BTree getOneTupleBTree()
BTree
for
doOneTupleTest(AbstractBTree)
protected void doOneTupleTest(AbstractBTree btree)
btree
- public static void assertEquals(ITuple expected, ITuple actual)
Note: This will fail if you apply it to tuples reported by
ITupleIterator
s whose DELETE flag was different since it verifies
the DELETE flag state and that is a property of the iterator NOT the
tuple. Whether or not a tuple is deleted is detected using
ITuple.isDeletedVersion()
.
expected
- actual
- Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.