Skip to content

Commit e610d37

Browse files
committed
Fix tests for CI and versions compatibility
1 parent c420f54 commit e610d37

File tree

3 files changed

+7
-23
lines changed

3 files changed

+7
-23
lines changed

spring-integration-jms/src/test/java/org/springframework/integration/jms/ActiveMQMultiContextTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public abstract class ActiveMQMultiContextTests {
4242

4343
@BeforeClass
4444
public static void startUp() throws Exception {
45+
amqFactory.setTrustAllPackages(true);
4546
connectionFactory.setCacheConsumers(false);
4647
connectionFactory.createConnection().close();
4748
}

spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/AbstractMongoDbMessageGroupStoreTests.java

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.Properties;
3232
import java.util.UUID;
3333

34+
import org.junit.After;
3435
import org.junit.Test;
3536

3637
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -59,10 +60,14 @@
5960
*/
6061
public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvailableTests {
6162

63+
@After
64+
public void tearDown() {
65+
cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
66+
}
67+
6268
@Test
6369
@MongoDbAvailable
6470
public void testNonExistingEmptyMessageGroup() throws Exception {
65-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
6671
MessageGroupStore store = getMessageGroupStore();
6772
store.addMessagesToGroup(1, new GenericMessage<Object>("foo"));
6873
MessageGroup messageGroup = store.getMessageGroup(1);
@@ -74,7 +79,6 @@ public void testNonExistingEmptyMessageGroup() throws Exception {
7479
@Test
7580
@MongoDbAvailable
7681
public void testMessageGroupWithAddedMessagePrimitiveGroupId() throws Exception {
77-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
7882
MessageGroupStore store = this.getMessageGroupStore();
7983
MessageStore messageStore = this.getMessageStore();
8084
MessageGroup messageGroup = store.getMessageGroup(1);
@@ -94,7 +98,6 @@ public void testMessageGroupWithAddedMessagePrimitiveGroupId() throws Exception
9498
@Test
9599
@MongoDbAvailable
96100
public void testMessageGroupWithAddedMessageUUIDGroupIdAndUUIDHeader() throws Exception {
97-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
98101
MessageGroupStore store = this.getMessageGroupStore();
99102
MessageStore messageStore = this.getMessageStore();
100103
Object id = UUID.randomUUID();
@@ -120,7 +123,6 @@ public void testMessageGroupWithAddedMessageUUIDGroupIdAndUUIDHeader() throws Ex
120123
@Test
121124
@MongoDbAvailable
122125
public void testCountMessagesInGroup() throws Exception {
123-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
124126
MessageGroupStore store = this.getMessageGroupStore();
125127
Message<?> messageA = new GenericMessage<String>("A");
126128
Message<?> messageB = new GenericMessage<String>("B");
@@ -131,7 +133,6 @@ public void testCountMessagesInGroup() throws Exception {
131133
@Test
132134
@MongoDbAvailable
133135
public void testPollMessages() throws Exception {
134-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
135136
MessageGroupStore store = this.getMessageGroupStore();
136137
Message<?> messageA = new GenericMessage<String>("A");
137138
Message<?> messageB = new GenericMessage<String>("B");
@@ -151,7 +152,6 @@ public void testPollMessages() throws Exception {
151152
@Test
152153
@MongoDbAvailable
153154
public void testSameMessageMultipleGroupsPoll() throws Exception {
154-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
155155
MessageGroupStore store = this.getMessageGroupStore();
156156
Message<?> messageA = new GenericMessage<String>("A");
157157
store.addMessagesToGroup(1, messageA);
@@ -187,7 +187,6 @@ public void testSameMessageMultipleGroupsPoll() throws Exception {
187187
@Test
188188
@MongoDbAvailable
189189
public void testSameMessageMultipleGroupsRemove() throws Exception {
190-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
191190
MessageGroupStore store = this.getMessageGroupStore();
192191

193192
Message<?> messageA = new GenericMessage<String>("A");
@@ -224,7 +223,6 @@ public void testSameMessageMultipleGroupsRemove() throws Exception {
224223
@Test
225224
@MongoDbAvailable
226225
public void testMessageGroupUpdatedDateChangesWithEachAddedMessage() throws Exception {
227-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
228226
MessageGroupStore store = this.getMessageGroupStore();
229227

230228
MessageGroup messageGroup = store.getMessageGroup(1);
@@ -253,7 +251,6 @@ public void testMessageGroupUpdatedDateChangesWithEachAddedMessage() throws Exce
253251
@Test
254252
@MongoDbAvailable
255253
public void testMessageGroupMarkingMessage() throws Exception {
256-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
257254
MessageGroupStore store = this.getMessageGroupStore();
258255

259256
MessageGroup messageGroup = store.getMessageGroup(1);
@@ -278,7 +275,6 @@ public void testMessageGroupMarkingMessage() throws Exception {
278275
@Test
279276
@MongoDbAvailable
280277
public void testRemoveMessageGroup() throws Exception {
281-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
282278
MessageGroupStore store = this.getMessageGroupStore();
283279
MessageStore messageStore = this.getMessageStore();
284280

@@ -301,7 +297,6 @@ public void testRemoveMessageGroup() throws Exception {
301297
@Test
302298
@MongoDbAvailable
303299
public void testCompleteMessageGroup() throws Exception {
304-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
305300
MessageGroupStore store = this.getMessageGroupStore();
306301

307302
MessageGroup messageGroup = store.getMessageGroup(1);
@@ -316,7 +311,6 @@ public void testCompleteMessageGroup() throws Exception {
316311
@Test
317312
@MongoDbAvailable
318313
public void testLastReleasedSequenceNumber() throws Exception {
319-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
320314
MessageGroupStore store = this.getMessageGroupStore();
321315

322316
MessageGroup messageGroup = store.getMessageGroup(1);
@@ -331,7 +325,6 @@ public void testLastReleasedSequenceNumber() throws Exception {
331325
@Test
332326
@MongoDbAvailable
333327
public void testRemoveMessageFromTheGroup() throws Exception {
334-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
335328
MessageGroupStore store = this.getMessageGroupStore();
336329

337330
MessageGroup messageGroup = store.getMessageGroup(1);
@@ -349,8 +342,6 @@ public void testRemoveMessageFromTheGroup() throws Exception {
349342
@Test
350343
@MongoDbAvailable
351344
public void testMultipleMessageStores() throws Exception {
352-
353-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
354345
MessageGroupStore store1 = this.getMessageGroupStore();
355346
MessageGroupStore store2 = this.getMessageGroupStore();
356347

@@ -373,7 +364,6 @@ public void testMultipleMessageStores() throws Exception {
373364
@Test
374365
@MongoDbAvailable
375366
public void testMessageGroupIterator() throws Exception {
376-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
377367
MessageGroupStore store1 = this.getMessageGroupStore();
378368
MessageGroupStore store2 = this.getMessageGroupStore();
379369

@@ -467,8 +457,6 @@ public void testAddAndRemoveMessagesFromMessageGroup() throws Exception {
467457

468458

469459
protected void testWithAggregatorWithShutdown(String config) throws Exception {
470-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
471-
472460
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config, this.getClass());
473461
context.refresh();
474462

@@ -517,7 +505,6 @@ protected void testWithAggregatorWithShutdown(String config) throws Exception {
517505
@Test
518506
@MongoDbAvailable
519507
public void testWithMessageHistory() throws Exception {
520-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
521508
MessageGroupStore store = this.getMessageGroupStore();
522509

523510
store.getMessageGroup(1);

spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/ConfigurableMongoDbMessageGroupStoreTests.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ public void testWithAggregatorWithShutdown() throws Exception {
7979
@Ignore("The performance test. Enough slow. Also needs the release strategy changed to size() == 1000")
8080
@MongoDbAvailable
8181
public void messageGroupStoreLazyLoadPerformance() throws Exception {
82-
cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
83-
8482
StopWatch watch = new StopWatch("Lazy-Load Performance");
8583

8684
int sequenceSize = 1000;
@@ -120,7 +118,6 @@ private void performLazyLoadEagerTest(StopWatch watch, int sequenceSize, boolean
120118
@Test
121119
@MongoDbAvailable
122120
public void testWithCustomConverter() throws Exception {
123-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
124121
ClassPathXmlApplicationContext context =
125122
new ClassPathXmlApplicationContext("ConfigurableMongoDbMessageStore-CustomConverter.xml", this.getClass());
126123
context.refresh();
@@ -134,7 +131,6 @@ public void testWithCustomConverter() throws Exception {
134131
@Test
135132
@MongoDbAvailable
136133
public void testPriorityChannel() throws Exception {
137-
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
138134
ClassPathXmlApplicationContext context =
139135
new ClassPathXmlApplicationContext("ConfigurableMongoDbMessageStore-CustomConverter.xml", this.getClass());
140136
context.refresh();

0 commit comments

Comments
 (0)