//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToSpecifySwedishAnalyzer() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBeAbleToSpecifySwedishAnalyzer() { ApplySetting(FulltextConfig.FulltextDefaultAnalyzer, SWEDISH); SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, PROP); IndexReference nodes; using (KernelTransactionImplementation transaction = KernelTransaction) { SchemaWrite schemaWrite = transaction.SchemaWrite(); nodes = schemaWrite.IndexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), "nodes"); transaction.Success(); } Await(nodes); long id; using (Transaction tx = Db.beginTx()) { id = CreateNodeIndexableByPropertyValue(Label, "Hello and hello again, in the end."); CreateNodeIndexableByPropertyValue(Label, "En apa och en tomte bodde i ett hus."); tx.Success(); } using (Transaction tx = Db.beginTx()) { KernelTransaction ktx = KernelTransaction(tx); AssertQueryFindsIds(ktx, "nodes", "and", id); AssertQueryFindsIds(ktx, "nodes", "in", id); AssertQueryFindsIds(ktx, "nodes", "the", id); AssertQueryFindsNothing(ktx, "nodes", "en"); AssertQueryFindsNothing(ktx, "nodes", "och"); AssertQueryFindsNothing(ktx, "nodes", "ett"); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToSpecifyFoldingAnalyzer() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBeAbleToSpecifyFoldingAnalyzer() { ApplySetting(FulltextConfig.FulltextDefaultAnalyzer, FOLDING); SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, PROP); IndexReference nodes; using (KernelTransactionImplementation transaction = KernelTransaction) { SchemaWrite schemaWrite = transaction.SchemaWrite(); nodes = schemaWrite.IndexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), "nodes"); transaction.Success(); } Await(nodes); long id; using (Transaction tx = Db.beginTx()) { id = CreateNodeIndexableByPropertyValue(Label, "Příliš žluťoučký kůň úpěl ďábelské ódy."); tx.Success(); } using (Transaction tx = Db.beginTx()) { KernelTransaction ktx = KernelTransaction(tx); AssertQueryFindsIds(ktx, "nodes", "prilis", id); AssertQueryFindsIds(ktx, "nodes", "zlutoucky", id); AssertQueryFindsIds(ktx, "nodes", "kun", id); AssertQueryFindsIds(ktx, "nodes", "upel", id); AssertQueryFindsIds(ktx, "nodes", "dabelske", id); AssertQueryFindsIds(ktx, "nodes", "ody", id); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private org.neo4j.internal.kernel.api.IndexReference createIndex(org.neo4j.internal.kernel.api.Transaction transaction) throws org.neo4j.internal.kernel.api.exceptions.schema.SchemaKernelException, org.neo4j.internal.kernel.api.exceptions.InvalidTransactionTypeKernelException private IndexReference CreateIndex([email protected] transaction) { TokenWrite tokenWrite = transaction.TokenWrite(); SchemaWrite schemaWrite = transaction.SchemaWrite(); LabelSchemaDescriptor schemaDescriptor = forLabel(tokenWrite.LabelGetOrCreateForName("hello"), tokenWrite.PropertyKeyGetOrCreateForName("hepp")); return(schemaWrite.IndexCreate(schemaDescriptor)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldAllowSchemaWriteAccessInFullMode() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldAllowSchemaWriteAccessInFullMode() { // Given KernelTransactionImplementation tx = newTransaction(AUTH_DISABLED); // When SchemaWrite writes = tx.SchemaWrite(); // Then assertNotNull(writes); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: void createConstraint(String key, String property) throws org.neo4j.internal.kernel.api.exceptions.KernelException internal override void CreateConstraint(string key, string property) { TokenWrite tokenWrite = TokenWriteInNewTransaction(); int label = tokenWrite.LabelGetOrCreateForName(key); int propertyKey = tokenWrite.PropertyKeyGetOrCreateForName(property); Commit(); SchemaWrite schemaWrite = SchemaWriteInNewTransaction(); schemaWrite.NodeKeyConstraintCreate(forLabel(label, propertyKey)); Commit(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: void createConstraint(String key, String property) throws org.neo4j.internal.kernel.api.exceptions.KernelException internal override void CreateConstraint(string key, string property) { TokenWrite tokenWrite = TokenWriteInNewTransaction(); int relTypeId = tokenWrite.RelationshipTypeGetOrCreateForName(key); int propertyKeyId = tokenWrite.PropertyKeyGetOrCreateForName(property); Commit(); SchemaWrite schemaWrite = SchemaWriteInNewTransaction(); schemaWrite.RelationshipPropertyExistenceConstraintCreate(forRelType(relTypeId, propertyKeyId)); Commit(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotReindexNodesWhenDefaultAnalyzerIsChanged() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotReindexNodesWhenDefaultAnalyzerIsChanged() { long firstID; long secondID; ApplySetting(FulltextConfig.FulltextDefaultAnalyzer, ENGLISH); SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, PROP); IndexReference nodes; using (KernelTransactionImplementation transaction = KernelTransaction) { SchemaWrite schemaWrite = transaction.SchemaWrite(); nodes = schemaWrite.IndexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), "nodes"); transaction.Success(); } Await(nodes); using (Transaction tx = Db.beginTx()) { firstID = CreateNodeIndexableByPropertyValue(Label, "Hello and hello again, in the end."); secondID = CreateNodeIndexableByPropertyValue(Label, "En apa och en tomte bodde i ett hus."); tx.Success(); } using (Transaction tx = Db.beginTx()) { KernelTransaction ktx = KernelTransaction(tx); AssertQueryFindsNothing(ktx, "nodes", "and"); AssertQueryFindsNothing(ktx, "nodes", "in"); AssertQueryFindsNothing(ktx, "nodes", "the"); AssertQueryFindsIds(ktx, "nodes", "en", secondID); AssertQueryFindsIds(ktx, "nodes", "och", secondID); AssertQueryFindsIds(ktx, "nodes", "ett", secondID); } ApplySetting(FulltextConfig.FulltextDefaultAnalyzer, SWEDISH); using (KernelTransactionImplementation ktx = KernelTransaction) { SchemaRead schemaRead = ktx.SchemaRead(); Await(schemaRead.IndexGetForName("nodes")); // These results should be exactly the same as before the configuration change and restart. AssertQueryFindsNothing(ktx, "nodes", "and"); AssertQueryFindsNothing(ktx, "nodes", "in"); AssertQueryFindsNothing(ktx, "nodes", "the"); AssertQueryFindsIds(ktx, "nodes", "en", secondID); AssertQueryFindsIds(ktx, "nodes", "och", secondID); AssertQueryFindsIds(ktx, "nodes", "ett", secondID); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void createConstraint(String label, String propertyKey) throws org.neo4j.internal.kernel.api.exceptions.KernelException private void CreateConstraint(string label, string propertyKey) { int labelId; int propertyKeyId; TokenWrite tokenWrite = TokenWriteInNewTransaction(); labelId = tokenWrite.LabelGetOrCreateForName(label); propertyKeyId = tokenWrite.PropertyKeyGetOrCreateForName(propertyKey); Commit(); SchemaWrite schemaWrite = SchemaWriteInNewTransaction(); schemaWrite.UniquePropertyConstraintCreate(forLabel(labelId, propertyKeyId)); Commit(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: void shouldFailWithNonExistentProviderName(IndexCreator creator) throws org.neo4j.internal.kernel.api.exceptions.KernelException internal virtual void ShouldFailWithNonExistentProviderName(IndexCreator creator) { // given SchemaWrite schemaWrite = SchemaWriteInNewTransaction(); // when try { creator.Create(schemaWrite, forLabel(0, 0), "something-completely-different"); fail("Should have failed"); } catch (IndexProviderNotFoundException) { // then good } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotBePossibleToCreateConstraintWithDuplicateProperties() throws org.neo4j.internal.kernel.api.exceptions.KernelException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotBePossibleToCreateConstraintWithDuplicateProperties() { // given SchemaWrite schemaWrite = SchemaWriteInNewTransaction(); // when try { LabelSchemaDescriptor descriptor = forLabel(0, 1, 1); schemaWrite.UniquePropertyConstraintCreate(descriptor); fail("Should have failed"); } catch (RepeatedPropertyInSchemaException) { // then good } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotBePossibleToCreateIndexWithDuplicateLabel() throws org.neo4j.internal.kernel.api.exceptions.KernelException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotBePossibleToCreateIndexWithDuplicateLabel() { // given SchemaWrite schemaWrite = SchemaWriteInNewTransaction(); // when try { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.api.schema.MultiTokenSchemaDescriptor descriptor = org.neo4j.kernel.api.schema.SchemaDescriptorFactory.multiToken(new int[]{0, 0}, org.neo4j.storageengine.api.EntityType.NODE, 1); MultiTokenSchemaDescriptor descriptor = SchemaDescriptorFactory.multiToken(new int[] { 0, 0 }, EntityType.NODE, 1); schemaWrite.IndexCreate(descriptor); fail("Should have failed"); } catch (RepeatedLabelInSchemaException) { // then good } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: void shouldCreateWithSpecificExistingProviderName(IndexCreator creator) throws org.neo4j.internal.kernel.api.exceptions.KernelException internal virtual void ShouldCreateWithSpecificExistingProviderName(IndexCreator creator) { int labelId = 0; foreach (GraphDatabaseSettings.SchemaIndex indexSetting in GraphDatabaseSettings.SchemaIndex.values()) { // given SchemaWrite schemaWrite = SchemaWriteInNewTransaction(); string provider = indexSetting.providerName(); LabelSchemaDescriptor descriptor = forLabel(labelId++, 0); creator.Create(schemaWrite, descriptor, provider); // when Commit(); // then assertEquals(provider, IndexingService.getIndexProxy(descriptor).Descriptor.providerDescriptor().name()); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: void dropConstraint(org.neo4j.internal.kernel.api.SchemaWrite writeOps, org.neo4j.internal.kernel.api.schema.constraints.ConstraintDescriptor constraint) throws Exception internal override void DropConstraint(SchemaWrite writeOps, ConstraintDescriptor constraint) { writeOps.ConstraintDrop(constraint); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: ConstraintDescriptor createConstraint(org.neo4j.internal.kernel.api.SchemaWrite writeOps, org.neo4j.kernel.api.schema.LabelSchemaDescriptor descriptor) throws Exception internal override ConstraintDescriptor CreateConstraint(SchemaWrite writeOps, LabelSchemaDescriptor descriptor) { return(writeOps.NodeKeyConstraintCreate(descriptor)); }