8181 * @author Michael Reiche
8282 */
8383@ 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 } )
8685public class CouchbasePersonTransactionReactiveIntegrationTests extends JavaIntegrationTests {
87-
86+ // intellij flags "Could not autowire" when config classes are specified with classes={...}. But they are populated.
8887 @ Autowired CouchbaseClientFactory couchbaseClientFactory ;
8988 @ Autowired ReactiveCouchbaseTransactionManager reactiveCouchbaseTransactionManager ;
9089 @ Autowired CouchbaseSimpleCallbackTransactionManager couchbaseTransactionManager ;
9190 @ Autowired ReactivePersonRepository rxRepo ;
9291 @ Autowired PersonRepository repo ;
9392 @ Autowired ReactiveCouchbaseTemplate rxCBTmpl ;
94-
9593 @ Autowired Cluster myCluster ;
96-
97- /* DO NOT @Autowired */ PersonService personService ;
98-
99- static GenericApplicationContext context ;
94+ @ Autowired PersonService personService ;
10095 @ Autowired ReactiveCouchbaseTemplate operations ;
10196
10297 @ BeforeAll
10398 public static void beforeAll () {
10499 callSuperBeforeAll (new Object () {});
105- context = new AnnotationConfigApplicationContext (CouchbasePersonTransactionReactiveIntegrationTests .Config .class ,
106- CouchbasePersonTransactionReactiveIntegrationTests .PersonService .class );
107100 }
108101
109102 @ AfterAll
@@ -113,28 +106,24 @@ public static void afterAll() {
113106
114107 @ BeforeEach
115108 public void beforeEachTest () {
116- personService = context .getBean (CouchbasePersonTransactionReactiveIntegrationTests .PersonService .class ); // getting it via autowired results in no @Transactional
117109 operations .removeByQuery (Person .class ).withConsistency (REQUEST_PLUS ).all ().collectList ().block ();
118110 operations .removeByQuery (EventLog .class ).withConsistency (REQUEST_PLUS ).all ().collectList ().block ();
119111 operations .findByQuery (Person .class ).withConsistency (REQUEST_PLUS ).all ().collectList ().block ();
120112 operations .findByQuery (EventLog .class ).withConsistency (REQUEST_PLUS ).all ().collectList ().block ();
121113 }
122114
123-
124- @ Test // DATAMONGO-2265
115+ @ Test
125116 public void shouldRollbackAfterException () {
126117 personService .savePersonErrors (new Person (null , "Walter" , "White" )) //
127118 .as (StepVerifier ::create ) //
128119 .verifyError (RuntimeException .class );
129- // operations.findByQuery(Person.class).withConsistency(QueryScanConsistency.REQUEST_PLUS).count().block();
130- // sleepMs(5000);
131120 operations .count (new Query (), Person .class ) //
132121 .as (StepVerifier ::create ) //
133122 .expectNext (0L ) //
134123 .verifyComplete ();
135124 }
136125
137- @ Test // DATAMONGO-2265
126+ @ Test
138127 // @Rollback(false)
139128 public void shouldRollbackAfterExceptionOfTxAnnotatedMethod () {
140129 Person p = new Person (null , "Walter" , "White" );
@@ -153,7 +142,7 @@ public void shouldRollbackAfterExceptionOfTxAnnotatedMethod() {
153142
154143 }
155144
156- @ Test // DATAMONGO-2265
145+ @ Test
157146 public void commitShouldPersistTxEntries () {
158147
159148 personService .savePerson (new Person (null , "Walter" , "White" )) //
@@ -169,7 +158,7 @@ public void commitShouldPersistTxEntries() {
169158 .verifyComplete ();
170159 }
171160
172- @ Test // DATAMONGO-2265
161+ @ Test
173162 public void commitShouldPersistTxEntriesOfTxAnnotatedMethod () {
174163
175164 personService .declarativeSavePerson (new Person (null , "Walter" , "White" )).as (StepVerifier ::create ) //
@@ -183,7 +172,7 @@ public void commitShouldPersistTxEntriesOfTxAnnotatedMethod() {
183172
184173 }
185174
186- @ Test // DATAMONGO-2265
175+ @ Test
187176 public void commitShouldPersistTxEntriesAcrossCollections () {
188177
189178 personService .saveWithLogs (new Person (null , "Walter" , "White" )) //
@@ -202,7 +191,7 @@ public void commitShouldPersistTxEntriesAcrossCollections() {
202191 .verifyComplete ();
203192 }
204193
205- @ Test // DATAMONGO-2265
194+ @ Test
206195 public void rollbackShouldAbortAcrossCollections () {
207196
208197 personService .saveWithErrorLogs (new Person (null , "Walter" , "White" )) //
@@ -221,16 +210,15 @@ public void rollbackShouldAbortAcrossCollections() {
221210 .verifyComplete ();
222211 }
223212
224- @ Test // DATAMONGO-2265
213+ @ Test
225214 public void countShouldWorkInsideTransaction () {
226-
227215 personService .countDuringTx (new Person (null , "Walter" , "White" )) //
228216 .as (StepVerifier ::create ) //
229217 .expectNext (1L ) //
230218 .verifyComplete ();
231219 }
232220
233- @ Test // DATAMONGO-2265
221+ @ Test
234222 public void emitMultipleElementsDuringTransaction () {
235223
236224 try {
@@ -244,21 +232,14 @@ public void emitMultipleElementsDuringTransaction() {
244232 }
245233 }
246234
247- @ Test // DATAMONGO-2265
235+ @ Test
248236 public void errorAfterTxShouldNotAffectPreviousStep () {
249237
250238 Person p = new Person (1 , "Walter" , "White" );
251- //remove(couchbaseTemplate, "_default", p.getId().toString());
252239 personService .savePerson (p ) //
253- //.delayElement(Duration.ofMillis(100)) //
254240 .then (Mono .error (new RuntimeException ("my big bad evil error" ))).as (StepVerifier ::create ) //
255241 .expectError ()
256242 .verify ();
257- //.expectError() //
258- //.as(StepVerifier::create)
259- //.expectNext(p)
260- //.verifyComplete();
261-
262243 operations .findByQuery (Person .class ).withConsistency (REQUEST_PLUS ).count () //
263244 .as (StepVerifier ::create ) //
264245 .expectNext (1L ) //
0 commit comments