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 shouldPropagateRelationshipCountsInHA() throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldPropagateRelationshipCountsInHA() { ManagedCluster cluster = ClusterRule.startCluster(); HighlyAvailableGraphDatabase master = cluster.Master; using (Transaction tx = master.BeginTx()) { Node left = master.CreateNode(); Node right = master.CreateNode(Label.label("A")); left.CreateRelationshipTo(right, RelationshipType.withName("Type")); tx.Success(); } cluster.Sync(); foreach (HighlyAvailableGraphDatabase db in cluster.AllMembers) { using ([email protected] tx = Db.DependencyResolver.resolveDependency(typeof(Kernel)).beginTransaction(@explicit, AUTH_DISABLED)) { assertEquals(1, tx.dataRead().countsForRelationship(-1, -1, -1)); assertEquals(1, tx.dataRead().countsForRelationship(-1, -1, 0)); assertEquals(1, tx.dataRead().countsForRelationship(-1, 0, -1)); assertEquals(1, tx.dataRead().countsForRelationship(-1, 0, 0)); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRebuildMissingCountsStoreAfterRecovery() throws java.io.IOException, org.neo4j.internal.kernel.api.exceptions.TransactionFailureException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRebuildMissingCountsStoreAfterRecovery() { // given CreateAliensAndHumans(); // when RotateLog(); DeleteHumans(); FileSystemAbstraction fs = Crash(); DeleteCounts(fs); Restart(fs); // then using ([email protected] tx = (( GraphDatabaseAPI )_db).DependencyResolver.resolveDependency(typeof(Kernel)).beginTransaction(@explicit, AUTH_DISABLED)) { assertEquals(ALIENS, tx.DataRead().countsForNode(-1)); assertEquals(ALIENS, tx.DataRead().countsForNode(LabelId(_alien))); assertEquals(0, tx.DataRead().countsForNode(LabelId(_human))); } // and also LogMatcherBuilder matcherBuilder = inLog(typeof(MetaDataStore)); _internalLogProvider.assertAtLeastOnce(matcherBuilder.warn("Missing counts store, rebuilding it.")); _internalLogProvider.assertAtLeastOnce(matcherBuilder.warn("Counts store rebuild completed.")); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static void assertOnIndexCounts(int expectedIndexUpdates, int expectedIndexSize, int expectedUniqueValues, int expectedSampleSize, org.neo4j.storageengine.api.schema.IndexDescriptor indexDescriptor, HighlyAvailableGraphDatabase db) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException, org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException private static void AssertOnIndexCounts(int expectedIndexUpdates, int expectedIndexSize, int expectedUniqueValues, int expectedSampleSize, IndexDescriptor indexDescriptor, HighlyAvailableGraphDatabase db) { using ([email protected] tx = Db.DependencyResolver.resolveDependency(typeof(Kernel)).beginTransaction(@explicit, AUTH_DISABLED)) { IndexReference indexReference = tx.SchemaRead().index(indexDescriptor.Schema()); AssertDoubleLongEquals(expectedIndexUpdates, expectedIndexSize, tx.SchemaRead().indexUpdatesAndSize(indexReference, newDoubleLongRegister())); AssertDoubleLongEquals(expectedUniqueValues, expectedSampleSize, tx.SchemaRead().indexSample(indexReference, newDoubleLongRegister())); } }
//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 org.neo4j.register.Register_DoubleLongRegister fetchIndexSizeValues(org.neo4j.graphdb.GraphDatabaseService db) throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException, org.neo4j.internal.kernel.api.exceptions.TransactionFailureException private Register_DoubleLongRegister FetchIndexSizeValues(GraphDatabaseService db) { try { // Then db = (new TestGraphDatabaseFactory()).newEmbeddedDatabase(TestDirectory.storeDir()); //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("deprecation") org.neo4j.kernel.internal.GraphDatabaseAPI api = (org.neo4j.kernel.internal.GraphDatabaseAPI) db; GraphDatabaseAPI api = ( GraphDatabaseAPI )db; using ([email protected] tx = api.DependencyResolver.resolveDependency(typeof(Kernel)).beginTransaction(@explicit, AUTH_DISABLED)) { return(tx.SchemaRead().indexUpdatesAndSize(IndexId(tx), Registers.newDoubleLongRegister())); } } finally { if (db != null) { Db.shutdown(); } } }
//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))); } } }