Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void reportNotCleanNativeIndex() throws java.io.IOException, org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ReportNotCleanNativeIndex()
        {
            DatabaseLayout databaseLayout = Db.databaseLayout();

            SomeData();
            ResolveComponent(typeof(CheckPointer)).forceCheckPoint(new SimpleTriggerInfo("forcedCheckpoint"));
            File indexesCopy  = databaseLayout.File("indexesCopy");
            File indexSources = ResolveComponent(typeof(DefaultIndexProviderMap)).DefaultProvider.directoryStructure().rootDirectory();

            copyRecursively(indexSources, indexesCopy, _sourceCopyFileFilter);

            using (Transaction tx = Db.beginTx())
            {
                CreateNewNode(new Label[] { LABEL_ONE });
                tx.Success();
            }

            Db.shutdownAndKeepStore();

            copyRecursively(indexesCopy, indexSources);

            ConsistencyCheckService.Result result = FullConsistencyCheck();
            assertFalse("Expected consistency check to fail", result.Successful);
            assertThat(ReadReport(result), hasItem(containsString("WARN : Index was not properly shutdown and rebuild is required.")));
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void takeLabelLockForQueryWithIndexUsages() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TakeLabelLockForQueryWithIndexUsages()
        {
            string labelName   = "Human";
            Label  human       = Label.label(labelName);
            string propertyKey = "name";

            CreateIndex(human, propertyKey);

            using (Transaction transaction = DatabaseRule.beginTx())
            {
                Node node = DatabaseRule.createNode(human);
                node.SetProperty(propertyKey, RandomStringUtils.randomAscii(10));
                transaction.Success();
            }

            string query = "MATCH (n:" + labelName + ") where n." + propertyKey + " = \"Fry\" RETURN n ";

            IList <LockOperationRecord> lockOperationRecords = TraceQueryLocks(query);

            assertThat("Observed list of lock operations is: " + lockOperationRecords, lockOperationRecords, hasSize(1));

            LockOperationRecord operationRecord = lockOperationRecords[0];

            assertTrue(operationRecord.Acquisition);
            assertFalse(operationRecord.Exclusive);
            assertEquals(ResourceTypes.LABEL, operationRecord.ResourceType);
        }
Beispiel #3
0
 private void RemoveOldNodes(LongStream idRange)
 {
     using (Transaction transaction = Database.beginTx())
     {
         idRange.mapToObj(id => Database.getNodeById(id)).forEach(Node.delete);
         transaction.Success();
     }
 }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void reportNotCleanLabelIndex() throws java.io.IOException, org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ReportNotCleanLabelIndex()
        {
            DatabaseLayout databaseLayout = Db.databaseLayout();

            SomeData();
            Db.resolveDependency(typeof(CheckPointer)).forceCheckPoint(new SimpleTriggerInfo("forcedCheckpoint"));
            File labelIndexFileCopy = databaseLayout.File("label_index_copy");

            copyFile(databaseLayout.LabelScanStore(), labelIndexFileCopy);

            using (Transaction tx = Db.beginTx())
            {
                Db.createNode(LABEL_ONE);
                tx.Success();
            }

            Db.shutdownAndKeepStore();

            copyFile(labelIndexFileCopy, databaseLayout.LabelScanStore());

            ConsistencyCheckService.Result result = FullConsistencyCheck();
            assertFalse("Expected consistency check to fail", result.Successful);
            assertThat(ReadReport(result), hasItem(containsString("WARN : Label index was not properly shutdown and rebuild is required.")));
        }