}
}
@Test
public void testSingleNode() {
final Neo4jOperations template = new Neo4jTemplate(graph, transactionManager);
template.exec(new GraphCallback.WithoutResult() {
@Override
public void doWithGraphWithoutResult(GraphDatabase graph) throws Exception {
Node node = graph.createNode(map("name", "Test", "size", 100), null);
refNode.createRelationshipTo(node, HAS);
final Relationship toTestNode = refNode.getSingleRelationship(HAS, Direction.OUTGOING);
final Node nodeByRelationship = toTestNode.getEndNode();
assertEquals("Test", nodeByRelationship.getProperty("name"));
assertEquals(100, nodeByRelationship.getProperty("size"));
}
});
template.exec(new GraphCallback.WithoutResult() {
public void doWithGraphWithoutResult(GraphDatabase graph) throws Exception {
final Relationship toTestNode = refNode.getSingleRelationship(HAS, Direction.OUTGOING);
final Node nodeByRelationship = toTestNode.getEndNode();
assertEquals("Test", nodeByRelationship.getProperty("name"));
assertEquals(100, nodeByRelationship.getProperty("size"));