//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPopulateIndexWithExistingNodesAndRelationships() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldPopulateIndexWithExistingNodesAndRelationships() { long firstNodeID; long secondNodeID; long firstRelID; long secondRelID; using (Transaction tx = Db.beginTx()) { // skip a few rel ids, so the ones we work with are different from the node ids, just in case. Node node = Db.createNode(); node.CreateRelationshipTo(node, Reltype); node.CreateRelationshipTo(node, Reltype); node.CreateRelationshipTo(node, Reltype); firstNodeID = CreateNodeIndexableByPropertyValue(Label, "Hello. Hello again."); secondNodeID = CreateNodeIndexableByPropertyValue(Label, "This string is slightly shorter than the zebra one"); firstRelID = CreateRelationshipIndexableByPropertyValue(firstNodeID, secondNodeID, "Goodbye"); secondRelID = CreateRelationshipIndexableByPropertyValue(secondNodeID, firstNodeID, "And now, something completely different"); tx.Success(); } SchemaDescriptor nodes = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, PROP); SchemaDescriptor rels = FulltextAdapter.schemaFor(RELATIONSHIP, new string[] { Reltype.name() }, Settings, PROP); IndexReference nodesIndex; IndexReference relsIndex; using (KernelTransactionImplementation tx = KernelTransaction) { nodesIndex = tx.schemaWrite().indexCreate(nodes, FulltextIndexProviderFactory.Descriptor.name(), NODE_INDEX_NAME); relsIndex = tx.schemaWrite().indexCreate(rels, FulltextIndexProviderFactory.Descriptor.name(), REL_INDEX_NAME); tx.Success(); } Await(nodesIndex); Await(relsIndex); using (Transaction tx = Db.beginTx()) { KernelTransaction ktx = KernelTransaction(tx); AssertQueryFindsIds(ktx, NODE_INDEX_NAME, "hello", firstNodeID); AssertQueryFindsIds(ktx, NODE_INDEX_NAME, "string", secondNodeID); AssertQueryFindsNothing(ktx, NODE_INDEX_NAME, "goodbye"); AssertQueryFindsNothing(ktx, NODE_INDEX_NAME, "different"); AssertQueryFindsNothing(ktx, REL_INDEX_NAME, "hello"); AssertQueryFindsNothing(ktx, REL_INDEX_NAME, "string"); AssertQueryFindsIds(ktx, REL_INDEX_NAME, "goodbye", firstRelID); AssertQueryFindsIds(ktx, REL_INDEX_NAME, "different", secondRelID); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotReturnNonMatches() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotReturnNonMatches() { SchemaDescriptor nodes = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, PROP); SchemaDescriptor rels = FulltextAdapter.schemaFor(RELATIONSHIP, new string[] { Reltype.name() }, Settings, PROP); IndexReference nodesIndex; IndexReference relsIndex; using (KernelTransactionImplementation tx = KernelTransaction) { nodesIndex = tx.SchemaWrite().indexCreate(nodes, FulltextIndexProviderFactory.Descriptor.name(), NODE_INDEX_NAME); relsIndex = tx.SchemaWrite().indexCreate(rels, FulltextIndexProviderFactory.Descriptor.name(), REL_INDEX_NAME); tx.Success(); } Await(nodesIndex); Await(relsIndex); using (Transaction tx = Db.beginTx()) { long firstNode = CreateNodeIndexableByPropertyValue(Label, "Hello. Hello again."); long secondNode = CreateNodeWithProperty(Label, "prop2", "A zebroid (also zedonk, zorse, zebra mule, zonkey, and zebmule) is the offspring of any " + "cross between a zebra and any other equine: essentially, a zebra hybrid."); CreateRelationshipIndexableByPropertyValue(firstNode, secondNode, "Hello. Hello again."); CreateRelationshipWithProperty(secondNode, firstNode, "prop2", "A zebroid (also zedonk, zorse, zebra mule, zonkey, and zebmule) is the offspring of any " + "cross between a zebra and any other equine: essentially, a zebra hybrid."); tx.Success(); } using (Transaction tx = Db.beginTx()) { KernelTransaction ktx = KernelTransaction(tx); AssertQueryFindsNothing(ktx, NODE_INDEX_NAME, "zebra"); AssertQueryFindsNothing(ktx, REL_INDEX_NAME, "zebra"); } }