Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void multipleCorruptionsInFusionIndex() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MultipleCorruptionsInFusionIndex()
        {
            Setup(GraphDatabaseSettings.SchemaIndex.NATIVE20, db =>
            {
                using (Transaction tx = Db.beginTx())
                {
                    // Also make sure we have some numbers
                    for (int i = 0; i < 1000; i++)
                    {
                        Node node = Db.createNode(_label);
                        node.setProperty(PROP_KEY1, i);
                        Node secondNode = Db.createNode(_label);
                        secondNode.setProperty(PROP_KEY1, LocalDate.ofEpochDay(i));
                    }
                    tx.success();
                }
            });

            File[] indexFiles = SchemaIndexFiles();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.List<java.io.File> files = corruptIndexes(true, (tree, inspection) ->
            IList <File> files = CorruptIndexes(true, (tree, inspection) =>
            {
                long leafNode     = inspection.LeafNodes.get(1);
                long internalNode = inspection.InternalNodes.get(0);
                tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(leafNode, GBPTreeCorruption.rightSiblingPointToNonExisting()));
                tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(internalNode, GBPTreeCorruption.setChild(0, internalNode)));
            }, indexFiles);

            ConsistencyCheckService.Result result = RunConsistencyCheck();
            foreach (File file in files)
            {
                AssertResultContainsMessage(result, "Index file: " + file.AbsolutePath);
            }
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void childNodeFoundAmongParentNodes() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ChildNodeFoundAmongParentNodes()
        {
            Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10);
            File[] indexFiles = SchemaIndexFiles();
            CorruptIndexes(true, (tree, inspection) =>
            {
                long rootNode = inspection.RootNode;
                tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(rootNode, GBPTreeCorruption.setChild(0, rootNode)));
            }, indexFiles);

            ConsistencyCheckService.Result result = RunConsistencyCheck();

            assertFalse("Expected store to be considered inconsistent.", result.Successful);
            AssertResultContainsMessage(result, "Circular reference, child tree node found among parent nodes. Parents:");
        }