Beispiel #1
0
        private IndexReference IndexId([email protected] tx)
        {
            int labelId       = tx.TokenRead().nodeLabel(_label.name());
            int propertyKeyId = tx.TokenRead().propertyKey(_property);

            return(tx.SchemaRead().index(labelId, propertyKeyId));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRecoverTheCountsStoreEvenWhenIfNeoStoreDoesNotNeedRecovery() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRecoverTheCountsStoreEvenWhenIfNeoStoreDoesNotNeedRecovery()
        {
            // given
            CreateNode("A");
            CheckPoint();
            CreateNode("B");
            FlushNeoStoreOnly();

            // when
            CrashAndRestart();

            // then
            using ([email protected] tx = (( GraphDatabaseAPI )_db).DependencyResolver.resolveDependency(typeof(Kernel)).beginTransaction(@explicit, AUTH_DISABLED))
            {
                assertEquals(1, tx.DataRead().countsForNode(tx.TokenRead().nodeLabel("A")));
                assertEquals(1, tx.DataRead().countsForNode(tx.TokenRead().nodeLabel("B")));
                assertEquals(2, tx.DataRead().countsForNode(NO_TOKEN));
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void verifyThatThereAreExactlyOneIndexEntryPerNodeInTheIndexes(int i, org.neo4j.helpers.collection.Pair<long[],long[]> data) throws Exception
        private void VerifyThatThereAreExactlyOneIndexEntryPerNodeInTheIndexes(int i, Pair <long[], long[]> data)
        {
            Kernel kernel = Db.DependencyResolver.resolveDependency(typeof(Kernel));

            using ([email protected] tx = kernel.BeginTransaction(@implicit, AnonymousContext.read()))
            {
                int            labelAId = tx.TokenRead().nodeLabel(LabelA(i).name());
                int            keyAId   = tx.TokenRead().propertyKey(KeyA(i));
                int            labelBId = tx.TokenRead().nodeLabel(LabelB(i).name());
                int            keyBId   = tx.TokenRead().propertyKey(KeyB(i));
                IndexReference indexA   = TestIndexDescriptorFactory.forLabel(labelAId, keyAId);
                IndexReference indexB   = TestIndexDescriptorFactory.forLabel(labelBId, keyBId);

                for (int j = 0; j < NODES_PER_INDEX; j++)
                {
                    long nodeAId = data.First()[j];
                    assertEquals(1, tx.SchemaRead().nodesCountIndexed(indexA, nodeAId, keyAId, Values.of(nodeAId)));
                    long nodeBId = data.Other()[j];
                    assertEquals(1, tx.SchemaRead().nodesCountIndexed(indexB, nodeBId, keyBId, Values.of(nodeBId)));
                }
            }
        }