geode-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kirk Lund <kl...@apache.org>
Subject ExecutorServiceRule
Date Fri, 12 Jan 2018 00:18:03 GMT
GEODE-4239: Create JUnit Rule to facilitate reuse of ExecutorService
pattern for concurrent integration tests

I just merged GEODE-4239 to develop. This introduces a new JUnit rule
called ExecutorServiceRule. The commit also updates about 8 tests to use
this rule.

ExecutorServiceRule provides a reusable mechanism for executing tasks
asynchronously in tests. It creates an ExecutorService which is terminated
after the scope of the rule and can be used in tests for hangs, deadlocks,
and infinite loops.

You can use this in any type of test (Unit Test, Integration Test,
Distributed Test). If you're doing any sort of waiting in a test, then you
probably want to move that from Unit Test to Integration Test category.
RegionVersionVectorTest is an example of a Unit Test usage that's ok. You
can use it as a method @Rule or a @ClassRule.

The javadocs on ExecutorServiceRule explain how to use it. You can also
look at these tests for example usage:

* AbortableTaskServiceJUnitTest
* BlockingProcessStreamReaderWindowsTest
* DLockServiceLeakTest
* FileProcessControllerIntegrationTest
* GMSEncryptJUnitTest
* InterruptDiskJUnitTest
* MainLauncherJUnitTest
* RegionVersionVectorTest

ExecutorServiceRule is directly tested by these new tests:

* ExecutorServiceRuleTest
* ExecutorServiceRuleIntegrationTest

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message