31
31
import java .util .Properties ;
32
32
import java .util .UUID ;
33
33
34
+ import org .junit .After ;
34
35
import org .junit .Test ;
35
36
36
37
import org .springframework .context .support .ClassPathXmlApplicationContext ;
59
60
*/
60
61
public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvailableTests {
61
62
63
+ @ After
64
+ public void tearDown () {
65
+ cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
66
+ }
67
+
62
68
@ Test
63
69
@ MongoDbAvailable
64
70
public void testNonExistingEmptyMessageGroup () throws Exception {
65
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
66
71
MessageGroupStore store = getMessageGroupStore ();
67
72
store .addMessagesToGroup (1 , new GenericMessage <Object >("foo" ));
68
73
MessageGroup messageGroup = store .getMessageGroup (1 );
@@ -74,7 +79,6 @@ public void testNonExistingEmptyMessageGroup() throws Exception {
74
79
@ Test
75
80
@ MongoDbAvailable
76
81
public void testMessageGroupWithAddedMessagePrimitiveGroupId () throws Exception {
77
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
78
82
MessageGroupStore store = this .getMessageGroupStore ();
79
83
MessageStore messageStore = this .getMessageStore ();
80
84
MessageGroup messageGroup = store .getMessageGroup (1 );
@@ -94,7 +98,6 @@ public void testMessageGroupWithAddedMessagePrimitiveGroupId() throws Exception
94
98
@ Test
95
99
@ MongoDbAvailable
96
100
public void testMessageGroupWithAddedMessageUUIDGroupIdAndUUIDHeader () throws Exception {
97
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
98
101
MessageGroupStore store = this .getMessageGroupStore ();
99
102
MessageStore messageStore = this .getMessageStore ();
100
103
Object id = UUID .randomUUID ();
@@ -120,7 +123,6 @@ public void testMessageGroupWithAddedMessageUUIDGroupIdAndUUIDHeader() throws Ex
120
123
@ Test
121
124
@ MongoDbAvailable
122
125
public void testCountMessagesInGroup () throws Exception {
123
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
124
126
MessageGroupStore store = this .getMessageGroupStore ();
125
127
Message <?> messageA = new GenericMessage <String >("A" );
126
128
Message <?> messageB = new GenericMessage <String >("B" );
@@ -131,7 +133,6 @@ public void testCountMessagesInGroup() throws Exception {
131
133
@ Test
132
134
@ MongoDbAvailable
133
135
public void testPollMessages () throws Exception {
134
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
135
136
MessageGroupStore store = this .getMessageGroupStore ();
136
137
Message <?> messageA = new GenericMessage <String >("A" );
137
138
Message <?> messageB = new GenericMessage <String >("B" );
@@ -151,7 +152,6 @@ public void testPollMessages() throws Exception {
151
152
@ Test
152
153
@ MongoDbAvailable
153
154
public void testSameMessageMultipleGroupsPoll () throws Exception {
154
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
155
155
MessageGroupStore store = this .getMessageGroupStore ();
156
156
Message <?> messageA = new GenericMessage <String >("A" );
157
157
store .addMessagesToGroup (1 , messageA );
@@ -187,7 +187,6 @@ public void testSameMessageMultipleGroupsPoll() throws Exception {
187
187
@ Test
188
188
@ MongoDbAvailable
189
189
public void testSameMessageMultipleGroupsRemove () throws Exception {
190
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
191
190
MessageGroupStore store = this .getMessageGroupStore ();
192
191
193
192
Message <?> messageA = new GenericMessage <String >("A" );
@@ -224,7 +223,6 @@ public void testSameMessageMultipleGroupsRemove() throws Exception {
224
223
@ Test
225
224
@ MongoDbAvailable
226
225
public void testMessageGroupUpdatedDateChangesWithEachAddedMessage () throws Exception {
227
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
228
226
MessageGroupStore store = this .getMessageGroupStore ();
229
227
230
228
MessageGroup messageGroup = store .getMessageGroup (1 );
@@ -253,7 +251,6 @@ public void testMessageGroupUpdatedDateChangesWithEachAddedMessage() throws Exce
253
251
@ Test
254
252
@ MongoDbAvailable
255
253
public void testMessageGroupMarkingMessage () throws Exception {
256
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
257
254
MessageGroupStore store = this .getMessageGroupStore ();
258
255
259
256
MessageGroup messageGroup = store .getMessageGroup (1 );
@@ -278,7 +275,6 @@ public void testMessageGroupMarkingMessage() throws Exception {
278
275
@ Test
279
276
@ MongoDbAvailable
280
277
public void testRemoveMessageGroup () throws Exception {
281
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
282
278
MessageGroupStore store = this .getMessageGroupStore ();
283
279
MessageStore messageStore = this .getMessageStore ();
284
280
@@ -301,7 +297,6 @@ public void testRemoveMessageGroup() throws Exception {
301
297
@ Test
302
298
@ MongoDbAvailable
303
299
public void testCompleteMessageGroup () throws Exception {
304
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
305
300
MessageGroupStore store = this .getMessageGroupStore ();
306
301
307
302
MessageGroup messageGroup = store .getMessageGroup (1 );
@@ -316,7 +311,6 @@ public void testCompleteMessageGroup() throws Exception {
316
311
@ Test
317
312
@ MongoDbAvailable
318
313
public void testLastReleasedSequenceNumber () throws Exception {
319
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
320
314
MessageGroupStore store = this .getMessageGroupStore ();
321
315
322
316
MessageGroup messageGroup = store .getMessageGroup (1 );
@@ -331,7 +325,6 @@ public void testLastReleasedSequenceNumber() throws Exception {
331
325
@ Test
332
326
@ MongoDbAvailable
333
327
public void testRemoveMessageFromTheGroup () throws Exception {
334
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
335
328
MessageGroupStore store = this .getMessageGroupStore ();
336
329
337
330
MessageGroup messageGroup = store .getMessageGroup (1 );
@@ -349,8 +342,6 @@ public void testRemoveMessageFromTheGroup() throws Exception {
349
342
@ Test
350
343
@ MongoDbAvailable
351
344
public void testMultipleMessageStores () throws Exception {
352
-
353
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
354
345
MessageGroupStore store1 = this .getMessageGroupStore ();
355
346
MessageGroupStore store2 = this .getMessageGroupStore ();
356
347
@@ -373,7 +364,6 @@ public void testMultipleMessageStores() throws Exception {
373
364
@ Test
374
365
@ MongoDbAvailable
375
366
public void testMessageGroupIterator () throws Exception {
376
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
377
367
MessageGroupStore store1 = this .getMessageGroupStore ();
378
368
MessageGroupStore store2 = this .getMessageGroupStore ();
379
369
@@ -467,8 +457,6 @@ public void testAddAndRemoveMessagesFromMessageGroup() throws Exception {
467
457
468
458
469
459
protected void testWithAggregatorWithShutdown (String config ) throws Exception {
470
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
471
-
472
460
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext (config , this .getClass ());
473
461
context .refresh ();
474
462
@@ -517,7 +505,6 @@ protected void testWithAggregatorWithShutdown(String config) throws Exception {
517
505
@ Test
518
506
@ MongoDbAvailable
519
507
public void testWithMessageHistory () throws Exception {
520
- this .cleanupCollections (new SimpleMongoDbFactory (new MongoClient (), "test" ));
521
508
MessageGroupStore store = this .getMessageGroupStore ();
522
509
523
510
store .getMessageGroup (1 );
0 commit comments