@@ -91,6 +91,54 @@ public static Collection<Object[]> data() {
9191 @ Parameterized .Parameter
9292 public String graphImpl ;
9393
94+ @ Test
95+ public void noWeightStream () throws Exception {
96+ PathConsumer consumer = mock (PathConsumer .class );
97+ DB .execute (
98+ "MATCH (start:Node{type:'start'}), (end:Node{type:'end'}) " +
99+ "CALL algo.shortestPath.stream(start, end) " +
100+ "YIELD nodeId, cost RETURN nodeId, cost" )
101+ .accept ((Result .ResultVisitor <Exception >) row -> {
102+ consumer .accept ((Long ) row .getNumber ("nodeId" ), (Double ) row .getNumber ("cost" ));
103+ return true ;
104+ });
105+ verify (consumer , times (2 )).accept (anyLong (), anyDouble ());
106+ verify (consumer , times (1 )).accept (anyLong (), eq (0.0 ));
107+ verify (consumer , times (1 )).accept (anyLong (), eq (1.0 ));
108+ }
109+
110+ @ Test
111+ public void noWeightWrite () throws Exception {
112+ DB .execute (
113+ "MATCH (start:Node{type:'start'}), (end:Node{type:'end'}) " +
114+ "CALL algo.shortestPath(start, end) " +
115+ "YIELD loadMillis, evalMillis, writeMillis, nodeCount, totalCost\n " +
116+ "RETURN loadMillis, evalMillis, writeMillis, nodeCount, totalCost" )
117+ .accept ((Result .ResultVisitor <Exception >) row -> {
118+ assertEquals (1.0 , (Double ) row .getNumber ("totalCost" ), 0.01 );
119+ assertEquals (2L , row .getNumber ("nodeCount" ));
120+ assertNotEquals (-1L , row .getNumber ("loadMillis" ));
121+ assertNotEquals (-1L , row .getNumber ("evalMillis" ));
122+ assertNotEquals (-1L , row .getNumber ("writeMillis" ));
123+ return false ;
124+ });
125+
126+ final StepConsumer mock = mock (StepConsumer .class );
127+
128+ DB .execute ("MATCH (n) WHERE exists(n.sssp) RETURN id(n) as id, n.sssp as sssp" )
129+ .accept (row -> {
130+ mock .accept (
131+ row .getNumber ("id" ).longValue (),
132+ row .getNumber ("sssp" ).intValue ());
133+ return true ;
134+ });
135+
136+ verify (mock , times (2 )).accept (anyLong (), anyInt ());
137+
138+ verify (mock , times (1 )).accept (anyLong (), eq (0 ));
139+ verify (mock , times (1 )).accept (anyLong (), eq (1 ));
140+ }
141+
94142 @ Test
95143 public void testDijkstraStream () throws Exception {
96144 PathConsumer consumer = mock (PathConsumer .class );
0 commit comments