public class RelatedNodesQuestionTest
{
@Test
public void question5346011()
{
GraphDatabaseService service = new EmbeddedGraphDatabase( "target/soquestion-test" );
Transaction transaction = service.beginTx();
try
{
RelationshipIndex index = service.index().forRelationships( "exact" );
// ...creation of the nodes and relationship
Node node1 = service.createNode();
Node node2 = service.createNode();
String a_uuid = "xyz";
Relationship relationship = node1.createRelationshipTo( node2, DynamicRelationshipType.withName( "related" ) );
index.add( relationship, "uuid", a_uuid );
// query
IndexHits<Relationship> hits = index.get( "uuid", a_uuid, node1, node2 );
assertEquals( 1, hits.size() );
transaction.success();
}
finally
{
transaction.finish();
}
service.shutdown();
}