81
81
* @author Michael Reiche
82
82
*/
83
83
@ IgnoreWhen (missesCapabilities = Capabilities .QUERY , clusterTypes = ClusterType .MOCKED )
84
- @ SpringJUnitConfig (CouchbasePersonTransactionReactiveIntegrationTests .Config .class )
85
- //@Transactional(transactionManager = BeanNames.COUCHBASE_TRANSACTION_MANAGER)
84
+ @ SpringJUnitConfig (classes = { CouchbasePersonTransactionReactiveIntegrationTests .Config .class , CouchbasePersonTransactionReactiveIntegrationTests .PersonService .class } )
86
85
public class CouchbasePersonTransactionReactiveIntegrationTests extends JavaIntegrationTests {
87
-
86
+ // intellij flags "Could not autowire" when config classes are specified with classes={...}. But they are populated.
88
87
@ Autowired CouchbaseClientFactory couchbaseClientFactory ;
89
88
@ Autowired ReactiveCouchbaseTransactionManager reactiveCouchbaseTransactionManager ;
90
89
@ Autowired CouchbaseSimpleCallbackTransactionManager couchbaseTransactionManager ;
91
90
@ Autowired ReactivePersonRepository rxRepo ;
92
91
@ Autowired PersonRepository repo ;
93
92
@ Autowired ReactiveCouchbaseTemplate rxCBTmpl ;
94
-
95
93
@ Autowired Cluster myCluster ;
96
-
97
- /* DO NOT @Autowired */ PersonService personService ;
98
-
99
- static GenericApplicationContext context ;
94
+ @ Autowired PersonService personService ;
100
95
@ Autowired ReactiveCouchbaseTemplate operations ;
101
96
102
97
@ BeforeAll
103
98
public static void beforeAll () {
104
99
callSuperBeforeAll (new Object () {});
105
- context = new AnnotationConfigApplicationContext (CouchbasePersonTransactionReactiveIntegrationTests .Config .class ,
106
- CouchbasePersonTransactionReactiveIntegrationTests .PersonService .class );
107
100
}
108
101
109
102
@ AfterAll
@@ -113,28 +106,24 @@ public static void afterAll() {
113
106
114
107
@ BeforeEach
115
108
public void beforeEachTest () {
116
- personService = context .getBean (CouchbasePersonTransactionReactiveIntegrationTests .PersonService .class ); // getting it via autowired results in no @Transactional
117
109
operations .removeByQuery (Person .class ).withConsistency (REQUEST_PLUS ).all ().collectList ().block ();
118
110
operations .removeByQuery (EventLog .class ).withConsistency (REQUEST_PLUS ).all ().collectList ().block ();
119
111
operations .findByQuery (Person .class ).withConsistency (REQUEST_PLUS ).all ().collectList ().block ();
120
112
operations .findByQuery (EventLog .class ).withConsistency (REQUEST_PLUS ).all ().collectList ().block ();
121
113
}
122
114
123
-
124
- @ Test // DATAMONGO-2265
115
+ @ Test
125
116
public void shouldRollbackAfterException () {
126
117
personService .savePersonErrors (new Person (null , "Walter" , "White" )) //
127
118
.as (StepVerifier ::create ) //
128
119
.verifyError (RuntimeException .class );
129
- // operations.findByQuery(Person.class).withConsistency(QueryScanConsistency.REQUEST_PLUS).count().block();
130
- // sleepMs(5000);
131
120
operations .count (new Query (), Person .class ) //
132
121
.as (StepVerifier ::create ) //
133
122
.expectNext (0L ) //
134
123
.verifyComplete ();
135
124
}
136
125
137
- @ Test // DATAMONGO-2265
126
+ @ Test
138
127
// @Rollback(false)
139
128
public void shouldRollbackAfterExceptionOfTxAnnotatedMethod () {
140
129
Person p = new Person (null , "Walter" , "White" );
@@ -153,7 +142,7 @@ public void shouldRollbackAfterExceptionOfTxAnnotatedMethod() {
153
142
154
143
}
155
144
156
- @ Test // DATAMONGO-2265
145
+ @ Test
157
146
public void commitShouldPersistTxEntries () {
158
147
159
148
personService .savePerson (new Person (null , "Walter" , "White" )) //
@@ -169,7 +158,7 @@ public void commitShouldPersistTxEntries() {
169
158
.verifyComplete ();
170
159
}
171
160
172
- @ Test // DATAMONGO-2265
161
+ @ Test
173
162
public void commitShouldPersistTxEntriesOfTxAnnotatedMethod () {
174
163
175
164
personService .declarativeSavePerson (new Person (null , "Walter" , "White" )).as (StepVerifier ::create ) //
@@ -183,7 +172,7 @@ public void commitShouldPersistTxEntriesOfTxAnnotatedMethod() {
183
172
184
173
}
185
174
186
- @ Test // DATAMONGO-2265
175
+ @ Test
187
176
public void commitShouldPersistTxEntriesAcrossCollections () {
188
177
189
178
personService .saveWithLogs (new Person (null , "Walter" , "White" )) //
@@ -202,7 +191,7 @@ public void commitShouldPersistTxEntriesAcrossCollections() {
202
191
.verifyComplete ();
203
192
}
204
193
205
- @ Test // DATAMONGO-2265
194
+ @ Test
206
195
public void rollbackShouldAbortAcrossCollections () {
207
196
208
197
personService .saveWithErrorLogs (new Person (null , "Walter" , "White" )) //
@@ -221,16 +210,15 @@ public void rollbackShouldAbortAcrossCollections() {
221
210
.verifyComplete ();
222
211
}
223
212
224
- @ Test // DATAMONGO-2265
213
+ @ Test
225
214
public void countShouldWorkInsideTransaction () {
226
-
227
215
personService .countDuringTx (new Person (null , "Walter" , "White" )) //
228
216
.as (StepVerifier ::create ) //
229
217
.expectNext (1L ) //
230
218
.verifyComplete ();
231
219
}
232
220
233
- @ Test // DATAMONGO-2265
221
+ @ Test
234
222
public void emitMultipleElementsDuringTransaction () {
235
223
236
224
try {
@@ -244,21 +232,14 @@ public void emitMultipleElementsDuringTransaction() {
244
232
}
245
233
}
246
234
247
- @ Test // DATAMONGO-2265
235
+ @ Test
248
236
public void errorAfterTxShouldNotAffectPreviousStep () {
249
237
250
238
Person p = new Person (1 , "Walter" , "White" );
251
- //remove(couchbaseTemplate, "_default", p.getId().toString());
252
239
personService .savePerson (p ) //
253
- //.delayElement(Duration.ofMillis(100)) //
254
240
.then (Mono .error (new RuntimeException ("my big bad evil error" ))).as (StepVerifier ::create ) //
255
241
.expectError ()
256
242
.verify ();
257
- //.expectError() //
258
- //.as(StepVerifier::create)
259
- //.expectNext(p)
260
- //.verifyComplete();
261
-
262
243
operations .findByQuery (Person .class ).withConsistency (REQUEST_PLUS ).count () //
263
244
.as (StepVerifier ::create ) //
264
245
.expectNext (1L ) //
0 commit comments