//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void testCreateIndexWithGivenProvider(String label, String... properties) throws org.neo4j.internal.kernel.api.exceptions.KernelException private void TestCreateIndexWithGivenProvider(string label, params string[] properties) { // given Transaction transaction = NewTransaction(AnonymousContext.writeToken()); int labelId = transaction.TokenWrite().labelGetOrCreateForName(label); int[] propertyKeyIds = CreateProperties(transaction, properties); TextValue value = stringValue("some value"); long node = CreateNodeWithPropertiesAndLabel(transaction, labelId, propertyKeyIds, value); Commit(); // when NewTransaction(AnonymousContext.full()); string pattern = IndexPattern(label, properties); string specifiedProvider = NATIVE10.providerName(); RawIterator <object[], ProcedureException> result = CallIndexProcedure(pattern, specifiedProvider); // then assertThat(Arrays.asList(result.Next()), contains(pattern, specifiedProvider, ExpectedSuccessfulCreationStatus)); Commit(); AwaitIndexOnline(); // and then transaction = NewTransaction(AnonymousContext.read()); SchemaRead schemaRead = transaction.SchemaRead(); IndexReference index = schemaRead.Index(labelId, propertyKeyIds); AssertCorrectIndex(labelId, propertyKeyIds, UniquenessConstraint, index); AssertIndexData(transaction, propertyKeyIds, value, node, index); Commit(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void throwIfIndexAlreadyExists() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ThrowIfIndexAlreadyExists() { // given string label = "Superhero"; string propertyKey = "primaryPower"; using (Org.Neo4j.Graphdb.Transaction tx = Db.beginTx()) { Db.schema().indexFor(Label.label(label)).on(propertyKey).create(); tx.Success(); } AwaitIndexOnline(); // when NewTransaction(AnonymousContext.full()); string pattern = IndexPattern(label, propertyKey); try { CallIndexProcedure(pattern, GraphDatabaseSettings.SchemaIndex.NATIVE20.providerName()); fail("Should have failed"); } catch (ProcedureException e) { // then assertThat(e.Message, containsString("There already exists an index ")); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void createConstraint(String label, String... properties) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException, org.neo4j.internal.kernel.api.exceptions.ProcedureException private void CreateConstraint(string label, params string[] properties) { NewTransaction(AnonymousContext.full()); string pattern = IndexPattern(label, properties); string specifiedProvider = NATIVE10.providerName(); CallIndexProcedure(pattern, specifiedProvider); Commit(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void throwIfNullProvider() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ThrowIfNullProvider() { // given Transaction transaction = NewTransaction(AnonymousContext.writeToken()); transaction.TokenWrite().labelGetOrCreateForName("Person"); CreateProperties(transaction, "name"); Commit(); // when NewTransaction(AnonymousContext.full()); string pattern = IndexPattern("Person", "name"); ProcedureException e = assertThrows(typeof(ProcedureException), () => CallIndexProcedure(pattern, null)); // then assertThat(e.Message, containsString("Could not create index with specified index provider being null")); Commit(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCreateNonExistingLabelAndPropertyToken() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCreateNonExistingLabelAndPropertyToken() { // given string label = "MyLabel"; string propKey = "myKey"; Transaction transaction = NewTransaction(AnonymousContext.read()); assertEquals("label token should not exist", [email protected]_Fields.NO_TOKEN, transaction.TokenRead().nodeLabel(label)); assertEquals("property token should not exist", [email protected]_Fields.NO_TOKEN, transaction.TokenRead().propertyKey(propKey)); Commit(); // when NewTransaction(AnonymousContext.full()); CallIndexProcedure(IndexPattern(label, propKey), GraphDatabaseSettings.SchemaIndex.NATIVE20.providerName()); Commit(); // then transaction = NewTransaction(AnonymousContext.read()); assertNotEquals("label token should exist", [email protected]_Fields.NO_TOKEN, transaction.TokenRead().nodeLabel(label)); assertNotEquals("property token should exist", [email protected]_Fields.NO_TOKEN, transaction.TokenRead().propertyKey(propKey)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void throwIfNonExistingProvider() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ThrowIfNonExistingProvider() { // given Transaction transaction = NewTransaction(AnonymousContext.writeToken()); transaction.TokenWrite().labelGetOrCreateForName("Person"); CreateProperties(transaction, "name"); Commit(); // when NewTransaction(AnonymousContext.full()); string pattern = IndexPattern("Person", "name"); try { CallIndexProcedure(pattern, "non+existing-1.0"); fail("Expected to fail"); } catch (ProcedureException e) { // then assertThat(e.Message, allOf(containsString("Failed to invoke procedure"), containsString("Tried to get index provider"), containsString("available providers in this session being"), containsString("default being"))); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: protected org.neo4j.internal.kernel.api.Procedures procsSchema() throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException protected internal virtual Procedures ProcsSchema() { _transaction = Kernel.beginTransaction(KernelTransaction.Type.@implicit, AnonymousContext.full()); return(_transaction.procedures()); }