Beispiel #1
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 #2
0
        private Node CreateNewNode(Label[] labels)
        {
            Node node = Db.createNode(labels);

            node.SetProperty(PROPERTY_KEY, Random.Next());
            return(node);
        }
Beispiel #3
0
 private void TestNodeCreationTransaction(Label label, int i)
 {
     using (Transaction transaction = Database.beginTx())
     {
         Node node = Database.createNode(label);
         node.SetProperty("property" + i, i);
         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.")));
        }