//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void createAndQueryFulltextRelationshipIndex() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void CreateAndQueryFulltextRelationshipIndex() { FulltextIndexProvider provider = ( FulltextIndexProvider )Db.resolveDependency(typeof(IndexProviderMap)).lookup(DESCRIPTOR); IndexReference indexReference; using (KernelTransactionImplementation transaction = KernelTransaction) { MultiTokenSchemaDescriptor multiTokenSchemaDescriptor = multiToken(new int[] { 0, 1, 2 }, EntityType.RELATIONSHIP, 0, 1, 2, 3); FulltextSchemaDescriptor schema = new FulltextSchemaDescriptor(multiTokenSchemaDescriptor, new Properties()); indexReference = transaction.SchemaWrite().indexCreate(schema, DESCRIPTOR.name(), "fulltext"); transaction.Success(); } Await(indexReference); long secondRelId; using (Transaction transaction = Db.beginTx()) { Relationship ho = _node1.createRelationshipTo(_node2, RelationshipType.withName("ho")); secondRelId = ho.Id; ho.SetProperty("hej", "villa"); ho.SetProperty("ho", "value3"); transaction.Success(); } VerifyRelationshipData(provider, secondRelId); Db.restartDatabase(DatabaseRule.RestartAction_Fields.EMPTY); provider = ( FulltextIndexProvider )Db.resolveDependency(typeof(IndexProviderMap)).lookup(DESCRIPTOR); VerifyRelationshipData(provider, secondRelId); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private org.neo4j.internal.kernel.api.IndexReference createIndex(int[] entityTokens, int[] propertyIds) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException, org.neo4j.internal.kernel.api.exceptions.InvalidTransactionTypeKernelException, org.neo4j.internal.kernel.api.exceptions.schema.SchemaKernelException private IndexReference CreateIndex(int[] entityTokens, int[] propertyIds) { IndexReference fulltext; using (KernelTransactionImplementation transaction = KernelTransaction) { MultiTokenSchemaDescriptor multiTokenSchemaDescriptor = multiToken(entityTokens, EntityType.NODE, propertyIds); FulltextSchemaDescriptor schema = new FulltextSchemaDescriptor(multiTokenSchemaDescriptor, new Properties()); fulltext = transaction.SchemaWrite().indexCreate(schema, DESCRIPTOR.name(), NAME); transaction.Success(); } return(fulltext); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldListMultiTokenIndexesInTheCoreAPI() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldListMultiTokenIndexesInTheCoreAPI() { Transaction transaction = NewTransaction(AUTH_DISABLED); MultiTokenSchemaDescriptor descriptor = SchemaDescriptorFactory.multiToken(new int[] { _labelId, _labelId2 }, EntityType.NODE, _propertyKeyId); transaction.SchemaWrite().indexCreate(descriptor); Commit(); //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: try (@SuppressWarnings("unused") org.neo4j.graphdb.Transaction tx = db.beginTx()) using (Org.Neo4j.Graphdb.Transaction tx = Db.beginTx()) { ISet <IndexDefinition> indexes = Iterables.asSet(Db.schema().Indexes); // then assertEquals(1, indexes.Count); IndexDefinition index = indexes.GetEnumerator().next(); try { index.Label; fail("index.getLabel() should have thrown. "); } catch (System.InvalidOperationException) { } try { index.RelationshipType; fail("index.getRelationshipType() should have thrown. "); } catch (System.InvalidOperationException) { } try { index.RelationshipTypes; fail("index.getRelationshipTypes() should have thrown. "); } catch (System.InvalidOperationException) { } assertThat(index.Labels, containsInAnyOrder(label(LABEL), label(LABEL2))); assertFalse("should not be a constraint index", index.ConstraintIndex); assertTrue("should be a multi-token index", index.MultiTokenIndex); assertFalse("should not be a composite index", index.CompositeIndex); assertTrue("should be a node index", index.NodeIndex); assertFalse("should not be a relationship index", index.RelationshipIndex); assertEquals(asSet(PROPERTY_KEY), Iterables.asSet(index.PropertyKeys)); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void createAndRetainRelationshipFulltextIndex() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void CreateAndRetainRelationshipFulltextIndex() { IndexReference indexReference; using (KernelTransactionImplementation transaction = KernelTransaction) { MultiTokenSchemaDescriptor multiTokenSchemaDescriptor = multiToken(new int[] { 0, 1, 2 }, EntityType.RELATIONSHIP, 0, 1, 2, 3); FulltextSchemaDescriptor schema = new FulltextSchemaDescriptor(multiTokenSchemaDescriptor, new Properties()); indexReference = transaction.SchemaWrite().indexCreate(schema, DESCRIPTOR.name(), "fulltext"); transaction.Success(); } Await(indexReference); Db.restartDatabase(DatabaseRule.RestartAction_Fields.EMPTY); VerifyThatFulltextIndexIsPresent(indexReference); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @ParameterizedTest @MethodSource("nodeAndRelationshipEntityTypes") void shouldMatchOnAnyEntityAndPropertyTokenForPartialPropertySchemaType(org.neo4j.storageengine.api.EntityType entityType) internal virtual void ShouldMatchOnAnyEntityAndPropertyTokenForPartialPropertySchemaType(EntityType entityType) { // given SchemaDescriptorLookupSet <SchemaDescriptor> set = new SchemaDescriptorLookupSet <SchemaDescriptor>(); MultiTokenSchemaDescriptor descriptor1 = SchemaDescriptorFactory.multiToken(Ints(0, 1, 2), entityType, 3, 4, 5); MultiTokenSchemaDescriptor descriptor2 = SchemaDescriptorFactory.multiToken(Ints(0, 1), entityType, 3, 4); MultiTokenSchemaDescriptor descriptor3 = SchemaDescriptorFactory.multiToken(Ints(0, 2), entityType, 4, 5); set.Add(descriptor1); set.Add(descriptor2); set.Add(descriptor3); // given that this test revolves around entity tokens 0,1,2 and property tokens 3,4,5 these 3 descriptors below matches either // only those tokens for entity or property or neither. I.e. these should never be included in matching results set.Add(SchemaDescriptorFactory.multiToken(Ints(3, 4), entityType, 4, 5)); set.Add(SchemaDescriptorFactory.multiToken(Ints(0, 1), entityType, 6, 7)); set.Add(SchemaDescriptorFactory.multiToken(Ints(3, 4), entityType, 6, 7)); // when matching these descriptors (in this case partial/complete list doesn't quite matter because the descriptors // themselves are partially matched anyway. ISet <SchemaDescriptor> descriptors1 = new HashSet <SchemaDescriptor>(); ISet <SchemaDescriptor> descriptors1Partial = new HashSet <SchemaDescriptor>(); ISet <SchemaDescriptor> descriptors2 = new HashSet <SchemaDescriptor>(); ISet <SchemaDescriptor> descriptors2Partial = new HashSet <SchemaDescriptor>(); ISet <SchemaDescriptor> descriptors3 = new HashSet <SchemaDescriptor>(); ISet <SchemaDescriptor> descriptors3Partial = new HashSet <SchemaDescriptor>(); set.MatchingDescriptorsForCompleteListOfProperties(descriptors1, Longs(0, 1), Ints(4, 5)); set.MatchingDescriptorsForPartialListOfProperties(descriptors1Partial, Longs(0, 1), Ints(4, 5)); set.MatchingDescriptorsForCompleteListOfProperties(descriptors2, Longs(0), Ints(3)); set.MatchingDescriptorsForPartialListOfProperties(descriptors2Partial, Longs(0), Ints(3)); set.MatchingDescriptorsForCompleteListOfProperties(descriptors3, Longs(1), Ints(5)); set.MatchingDescriptorsForPartialListOfProperties(descriptors3Partial, Longs(1), Ints(5)); // then assertEquals(asSet(descriptor1, descriptor2, descriptor3), descriptors1); assertEquals(asSet(descriptor1, descriptor2, descriptor3), descriptors1Partial); assertEquals(asSet(descriptor1, descriptor2), descriptors2); assertEquals(asSet(descriptor1, descriptor2), descriptors2Partial); assertEquals(asSet(descriptor1), descriptors3); assertEquals(asSet(descriptor1), descriptors3Partial); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void removeSchemaWithRepeatedRelType() public virtual void RemoveSchemaWithRepeatedRelType() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final SchemaCache cache = newSchemaCache(); SchemaCache cache = NewSchemaCache(); const int id = 1; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int[] repeatedRelTypes = {0, 1, 0}; int[] repeatedRelTypes = new int[] { 0, 1, 0 }; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.api.schema.MultiTokenSchemaDescriptor schema = org.neo4j.kernel.api.schema.SchemaDescriptorFactory.multiToken(repeatedRelTypes, org.neo4j.storageengine.api.EntityType.RELATIONSHIP, 1); MultiTokenSchemaDescriptor schema = SchemaDescriptorFactory.multiToken(repeatedRelTypes, EntityType.RELATIONSHIP, 1); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.storageengine.api.schema.StoreIndexDescriptor storeIndexDescriptor = org.neo4j.storageengine.api.schema.IndexDescriptorFactory.forSchema(schema).withId(id); StoreIndexDescriptor storeIndexDescriptor = IndexDescriptorFactory.forSchema(schema).withId(id); cache.AddSchemaRule(storeIndexDescriptor); cache.RemoveSchemaRule(id); }