1616
1717package org .springframework .data .couchbase .repository ;
1818
19- import com .couchbase .client .core .error .IndexExistsException ;
19+ import static java .util .Arrays .asList ;
20+ import static org .junit .jupiter .api .Assertions .assertEquals ;
21+ import static org .junit .jupiter .api .Assertions .assertFalse ;
22+ import static org .junit .jupiter .api .Assertions .assertThrows ;
23+ import static org .junit .jupiter .api .Assertions .assertTrue ;
24+
25+ import reactor .core .publisher .Flux ;
26+ import reactor .test .StepVerifier ;
27+
28+ import java .util .List ;
29+ import java .util .concurrent .Callable ;
30+ import java .util .concurrent .ExecutorService ;
31+ import java .util .concurrent .Executors ;
32+ import java .util .concurrent .Future ;
33+ import java .util .stream .Collectors ;
34+
2035import org .junit .jupiter .api .BeforeEach ;
2136import org .junit .jupiter .api .Test ;
2237import org .springframework .beans .factory .annotation .Autowired ;
3550import org .springframework .data .couchbase .util .ClusterType ;
3651import org .springframework .data .couchbase .util .IgnoreWhen ;
3752import org .springframework .test .context .junit .jupiter .SpringJUnitConfig ;
38- import reactor .test .StepVerifier ;
39-
40- import java .util .List ;
41- import java .util .concurrent .Callable ;
42- import java .util .concurrent .ExecutorService ;
43- import java .util .concurrent .Executors ;
44- import java .util .concurrent .Future ;
45- import java .util .stream .Collectors ;
4653
47- import static java .util .Arrays .*;
48- import static org .assertj .core .api .Assertions .*;
49- import static org .junit .jupiter .api .Assertions .*;
54+ import com .couchbase .client .core .error .IndexExistsException ;
5055
5156/**
5257 * template class for Reactive Couchbase operations
5863@ IgnoreWhen (missesCapabilities = Capabilities .QUERY , clusterTypes = ClusterType .MOCKED )
5964public class ReactiveCouchbaseRepositoryQueryIntegrationTests extends ClusterAwareIntegrationTests {
6065
61- @ Autowired
62- CouchbaseClientFactory clientFactory ;
66+ @ Autowired CouchbaseClientFactory clientFactory ;
6367
64- @ Autowired
65- ReactiveAirportRepository airportRepository ; // intellij flags "Could not Autowire", but it runs ok.
66- @ Autowired
67- ReactiveUserRepository userRepository ; // intellij flags "Could not Autowire", but it runs ok.
68+ @ Autowired ReactiveAirportRepository airportRepository ; // intellij flags "Could not Autowire", but it runs ok.
69+ @ Autowired ReactiveUserRepository userRepository ; // intellij flags "Could not Autowire", but it runs ok.
6870
6971 @ BeforeEach
7072 void beforeEach () {
@@ -119,7 +121,7 @@ public void testCas() {
119121
120122 @ Test
121123 void count () {
122- String [] iatas = {"JFK" , "IAD" , "SFO" , "SJC" , "SEA" , "LAX" , "PHX" };
124+ String [] iatas = { "JFK" , "IAD" , "SFO" , "SJC" , "SEA" , "LAX" , "PHX" };
123125 Future [] future = new Future [iatas .length ];
124126 ExecutorService executorService = Executors .newFixedThreadPool (iatas .length );
125127 try {
@@ -129,7 +131,7 @@ void count() {
129131 airportRepository .save (airport ).block ();
130132 }
131133
132- Long airportCount = airportCount = airportRepository .count ().block ();
134+ Long airportCount = airportRepository .count ().block ();
133135 assertEquals (iatas .length , airportCount );
134136
135137 airportCount = airportRepository .countByIataIn ("JFK" , "IAD" , "SFO" ).block ();
@@ -154,21 +156,23 @@ void count() {
154156 }
155157
156158 @ Test
157- // DATACOUCH-650
159+ // DATACOUCH-650
158160 void deleteAllById () {
159161
160162 Airport vienna = new Airport ("airports::vie" , "vie" , "LOWW" );
161163 Airport frankfurt = new Airport ("airports::fra" , "fra" , "EDDF" );
162164 Airport losAngeles = new Airport ("airports::lax" , "lax" , "KLAX" );
163165
164166 try {
165- airportRepository .saveAll (asList (vienna , frankfurt , losAngeles )).as (StepVerifier ::create ).verifyComplete ();
167+ airportRepository .saveAll (asList (vienna , frankfurt , losAngeles )).as (StepVerifier ::create )
168+ .expectNext (vienna , frankfurt , losAngeles ).verifyComplete ();
166169
167- airportRepository .deleteAllById (asList (vienna .getId (), losAngeles .getId ())).as (StepVerifier ::create ).verifyComplete ();
170+ airportRepository .deleteAllById (asList (vienna .getId (), losAngeles .getId ())).as (StepVerifier ::create )
171+ .verifyComplete ();
168172
169173 airportRepository .findAll ().as (StepVerifier ::create ).expectNext (frankfurt ).verifyComplete ();
170174 } finally {
171- airportRepository .deleteAll ();
175+ airportRepository .deleteAll (). block () ;
172176 }
173177 }
174178
0 commit comments