@@ -103,13 +103,16 @@ public void beforeEach() {
103
103
// first call the super method
104
104
super .beforeEach ();
105
105
// 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 ();
107
108
couchbaseTemplate .findByQuery (User .class ).withConsistency (QueryScanConsistency .REQUEST_PLUS )
108
109
.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 ();
110
112
couchbaseTemplate .findByQuery (Airport .class ).withConsistency (QueryScanConsistency .REQUEST_PLUS ).inScope (scopeName )
111
113
.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 ();
113
116
couchbaseTemplate .findByQuery (Airport .class ).withConsistency (QueryScanConsistency .REQUEST_PLUS ).inScope (otherScope )
114
117
.inCollection (otherCollection ).all ();
115
118
}
@@ -355,7 +358,7 @@ void distinctReactive() {
355
358
assertEquals (2 , count1 );
356
359
357
360
// 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" })
359
362
.withConsistency (QueryScanConsistency .REQUEST_PLUS ).inCollection (collectionName ).count ().block ();
360
363
assertEquals (7 , count2 );
361
364
@@ -384,7 +387,7 @@ public void existsById() { // 1
384
387
GetOptions options = GetOptions .getOptions ().timeout (Duration .ofSeconds (10 ));
385
388
ExistsOptions existsOptions = ExistsOptions .existsOptions ().timeout (Duration .ofSeconds (10 ));
386
389
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
387
- .one (vie );
390
+ .one (vie . withIcao ( "398" ) );
388
391
try {
389
392
Boolean exists = couchbaseTemplate .existsById ().inScope (scopeName ).inCollection (collectionName )
390
393
.withOptions (existsOptions ).one (saved .getId ());
@@ -399,7 +402,7 @@ public void existsById() { // 1
399
402
public void findByAnalytics () { // 2
400
403
AnalyticsOptions options = AnalyticsOptions .analyticsOptions ().timeout (Duration .ofSeconds (10 ));
401
404
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
402
- .one (vie );
405
+ .one (vie . withIcao ( "413" ) );
403
406
try {
404
407
List <Airport > found = couchbaseTemplate .findByAnalytics (Airport .class ).inScope (scopeName )
405
408
.inCollection (collectionName ).withOptions (options ).all ();
@@ -413,7 +416,7 @@ public void findByAnalytics() { // 2
413
416
public void findById () { // 3
414
417
GetOptions options = GetOptions .getOptions ().timeout (Duration .ofSeconds (10 ));
415
418
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
416
- .one (vie );
419
+ .one (vie . withIcao ( "427" ) );
417
420
try {
418
421
Airport found = couchbaseTemplate .findById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
419
422
.withOptions (options ).one (saved .getId ());
@@ -427,7 +430,7 @@ public void findById() { // 3
427
430
public void findByQuery () { // 4
428
431
QueryOptions options = QueryOptions .queryOptions ().timeout (Duration .ofSeconds (10 ));
429
432
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
430
- .one (vie );
433
+ .one (vie . withIcao ( "441" ) );
431
434
try {
432
435
List <Airport > found = couchbaseTemplate .findByQuery (Airport .class )
433
436
.withConsistency (QueryScanConsistency .REQUEST_PLUS ).inScope (scopeName ).inCollection (collectionName )
@@ -442,7 +445,7 @@ public void findByQuery() { // 4
442
445
public void findFromReplicasById () { // 5
443
446
GetAnyReplicaOptions options = GetAnyReplicaOptions .getAnyReplicaOptions ().timeout (Duration .ofSeconds (10 ));
444
447
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
445
- .one (vie );
448
+ .one (vie . withIcao ( "456" ) );
446
449
try {
447
450
Airport found = couchbaseTemplate .findFromReplicasById (Airport .class ).inScope (scopeName )
448
451
.inCollection (collectionName ).withOptions (options ).any (saved .getId ());
@@ -471,7 +474,7 @@ public void insertById() { // 6
471
474
public void removeById () { // 7
472
475
RemoveOptions options = RemoveOptions .removeOptions ().timeout (Duration .ofSeconds (10 ));
473
476
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
474
- .one (vie );
477
+ .one (vie . withIcao ( "485" ) );
475
478
RemoveResult removeResult = couchbaseTemplate .removeById ().inScope (scopeName ).inCollection (collectionName )
476
479
.withOptions (options ).one (saved .getId ());
477
480
assertEquals (saved .getId (), removeResult .getId ());
@@ -481,7 +484,7 @@ public void removeById() { // 7
481
484
public void removeByQuery () { // 8
482
485
QueryOptions options = QueryOptions .queryOptions ().timeout (Duration .ofSeconds (10 ));
483
486
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
484
- .one (vie );
487
+ .one (vie . withIcao ( "495" ) );
485
488
List <RemoveResult > removeResults = couchbaseTemplate .removeByQuery (Airport .class )
486
489
.withConsistency (QueryScanConsistency .REQUEST_PLUS ).inScope (scopeName ).inCollection (collectionName )
487
490
.withOptions (options ).matching (Query .query (QueryCriteria .where ("iata" ).is (vie .getIata ()))).all ();
@@ -494,7 +497,7 @@ public void replaceById() { // 9
494
497
ReplaceOptions options = ReplaceOptions .replaceOptions ().timeout (Duration .ofSeconds (10 ));
495
498
GetOptions getOptions = GetOptions .getOptions ().timeout (Duration .ofSeconds (10 ));
496
499
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
497
- .withOptions (insertOptions ).one (vie );
500
+ .withOptions (insertOptions ).one (vie . withIcao ( "508" ) );
498
501
Airport replaced = couchbaseTemplate .replaceById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
499
502
.withOptions (options ).one (vie .withIcao ("newIcao" ));
500
503
try {
@@ -512,7 +515,7 @@ public void upsertById() { // 10
512
515
GetOptions getOptions = GetOptions .getOptions ().timeout (Duration .ofSeconds (10 ));
513
516
514
517
Airport saved = couchbaseTemplate .upsertById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
515
- .withOptions (options ).one (vie );
518
+ .withOptions (options ).one (vie . withIcao ( "526" ) );
516
519
try {
517
520
Airport found = couchbaseTemplate .findById (Airport .class ).inScope (scopeName ).inCollection (collectionName )
518
521
.withOptions (getOptions ).one (saved .getId ());
@@ -527,13 +530,14 @@ public void existsByIdOther() { // 1
527
530
GetOptions options = GetOptions .getOptions ().timeout (Duration .ofSeconds (10 ));
528
531
ExistsOptions existsOptions = ExistsOptions .existsOptions ().timeout (Duration .ofSeconds (10 ));
529
532
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
530
- .one (vie );
533
+ .one (vie .withIcao ("lowg" ));
534
+
531
535
try {
532
536
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 ());
535
539
} finally {
536
- couchbaseTemplate .removeById ().inScope (otherScope ).inCollection (otherCollection ).one (saved .getId ());
540
+ couchbaseTemplate .removeById ().inScope (otherScope ).inCollection (otherCollection ).one (vie .getId ());
537
541
}
538
542
}
539
543
@@ -542,7 +546,7 @@ public void existsByIdOther() { // 1
542
546
public void findByAnalyticsOther () { // 2
543
547
AnalyticsOptions options = AnalyticsOptions .analyticsOptions ().timeout (Duration .ofSeconds (10 ));
544
548
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
545
- .one (vie );
549
+ .one (vie . withIcao ( "566" ) );
546
550
try {
547
551
List <Airport > found = couchbaseTemplate .findByAnalytics (Airport .class ).inScope (otherScope )
548
552
.inCollection (otherCollection ).withOptions (options ).all ();
@@ -556,7 +560,7 @@ public void findByAnalyticsOther() { // 2
556
560
public void findByIdOther () { // 3
557
561
GetOptions options = GetOptions .getOptions ().timeout (Duration .ofSeconds (10 ));
558
562
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
559
- .one (vie );
563
+ .one (vie . withIcao ( "580" ) );
560
564
try {
561
565
Airport found = couchbaseTemplate .findById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
562
566
.withOptions (options ).one (saved .getId ());
@@ -570,7 +574,7 @@ public void findByIdOther() { // 3
570
574
public void findByQueryOther () { // 4
571
575
QueryOptions options = QueryOptions .queryOptions ().timeout (Duration .ofSeconds (10 ));
572
576
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
573
- .one (vie );
577
+ .one (vie . withIcao ( "594" ) );
574
578
try {
575
579
List <Airport > found = couchbaseTemplate .findByQuery (Airport .class )
576
580
.withConsistency (QueryScanConsistency .REQUEST_PLUS ).inScope (otherScope ).inCollection (otherCollection )
@@ -585,7 +589,7 @@ public void findByQueryOther() { // 4
585
589
public void findFromReplicasByIdOther () { // 5
586
590
GetAnyReplicaOptions options = GetAnyReplicaOptions .getAnyReplicaOptions ().timeout (Duration .ofSeconds (10 ));
587
591
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
588
- .one (vie );
592
+ .one (vie . withIcao ( "609" ) );
589
593
try {
590
594
Airport found = couchbaseTemplate .findFromReplicasById (Airport .class ).inScope (otherScope )
591
595
.inCollection (otherCollection ).withOptions (options ).any (saved .getId ());
@@ -614,7 +618,7 @@ public void insertByIdOther() { // 6
614
618
public void removeByIdOther () { // 7
615
619
RemoveOptions options = RemoveOptions .removeOptions ().timeout (Duration .ofSeconds (10 ));
616
620
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
617
- .one (vie );
621
+ .one (vie . withIcao ( "638" ) );
618
622
RemoveResult removeResult = couchbaseTemplate .removeById ().inScope (otherScope ).inCollection (otherCollection )
619
623
.withOptions (options ).one (saved .getId ());
620
624
assertEquals (saved .getId (), removeResult .getId ());
@@ -624,7 +628,7 @@ public void removeByIdOther() { // 7
624
628
public void removeByQueryOther () { // 8
625
629
QueryOptions options = QueryOptions .queryOptions ().timeout (Duration .ofSeconds (10 ));
626
630
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
627
- .one (vie );
631
+ .one (vie . withIcao ( "648" ) );
628
632
List <RemoveResult > removeResults = couchbaseTemplate .removeByQuery (Airport .class )
629
633
.withConsistency (QueryScanConsistency .REQUEST_PLUS ).inScope (otherScope ).inCollection (otherCollection )
630
634
.withOptions (options ).matching (Query .query (QueryCriteria .where ("iata" ).is (vie .getIata ()))).all ();
@@ -637,7 +641,7 @@ public void replaceByIdOther() { // 9
637
641
ReplaceOptions options = ReplaceOptions .replaceOptions ().timeout (Duration .ofSeconds (10 ));
638
642
GetOptions getOptions = GetOptions .getOptions ().timeout (Duration .ofSeconds (10 ));
639
643
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
640
- .withOptions (insertOptions ).one (vie );
644
+ .withOptions (insertOptions ).one (vie . withIcao ( "661" ) );
641
645
Airport replaced = couchbaseTemplate .replaceById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
642
646
.withOptions (options ).one (vie .withIcao ("newIcao" ));
643
647
try {
@@ -655,7 +659,7 @@ public void upsertByIdOther() { // 10
655
659
GetOptions getOptions = GetOptions .getOptions ().timeout (Duration .ofSeconds (10 ));
656
660
657
661
Airport saved = couchbaseTemplate .upsertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
658
- .withOptions (options ).one (vie );
662
+ .withOptions (options ).one (vie . withIcao ( "679" ) );
659
663
try {
660
664
Airport found = couchbaseTemplate .findById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
661
665
.withOptions (getOptions ).one (saved .getId ());
@@ -699,7 +703,7 @@ public void findByQueryOptions() { // 4
699
703
public void findFromReplicasByIdOptions () { // 5
700
704
GetAnyReplicaOptions options = GetAnyReplicaOptions .getAnyReplicaOptions ().timeout (Duration .ofNanos (1000 ));
701
705
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
702
- .one (vie );
706
+ .one (vie . withIcao ( "723" ) );
703
707
try {
704
708
Airport found = couchbaseTemplate .findFromReplicasById (Airport .class ).inScope (otherScope )
705
709
.inCollection (otherCollection ).withOptions (options ).any (saved .getId ());
@@ -719,7 +723,7 @@ public void insertByIdOptions() { // 6
719
723
@ Test
720
724
public void removeByIdOptions () { // 7 - options
721
725
Airport saved = couchbaseTemplate .insertById (Airport .class ).inScope (otherScope ).inCollection (otherCollection )
722
- .one (vie );
726
+ .one (vie . withIcao ( "743" ) );
723
727
RemoveOptions options = RemoveOptions .removeOptions ().timeout (Duration .ofNanos (10 ));
724
728
assertThrows (AmbiguousTimeoutException .class , () -> couchbaseTemplate .removeById ().inScope (otherScope )
725
729
.inCollection (otherCollection ).withOptions (options ).one (vie .getId ()));
@@ -746,7 +750,7 @@ public void replaceByIdOptions() { // 9 - options
746
750
public void upsertByIdOptions () { // 10 - options
747
751
UpsertOptions options = UpsertOptions .upsertOptions ().timeout (Duration .ofNanos (10 ));
748
752
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" ) ));
750
754
}
751
755
752
756
@ Test
0 commit comments