@@ -103,13 +103,16 @@ public void beforeEach() {
103103 // first call the super method
104104 super .beforeEach ();
105105 // then do processing for this class
106- couchbaseTemplate .removeByQuery (User .class ).inCollection (collectionName ).all ();
106+ couchbaseTemplate .removeByQuery (User .class ).withConsistency (QueryScanConsistency .REQUEST_PLUS )
107+ .inCollection (collectionName ).all ();
107108 couchbaseTemplate .findByQuery (User .class ).withConsistency (QueryScanConsistency .REQUEST_PLUS )
108109 .inCollection (collectionName ).all ();
109- couchbaseTemplate .removeByQuery (Airport .class ).inScope (scopeName ).inCollection (collectionName ).all ();
110+ couchbaseTemplate .removeByQuery (Airport .class ).withConsistency (QueryScanConsistency .REQUEST_PLUS ).inScope (scopeName )
111+ .inCollection (collectionName ).all ();
110112 couchbaseTemplate .findByQuery (Airport .class ).withConsistency (QueryScanConsistency .REQUEST_PLUS ).inScope (scopeName )
111113 .inCollection (collectionName ).all ();
112- couchbaseTemplate .removeByQuery (Airport .class ).inScope (otherScope ).inCollection (otherCollection ).all ();
114+ couchbaseTemplate .removeByQuery (Airport .class ).withConsistency (QueryScanConsistency .REQUEST_PLUS )
115+ .inScope (otherScope ).inCollection (otherCollection ).all ();
113116 couchbaseTemplate .findByQuery (Airport .class ).withConsistency (QueryScanConsistency .REQUEST_PLUS ).inScope (otherScope )
114117 .inCollection (otherCollection ).all ();
115118 }
@@ -355,7 +358,7 @@ void distinctReactive() {
355358 assertEquals (2 , count1 );
356359
357360 // count (distinct { iata, icao } )
358- Long count2 = reactiveCouchbaseTemplate .findByQuery (Airport .class ).distinct (new String [] {"iata" , "icao" })
361+ Long count2 = reactiveCouchbaseTemplate .findByQuery (Airport .class ).distinct (new String [] { "iata" , "icao" })
359362 .withConsistency (QueryScanConsistency .REQUEST_PLUS ).inCollection (collectionName ).count ().block ();
360363 assertEquals (7 , count2 );
361364
@@ -384,7 +387,7 @@ public void existsById() { // 1
384387 GetOptions options = GetOptions .getOptions ().timeout (Duration .ofSeconds (10 ));
385388 ExistsOptions existsOptions = ExistsOptions .existsOptions ().timeout (Duration .ofSeconds (10 ));
386389 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
387- .one (vie );
390+ .one (vie . withIcao ( "398" ) );
388391 try {
389392 Boolean exists = couchbaseTemplate .existsById ().inScope (scopeName ).inCollection (collectionName )
390393 .withOptions (existsOptions ).one (saved .getId ());
@@ -399,7 +402,7 @@ public void existsById() { // 1
399402 public void findByAnalytics () { // 2
400403 AnalyticsOptions options = AnalyticsOptions .analyticsOptions ().timeout (Duration .ofSeconds (10 ));
401404 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
402- .one (vie );
405+ .one (vie . withIcao ( "413" ) );
403406 try {
404407 List <Airport > found = couchbaseTemplate .findByAnalytics (Airport .class ).inScope (scopeName )
405408 .inCollection (collectionName ).withOptions (options ).all ();
@@ -413,7 +416,7 @@ public void findByAnalytics() { // 2
413416 public void findById () { // 3
414417 GetOptions options = GetOptions .getOptions ().timeout (Duration .ofSeconds (10 ));
415418 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
416- .one (vie );
419+ .one (vie . withIcao ( "427" ) );
417420 try {
418421 Airport found = couchbaseTemplate .findById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
419422 .withOptions (options ).one (saved .getId ());
@@ -427,7 +430,7 @@ public void findById() { // 3
427430 public void findByQuery () { // 4
428431 QueryOptions options = QueryOptions .queryOptions ().timeout (Duration .ofSeconds (10 ));
429432 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
430- .one (vie );
433+ .one (vie . withIcao ( "441" ) );
431434 try {
432435 List <Airport > found = couchbaseTemplate .findByQuery (Airport .class )
433436 .withConsistency (QueryScanConsistency .REQUEST_PLUS ).inScope (scopeName ).inCollection (collectionName )
@@ -442,7 +445,7 @@ public void findByQuery() { // 4
442445 public void findFromReplicasById () { // 5
443446 GetAnyReplicaOptions options = GetAnyReplicaOptions .getAnyReplicaOptions ().timeout (Duration .ofSeconds (10 ));
444447 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
445- .one (vie );
448+ .one (vie . withIcao ( "456" ) );
446449 try {
447450 Airport found = couchbaseTemplate .findFromReplicasById (Airport .class ).inScope (scopeName )
448451 .inCollection (collectionName ).withOptions (options ).any (saved .getId ());
@@ -471,7 +474,7 @@ public void insertById() { // 6
471474 public void removeById () { // 7
472475 RemoveOptions options = RemoveOptions .removeOptions ().timeout (Duration .ofSeconds (10 ));
473476 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
474- .one (vie );
477+ .one (vie . withIcao ( "485" ) );
475478 RemoveResult removeResult = couchbaseTemplate .removeById ().inScope (scopeName ).inCollection (collectionName )
476479 .withOptions (options ).one (saved .getId ());
477480 assertEquals (saved .getId (), removeResult .getId ());
@@ -481,7 +484,7 @@ public void removeById() { // 7
481484 public void removeByQuery () { // 8
482485 QueryOptions options = QueryOptions .queryOptions ().timeout (Duration .ofSeconds (10 ));
483486 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
484- .one (vie );
487+ .one (vie . withIcao ( "495" ) );
485488 List <RemoveResult > removeResults = couchbaseTemplate .removeByQuery (Airport .class )
486489 .withConsistency (QueryScanConsistency .REQUEST_PLUS ).inScope (scopeName ).inCollection (collectionName )
487490 .withOptions (options ).matching (Query .query (QueryCriteria .where ("iata" ).is (vie .getIata ()))).all ();
@@ -494,7 +497,7 @@ public void replaceById() { // 9
494497 ReplaceOptions options = ReplaceOptions .replaceOptions ().timeout (Duration .ofSeconds (10 ));
495498 GetOptions getOptions = GetOptions .getOptions ().timeout (Duration .ofSeconds (10 ));
496499 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
497- .withOptions (insertOptions ).one (vie );
500+ .withOptions (insertOptions ).one (vie . withIcao ( "508" ) );
498501 Airport replaced = couchbaseTemplate .replaceById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
499502 .withOptions (options ).one (vie .withIcao ("newIcao" ));
500503 try {
@@ -512,7 +515,7 @@ public void upsertById() { // 10
512515 GetOptions getOptions = GetOptions .getOptions ().timeout (Duration .ofSeconds (10 ));
513516
514517 Airport saved = couchbaseTemplate .upsertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
515- .withOptions (options ).one (vie );
518+ .withOptions (options ).one (vie . withIcao ( "526" ) );
516519 try {
517520 Airport found = couchbaseTemplate .findById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
518521 .withOptions (getOptions ).one (saved .getId ());
@@ -527,13 +530,14 @@ public void existsByIdOther() { // 1
527530 GetOptions options = GetOptions .getOptions ().timeout (Duration .ofSeconds (10 ));
528531 ExistsOptions existsOptions = ExistsOptions .existsOptions ().timeout (Duration .ofSeconds (10 ));
529532 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
530- .one (vie );
533+ .one (vie .withIcao ("lowg" ));
534+
531535 try {
532536 Boolean exists = couchbaseTemplate .existsById ().inScope (otherScope ).inCollection (otherCollection )
533- .withOptions (existsOptions ).one (saved .getId ());
534- assertTrue (exists , "Airport should exist: " + saved .getId ());
537+ .withOptions (existsOptions ).one (vie .getId ());
538+ assertTrue (exists , "Airport should exist: " + vie .getId ());
535539 } finally {
536- couchbaseTemplate .removeById ().inScope (otherScope ).inCollection (otherCollection ).one (saved .getId ());
540+ couchbaseTemplate .removeById ().inScope (otherScope ).inCollection (otherCollection ).one (vie .getId ());
537541 }
538542 }
539543
@@ -542,7 +546,7 @@ public void existsByIdOther() { // 1
542546 public void findByAnalyticsOther () { // 2
543547 AnalyticsOptions options = AnalyticsOptions .analyticsOptions ().timeout (Duration .ofSeconds (10 ));
544548 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
545- .one (vie );
549+ .one (vie . withIcao ( "566" ) );
546550 try {
547551 List <Airport > found = couchbaseTemplate .findByAnalytics (Airport .class ).inScope (otherScope )
548552 .inCollection (otherCollection ).withOptions (options ).all ();
@@ -556,7 +560,7 @@ public void findByAnalyticsOther() { // 2
556560 public void findByIdOther () { // 3
557561 GetOptions options = GetOptions .getOptions ().timeout (Duration .ofSeconds (10 ));
558562 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
559- .one (vie );
563+ .one (vie . withIcao ( "580" ) );
560564 try {
561565 Airport found = couchbaseTemplate .findById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
562566 .withOptions (options ).one (saved .getId ());
@@ -570,7 +574,7 @@ public void findByIdOther() { // 3
570574 public void findByQueryOther () { // 4
571575 QueryOptions options = QueryOptions .queryOptions ().timeout (Duration .ofSeconds (10 ));
572576 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
573- .one (vie );
577+ .one (vie . withIcao ( "594" ) );
574578 try {
575579 List <Airport > found = couchbaseTemplate .findByQuery (Airport .class )
576580 .withConsistency (QueryScanConsistency .REQUEST_PLUS ).inScope (otherScope ).inCollection (otherCollection )
@@ -585,7 +589,7 @@ public void findByQueryOther() { // 4
585589 public void findFromReplicasByIdOther () { // 5
586590 GetAnyReplicaOptions options = GetAnyReplicaOptions .getAnyReplicaOptions ().timeout (Duration .ofSeconds (10 ));
587591 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
588- .one (vie );
592+ .one (vie . withIcao ( "609" ) );
589593 try {
590594 Airport found = couchbaseTemplate .findFromReplicasById (Airport .class ).inScope (otherScope )
591595 .inCollection (otherCollection ).withOptions (options ).any (saved .getId ());
@@ -614,7 +618,7 @@ public void insertByIdOther() { // 6
614618 public void removeByIdOther () { // 7
615619 RemoveOptions options = RemoveOptions .removeOptions ().timeout (Duration .ofSeconds (10 ));
616620 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
617- .one (vie );
621+ .one (vie . withIcao ( "638" ) );
618622 RemoveResult removeResult = couchbaseTemplate .removeById ().inScope (otherScope ).inCollection (otherCollection )
619623 .withOptions (options ).one (saved .getId ());
620624 assertEquals (saved .getId (), removeResult .getId ());
@@ -624,7 +628,7 @@ public void removeByIdOther() { // 7
624628 public void removeByQueryOther () { // 8
625629 QueryOptions options = QueryOptions .queryOptions ().timeout (Duration .ofSeconds (10 ));
626630 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
627- .one (vie );
631+ .one (vie . withIcao ( "648" ) );
628632 List <RemoveResult > removeResults = couchbaseTemplate .removeByQuery (Airport .class )
629633 .withConsistency (QueryScanConsistency .REQUEST_PLUS ).inScope (otherScope ).inCollection (otherCollection )
630634 .withOptions (options ).matching (Query .query (QueryCriteria .where ("iata" ).is (vie .getIata ()))).all ();
@@ -637,7 +641,7 @@ public void replaceByIdOther() { // 9
637641 ReplaceOptions options = ReplaceOptions .replaceOptions ().timeout (Duration .ofSeconds (10 ));
638642 GetOptions getOptions = GetOptions .getOptions ().timeout (Duration .ofSeconds (10 ));
639643 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
640- .withOptions (insertOptions ).one (vie );
644+ .withOptions (insertOptions ).one (vie . withIcao ( "661" ) );
641645 Airport replaced = couchbaseTemplate .replaceById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
642646 .withOptions (options ).one (vie .withIcao ("newIcao" ));
643647 try {
@@ -655,7 +659,7 @@ public void upsertByIdOther() { // 10
655659 GetOptions getOptions = GetOptions .getOptions ().timeout (Duration .ofSeconds (10 ));
656660
657661 Airport saved = couchbaseTemplate .upsertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
658- .withOptions (options ).one (vie );
662+ .withOptions (options ).one (vie . withIcao ( "679" ) );
659663 try {
660664 Airport found = couchbaseTemplate .findById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
661665 .withOptions (getOptions ).one (saved .getId ());
@@ -699,7 +703,7 @@ public void findByQueryOptions() { // 4
699703 public void findFromReplicasByIdOptions () { // 5
700704 GetAnyReplicaOptions options = GetAnyReplicaOptions .getAnyReplicaOptions ().timeout (Duration .ofNanos (1000 ));
701705 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
702- .one (vie );
706+ .one (vie . withIcao ( "723" ) );
703707 try {
704708 Airport found = couchbaseTemplate .findFromReplicasById (Airport .class ).inScope (otherScope )
705709 .inCollection (otherCollection ).withOptions (options ).any (saved .getId ());
@@ -719,7 +723,7 @@ public void insertByIdOptions() { // 6
719723 @ Test
720724 public void removeByIdOptions () { // 7 - options
721725 Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
722- .one (vie );
726+ .one (vie . withIcao ( "743" ) );
723727 RemoveOptions options = RemoveOptions .removeOptions ().timeout (Duration .ofNanos (10 ));
724728 assertThrows (AmbiguousTimeoutException .class , () -> couchbaseTemplate .removeById ().inScope (otherScope )
725729 .inCollection (otherCollection ).withOptions (options ).one (vie .getId ()));
@@ -746,7 +750,7 @@ public void replaceByIdOptions() { // 9 - options
746750 public void upsertByIdOptions () { // 10 - options
747751 UpsertOptions options = UpsertOptions .upsertOptions ().timeout (Duration .ofNanos (10 ));
748752 assertThrows (AmbiguousTimeoutException .class , () -> couchbaseTemplate .upsertById (Airport .class ).inScope (otherScope )
749- .inCollection (otherCollection ).withOptions (options ).one (vie ));
753+ .inCollection (otherCollection ).withOptions (options ).one (vie . withIcao ( "770" ) ));
750754 }
751755
752756 @ Test
0 commit comments