//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void lazyLoadWithinWriteTransaction() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void LazyLoadWithinWriteTransaction() { // Given FileSystemAbstraction fileSystem = Fs.get(); BatchInserter inserter = BatchInserters.inserter(TestDirectory.databaseDir(), fileSystem); int count = 3000; long nodeId = inserter.CreateNode(MapWithManyProperties(count)); inserter.Shutdown(); GraphDatabaseService db = (new TestGraphDatabaseFactory()).setFileSystem(fileSystem).newImpermanentDatabase(TestDirectory.databaseDir()); // When try { using (Transaction tx = Db.beginTx()) { Db.createNode(); Node node = Db.getNodeById(nodeId); // Then assertEquals(count, Iterables.count(node.PropertyKeys)); tx.Success(); } } finally { Db.shutdown(); } }
private static void CreateEndCloseIndexProvider(BatchInserter inserter) { LuceneBatchInserterIndexProviderNewImpl provider = new LuceneBatchInserterIndexProviderNewImpl(inserter); provider.Shutdown(); inserter.Shutdown(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldThrowWhenPopulatingWithNonUniquePoints() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldThrowWhenPopulatingWithNonUniquePoints() { Config config = Config.defaults(stringMap(default_schema_provider.name(), _schemaIndex.providerName())); BatchInserter inserter = NewBatchInserter(config); PointValue point = Values.pointValue(CoordinateReferenceSystem.WGS84, 0.0, 0.0); inserter.createNode(MapUtil.map("prop", point), TestLabels.LABEL_ONE); inserter.createNode(MapUtil.map("prop", point), TestLabels.LABEL_ONE); inserter.CreateDeferredConstraint(TestLabels.LABEL_ONE).assertPropertyIsUnique("prop").create(); inserter.Shutdown(); GraphDatabaseService db = GraphDatabaseService(config); try { using (Transaction tx = Db.beginTx()) { IEnumerator <IndexDefinition> indexes = Db.schema().Indexes.GetEnumerator(); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(indexes.hasNext()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: IndexDefinition index = indexes.next(); Org.Neo4j.Graphdb.schema.Schema_IndexState indexState = Db.schema().getIndexState(index); assertEquals(Org.Neo4j.Graphdb.schema.Schema_IndexState.Failed, indexState); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(indexes.hasNext()); tx.Success(); } } finally { Db.shutdown(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPopulateIndexWithUniquePointsThatCollideOnSpaceFillingCurve() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldPopulateIndexWithUniquePointsThatCollideOnSpaceFillingCurve() { Config config = Config.defaults(stringMap(default_schema_provider.name(), _schemaIndex.providerName())); BatchInserter inserter = NewBatchInserter(config); Pair <PointValue, PointValue> collidingPoints = SpatialIndexValueTestUtil.pointsWithSameValueOnSpaceFillingCurve(config); inserter.createNode(MapUtil.map("prop", collidingPoints.First()), TestLabels.LABEL_ONE); inserter.createNode(MapUtil.map("prop", collidingPoints.Other()), TestLabels.LABEL_ONE); inserter.CreateDeferredConstraint(TestLabels.LABEL_ONE).assertPropertyIsUnique("prop").create(); inserter.Shutdown(); GraphDatabaseService db = GraphDatabaseService(config); try { AwaitIndexesOnline(db); using (Transaction tx = Db.beginTx()) { AssertSingleCorrectHit(db, collidingPoints.First()); AssertSingleCorrectHit(db, collidingPoints.Other()); tx.Success(); } } finally { Db.shutdown(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void batchInserterShouldUseConfiguredIndexProvider() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void BatchInserterShouldUseConfiguredIndexProvider() { Config config = Config.defaults(stringMap(default_schema_provider.name(), _schemaIndex.providerName())); BatchInserter inserter = NewBatchInserter(config); inserter.CreateDeferredSchemaIndex(TestLabels.LABEL_ONE).on("key").create(); inserter.Shutdown(); GraphDatabaseService db = GraphDatabaseService(config); AwaitIndexesOnline(db); try { using (Transaction tx = Db.beginTx()) { DependencyResolver dependencyResolver = (( GraphDatabaseAPI )db).DependencyResolver; ThreadToStatementContextBridge threadToStatementContextBridge = dependencyResolver.ResolveDependency(typeof(ThreadToStatementContextBridge)); KernelTransaction kernelTransaction = threadToStatementContextBridge.GetKernelTransactionBoundToThisThread(true); TokenRead tokenRead = kernelTransaction.TokenRead(); SchemaRead schemaRead = kernelTransaction.SchemaRead(); int labelId = tokenRead.NodeLabel(TestLabels.LABEL_ONE.name()); int propertyId = tokenRead.PropertyKey("key"); IndexReference index = schemaRead.Index(labelId, propertyId); assertTrue(UnexpectedIndexProviderMessage(index), _schemaIndex.providerName().contains(index.ProviderKey())); assertTrue(UnexpectedIndexProviderMessage(index), _schemaIndex.providerName().contains(index.ProviderVersion())); tx.Success(); } } finally { Db.shutdown(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testHonorsPassedInParams() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TestHonorsPassedInParams() { BatchInserter inserter = BatchInserters.inserter(_testDirectory.databaseDir(), _fileSystemRule.get(), stringMap(GraphDatabaseSettings.pagecache_memory.name(), "280K")); NeoStores neoStores = ReflectionUtil.getPrivateField(inserter, "neoStores", typeof(NeoStores)); PageCache pageCache = ReflectionUtil.getPrivateField(neoStores, "pageCache", typeof(PageCache)); inserter.Shutdown(); long mappedMemoryTotalSize = MuninnPageCache.memoryRequiredForPages(pageCache.MaxCachedPages()); assertThat("memory mapped config is active", mappedMemoryTotalSize, @is(allOf(greaterThan(kibiBytes(270)), lessThan(kibiBytes(290))))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testCreatesStoreLockFile() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TestCreatesStoreLockFile() { // Given DatabaseLayout databaseLayout = _testDirectory.databaseLayout(); // When BatchInserter inserter = BatchInserters.inserter(databaseLayout.DatabaseDirectory(), _fileSystemRule.get()); // Then assertThat(databaseLayout.StoreLayout.storeLockFile().exists(), equalTo(true)); inserter.Shutdown(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldInsertDifferentTypesOfThings() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldInsertDifferentTypesOfThings() { // GIVEN BatchInserter inserter = BatchInserters.Inserter(Directory.databaseDir(), FileSystemRule.get(), stringMap(GraphDatabaseSettings.log_queries.name(), "true", GraphDatabaseSettings.record_format.name(), RecordFormat, GraphDatabaseSettings.log_queries_filename.name(), Directory.file("query.log").AbsolutePath)); long node1Id; long node2Id; long relationshipId; try { // WHEN node1Id = inserter.createNode(SomeProperties(1), Enum.GetValues(typeof(Labels))); node2Id = node1Id + 10; inserter.createNode(node2Id, SomeProperties(2), Enum.GetValues(typeof(Labels))); relationshipId = inserter.CreateRelationship(node1Id, node2Id, MyRelTypes.TEST, SomeProperties(3)); inserter.CreateDeferredSchemaIndex(Labels.One).on("key").create(); inserter.CreateDeferredConstraint(Labels.Two).assertPropertyIsUnique("key").create(); } finally { inserter.Shutdown(); } // THEN GraphDatabaseService db = (new EnterpriseGraphDatabaseFactory()).newEmbeddedDatabaseBuilder(Directory.databaseDir()).setConfig(OnlineBackupSettings.online_backup_enabled, Settings.FALSE).newGraphDatabase(); try { using (Transaction tx = Db.beginTx()) { Node node1 = Db.getNodeById(node1Id); Node node2 = Db.getNodeById(node2Id); assertEquals(SomeProperties(1), node1.AllProperties); assertEquals(SomeProperties(2), node2.AllProperties); assertEquals(relationshipId, single(node1.Relationships).Id); assertEquals(relationshipId, single(node2.Relationships).Id); assertEquals(SomeProperties(3), single(node1.Relationships).AllProperties); tx.Success(); } } finally { Db.shutdown(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void insertIntoExistingDatabase() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void InsertIntoExistingDatabase() { File storeDir = Directory.databaseDir(); GraphDatabaseService db = NewDb(storeDir, RecordFormat); try { CreateThreeNodes(db); } finally { Db.shutdown(); } BatchInserter inserter = BatchInserters.Inserter(Directory.databaseDir(), FileSystemRule.get()); try { long start = inserter.createNode(SomeProperties(5), Labels.One); long end = inserter.createNode(SomeProperties(5), Labels.One); inserter.CreateRelationship(start, end, MyRelTypes.TEST, SomeProperties(5)); } finally { inserter.Shutdown(); } db = NewDb(storeDir, RecordFormat); try { VerifyNodeCount(db, 4); } finally { Db.shutdown(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldStartBatchInserterWithRealIndexProvider() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldStartBatchInserterWithRealIndexProvider() { BatchInserter inserter = inserter(_testDirectory.databaseDir(), Config, KernelExtensions); inserter.Shutdown(); }
private static void VerifyProvidedFileSystemOpenAfterShutdown(BatchInserter inserter, EphemeralFileSystemAbstraction fileSystemAbstraction) { inserter.Shutdown(); assertFalse(fileSystemAbstraction.Closed); }
private static void VerifyInserterFileSystemClose(BatchInserter inserter) { assertThat("Expect specific implementation that will do required cleanups.", inserter, @is(instanceOf(typeof(FileSystemClosingBatchInserter)))); inserter.Shutdown(); }
public override void Shutdown() { @delegate.Shutdown(); CloseFileSystem(); }