Skip to content

Commit

Permalink
Fix tests for CI and versions compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
artembilan committed Dec 9, 2020
1 parent c420f54 commit e610d37
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
Expand Up @@ -42,6 +42,7 @@ public abstract class ActiveMQMultiContextTests {

@BeforeClass
public static void startUp() throws Exception {
amqFactory.setTrustAllPackages(true);
connectionFactory.setCacheConsumers(false);
connectionFactory.createConnection().close();
}
Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Object>("foo"));
MessageGroup messageGroup = store.getMessageGroup(1);
Expand All @@ -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);
Expand All @@ -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();
Expand All @@ -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<String>("A");
Message<?> messageB = new GenericMessage<String>("B");
Expand All @@ -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<String>("A");
Message<?> messageB = new GenericMessage<String>("B");
Expand All @@ -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<String>("A");
store.addMessagesToGroup(1, messageA);
Expand Down Expand Up @@ -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<String>("A");
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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();

Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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();

Expand All @@ -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();

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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);
Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit e610d37

Please sign in to comment.