INT-4176: Fix Gemfire tests

JIRA: https://jira.spring.io/browse/INT-4176

The `DelayerHandlerRescheduleIntegrationTests` doesn't close `context` in the end of test.
That causes clashes for `beanFactoryResolver` in other tests.
When those tests are fail, we come into condition when new processes can't be started/stopped because of effect of non-stopped context

* Fix all the `DelayerHandlerRescheduleIntegrationTests` to stop `context` in the end of test
* Remove unused files in the `gemfire/store` test package
* Add current date value to the `CacheServerProcess` name to avoid clashes with other ran on the same host
* Add NPE check for `region` in the `GemfireMetadataStoreTests`
* Extract `@BeforeClass/@AfterClass` for the `CacheWritingMessageHandlerTests` to start only one Gemfire cache per class

**Cherry-pick to 4.3.x & 4.2.x**
This commit is contained in:
Artem Bilan
2016-11-30 14:03:09 -05:00
committed by Gary Russell
parent 85730bfe60
commit 9078a74a19
10 changed files with 64 additions and 92 deletions

View File

@@ -59,13 +59,13 @@ public class DelayerHandlerRescheduleIntegrationTests extends MongoDbAvailableTe
@Test
@MongoDbAvailable
public void testWithMongoDbMessageStore() throws Exception {
this.testDelayerHandlerRescheduleWithMongoDbMessageStore("DelayerHandlerRescheduleIntegrationTests-context.xml");
testDelayerHandlerRescheduleWithMongoDbMessageStore("DelayerHandlerRescheduleIntegrationTests-context.xml");
}
@Test
@MongoDbAvailable
public void testWithConfigurableMongoDbMessageStore() throws Exception {
this.testDelayerHandlerRescheduleWithMongoDbMessageStore("DelayerHandlerRescheduleIntegrationConfigurableTests-context.xml");
testDelayerHandlerRescheduleWithMongoDbMessageStore("DelayerHandlerRescheduleIntegrationConfigurableTests-context.xml");
}
@SuppressWarnings("unchecked")
@@ -84,7 +84,8 @@ public class DelayerHandlerRescheduleIntegrationTests extends MongoDbAvailableTe
// Emulate restart and check DB state before next start
// Interrupt taskScheduler as quickly as possible
ThreadPoolTaskScheduler taskScheduler = (ThreadPoolTaskScheduler) IntegrationContextUtils.getTaskScheduler(context);
ThreadPoolTaskScheduler taskScheduler =
(ThreadPoolTaskScheduler) IntegrationContextUtils.getTaskScheduler(context);
taskScheduler.shutdown();
taskScheduler.getScheduledExecutor().awaitTermination(10, TimeUnit.SECONDS);
context.destroy();
@@ -110,7 +111,8 @@ public class DelayerHandlerRescheduleIntegrationTests extends MongoDbAvailableTe
Message<String> original1 = (Message<String>) ((DelayHandler.DelayedMessageWrapper) payload).getOriginal();
messageInStore = iterator.next();
Message<String> original2 = (Message<String>) ((DelayHandler.DelayedMessageWrapper) messageInStore.getPayload()).getOriginal();
Message<String> original2 = (Message<String>) ((DelayHandler.DelayedMessageWrapper) messageInStore.getPayload())
.getOriginal();
assertThat(message1, Matchers.anyOf(Matchers.is(original1), Matchers.is(original2)));
context.refresh();
@@ -128,7 +130,7 @@ public class DelayerHandlerRescheduleIntegrationTests extends MongoDbAvailableTe
assertNotSame(payload1, payload2);
assertEquals(0, messageStore.messageGroupSize(delayerMessageGroupId));
context.destroy();
}
}