16
16
17
17
package org .springframework .data .couchbase .repository ;
18
18
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
-
19
+ import com .couchbase .client .core .error .IndexExistsException ;
35
20
import org .junit .jupiter .api .BeforeEach ;
36
21
import org .junit .jupiter .api .Test ;
37
22
import org .springframework .beans .factory .annotation .Autowired ;
50
35
import org .springframework .data .couchbase .util .ClusterType ;
51
36
import org .springframework .data .couchbase .util .IgnoreWhen ;
52
37
import org .springframework .test .context .junit .jupiter .SpringJUnitConfig ;
38
+ import reactor .test .StepVerifier ;
53
39
54
- import com .couchbase .client .core .error .IndexExistsException ;
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 ;
46
+
47
+ import static java .util .Arrays .*;
48
+ import static org .assertj .core .api .Assertions .*;
49
+ import static org .junit .jupiter .api .Assertions .*;
55
50
56
51
/**
57
52
* template class for Reactive Couchbase operations
63
58
@ IgnoreWhen (missesCapabilities = Capabilities .QUERY , clusterTypes = ClusterType .MOCKED )
64
59
public class ReactiveCouchbaseRepositoryQueryIntegrationTests extends ClusterAwareIntegrationTests {
65
60
66
- @ Autowired CouchbaseClientFactory clientFactory ;
61
+ @ Autowired
62
+ CouchbaseClientFactory clientFactory ;
67
63
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.
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.
70
68
71
69
@ BeforeEach
72
70
void beforeEach () {
@@ -121,7 +119,7 @@ public void testCas() {
121
119
122
120
@ Test
123
121
void count () {
124
- String [] iatas = { "JFK" , "IAD" , "SFO" , "SJC" , "SEA" , "LAX" , "PHX" };
122
+ String [] iatas = {"JFK" , "IAD" , "SFO" , "SJC" , "SEA" , "LAX" , "PHX" };
125
123
Future [] future = new Future [iatas .length ];
126
124
ExecutorService executorService = Executors .newFixedThreadPool (iatas .length );
127
125
try {
@@ -131,7 +129,7 @@ void count() {
131
129
airportRepository .save (airport ).block ();
132
130
}
133
131
134
- Long airportCount = airportRepository .count ().block ();
132
+ Long airportCount = airportCount = airportRepository .count ().block ();
135
133
assertEquals (iatas .length , airportCount );
136
134
137
135
airportCount = airportRepository .countByIataIn ("JFK" , "IAD" , "SFO" ).block ();
@@ -156,23 +154,21 @@ void count() {
156
154
}
157
155
158
156
@ Test
159
- // DATACOUCH-650
157
+ // DATACOUCH-650
160
158
void deleteAllById () {
161
159
162
160
Airport vienna = new Airport ("airports::vie" , "vie" , "LOWW" );
163
161
Airport frankfurt = new Airport ("airports::fra" , "fra" , "EDDF" );
164
162
Airport losAngeles = new Airport ("airports::lax" , "lax" , "KLAX" );
165
163
166
164
try {
167
- airportRepository .saveAll (asList (vienna , frankfurt , losAngeles )).as (StepVerifier ::create )
168
- .expectNext (vienna , frankfurt , losAngeles ).verifyComplete ();
165
+ airportRepository .saveAll (asList (vienna , frankfurt , losAngeles )).as (StepVerifier ::create ).verifyComplete ();
169
166
170
- airportRepository .deleteAllById (asList (vienna .getId (), losAngeles .getId ())).as (StepVerifier ::create )
171
- .verifyComplete ();
167
+ airportRepository .deleteAllById (asList (vienna .getId (), losAngeles .getId ())).as (StepVerifier ::create ).verifyComplete ();
172
168
173
169
airportRepository .findAll ().as (StepVerifier ::create ).expectNext (frankfurt ).verifyComplete ();
174
170
} finally {
175
- airportRepository .deleteAll (). block () ;
171
+ airportRepository .deleteAll ();
176
172
}
177
173
}
178
174
0 commit comments