Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Note: Please see The Green Report for latest recommendations in writing DistributedTests.

Updating Old Client/Server DUnit Test to Use Rules

...

1) change "extends JUnit4DistributedTestCase" to "implements Serializable"

Code Block
@Category(DistributedTest.class)
@SuppressWarnings("serial")
public class CacheRegionClearStatsDUnitTest implements Serializable {

...

4) (optional) remove any other uses of @SuppressWarnings

5) add DistributedTestRule add DistributedRule (and optionally CacheRule and ClientCacheRule)

Code Block
@ClassRule@Rule
public staticDistributedRule DistributedTestRule distributedTestRuledistributedRule = new DistributedTestRuleDistributedRule();

@Rule
public CacheRule cacheRule = new CacheRule();

...

Code Block
@Before
public void setUp() throws Exception {
  server1 = getHost(0).getVM(0);
  client1 = getHost(0).getVM(1);
}

7) delete any lines that instantiate CacheRegionClearStatsDUnitTest

...

14) replace any WaitCriterion with AwailityAwaitility

15) delete any dead code or commented out code

...