diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/ActiveMQMultiContextTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/ActiveMQMultiContextTests.java index 43fb37079a7..e6207c76b1e 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/ActiveMQMultiContextTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/ActiveMQMultiContextTests.java @@ -42,6 +42,7 @@ public abstract class ActiveMQMultiContextTests { @BeforeClass public static void startUp() throws Exception { + amqFactory.setTrustAllPackages(true); connectionFactory.setCacheConsumers(false); connectionFactory.createConnection().close(); } diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/AbstractMongoDbMessageGroupStoreTests.java b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/AbstractMongoDbMessageGroupStoreTests.java index e2198a50253..c14fca147b3 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/AbstractMongoDbMessageGroupStoreTests.java +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/AbstractMongoDbMessageGroupStoreTests.java @@ -31,6 +31,7 @@ import java.util.Properties; import java.util.UUID; +import org.junit.After; import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -59,10 +60,14 @@ */ public abstract class AbstractMongoDbMessageGroupStoreTests extends MongoDbAvailableTests { + @After + public void tearDown() { + cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); + } + @Test @MongoDbAvailable public void testNonExistingEmptyMessageGroup() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = getMessageGroupStore(); store.addMessagesToGroup(1, new GenericMessage("foo")); MessageGroup messageGroup = store.getMessageGroup(1); @@ -74,7 +79,6 @@ public void testNonExistingEmptyMessageGroup() throws Exception { @Test @MongoDbAvailable public void testMessageGroupWithAddedMessagePrimitiveGroupId() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); MessageStore messageStore = this.getMessageStore(); MessageGroup messageGroup = store.getMessageGroup(1); @@ -94,7 +98,6 @@ public void testMessageGroupWithAddedMessagePrimitiveGroupId() throws Exception @Test @MongoDbAvailable public void testMessageGroupWithAddedMessageUUIDGroupIdAndUUIDHeader() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); MessageStore messageStore = this.getMessageStore(); Object id = UUID.randomUUID(); @@ -120,7 +123,6 @@ public void testMessageGroupWithAddedMessageUUIDGroupIdAndUUIDHeader() throws Ex @Test @MongoDbAvailable public void testCountMessagesInGroup() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); Message messageA = new GenericMessage("A"); Message messageB = new GenericMessage("B"); @@ -131,7 +133,6 @@ public void testCountMessagesInGroup() throws Exception { @Test @MongoDbAvailable public void testPollMessages() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); Message messageA = new GenericMessage("A"); Message messageB = new GenericMessage("B"); @@ -151,7 +152,6 @@ public void testPollMessages() throws Exception { @Test @MongoDbAvailable public void testSameMessageMultipleGroupsPoll() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); Message messageA = new GenericMessage("A"); store.addMessagesToGroup(1, messageA); @@ -187,7 +187,6 @@ public void testSameMessageMultipleGroupsPoll() throws Exception { @Test @MongoDbAvailable public void testSameMessageMultipleGroupsRemove() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); Message messageA = new GenericMessage("A"); @@ -224,7 +223,6 @@ public void testSameMessageMultipleGroupsRemove() throws Exception { @Test @MongoDbAvailable public void testMessageGroupUpdatedDateChangesWithEachAddedMessage() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); MessageGroup messageGroup = store.getMessageGroup(1); @@ -253,7 +251,6 @@ public void testMessageGroupUpdatedDateChangesWithEachAddedMessage() throws Exce @Test @MongoDbAvailable public void testMessageGroupMarkingMessage() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); MessageGroup messageGroup = store.getMessageGroup(1); @@ -278,7 +275,6 @@ public void testMessageGroupMarkingMessage() throws Exception { @Test @MongoDbAvailable public void testRemoveMessageGroup() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); MessageStore messageStore = this.getMessageStore(); @@ -301,7 +297,6 @@ public void testRemoveMessageGroup() throws Exception { @Test @MongoDbAvailable public void testCompleteMessageGroup() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); MessageGroup messageGroup = store.getMessageGroup(1); @@ -316,7 +311,6 @@ public void testCompleteMessageGroup() throws Exception { @Test @MongoDbAvailable public void testLastReleasedSequenceNumber() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); MessageGroup messageGroup = store.getMessageGroup(1); @@ -331,7 +325,6 @@ public void testLastReleasedSequenceNumber() throws Exception { @Test @MongoDbAvailable public void testRemoveMessageFromTheGroup() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); MessageGroup messageGroup = store.getMessageGroup(1); @@ -349,8 +342,6 @@ public void testRemoveMessageFromTheGroup() throws Exception { @Test @MongoDbAvailable public void testMultipleMessageStores() throws Exception { - - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store1 = this.getMessageGroupStore(); MessageGroupStore store2 = this.getMessageGroupStore(); @@ -373,7 +364,6 @@ public void testMultipleMessageStores() throws Exception { @Test @MongoDbAvailable public void testMessageGroupIterator() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store1 = this.getMessageGroupStore(); MessageGroupStore store2 = this.getMessageGroupStore(); @@ -467,8 +457,6 @@ public void testAddAndRemoveMessagesFromMessageGroup() throws Exception { protected void testWithAggregatorWithShutdown(String config) throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); - ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config, this.getClass()); context.refresh(); @@ -517,7 +505,6 @@ protected void testWithAggregatorWithShutdown(String config) throws Exception { @Test @MongoDbAvailable public void testWithMessageHistory() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); MessageGroupStore store = this.getMessageGroupStore(); store.getMessageGroup(1); diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/ConfigurableMongoDbMessageGroupStoreTests.java b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/ConfigurableMongoDbMessageGroupStoreTests.java index c9078230f93..56b7578f92c 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/ConfigurableMongoDbMessageGroupStoreTests.java +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/ConfigurableMongoDbMessageGroupStoreTests.java @@ -79,8 +79,6 @@ public void testWithAggregatorWithShutdown() throws Exception { @Ignore("The performance test. Enough slow. Also needs the release strategy changed to size() == 1000") @MongoDbAvailable public void messageGroupStoreLazyLoadPerformance() throws Exception { - cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); - StopWatch watch = new StopWatch("Lazy-Load Performance"); int sequenceSize = 1000; @@ -120,7 +118,6 @@ private void performLazyLoadEagerTest(StopWatch watch, int sequenceSize, boolean @Test @MongoDbAvailable public void testWithCustomConverter() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("ConfigurableMongoDbMessageStore-CustomConverter.xml", this.getClass()); context.refresh(); @@ -134,7 +131,6 @@ public void testWithCustomConverter() throws Exception { @Test @MongoDbAvailable public void testPriorityChannel() throws Exception { - this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test")); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("ConfigurableMongoDbMessageStore-CustomConverter.xml", this.getClass()); context.refresh();