@@ -565,7 +565,7 @@ void query(ArangoDatabase db) {
565
565
for (int i = 0 ; i < 10 ; i ++) {
566
566
db .collection (CNAME1 ).insertDocument (new BaseDocument (), null );
567
567
}
568
- final ArangoCursor <String > cursor = db .query ("for i in " + CNAME1 + " return i._id" , null , null , String .class );
568
+ final ArangoCursor <String > cursor = db .query ("for i in " + CNAME1 + " return i._id" , String .class );
569
569
assertThat ((Object ) cursor ).isNotNull ();
570
570
for (int i = 0 ; i < 10 ; i ++, cursor .next ()) {
571
571
assertThat ((Iterator <?>) cursor ).hasNext ();
@@ -575,8 +575,7 @@ void query(ArangoDatabase db) {
575
575
@ ParameterizedTest (name = "{index}" )
576
576
@ MethodSource ("dbs" )
577
577
void queryWithNullBindVar (ArangoDatabase db ) {
578
- final ArangoCursor <Object > cursor = db .query ("return @foo" , Collections .singletonMap ("foo" , null ), null ,
579
- Object .class );
578
+ final ArangoCursor <Object > cursor = db .query ("return @foo" , Object .class , Collections .singletonMap ("foo" , null ));
580
579
assertThat (cursor .hasNext ()).isTrue ();
581
580
assertThat (cursor .next ()).isNull ();
582
581
}
@@ -587,7 +586,7 @@ void queryForEach(ArangoDatabase db) {
587
586
for (int i = 0 ; i < 10 ; i ++) {
588
587
db .collection (CNAME1 ).insertDocument (new BaseDocument (), null );
589
588
}
590
- final ArangoCursor <String > cursor = db .query ("for i in " + CNAME1 + " return i._id" , null , null , String .class );
589
+ final ArangoCursor <String > cursor = db .query ("for i in " + CNAME1 + " return i._id" , String .class );
591
590
assertThat ((Object ) cursor ).isNotNull ();
592
591
593
592
int i = 0 ;
@@ -606,8 +605,7 @@ void queryWithCount(ArangoDatabase db) {
606
605
}
607
606
608
607
final ArangoCursor <String > cursor = db
609
- .query ("for i in " + CNAME1 + " Limit 6 return i._id" , null , new AqlQueryOptions ().count (true ),
610
- String .class );
608
+ .query ("for i in " + CNAME1 + " Limit 6 return i._id" , String .class , new AqlQueryOptions ().count (true ));
611
609
assertThat ((Object ) cursor ).isNotNull ();
612
610
for (int i = 1 ; i <= 6 ; i ++, cursor .next ()) {
613
611
assertThat (cursor .hasNext ()).isTrue ();
@@ -623,8 +621,7 @@ void queryWithLimitAndFullCount(ArangoDatabase db) {
623
621
}
624
622
625
623
final ArangoCursor <String > cursor = db
626
- .query ("for i in " + CNAME1 + " Limit 5 return i._id" , null , new AqlQueryOptions ().fullCount (true ),
627
- String .class );
624
+ .query ("for i in " + CNAME1 + " Limit 5 return i._id" , String .class , new AqlQueryOptions ().fullCount (true ));
628
625
assertThat ((Object ) cursor ).isNotNull ();
629
626
for (int i = 0 ; i < 5 ; i ++, cursor .next ()) {
630
627
assertThat ((Iterator <?>) cursor ).hasNext ();
@@ -642,8 +639,7 @@ void queryWithBatchSize(ArangoDatabase db) {
642
639
}
643
640
644
641
final ArangoCursor <String > cursor = db
645
- .query ("for i in " + CNAME1 + " return i._id" , null , new AqlQueryOptions ().batchSize (5 ).count (true ),
646
- String .class );
642
+ .query ("for i in " + CNAME1 + " return i._id" , String .class , new AqlQueryOptions ().batchSize (5 ).count (true ));
647
643
648
644
assertThat ((Object ) cursor ).isNotNull ();
649
645
for (int i = 0 ; i < 10 ; i ++, cursor .next ()) {
@@ -659,8 +655,7 @@ void queryIterateWithBatchSize(ArangoDatabase db) {
659
655
}
660
656
661
657
final ArangoCursor <String > cursor = db
662
- .query ("for i in " + CNAME1 + " return i._id" , null , new AqlQueryOptions ().batchSize (5 ).count (true ),
663
- String .class );
658
+ .query ("for i in " + CNAME1 + " return i._id" , String .class , new AqlQueryOptions ().batchSize (5 ).count (true ));
664
659
665
660
assertThat ((Object ) cursor ).isNotNull ();
666
661
final AtomicInteger i = new AtomicInteger (0 );
@@ -681,8 +676,7 @@ void queryWithTTL(ArangoDatabase db) throws InterruptedException {
681
676
}
682
677
683
678
final ArangoCursor <String > cursor = db
684
- .query ("for i in " + CNAME1 + " return i._id" , null , new AqlQueryOptions ().batchSize (5 ).ttl (ttl ),
685
- String .class );
679
+ .query ("for i in " + CNAME1 + " return i._id" , String .class , new AqlQueryOptions ().batchSize (5 ).ttl (ttl ));
686
680
687
681
assertThat ((Iterable <String >) cursor ).isNotNull ();
688
682
@@ -733,15 +727,15 @@ void queryWithCache(ArangoDatabase db) {
733
727
db .setQueryCacheProperties (properties );
734
728
735
729
final ArangoCursor <String > cursor = db
736
- .query ("FOR t IN " + CNAME1 + " FILTER t.age >= 10 SORT t.age RETURN t._id" , null ,
737
- new AqlQueryOptions ().cache (true ), String . class );
730
+ .query ("FOR t IN " + CNAME1 + " FILTER t.age >= 10 SORT t.age RETURN t._id" , String . class ,
731
+ new AqlQueryOptions ().cache (true ));
738
732
739
733
assertThat ((Object ) cursor ).isNotNull ();
740
734
assertThat (cursor .isCached ()).isFalse ();
741
735
742
736
final ArangoCursor <String > cachedCursor = db
743
- .query ("FOR t IN " + CNAME1 + " FILTER t.age >= 10 SORT t.age RETURN t._id" , null ,
744
- new AqlQueryOptions ().cache (true ), String . class );
737
+ .query ("FOR t IN " + CNAME1 + " FILTER t.age >= 10 SORT t.age RETURN t._id" , String . class ,
738
+ new AqlQueryOptions ().cache (true ));
745
739
746
740
assertThat ((Object ) cachedCursor ).isNotNull ();
747
741
assertThat (cachedCursor .isCached ()).isTrue ();
@@ -754,34 +748,34 @@ void queryWithCache(ArangoDatabase db) {
754
748
@ ParameterizedTest (name = "{index}" )
755
749
@ MethodSource ("dbs" )
756
750
void queryWithMemoryLimit (ArangoDatabase db ) {
757
- Throwable thrown = catchThrowable (() -> db .query ("RETURN 1..100000" , null ,
758
- new AqlQueryOptions ().memoryLimit (32 * 1024L ), String . class ));
751
+ Throwable thrown = catchThrowable (() -> db .query ("RETURN 1..100000" , String . class ,
752
+ new AqlQueryOptions ().memoryLimit (32 * 1024L )));
759
753
assertThat (thrown ).isInstanceOf (ArangoDBException .class );
760
754
assertThat (((ArangoDBException ) thrown ).getErrorNum ()).isEqualTo (32 );
761
755
}
762
756
763
757
@ ParameterizedTest (name = "{index}" )
764
758
@ MethodSource ("dbs" )
765
759
void queryWithFailOnWarningTrue (ArangoDatabase db ) {
766
- Throwable thrown = catchThrowable (() -> db .query ("RETURN 1 / 0" , null ,
767
- new AqlQueryOptions ().failOnWarning (true ), String . class ));
760
+ Throwable thrown = catchThrowable (() -> db .query ("RETURN 1 / 0" , String . class ,
761
+ new AqlQueryOptions ().failOnWarning (true )));
768
762
assertThat (thrown ).isInstanceOf (ArangoDBException .class );
769
763
}
770
764
771
765
@ ParameterizedTest (name = "{index}" )
772
766
@ MethodSource ("dbs" )
773
767
void queryWithFailOnWarningFalse (ArangoDatabase db ) {
774
768
final ArangoCursor <String > cursor = db
775
- .query ("RETURN 1 / 0" , null , new AqlQueryOptions ().failOnWarning (false ), String . class );
769
+ .query ("RETURN 1 / 0" , String . class , new AqlQueryOptions ().failOnWarning (false ));
776
770
assertThat (cursor .next ()).isNull ();
777
771
}
778
772
779
773
@ ParameterizedTest (name = "{index}" )
780
774
@ MethodSource ("dbs" )
781
775
void queryWithTimeout (ArangoDatabase db ) {
782
776
assumeTrue (isAtLeastVersion (3 , 6 ));
783
- Throwable thrown = catchThrowable (() -> db .query ("RETURN SLEEP(1)" , null ,
784
- new AqlQueryOptions ().maxRuntime (0.1 ), String . class ).next ());
777
+ Throwable thrown = catchThrowable (() -> db .query ("RETURN SLEEP(1)" , String . class ,
778
+ new AqlQueryOptions ().maxRuntime (0.1 )).next ());
785
779
assertThat (thrown ).isInstanceOf (ArangoDBException .class );
786
780
assertThat (((ArangoDBException ) thrown ).getResponseCode ()).isEqualTo (410 );
787
781
}
@@ -790,10 +784,10 @@ void queryWithTimeout(ArangoDatabase db) {
790
784
@ MethodSource ("dbs" )
791
785
void queryWithMaxWarningCount (ArangoDatabase db ) {
792
786
final ArangoCursor <String > cursorWithWarnings = db
793
- .query ("RETURN 1 / 0" , null , new AqlQueryOptions (), String . class );
787
+ .query ("RETURN 1 / 0" , String . class , new AqlQueryOptions ());
794
788
assertThat (cursorWithWarnings .getWarnings ()).hasSize (1 );
795
789
final ArangoCursor <String > cursorWithLimitedWarnings = db
796
- .query ("RETURN 1 / 0" , null , new AqlQueryOptions ().maxWarningCount (0L ), String . class );
790
+ .query ("RETURN 1 / 0" , String . class , new AqlQueryOptions ().maxWarningCount (0L ));
797
791
final Collection <CursorWarning > warnings = cursorWithLimitedWarnings .getWarnings ();
798
792
assertThat (warnings ).isNullOrEmpty ();
799
793
}
@@ -807,8 +801,8 @@ void queryCursor(ArangoDatabase db) {
807
801
}
808
802
809
803
final int batchSize = 5 ;
810
- final ArangoCursor <String > cursor = db .query ("for i in " + CNAME1 + " return i._id" , null ,
811
- new AqlQueryOptions ().batchSize (batchSize ).count (true ), String . class );
804
+ final ArangoCursor <String > cursor = db .query ("for i in " + CNAME1 + " return i._id" , String . class ,
805
+ new AqlQueryOptions ().batchSize (batchSize ).count (true ));
812
806
assertThat ((Object ) cursor ).isNotNull ();
813
807
assertThat (cursor .getCount ()).isGreaterThanOrEqualTo (numbDocs );
814
808
@@ -859,8 +853,7 @@ void queryWithBindVars(ArangoDatabase db) {
859
853
bindVars .put ("age" , 25 );
860
854
861
855
final ArangoCursor <String > cursor = db
862
- .query ("FOR t IN @@coll FILTER t.age >= @age SORT t.age RETURN t._id" , bindVars , null ,
863
- String .class );
856
+ .query ("FOR t IN @@coll FILTER t.age >= @age SORT t.age RETURN t._id" , String .class , bindVars );
864
857
865
858
assertThat ((Object ) cursor ).isNotNull ();
866
859
@@ -876,7 +869,7 @@ void queryWithRawBindVars(ArangoDatabase db) {
876
869
bindVars .put ("foo" , RawJson .of ("\" fooValue\" " ));
877
870
bindVars .put ("bar" , RawBytes .of (db .getSerde ().serializeUserData (11 )));
878
871
879
- final JsonNode res = db .query ("RETURN {foo: @foo, bar: @bar}" , bindVars , null , JsonNode .class ).next ();
872
+ final JsonNode res = db .query ("RETURN {foo: @foo, bar: @bar}" , JsonNode .class , bindVars ).next ();
880
873
881
874
assertThat (res .get ("foo" ).textValue ()).isEqualTo ("fooValue" );
882
875
assertThat (res .get ("bar" ).intValue ()).isEqualTo (11 );
@@ -885,7 +878,7 @@ void queryWithRawBindVars(ArangoDatabase db) {
885
878
@ ParameterizedTest (name = "{index}" )
886
879
@ MethodSource ("arangos" )
887
880
void queryWithWarning (ArangoDB arangoDB ) {
888
- final ArangoCursor <String > cursor = arangoDB .db ().query ("return 1/0" , null , null , String .class );
881
+ final ArangoCursor <String > cursor = arangoDB .db ().query ("return 1/0" , String .class );
889
882
890
883
assertThat ((Object ) cursor ).isNotNull ();
891
884
assertThat (cursor .getWarnings ()).isNotNull ();
@@ -896,8 +889,7 @@ void queryWithWarning(ArangoDB arangoDB) {
896
889
void queryStream (ArangoDatabase db ) {
897
890
if (isAtLeastVersion (3 , 4 )) {
898
891
final ArangoCursor <Void > cursor = db
899
- .query ("FOR i IN 1..2 RETURN i" , null , new AqlQueryOptions ().stream (true ).count (true ),
900
- Void .class );
892
+ .query ("FOR i IN 1..2 RETURN i" , Void .class , new AqlQueryOptions ().stream (true ).count (true ));
901
893
assertThat ((Object ) cursor ).isNotNull ();
902
894
assertThat (cursor .getCount ()).isNull ();
903
895
}
@@ -907,7 +899,7 @@ void queryStream(ArangoDatabase db) {
907
899
@ MethodSource ("arangos" )
908
900
void queryClose (ArangoDB arangoDB ) throws IOException {
909
901
final ArangoCursor <String > cursor = arangoDB .db ()
910
- .query ("for i in 1..2 return i" , null , new AqlQueryOptions ().batchSize (1 ), String . class );
902
+ .query ("for i in 1..2 return i" , String . class , new AqlQueryOptions ().batchSize (1 ));
911
903
cursor .close ();
912
904
AtomicInteger count = new AtomicInteger ();
913
905
Throwable thrown = catchThrowable (() -> {
@@ -925,25 +917,24 @@ void queryClose(ArangoDB arangoDB) throws IOException {
925
917
@ MethodSource ("dbs" )
926
918
void queryNoResults (ArangoDatabase db ) throws IOException {
927
919
final ArangoCursor <BaseDocument > cursor = db
928
- .query ("FOR i IN @@col RETURN i" , new MapBuilder ().put ("@col" , CNAME1 ).get (), null ,
929
- BaseDocument .class );
920
+ .query ("FOR i IN @@col RETURN i" , BaseDocument .class , new MapBuilder ().put ("@col" , CNAME1 ).get ());
930
921
cursor .close ();
931
922
}
932
923
933
924
@ ParameterizedTest (name = "{index}" )
934
925
@ MethodSource ("dbs" )
935
926
void queryWithNullBindParam (ArangoDatabase db ) throws IOException {
936
927
final ArangoCursor <BaseDocument > cursor = db .query ("FOR i IN @@col FILTER i.test == @test RETURN i" ,
937
- new MapBuilder ().put ("@col" , CNAME1 ).put ("test" , null ).get (), null , BaseDocument . class );
928
+ BaseDocument . class , new MapBuilder ().put ("@col" , CNAME1 ).put ("test" , null ).get ());
938
929
cursor .close ();
939
930
}
940
931
941
932
@ ParameterizedTest (name = "{index}" )
942
933
@ MethodSource ("dbs" )
943
934
void queryAllowDirtyRead (ArangoDatabase db ) throws IOException {
944
935
final ArangoCursor <BaseDocument > cursor = db .query ("FOR i IN @@col FILTER i.test == @test RETURN i" ,
945
- new MapBuilder ().put ("@col" , CNAME1 ).put ("test" , null ).get (),
946
- new AqlQueryOptions ().allowDirtyRead (true ), BaseDocument . class );
936
+ BaseDocument . class , new MapBuilder ().put ("@col" , CNAME1 ).put ("test" , null ).get (),
937
+ new AqlQueryOptions ().allowDirtyRead (true ));
947
938
if (isAtLeastVersion (3 , 10 )) {
948
939
assertThat (cursor .isPotentialDirtyRead ()).isTrue ();
949
940
}
@@ -1023,7 +1014,7 @@ void parseQuery(ArangoDatabase db) {
1023
1014
@ MethodSource ("dbs" )
1024
1015
void getCurrentlyRunningQueries (ArangoDatabase db ) throws InterruptedException {
1025
1016
String query = "return sleep(1)" ;
1026
- Thread t = new Thread (() -> db .query (query , null , null , Void .class ));
1017
+ Thread t = new Thread (() -> db .query (query , Void .class ));
1027
1018
t .start ();
1028
1019
Thread .sleep (300 );
1029
1020
final Collection <QueryEntity > currentlyRunningQueries = db .getCurrentlyRunningQueries ();
@@ -1040,7 +1031,7 @@ void killQuery(ArangoDatabase db) throws InterruptedException, ExecutionExceptio
1040
1031
ExecutorService es = Executors .newSingleThreadExecutor ();
1041
1032
Future <?> future = es .submit (() -> {
1042
1033
try {
1043
- db .query ("return sleep(5)" , null , null , Void .class );
1034
+ db .query ("return sleep(5)" , Void .class );
1044
1035
fail ();
1045
1036
} catch (ArangoDBException e ) {
1046
1037
assertThat (e .getResponseCode ()).isEqualTo (410 );
@@ -1074,7 +1065,7 @@ void getAndClearSlowQueries(ArangoDatabase db) {
1074
1065
properties .setSlowQueryThreshold (1L );
1075
1066
db .setQueryTrackingProperties (properties );
1076
1067
1077
- db .query ("return sleep(1.1)" , null , null , Void .class );
1068
+ db .query ("return sleep(1.1)" , Void .class );
1078
1069
final Collection <QueryEntity > slowQueries = db .getSlowQueries ();
1079
1070
assertThat (slowQueries ).hasSize (1 );
1080
1071
final QueryEntity queryEntity = slowQueries .iterator ().next ();
0 commit comments