I just merged my changes for GEODE-773 to develop. You can see detailed
diffs and review at https://reviews.apache.org/r/43230/ and I'll try to
summarize all the changes here.

DistributedTestCase has been very bloated. I've exploded it out into
several utility classes in com.gemstone.gemfire.test.dunit that are
patterned after similar classes in JUnit.

The usage pattern for JUnit is to use import static statements to enable a
test to invoke various public static methods for assertions. These public
static methods are organized within classes by the type of functionality.
All of the other testing frameworks such as CatchException, Awaitility,
Mockito, etc follow this as well.

I used Eclipse refactoring to move methods and there's no option to change
affected classes use "import static" so most of the dunit tests are
invoking these methods statically from the class name.

Here's a summary of the new classes in com.gemstone.gemfire.test.dunit. All
of these have some basic new javadocs as well:

1) Assert

This class extends org.junit.Assert and provides additional assert and fail
methods.

Ex: fail(String, Throwable)

2) DebuggerUtils

Debugger support for DUnit VMs has moved to this class.

Ex: attachDebugger(VM, String)

3) DistributedTestCase

This class provides TestCase lifecycle for DUnit tests (such as
initializing DUnit VMs) and setUp and tearDown hooks for sub-testcases and
tests.

The tearDown has been refactored such that subclasses can implement
preTearDown() and postTearDown() which are invoked before and after the
tearDown for DistributedTestCase (ie tearDownDistributedTestCase).
CacheTestCase implements preTearDown() and provides similar hooks for its'
subclasses called preTearDownCacheTestCase() and
postTearDownCacheTestCase().

The getSystem(), getLonerSystem(), etc type methods still remain in
DistributedTestCase as well.

4) DistributedTestUtils

Provides utility methods that affect the runtime environment or artifacts
generated by a DistributedTest.

Ex: crashDistributedSystem(VM),
getAllDistributedSystemProperties(Properties),
unregisterDataSerializerInThisVM()

5) IgnoredException

Renamed from ExpectedException. JUnit 4 has an ExpectedException Rule which
defines an Exception that must be thrown in order for the test to pass. Our
version is simply defining Exceptions and suspect strings that are
*ignored* during GrepLogs.

All static methods pertaining to IgnoredExceptions are moved to this class.

Ex: addIgnoredException(String)

6) Invoke

Utility methods for invoking SerializableRunnables and
SerializableCallables in DUnit VMs.

The VM class is currently unchanged and still has instance methods for
invoking. The Invoke class contains the invocation static methods that were
in DistirbutedTestCase.

Ex: invokeInEveryVM(SerializableCallableIF)

7) Jitter

8) LogWriterUtils

Deprecated Utility methods for LogWriter. This contains the older LogWriter
methods that are now deprecated in favor of using Logger.

Ex: getLogWriter()

9) NetworkUtils

Utility methods to perform network DNS lookups or similar actions.

Ex: getIPLiteral(), getServerHostName(Host)

10) WaitCriterion and StoppableWaitCriterion

These interfaces are now in their own class files.

11) ThreadUtils

Utility methods to perform thread related actions such as dumping thread
stacks.

Ex: dumpAllStacks(), join(Thread, long)

12) Wait

Deprecated utility methods to wait for some asynchronous action with
intermittent polling. This contains the older wait methods that are now
deprecated in favor of using Awaitility.

Ex: waitForCriterion(...),
pause(int), waitForExpiryClockToChange(LocalRegion)

-Kirk

Reply via email to