//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCloseIndexAndLabelScanSnapshots() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCloseIndexAndLabelScanSnapshots() { // Given LabelScanStore labelScanStore = mock(typeof(LabelScanStore)); IndexingService indexingService = mock(typeof(IndexingService)); ExplicitIndexProvider explicitIndexes = mock(typeof(ExplicitIndexProvider)); when(explicitIndexes.AllIndexProviders()).thenReturn(Collections.emptyList()); DatabaseLayout databaseLayout = mock(typeof(DatabaseLayout)); when(databaseLayout.MetadataStore()).thenReturn(mock(typeof(File))); LogFiles logFiles = mock(typeof(LogFiles)); FilesInStoreDirAre(databaseLayout, _standardStoreDirFiles, _standardStoreDirDirectories); StorageEngine storageEngine = mock(typeof(StorageEngine)); NeoStoreFileListing fileListing = new NeoStoreFileListing(databaseLayout, logFiles, labelScanStore, indexingService, explicitIndexes, storageEngine); ResourceIterator <File> scanSnapshot = ScanStoreFilesAre(labelScanStore, new string[] { "blah/scan.store", "scan.more" }); ResourceIterator <File> indexSnapshot = IndexFilesAre(indexingService, new string[] { "schema/index/my.index" }); ResourceIterator <StoreFileMetadata> result = fileListing.Builder().excludeLogFiles().build(); // When result.Close(); // Then verify(scanSnapshot).close(); verify(indexSnapshot).close(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mustLogPhaseTracker() public virtual void MustLogPhaseTracker() { Label nodeLabel = Label.label("testLabel5"); string key = "key"; string value = "hej"; using (Transaction transaction = _database.beginTx()) { _database.createNode(nodeLabel).setProperty(key, value); transaction.Success(); } // when using (Transaction tx = _database.beginTx()) { _database.schema().indexFor(nodeLabel).on(key).create(); tx.Success(); } WaitForOnlineIndexes(); // then using (Transaction tx = _database.beginTx()) { ResourceIterator <Node> nodes = _database.findNodes(nodeLabel, key, value); long nodeCount = Iterators.count(nodes); assertEquals("expected exactly one hit in index but was ", 1, nodeCount); nodes.Close(); tx.Success(); } AssertableLogProvider.LogMatcher matcher = inLog(typeof(IndexPopulationJob)).info(containsString("TIME/PHASE Final:")); _logProvider.assertAtLeastOnce(matcher); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testGetAllNodes() public virtual void TestGetAllNodes() { long highId = GetIdGenerator(IdType.NODE).HighestPossibleIdInUse; if (highId >= 0 && highId < 10000) { long count = Iterables.count(GraphDb.AllNodes); bool found = false; Node newNode = GraphDb.createNode(); NewTransaction(); long oldCount = count; count = 0; foreach (Node node in GraphDb.AllNodes) { count++; if (node.Equals(newNode)) { found = true; } } assertTrue(found); assertEquals(count, oldCount + 1); // Tests a bug in the "all nodes" iterator ResourceIterator <Node> allNodesIterator = GraphDb.AllNodes.GetEnumerator(); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertNotNull(allNodesIterator.next()); allNodesIterator.Close(); newNode.Delete(); NewTransaction(); found = false; count = 0; foreach (Node node in GraphDb.AllNodes) { count++; if (node.Equals(newNode)) { found = true; } } assertTrue(!found); assertEquals(count, oldCount); } // else we skip test, takes too long }
//TODO this test is not valid for compiled runtime as the transaction will be closed when the iterator was created //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCloseTransactionsWhenIteratingOverSingleColumn() public virtual void ShouldCloseTransactionsWhenIteratingOverSingleColumn() { // Given an execution result that has been started but not exhausted CreateNode(); CreateNode(); Result executionResult = Db.execute("CYPHER runtime=interpreted MATCH (n) RETURN n"); ResourceIterator <Node> resultIterator = executionResult.ColumnAs("n"); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: resultIterator.next(); assertThat(ActiveTransaction(), @is(notNullValue())); // When resultIterator.Close(); // Then assertThat(ActiveTransaction(), @is(nullValue())); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void snapshotFilesDeletedWhenSnapshotReleased() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SnapshotFilesDeletedWhenSnapshotReleased() { Label label = Label.label("testLabel"); PrepareDatabase(label); ResourceIterator <File> firstCheckpointSnapshot = _indexingService.snapshotIndexFiles(); GenerateData(label); ResourceIterator <File> secondCheckpointSnapshot = _indexingService.snapshotIndexFiles(); GenerateData(label); ResourceIterator <File> thirdCheckpointSnapshot = _indexingService.snapshotIndexFiles(); ISet <string> firstSnapshotFileNames = GetFileNames(firstCheckpointSnapshot); ISet <string> secondSnapshotFileNames = GetFileNames(secondCheckpointSnapshot); ISet <string> thirdSnapshotFileNames = GetFileNames(thirdCheckpointSnapshot); GenerateData(label); ForceCheckpoint(_checkPointer); //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: assertTrue(firstSnapshotFileNames.Select(File::new).All(_fileSystem.fileExists)); //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: assertTrue(secondSnapshotFileNames.Select(File::new).All(_fileSystem.fileExists)); //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: assertTrue(thirdSnapshotFileNames.Select(File::new).All(_fileSystem.fileExists)); firstCheckpointSnapshot.Close(); secondCheckpointSnapshot.Close(); thirdCheckpointSnapshot.Close(); GenerateData(label); ForceCheckpoint(_checkPointer); //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: assertFalse(firstSnapshotFileNames.Select(File::new).Any(_fileSystem.fileExists)); //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: assertFalse(secondSnapshotFileNames.Select(File::new).Any(_fileSystem.fileExists)); //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: assertFalse(thirdSnapshotFileNames.Select(File::new).Any(_fileSystem.fileExists)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void concurrentLuceneIndexSnapshotUseDifferentSnapshots() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ConcurrentLuceneIndexSnapshotUseDifferentSnapshots() { Label label = Label.label("testLabel"); Database.withSetting(GraphDatabaseSettings.default_schema_provider, GraphDatabaseSettings.SchemaIndex.NATIVE20.providerName()); PrepareDatabase(label); ForceCheckpoint(_checkPointer); ResourceIterator <File> firstCheckpointSnapshot = _indexingService.snapshotIndexFiles(); GenerateData(label); RemoveOldNodes(LongStream.range(1, 20)); UpdateOldNodes(LongStream.range(30, 40)); ForceCheckpoint(_checkPointer); ResourceIterator <File> secondCheckpointSnapshot = _indexingService.snapshotIndexFiles(); GenerateData(label); RemoveOldNodes(LongStream.range(50, 60)); UpdateOldNodes(LongStream.range(70, 80)); ForceCheckpoint(_checkPointer); ResourceIterator <File> thirdCheckpointSnapshot = _indexingService.snapshotIndexFiles(); ISet <string> firstSnapshotFileNames = GetFileNames(firstCheckpointSnapshot); ISet <string> secondSnapshotFileNames = GetFileNames(secondCheckpointSnapshot); ISet <string> thirdSnapshotFileNames = GetFileNames(thirdCheckpointSnapshot); CompareSnapshotFiles(firstSnapshotFileNames, secondSnapshotFileNames, _fileSystem); CompareSnapshotFiles(secondSnapshotFileNames, thirdSnapshotFileNames, _fileSystem); CompareSnapshotFiles(thirdSnapshotFileNames, firstSnapshotFileNames, _fileSystem); firstCheckpointSnapshot.Close(); secondCheckpointSnapshot.Close(); thirdCheckpointSnapshot.Close(); }