@Test public void shouldNotGetAnyRelationshipsWhenRetrievingFromNodeWithoutRelationships() throws Exception { long nodeId = graphdbHelper.createNode(); verifyRelReps( 0, actions.getNodeRelationships( nodeId, RelationshipDirection.all, Collections.<String>emptyList())); verifyRelReps( 0, actions.getNodeRelationships( nodeId, RelationshipDirection.in, Collections.<String>emptyList())); verifyRelReps( 0, actions.getNodeRelationships( nodeId, RelationshipDirection.out, Collections.<String>emptyList())); }
@Test public void shouldBeAbleToRetrieveRelationshipsFromNode() throws Exception { long nodeId = graphdbHelper.createNode(); graphdbHelper.createRelationship("LIKES", nodeId, graphdbHelper.createNode()); graphdbHelper.createRelationship("LIKES", graphdbHelper.createNode(), nodeId); graphdbHelper.createRelationship("HATES", nodeId, graphdbHelper.createNode()); verifyRelReps( 3, actions.getNodeRelationships( nodeId, RelationshipDirection.all, Collections.<String>emptyList())); verifyRelReps( 1, actions.getNodeRelationships( nodeId, RelationshipDirection.in, Collections.<String>emptyList())); verifyRelReps( 2, actions.getNodeRelationships( nodeId, RelationshipDirection.out, Collections.<String>emptyList())); verifyRelReps( 3, actions.getNodeRelationships( nodeId, RelationshipDirection.all, Arrays.asList("LIKES", "HATES"))); verifyRelReps( 1, actions.getNodeRelationships( nodeId, RelationshipDirection.in, Arrays.asList("LIKES", "HATES"))); verifyRelReps( 2, actions.getNodeRelationships( nodeId, RelationshipDirection.out, Arrays.asList("LIKES", "HATES"))); verifyRelReps( 2, actions.getNodeRelationships(nodeId, RelationshipDirection.all, Arrays.asList("LIKES"))); verifyRelReps( 1, actions.getNodeRelationships(nodeId, RelationshipDirection.in, Arrays.asList("LIKES"))); verifyRelReps( 1, actions.getNodeRelationships(nodeId, RelationshipDirection.out, Arrays.asList("LIKES"))); verifyRelReps( 1, actions.getNodeRelationships(nodeId, RelationshipDirection.all, Arrays.asList("HATES"))); verifyRelReps( 0, actions.getNodeRelationships(nodeId, RelationshipDirection.in, Arrays.asList("HATES"))); verifyRelReps( 1, actions.getNodeRelationships(nodeId, RelationshipDirection.out, Arrays.asList("HATES"))); }