INT-4143: Backport fixes for Gemfire tests

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

Gemfire: some fixes and optimization for tests

See https://build.spring.io/browse/INT-AT42SIO-199/

In some places we start `Cache` but doesn't close/destroy it in the end.
That sometimes causes conflicts with the already started GemFire from other tests or wrong state around `BeanFactoryLocator`

* Ensure `Cache` destroy in the end of each test
* In addition destroy `Region` as well to avoid unexpected race conditions, too
* Plus optimize some tests to start `Cache` and `Region` only once per test class, not for each test method

From here I can say that it even would be better to start `Cache`, and therefore whole GemFire, only once per entire Gemfire module test suite.
But that is fully different story.

Remove `forkEvery` from Gemfire module

Allow get a performance improvement for the build.

The `gradlew clean :spring-integration-gemfire:testAll` with existing state is like:
```
Total time: 3 mins 41.375 secs
```
With this fix and without `forkEvery`:
```
Total time: 1 mins 42.699 secs
```
So, 2 min saved time!

Plus fix timeouts in the `PayloadSerializingTransformerParserTests`

Conflicts:
	spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/inbound/CacheListeningMessageProducerTests.java
	spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/outbound/CacheWritingMessageHandlerTests.java

* Change `ZkLockRegistryTests.testTryLock()` to a couple attempts, since there is still some network backpressure involved
https://build.spring.io/browse/INT-AT42SIO-311/
This commit is contained in:
Artem Bilan
2016-06-30 12:17:34 -04:00
parent 5b80ff499c
commit a5fe5ce453
13 changed files with 177 additions and 146 deletions

View File

@@ -355,11 +355,13 @@ public class ZkLockRegistryTests extends ZookeeperTestSupport {
@Test
public void testTryLock() throws Exception {
ZookeeperLockRegistry registry = new ZookeeperLockRegistry(this.client);
for (int i = 0; i < 10; i++) {
Lock lock = registry.obtain("foo");
assertTrue(lock.tryLock());
lock.unlock();
}
Lock lock = registry.obtain("foo");
assertTrue(lock.tryLock());
lock.unlock();
assertTrue(lock.tryLock());
lock.unlock();
registry.destroy();
}