File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
driver/src/test/java/org/neo4j/driver/v1/integration Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -1343,6 +1343,38 @@ public void shouldPropagateTransactionRollbackErrorWhenClosed() throws Exception
1343
1343
testTransactionCloseErrorPropagationWhenSessionClosed ( "rollback_error.script" , false , "Unable to rollback" );
1344
1344
}
1345
1345
1346
+ @ Test
1347
+ public void shouldSupportNestedQueries ()
1348
+ {
1349
+ try ( Session session = neo4j .driver ().session () )
1350
+ {
1351
+ // populate db with test data
1352
+ session .run ( "UNWIND range(1, 100) AS x CREATE (:Property {id: x})" ).consume ();
1353
+ session .run ( "UNWIND range(1, 10) AS x CREATE (:Resource {id: x})" ).consume ();
1354
+
1355
+ int seenProperties = 0 ;
1356
+ int seenResources = 0 ;
1357
+
1358
+ // read properties and resources using a single session
1359
+ StatementResult properties = session .run ( "MATCH (p:Property) RETURN p" );
1360
+ while ( properties .hasNext () )
1361
+ {
1362
+ assertNotNull ( properties .next () );
1363
+ seenProperties ++;
1364
+
1365
+ StatementResult resources = session .run ( "MATCH (r:Resource) RETURN r" );
1366
+ while ( resources .hasNext () )
1367
+ {
1368
+ assertNotNull ( resources .next () );
1369
+ seenResources ++;
1370
+ }
1371
+ }
1372
+
1373
+ assertEquals ( 100 , seenProperties );
1374
+ assertEquals ( 1000 , seenResources );
1375
+ }
1376
+ }
1377
+
1346
1378
private void testExecuteReadTx ( AccessMode sessionMode )
1347
1379
{
1348
1380
Driver driver = neo4j .driver ();
You can’t perform that action at this time.
0 commit comments