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