@@ -491,6 +491,13 @@ public void testListValid() {
491491 runListTestWithPrefix ("wildcard.*" );
492492 }
493493
494+ @ Test
495+ public void testListValidMany () {
496+ runListTestWithPrefixMany ("wildcard" );
497+ runListTestWithPrefixMany ("wildcard." );
498+ runListTestWithPrefixMany ("wildcard.*" );
499+ }
500+
494501 private void runListTestWithPrefix (String prefix ) {
495502 EntityDescriptor entity = server .repo .getEntity ("dummy" );
496503 AttributeDescriptor <?> attribute = entity .getAttribute ("wildcard.*" );
@@ -560,6 +567,61 @@ public void onCompleted() {
560567 assertArrayEquals (new byte [] {1 , 2 , 3 , 4 }, response .getValue (1 ).getValue ().toByteArray ());
561568 }
562569
570+ private void runListTestWithPrefixMany (String prefix ) {
571+ EntityDescriptor entity = server .repo .getEntity ("dummy" );
572+ AttributeDescriptor <?> attribute = entity .getAttribute ("wildcard.*" );
573+ String key = "my-fancy-entity-key" ;
574+
575+ for (int i = 1 ; i <= 500 ; i ++) {
576+ Optionals .get (server .direct .getWriter (attribute ))
577+ .write (
578+ StreamElement .upsert (
579+ entity ,
580+ attribute ,
581+ UUID .randomUUID ().toString (),
582+ key ,
583+ "wildcard." + i ,
584+ System .currentTimeMillis (),
585+ new byte [] {1 , 2 , 3 }),
586+ CommitCallback .noop ());
587+ }
588+ Rpc .ListRequest request =
589+ Rpc .ListRequest .newBuilder ()
590+ .setEntity (entity .getName ())
591+ .setWildcardPrefix (prefix )
592+ .setKey (key )
593+ .build ();
594+
595+ List <Rpc .ListResponse > responses = new ArrayList <>();
596+ AtomicBoolean finished = new AtomicBoolean (false );
597+ final StreamObserver <Rpc .ListResponse > responseObserver ;
598+ responseObserver =
599+ new StreamObserver <>() {
600+ @ Override
601+ public void onNext (Rpc .ListResponse res ) {
602+ responses .add (res );
603+ }
604+
605+ @ Override
606+ public void onError (Throwable thrwbl ) {
607+ throw new RuntimeException (thrwbl );
608+ }
609+
610+ @ Override
611+ public void onCompleted () {
612+ finished .set (true );
613+ }
614+ };
615+
616+ retrieve .listAttributes (request , responseObserver );
617+
618+ assertTrue (finished .get ());
619+ assertEquals (1 , responses .size ());
620+ Rpc .ListResponse response = responses .get (0 );
621+ assertEquals (200 , response .getStatus ());
622+ assertEquals (500 , response .getValueCount ());
623+ }
624+
563625 @ Test
564626 public void testMultifetchListValid () {
565627 EntityDescriptor entity = server .repo .getEntity ("dummy" );
0 commit comments