Search in sources :

Example 96 with MutableBoolean

use of org.apache.commons.lang3.mutable.MutableBoolean in project neo4j by neo4j.

the class GBPTreeConsistencyCheckerTestBase method assertReportAnyStructuralInconsistency.

private static <KEY, VALUE> void assertReportAnyStructuralInconsistency(GBPTree<KEY, VALUE> index) throws IOException {
    MutableBoolean called = new MutableBoolean();
    index.consistencyCheck(new GBPTreeConsistencyCheckVisitor.Adaptor<>() {

        @Override
        public void rightmostNodeHasRightSibling(long rightSiblingPointer, long rightmostNode, Path file) {
            called.setTrue();
        }

        @Override
        public void siblingsDontPointToEachOther(long leftNode, long leftNodeGeneration, long leftRightSiblingPointerGeneration, long leftRightSiblingPointer, long rightLeftSiblingPointer, long rightLeftSiblingPointerGeneration, long rightNode, long rightNodeGeneration, Path file) {
            called.setTrue();
        }

        @Override
        public void keysLocatedInWrongNode(KeyRange<KEY> range, KEY key, int pos, int keyCount, long pageId, Path file) {
            called.setTrue();
        }

        @Override
        public void pageIdSeenMultipleTimes(long pageId, Path file) {
            called.setTrue();
        }

        @Override
        public void childNodeFoundAmongParentNodes(KeyRange<KEY> superRange, int level, long pageId, Path file) {
            called.setTrue();
        }
    }, NULL);
    assertCalled(called);
}
Also used : Path(java.nio.file.Path) MutableBoolean(org.apache.commons.lang3.mutable.MutableBoolean)

Example 97 with MutableBoolean

use of org.apache.commons.lang3.mutable.MutableBoolean in project neo4j by neo4j.

the class GBPTreeConsistencyCheckerTestBase method assertReportDirtyOnStartup.

private static <KEY, VALUE> void assertReportDirtyOnStartup(GBPTree<KEY, VALUE> index) throws IOException {
    MutableBoolean called = new MutableBoolean();
    index.consistencyCheck(new GBPTreeConsistencyCheckVisitor.Adaptor<>() {

        @Override
        public void dirtyOnStartup(Path file) {
            called.setTrue();
        }
    }, NULL);
    assertCalled(called);
}
Also used : Path(java.nio.file.Path) MutableBoolean(org.apache.commons.lang3.mutable.MutableBoolean)

Example 98 with MutableBoolean

use of org.apache.commons.lang3.mutable.MutableBoolean in project neo4j by neo4j.

the class GBPTreeConsistencyCheckerTestBase method assertReportUnknownTreeNodeType.

private static <KEY, VALUE> void assertReportUnknownTreeNodeType(GBPTree<KEY, VALUE> index, long targetNode) throws IOException {
    MutableBoolean called = new MutableBoolean();
    index.consistencyCheck(new GBPTreeConsistencyCheckVisitor.Adaptor<>() {

        @Override
        public void unknownTreeNodeType(long pageId, byte treeNodeType, Path file) {
            called.setTrue();
            assertEquals(targetNode, pageId);
        }
    }, NULL);
    assertCalled(called);
}
Also used : Path(java.nio.file.Path) MutableBoolean(org.apache.commons.lang3.mutable.MutableBoolean)

Example 99 with MutableBoolean

use of org.apache.commons.lang3.mutable.MutableBoolean in project neo4j by neo4j.

the class GBPTreeConsistencyCheckerTestBase method assertReportSpaceAreasNotSummingToTotalSpace.

private static <KEY, VALUE> void assertReportSpaceAreasNotSummingToTotalSpace(GBPTree<KEY, VALUE> index, long targetNode) throws IOException {
    MutableBoolean called = new MutableBoolean();
    index.consistencyCheck(new GBPTreeConsistencyCheckVisitor.Adaptor<>() {

        @Override
        public void nodeMetaInconsistency(long pageId, String message, Path file) {
            called.setTrue();
            assertEquals(targetNode, pageId);
            assertThat(message).contains("Space areas did not sum to total space");
        }
    }, NULL);
    assertCalled(called);
}
Also used : Path(java.nio.file.Path) MutableBoolean(org.apache.commons.lang3.mutable.MutableBoolean)

Example 100 with MutableBoolean

use of org.apache.commons.lang3.mutable.MutableBoolean in project neo4j by neo4j.

the class GBPTreeConsistencyCheckerTestBase method assertReportKeysLocatedInWrongNode.

private static <KEY, VALUE> void assertReportKeysLocatedInWrongNode(GBPTree<KEY, VALUE> index, long targetNode) throws IOException {
    Set<Long> allNodesWithKeysLocatedInWrongNode = new HashSet<>();
    MutableBoolean called = new MutableBoolean();
    index.consistencyCheck(new GBPTreeConsistencyCheckVisitor.Adaptor<>() {

        @Override
        public void keysLocatedInWrongNode(KeyRange<KEY> range, KEY key, int pos, int keyCount, long pageId, Path file) {
            called.setTrue();
            allNodesWithKeysLocatedInWrongNode.add(pageId);
        }
    }, NULL);
    assertCalled(called);
    assertTrue(allNodesWithKeysLocatedInWrongNode.contains(targetNode));
}
Also used : Path(java.nio.file.Path) MutableBoolean(org.apache.commons.lang3.mutable.MutableBoolean) HashSet(java.util.HashSet)

Aggregations

MutableBoolean (org.apache.commons.lang3.mutable.MutableBoolean)107 Test (org.junit.Test)28 Path (java.nio.file.Path)26 Test (org.junit.jupiter.api.Test)17 IOException (java.io.IOException)16 ArrayList (java.util.ArrayList)12 Query (org.apache.apex.malhar.lib.appdata.schemas.Query)11 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)11 List (java.util.List)9 AMutableInt64 (org.apache.asterix.om.base.AMutableInt64)8 MutableInt (org.apache.commons.lang3.mutable.MutableInt)7 MutableLong (org.apache.commons.lang3.mutable.MutableLong)7 Collections (java.util.Collections)6 AMutableDouble (org.apache.asterix.om.base.AMutableDouble)6 Set (java.util.Set)5 Assertions.assertFalse (org.junit.jupiter.api.Assertions.assertFalse)5 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)5 PageCache (org.neo4j.io.pagecache.PageCache)5 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 ClassAd (org.apache.asterix.external.classad.ClassAd)4