@@ -226,7 +226,7 @@ public void query() throws InterruptedException, ExecutionException {
226226 for (int i = 0 ; i < 10 ; i ++) {
227227 db .collection (COLLECTION_NAME ).insertDocument (new BaseDocument (), null ).get ();
228228 }
229- final CompletableFuture <ArangoCursor <String >> f = db .query ("for i in db_test return i._id" , null , null ,
229+ final CompletableFuture <ArangoCursorAsync <String >> f = db .query ("for i in db_test return i._id" , null , null ,
230230 String .class );
231231 assertThat (f , is (notNullValue ()));
232232 f .whenComplete ((cursor , ex ) -> {
@@ -248,15 +248,15 @@ public void queryForEach() throws InterruptedException, ExecutionException {
248248 for (int i = 0 ; i < 10 ; i ++) {
249249 db .collection (COLLECTION_NAME ).insertDocument (new BaseDocument (), null ).get ();
250250 }
251- final CompletableFuture <ArangoCursor <String >> f = db .query ("for i in db_test return i._id" , null , null ,
251+ final CompletableFuture <ArangoCursorAsync <String >> f = db .query ("for i in db_test return i._id" , null , null ,
252252 String .class );
253253 assertThat (f , is (notNullValue ()));
254254 f .whenComplete ((cursor , ex ) -> {
255255 assertThat (cursor , is (notNullValue ()));
256256 final AtomicInteger i = new AtomicInteger (0 );
257- for (; cursor .hasNext (); cursor . next ()) {
257+ cursor .forEachRemaining ( e -> {
258258 i .incrementAndGet ();
259- }
259+ });
260260 assertThat (i .get (), is (10 ));
261261 });
262262 f .get ();
@@ -272,15 +272,15 @@ public void queryStream() throws InterruptedException, ExecutionException {
272272 for (int i = 0 ; i < 10 ; i ++) {
273273 db .collection (COLLECTION_NAME ).insertDocument (new BaseDocument (), null ).get ();
274274 }
275- final CompletableFuture <ArangoCursor <String >> f = db .query ("for i in db_test return i._id" , null , null ,
275+ final CompletableFuture <ArangoCursorAsync <String >> f = db .query ("for i in db_test return i._id" , null , null ,
276276 String .class );
277277 assertThat (f , is (notNullValue ()));
278278 f .whenComplete ((cursor , ex ) -> {
279279 assertThat (cursor , is (notNullValue ()));
280280 final AtomicInteger i = new AtomicInteger (0 );
281- for (; cursor .hasNext (); cursor . next ()) {
281+ cursor .forEachRemaining ( e -> {
282282 i .incrementAndGet ();
283- }
283+ });
284284 assertThat (i .get (), is (10 ));
285285 });
286286 f .get ();
@@ -297,8 +297,8 @@ public void queryWithCount() throws InterruptedException, ExecutionException {
297297 db .collection (COLLECTION_NAME ).insertDocument (new BaseDocument (), null ).get ();
298298 }
299299
300- final CompletableFuture <ArangoCursor <String >> f = db .query ("for i in db_test Limit 6 return i._id" , null ,
301- new AqlQueryOptions ().count (true ), String .class );
300+ final CompletableFuture <ArangoCursorAsync <String >> f = db .query ("for i in db_test Limit 6 return i._id" ,
301+ null , new AqlQueryOptions ().count (true ), String .class );
302302 assertThat (f , is (notNullValue ()));
303303 f .whenComplete ((cursor , ex ) -> {
304304 assertThat (cursor , is (notNullValue ()));
@@ -321,8 +321,8 @@ public void queryWithLimitAndFullCount() throws InterruptedException, ExecutionE
321321 db .collection (COLLECTION_NAME ).insertDocument (new BaseDocument (), null ).get ();
322322 }
323323
324- final CompletableFuture <ArangoCursor <String >> f = db .query ("for i in db_test Limit 5 return i._id" , null ,
325- new AqlQueryOptions ().fullCount (true ), String .class );
324+ final CompletableFuture <ArangoCursorAsync <String >> f = db .query ("for i in db_test Limit 5 return i._id" ,
325+ null , new AqlQueryOptions ().fullCount (true ), String .class );
326326 assertThat (f , is (notNullValue ()));
327327 f .whenComplete ((cursor , ex ) -> {
328328 assertThat (cursor , is (notNullValue ()));
@@ -345,7 +345,7 @@ public void queryWithBatchSize() throws InterruptedException, ExecutionException
345345 for (int i = 0 ; i < 10 ; i ++) {
346346 db .collection (COLLECTION_NAME ).insertDocument (new BaseDocument (), null ).get ();
347347 }
348- final ArangoCursor <String > cursor = db .query ("for i in db_test return i._id" , null ,
348+ final ArangoCursorAsync <String > cursor = db .query ("for i in db_test return i._id" , null ,
349349 new AqlQueryOptions ().batchSize (5 ).count (true ), String .class ).get ();
350350 assertThat (cursor , is (notNullValue ()));
351351 for (int i = 0 ; i < 10 ; i ++, cursor .next ()) {
@@ -363,13 +363,13 @@ public void queryStreamWithBatchSize() throws InterruptedException, ExecutionExc
363363 for (int i = 0 ; i < 10 ; i ++) {
364364 db .collection (COLLECTION_NAME ).insertDocument (new BaseDocument (), null ).get ();
365365 }
366- final ArangoCursor <String > cursor = db .query ("for i in db_test return i._id" , null ,
366+ final ArangoCursorAsync <String > cursor = db .query ("for i in db_test return i._id" , null ,
367367 new AqlQueryOptions ().batchSize (5 ).count (true ), String .class ).get ();
368368 assertThat (cursor , is (notNullValue ()));
369369 final AtomicInteger i = new AtomicInteger (0 );
370- for (; cursor .hasNext (); cursor . next ()) {
370+ cursor .streamRemaining (). forEach ( e -> {
371371 i .incrementAndGet ();
372- }
372+ });
373373 assertThat (i .get (), is (10 ));
374374 } finally {
375375 db .collection (COLLECTION_NAME ).drop ().get ();
@@ -392,7 +392,7 @@ public void queryWithTTL() throws InterruptedException, ExecutionException {
392392 for (int i = 0 ; i < 10 ; i ++) {
393393 db .collection (COLLECTION_NAME ).insertDocument (new BaseDocument (), null ).get ();
394394 }
395- final ArangoCursor <String > cursor = db .query ("for i in db_test return i._id" , null ,
395+ final ArangoCursorAsync <String > cursor = db .query ("for i in db_test return i._id" , null ,
396396 new AqlQueryOptions ().batchSize (5 ).ttl (ttl ), String .class ).get ();
397397 assertThat (cursor , is (notNullValue ()));
398398 for (int i = 0 ; i < 10 ; i ++, cursor .next ()) {
@@ -443,13 +443,15 @@ public void queryWithCache() throws InterruptedException, ArangoDBException, Exe
443443 properties .setMode (CacheMode .on );
444444 db .setQueryCacheProperties (properties ).get ();
445445
446- final ArangoCursor <String > cursor = db .query ("FOR t IN db_test FILTER t.age >= 10 SORT t.age RETURN t._id" ,
447- null , new AqlQueryOptions ().cache (true ), String .class ).get ();
446+ final ArangoCursorAsync <String > cursor = db
447+ .query ("FOR t IN db_test FILTER t.age >= 10 SORT t.age RETURN t._id" , null ,
448+ new AqlQueryOptions ().cache (true ), String .class )
449+ .get ();
448450
449451 assertThat (cursor , is (notNullValue ()));
450452 assertThat (cursor .isCached (), is (false ));
451453
452- final ArangoCursor <String > cachedCursor = db
454+ final ArangoCursorAsync <String > cachedCursor = db
453455 .query ("FOR t IN db_test FILTER t.age >= 10 SORT t.age RETURN t._id" , null ,
454456 new AqlQueryOptions ().cache (true ), String .class )
455457 .get ();
@@ -500,7 +502,7 @@ public void queryWithBindVars() throws InterruptedException, ExecutionException
500502 final Map <String , Object > bindVars = new HashMap <>();
501503 bindVars .put ("@coll" , COLLECTION_NAME );
502504 bindVars .put ("age" , 25 );
503- final CompletableFuture <ArangoCursor <String >> f = db .query (
505+ final CompletableFuture <ArangoCursorAsync <String >> f = db .query (
504506 "FOR t IN @@coll FILTER t.age >= @age SORT t.age RETURN t._id" , bindVars , null , String .class );
505507 assertThat (f , is (notNullValue ()));
506508 f .whenComplete ((cursor , ex ) -> {
@@ -517,7 +519,7 @@ public void queryWithBindVars() throws InterruptedException, ExecutionException
517519
518520 @ Test
519521 public void queryWithWarning () throws InterruptedException , ExecutionException {
520- final CompletableFuture <ArangoCursor <String >> f = arangoDB .db ().query ("return _users + 1" , null , null ,
522+ final CompletableFuture <ArangoCursorAsync <String >> f = arangoDB .db ().query ("return _users + 1" , null , null ,
521523 String .class );
522524 assertThat (f , is (notNullValue ()));
523525 f .whenComplete ((cursor , ex ) -> {
@@ -530,7 +532,7 @@ public void queryWithWarning() throws InterruptedException, ExecutionException {
530532
531533 @ Test
532534 public void queryClose () throws IOException , ArangoDBException , InterruptedException , ExecutionException {
533- final ArangoCursor <String > cursor = arangoDB .db ()
535+ final ArangoCursorAsync <String > cursor = arangoDB .db ()
534536 .query ("for i in _apps return i._id" , null , new AqlQueryOptions ().batchSize (1 ), String .class ).get ();
535537 cursor .close ();
536538 int count = 0 ;
@@ -617,6 +619,7 @@ public void parseQuery() throws InterruptedException, ExecutionException {
617619 }
618620
619621 @ Test
622+ @ Ignore
620623 public void getAndClearSlowQueries () throws InterruptedException , ExecutionException {
621624 final QueryTrackingPropertiesEntity properties = db .getQueryTrackingProperties ().get ();
622625 final Long slowQueryThreshold = properties .getSlowQueryThreshold ();
0 commit comments