//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotIndexNodesWithWrongLabel() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotIndexNodesWithWrongLabel() { // Given File file = new File(DbRule.DatabaseDirAbsolutePath); BatchInserter inserter = BatchInserters.inserter(file, FileSystemRule.get()); inserter.createNode(map("name", "Bob"), label("User"), label("Admin")); inserter.CreateDeferredSchemaIndex(label("Banana")).on("name").create(); // When inserter.Shutdown(); // Then GraphDatabaseService db = DbRule.GraphDatabaseAPI; try { using (Transaction tx = Db.beginTx()) { assertThat(count(Db.findNodes(label("Banana"), "name", "Bob")), equalTo(0L)); } } finally { Db.shutdown(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldIndexNodesWithMultipleLabels() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldIndexNodesWithMultipleLabels() { // Given File path = DbRule.databaseLayout().databaseDirectory(); BatchInserter inserter = BatchInserters.inserter(path, FileSystemRule.get()); inserter.createNode(map("name", "Bob"), label("User"), label("Admin")); inserter.CreateDeferredSchemaIndex(label("User")).on("name").create(); inserter.CreateDeferredSchemaIndex(label("Admin")).on("name").create(); // When inserter.Shutdown(); // Then GraphDatabaseService db = DbRule.GraphDatabaseAPI; try { using (Transaction tx = Db.beginTx()) { assertThat(count(Db.findNodes(label("User"), "name", "Bob")), equalTo(1L)); assertThat(count(Db.findNodes(label("Admin"), "name", "Bob")), equalTo(1L)); } } finally { Db.shutdown(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToMakeRepeatedCallsToSetNodePropertyWithMultiplePropertiesPerBlock() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBeAbleToMakeRepeatedCallsToSetNodePropertyWithMultiplePropertiesPerBlock() { File file = DbRule.databaseLayout().databaseDirectory(); BatchInserter inserter = BatchInserters.inserter(file, FileSystemRule.get()); long nodeId = inserter.createNode(Collections.emptyMap()); const object finalValue1 = 87; const object finalValue2 = 3.14; inserter.SetNodeProperty(nodeId, "a", "some property value"); inserter.SetNodeProperty(nodeId, "a", 42); inserter.SetNodeProperty(nodeId, "b", finalValue2); inserter.SetNodeProperty(nodeId, "a", finalValue2); inserter.SetNodeProperty(nodeId, "a", true); inserter.SetNodeProperty(nodeId, "a", finalValue1); inserter.Shutdown(); GraphDatabaseService db = DbRule.GraphDatabaseAPI; try { using (Transaction ignored = Db.beginTx()) { assertThat(Db.getNodeById(nodeId).getProperty("a"), equalTo(finalValue1)); assertThat(Db.getNodeById(nodeId).getProperty("b"), equalTo(finalValue2)); } } finally { Db.shutdown(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void givenBatchInserterWhenArrayPropertyUpdated4TimesThenShouldNotFail() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void GivenBatchInserterWhenArrayPropertyUpdated4TimesThenShouldNotFail() { BatchInserter batchInserter = BatchInserters.inserter(TestDirectory.databaseDir(), FileSystemRule.get()); long nodeId = batchInserter.createNode(Collections.emptyMap()); for (int i = 0; i < 4; i++) { batchInserter.SetNodeProperty(nodeId, "array", new sbyte[] { 2, 3, 98, 1, 43, 50, 3, 33, 51, 55, 116, 16, 23, 56, 9, ( sbyte )-10, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1 }); } batchInserter.GetNodeProperties(nodeId); //fails here batchInserter.Shutdown(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void startBatchInserterOnTopOfEnterpriseDatabase() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void StartBatchInserterOnTopOfEnterpriseDatabase() { File databaseDir = _testDirectory.databaseDir(); GraphDatabaseService database = (new EnterpriseGraphDatabaseFactory()).newEmbeddedDatabase(databaseDir); using (Transaction transaction = database.BeginTx()) { database.Execute("CREATE CONSTRAINT ON (n:Person) ASSERT (n.firstname, n.surname) IS NODE KEY"); transaction.Success(); } database.Shutdown(); BatchInserter inserter = BatchInserters.inserter(databaseDir); inserter.Shutdown(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(expected = org.neo4j.kernel.impl.store.id.validation.ReservedIdException.class) public void makeSureCantCreateNodeWithMagicNumber() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MakeSureCantCreateNodeWithMagicNumber() { // given File path = DbRule.databaseLayout().databaseDirectory(); BatchInserter inserter = BatchInserters.inserter(path, FileSystemRule.get()); try { // when long id = IdGeneratorImpl.INTEGER_MINUS_ONE; inserter.CreateNode(id, null); // then throws } finally { inserter.Shutdown(); } }