@@ -912,13 +912,41 @@ void queryWithWarning(ArangoDB arangoDB) {
912912 @ ParameterizedTest (name = "{index}" )
913913 @ MethodSource ("dbs" )
914914 void queryStream (ArangoDatabase db ) {
915- if (isAtLeastVersion (3 , 4 )) {
916- final ArangoCursor <VPackSlice > cursor = db
917- .query ("FOR i IN 1..2 RETURN i" , null , new AqlQueryOptions ().stream (true ).count (true ),
918- VPackSlice .class );
919- assertThat ((Object ) cursor ).isNotNull ();
920- assertThat (cursor .getCount ()).isNull ();
921- }
915+ final ArangoCursor <VPackSlice > cursor = db
916+ .query ("FOR i IN 1..2 RETURN i" , null , new AqlQueryOptions ().stream (true ).count (true ),
917+ VPackSlice .class );
918+ assertThat ((Object ) cursor ).isNotNull ();
919+ assertThat (cursor .getCount ()).isNull ();
920+ }
921+
922+ @ ParameterizedTest (name = "{index}" )
923+ @ MethodSource ("dbs" )
924+ void queryForceOneShardAttributeValue (ArangoDatabase db ) {
925+ assumeTrue (isAtLeastVersion (3 , 10 ));
926+ assumeTrue (isCluster ());
927+ assumeTrue (isEnterprise ());
928+
929+ String cname = "forceOneShardAttr-" + UUID .randomUUID ();
930+ db .createCollection (cname , new CollectionCreateOptions ()
931+ .shardKeys ("foo" )
932+ .numberOfShards (3 ));
933+ ArangoCollection col = db .collection (cname );
934+ BaseDocument doc = new BaseDocument ();
935+ doc .addAttribute ("foo" , "bar" );
936+ col .insertDocument (doc );
937+
938+ ArangoCursor <BaseDocument > c1 = db
939+ .query ("FOR d IN @@c RETURN d" , Collections .singletonMap ("@c" , cname ), new AqlQueryOptions ()
940+ .forceOneShardAttributeValue ("bar" ),
941+ BaseDocument .class );
942+ assertThat (c1 .hasNext ()).isTrue ();
943+ assertThat (c1 .next ().getAttribute ("foo" )).isEqualTo ("bar" );
944+
945+ ArangoCursor <BaseDocument > c2 = db
946+ .query ("FOR d IN @@c RETURN d" , Collections .singletonMap ("@c" , cname ), new AqlQueryOptions ()
947+ .forceOneShardAttributeValue ("ooo" ),
948+ BaseDocument .class );
949+ assertThat (c2 .hasNext ()).isFalse ();
922950 }
923951
924952 @ ParameterizedTest (name = "{index}" )
0 commit comments