geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [04/50] [abbrv] geode git commit: GEODE-2632: change dependencies on GemFireCacheImpl to InternalCache
Date Thu, 11 May 2017 21:23:10 GMT
http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/cache30/CacheXml80DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/CacheXml80DUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/CacheXml80DUnitTest.java
index 1ac64fa..08b4716 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/CacheXml80DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/CacheXml80DUnitTest.java
@@ -12,28 +12,23 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
-/**
- * 
- */
 package org.apache.geode.cache30;
 
 import static org.junit.Assert.*;
 
 import java.io.File;
 import java.io.FileWriter;
-import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheException;
 import org.apache.geode.cache.DataPolicy;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.Scope;
@@ -50,23 +45,19 @@ import org.apache.geode.internal.cache.xmlcache.CacheXml;
 import org.apache.geode.internal.cache.xmlcache.CacheXmlGenerator;
 import org.apache.geode.internal.cache.xmlcache.DiskStoreAttributesCreation;
 import org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation;
-import org.apache.geode.test.dunit.Assert;
 import org.apache.geode.test.junit.categories.DistributedTest;
 
 @Category(DistributedTest.class)
 public class CacheXml80DUnitTest extends CacheXml70DUnitTest {
 
-  public CacheXml80DUnitTest() {
-    super();
-  }
-
+  @Override
   protected String getGemFireVersion() {
     return CacheXml.VERSION_8_0;
   }
 
   @SuppressWarnings("rawtypes")
   @Test
-  public void testCompressor() {
+  public void testCompressor() throws Exception {
     final String regionName = "testCompressor";
 
     final CacheCreation cache = new CacheCreation();
@@ -86,7 +77,7 @@ public class CacheXml80DUnitTest extends CacheXml70DUnitTest {
     regionAfter.localDestroyRegion();
   }
 
-  /*
+  /**
    * Tests xml creation for indexes First creates 3 indexes and makes sure the cache creates all 3
    * Creates a 4th through the api and writes out the xml Restarts the cache with the new xml Makes
    * sure the new cache has the 4 indexes
@@ -113,23 +104,20 @@ public class CacheXml80DUnitTest extends CacheXml70DUnitTest {
     c.getQueryService().createIndex("crIndex2", "r.CR_ID_2", "/replicated r");
     c.getQueryService().createIndex("rIndex", "r.R_ID", "/replicated r, r.positions.values rv");
 
-    File dir = new File("XML_" + this.getGemFireVersion());
+    File dir = new File(this.temporaryFolder.getRoot(), "XML_" + this.getGemFireVersion());
     dir.mkdirs();
-    File file = new File(dir, "actual-" + this.getUniqueName() + ".xml");
-    try {
-      PrintWriter pw = new PrintWriter(new FileWriter(file), true);
-      CacheXmlGenerator.generate(c, pw, this.getUseSchema(), this.getGemFireVersion());
-      pw.close();
-    } catch (IOException ex) {
-      Assert.fail("IOException during cache.xml generation to " + file, ex);
-    }
+    File file = new File(dir, "actual-" + getUniqueName() + ".xml");
+
+    PrintWriter pw = new PrintWriter(new FileWriter(file), true);
+    CacheXmlGenerator.generate(c, pw, getUseSchema(), getGemFireVersion());
+    pw.close();
 
     // Get index info before closing cache.
     indexes = qs.getIndexes();
 
     c.close();
     GemFireCacheImpl.testCacheXml = file;
-    assert (c.isClosed());
+    assertTrue(c.isClosed());
 
     c = getCache();
     qs = c.getQueryService();
@@ -184,7 +172,7 @@ public class CacheXml80DUnitTest extends CacheXml70DUnitTest {
   }
 
   @Test
-  public void testCacheServerDisableTcpNoDelay() throws CacheException {
+  public void testCacheServerDisableTcpNoDelay() throws Exception {
     CacheCreation cache = new CacheCreation();
 
     CacheServer cs = cache.addCacheServer();
@@ -196,9 +184,8 @@ public class CacheXml80DUnitTest extends CacheXml70DUnitTest {
     testXml(cache);
   }
 
-
   @Test
-  public void testCacheServerEnableTcpNoDelay() throws CacheException {
+  public void testCacheServerEnableTcpNoDelay() throws Exception {
     CacheCreation cache = new CacheCreation();
 
     CacheServer cs = cache.addCacheServer();
@@ -211,10 +198,9 @@ public class CacheXml80DUnitTest extends CacheXml70DUnitTest {
   }
 
   @Test
-  public void testDiskUsage() {
+  public void testDiskUsage() throws Exception {
     CacheCreation cache = new CacheCreation();
 
-
     DiskStoreAttributesCreation disk = new DiskStoreAttributesCreation();
     disk.setDiskUsageWarningPercentage(97);
     disk.setDiskUsageCriticalPercentage(98);
@@ -233,30 +219,28 @@ public class CacheXml80DUnitTest extends CacheXml70DUnitTest {
     return observer.isIndexesUsed && observer.indexName.equals(indexName);
   }
 
-  private class QueryObserverImpl extends QueryObserverAdapter {
+  private static class QueryObserverImpl extends QueryObserverAdapter {
 
     boolean isIndexesUsed = false;
 
-    ArrayList<String> indexesUsed = new ArrayList<String>();
+    List<String> indexesUsed = new ArrayList<String>();
 
     String indexName;
 
+    @Override
     public void beforeIndexLookup(Index index, int oper, Object key) {
       indexName = index.getName();
       indexesUsed.add(index.getName());
 
     }
 
+    @Override
     public void afterIndexLookup(Collection results) {
       if (results != null) {
         isIndexesUsed = true;
       }
     }
 
-    public int numIndexesUsed() {
-      return indexesUsed.size();
-    }
-
     public void reset() {
       indexName = null;
       isIndexesUsed = false;
@@ -264,7 +248,7 @@ public class CacheXml80DUnitTest extends CacheXml70DUnitTest {
     }
   }
 
-  private class TestObject {
+  private static class TestObject {
     public int CR_ID;
     public int CR_ID_2;
     public int R_ID;
@@ -282,24 +266,8 @@ public class CacheXml80DUnitTest extends CacheXml70DUnitTest {
       positions.put(ID, "TEST_STRING");
     }
 
-    public int getCR_ID() {
-      return CR_ID;
-    }
-
-    public int getCR_ID_2() {
-      return CR_ID_2;
-    }
-
-    public int getR_ID() {
-      return R_ID;
-    }
-
     public int ID() {
       return ID;
     }
-
-    public int getHASH_ID() {
-      return HASH_ID;
-    }
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/cache30/CacheXml81DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/CacheXml81DUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/CacheXml81DUnitTest.java
index aee196d..e6026e1 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/CacheXml81DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/CacheXml81DUnitTest.java
@@ -37,33 +37,29 @@ import org.apache.geode.test.junit.categories.DistributedTest;
 /**
  * Tests 8.1 schema based configuration. From this point all config test cases should extend this
  * test case where {@link #getUseSchema()} will return true.
- * 
  *
  * @since GemFire 8.1
  */
 @Category(DistributedTest.class)
 public class CacheXml81DUnitTest extends CacheXml80DUnitTest {
-  private static final long serialVersionUID = 1L;
-
-  public CacheXml81DUnitTest() {
-    super();
-  }
 
+  @Override
   protected String getGemFireVersion() {
     return CacheXml.VERSION_8_1;
   }
 
+  @Override
   protected boolean getUseSchema() {
     return true;
   }
 
   /**
-   * Test extensions to <code>cache<code> element.
+   * Test extensions to <code>cache</code> element.
    * 
    * @since GemFire 8.1
    */
   @Test
-  public void testCacheExtension() {
+  public void testCacheExtension() throws Exception {
     final CacheCreation cache = new CacheCreation();
     final MockCacheExtension extension = new MockCacheExtension("testCacheExtension");
     cache.getExtensionPoint().addExtension(extension);
@@ -88,7 +84,6 @@ public class CacheXml81DUnitTest extends CacheXml80DUnitTest {
     assertEquals(1, m.beforeCreateCounter.get());
     assertEquals(1, m.onCreateCounter.get());
     assertEquals(0, m.getXmlGeneratorCounter.get());
-
   }
 
   /**
@@ -97,7 +92,7 @@ public class CacheXml81DUnitTest extends CacheXml80DUnitTest {
    * @since GemFire 8.1
    */
   @Test
-  public void testRegionExtension() {
+  public void testRegionExtension() throws Exception {
     final String regionName = "testRegionExtension";
     final CacheCreation cache = new CacheCreation();
     final RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
@@ -128,7 +123,6 @@ public class CacheXml81DUnitTest extends CacheXml80DUnitTest {
     assertEquals(1, m.beforeCreateCounter.get());
     assertEquals(1, m.onCreateCounter.get());
     assertEquals(0, m.getXmlGeneratorCounter.get());
-
   }
 
   /**
@@ -138,7 +132,7 @@ public class CacheXml81DUnitTest extends CacheXml80DUnitTest {
    * @since GemFire 8.2
    */
   @Test
-  public void testLocatorInException() {
+  public void testLocatorInException() throws Exception {
     final String regionName = "testRegionExtension";
     final CacheCreation cache = new CacheCreation();
     final RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
@@ -153,8 +147,8 @@ public class CacheXml81DUnitTest extends CacheXml80DUnitTest {
     assertEquals(0, extension.onCreateCounter.get());
     assertEquals(0, extension.getXmlGeneratorCounter.get());
 
-    IgnoredException expectedException =
-        IgnoredException.addIgnoredException("While reading Cache XML file");
+    IgnoredException.addIgnoredException("While reading Cache XML file");
+
     try {
       testXml(cache);
       fail("Excepted CacheXmlException");
@@ -164,8 +158,6 @@ public class CacheXml81DUnitTest extends CacheXml80DUnitTest {
         assertTrue(((SAXParseException) e.getCause()).getColumnNumber() > 0);
         assertEquals("Value is 'exception'.", e.getCause().getMessage());
       }
-    } finally {
-      expectedException.remove();
     }
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/cache30/CacheXmlGeode10DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/CacheXmlGeode10DUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/CacheXmlGeode10DUnitTest.java
index ca2618b..4f4a808 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/CacheXmlGeode10DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/CacheXmlGeode10DUnitTest.java
@@ -12,10 +12,6 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
-/**
- * 
- */
 package org.apache.geode.cache30;
 
 import static org.apache.geode.distributed.ConfigurationProperties.*;
@@ -36,6 +32,7 @@ import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
 import org.apache.geode.cache.asyncqueue.AsyncEventQueueFactory;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.internal.cache.LocalRegion;
+import org.apache.geode.internal.cache.RegionEntryContext;
 import org.apache.geode.internal.cache.xmlcache.CacheCreation;
 import org.apache.geode.internal.cache.xmlcache.CacheXml;
 import org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation;
@@ -44,57 +41,46 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.junit.categories.DistributedTest;
 
-
 @Category(DistributedTest.class)
 public class CacheXmlGeode10DUnitTest extends CacheXml81DUnitTest {
-  private static final long serialVersionUID = -6437436147079728413L;
-
-  public CacheXmlGeode10DUnitTest() {
-    super();
-  }
-
-
-  // ////// Helper methods
 
+  @Override
   protected String getGemFireVersion() {
     return CacheXml.VERSION_1_0;
   }
 
   @SuppressWarnings("rawtypes")
   @Test
-  public void testEnableOffHeapMemory() {
-    try {
-      System.setProperty(DistributionConfig.GEMFIRE_PREFIX + OFF_HEAP_MEMORY_SIZE, "1m");
+  public void testEnableOffHeapMemory() throws Exception {
+    System.setProperty(DistributionConfig.GEMFIRE_PREFIX + OFF_HEAP_MEMORY_SIZE, "1m");
 
-      final String regionName = "testEnableOffHeapMemory";
+    final String regionName = "testEnableOffHeapMemory";
 
-      final CacheCreation cache = new CacheCreation();
-      final RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
-      attrs.setOffHeap(true);
-      assertEquals(true, attrs.getOffHeap());
+    final CacheCreation cache = new CacheCreation();
+    final RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
+    attrs.setOffHeap(true);
+    assertEquals(true, attrs.getOffHeap());
 
-      final Region regionBefore = cache.createRegion(regionName, attrs);
-      assertNotNull(regionBefore);
-      assertEquals(true, regionBefore.getAttributes().getOffHeap());
+    final Region regionBefore = cache.createRegion(regionName, attrs);
+    assertNotNull(regionBefore);
+    assertEquals(true, regionBefore.getAttributes().getOffHeap());
 
-      testXml(cache);
+    testXml(cache);
 
-      final Cache c = getCache();
-      assertNotNull(c);
+    final Cache c = getCache();
+    assertNotNull(c);
 
-      final Region regionAfter = c.getRegion(regionName);
-      assertNotNull(regionAfter);
-      assertEquals(true, regionAfter.getAttributes().getOffHeap());
-      assertEquals(true, ((LocalRegion) regionAfter).getOffHeap());
-      regionAfter.localDestroyRegion();
-    } finally {
-      System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + OFF_HEAP_MEMORY_SIZE);
-    }
+    final Region regionAfter = c.getRegion(regionName);
+    assertNotNull(regionAfter);
+    assertEquals(true, regionAfter.getAttributes().getOffHeap());
+    assertEquals(true, ((RegionEntryContext) regionAfter).getOffHeap());
+    regionAfter.localDestroyRegion();
   }
 
   @SuppressWarnings("rawtypes")
   @Test
-  public void testEnableOffHeapMemoryRootRegionWithoutOffHeapMemoryThrowsException() {
+  public void testEnableOffHeapMemoryRootRegionWithoutOffHeapMemoryThrowsException()
+      throws Exception {
     final String regionName = getUniqueName();
 
     final CacheCreation cache = new CacheCreation();
@@ -106,25 +92,26 @@ public class CacheXmlGeode10DUnitTest extends CacheXml81DUnitTest {
     assertNotNull(regionBefore);
     assertEquals(true, regionBefore.getAttributes().getOffHeap());
 
-    IgnoredException expectedException = IgnoredException.addIgnoredException(
+    IgnoredException.addIgnoredException(
         LocalizedStrings.LocalRegion_THE_REGION_0_WAS_CONFIGURED_TO_USE_OFF_HEAP_MEMORY_BUT_OFF_HEAP_NOT_CONFIGURED
             .toLocalizedString("/" + regionName));
+
     try {
       testXml(cache);
+      fail("Expected IllegalStateException to be thrown");
     } catch (IllegalStateException e) {
       // expected
       String msg =
           LocalizedStrings.LocalRegion_THE_REGION_0_WAS_CONFIGURED_TO_USE_OFF_HEAP_MEMORY_BUT_OFF_HEAP_NOT_CONFIGURED
               .toLocalizedString("/" + regionName);
       assertEquals(msg, e.getMessage());
-    } finally {
-      expectedException.remove();
     }
   }
 
   @SuppressWarnings({"rawtypes", "deprecation", "unchecked"})
   @Test
-  public void testEnableOffHeapMemorySubRegionWithoutOffHeapMemoryThrowsException() {
+  public void testEnableOffHeapMemorySubRegionWithoutOffHeapMemoryThrowsException()
+      throws Exception {
     final String rootRegionName = getUniqueName();
     final String subRegionName = "subRegion";
 
@@ -144,27 +131,25 @@ public class CacheXmlGeode10DUnitTest extends CacheXml81DUnitTest {
     assertNotNull(subRegionBefore);
     assertEquals(true, subRegionBefore.getAttributes().getOffHeap());
 
-    IgnoredException expectedException = IgnoredException.addIgnoredException(
+    IgnoredException.addIgnoredException(
         LocalizedStrings.LocalRegion_THE_REGION_0_WAS_CONFIGURED_TO_USE_OFF_HEAP_MEMORY_BUT_OFF_HEAP_NOT_CONFIGURED
             .toLocalizedString("/" + rootRegionName + "/" + subRegionName));
+
     try {
       testXml(cache);
+      fail("Expected IllegalStateException to be thrown");
     } catch (IllegalStateException e) {
       // expected
       final String msg =
           LocalizedStrings.LocalRegion_THE_REGION_0_WAS_CONFIGURED_TO_USE_OFF_HEAP_MEMORY_BUT_OFF_HEAP_NOT_CONFIGURED
               .toLocalizedString("/" + rootRegionName + "/" + subRegionName);
       assertEquals(msg, e.getMessage());
-    } finally {
-      expectedException.remove();
     }
   }
 
   /**
    * Test the ResourceManager element's critical-off-heap-percentage and
    * eviction-off-heap-percentage attributes
-   * 
-   * @throws Exception
    */
   @Test
   public void testResourceManagerThresholds() throws Exception {
@@ -172,102 +157,96 @@ public class CacheXmlGeode10DUnitTest extends CacheXml81DUnitTest {
     final float low = 90.0f;
     final float high = 95.0f;
 
-    try {
-      System.setProperty(DistributionConfig.GEMFIRE_PREFIX + OFF_HEAP_MEMORY_SIZE, "1m");
-
-      Cache c;
-      ResourceManagerCreation rmc = new ResourceManagerCreation();
-      rmc.setEvictionOffHeapPercentage(low);
-      rmc.setCriticalOffHeapPercentage(high);
-      cache.setResourceManagerCreation(rmc);
-      testXml(cache);
-      {
-        c = getCache();
-        assertEquals(low, c.getResourceManager().getEvictionOffHeapPercentage(), 0);
-        assertEquals(high, c.getResourceManager().getCriticalOffHeapPercentage(), 0);
-      }
-      closeCache();
+    System.setProperty(DistributionConfig.GEMFIRE_PREFIX + OFF_HEAP_MEMORY_SIZE, "1m");
 
-      rmc = new ResourceManagerCreation();
-      // Set them to similar values
-      rmc.setEvictionOffHeapPercentage(low);
-      rmc.setCriticalOffHeapPercentage(low + 1);
-      cache.setResourceManagerCreation(rmc);
-      testXml(cache);
-      {
-        c = getCache();
-        assertEquals(low, c.getResourceManager().getEvictionOffHeapPercentage(), 0);
-        assertEquals(low + 1, c.getResourceManager().getCriticalOffHeapPercentage(), 0);
-      }
-      closeCache();
+    Cache c;
+    ResourceManagerCreation rmc = new ResourceManagerCreation();
+    rmc.setEvictionOffHeapPercentage(low);
+    rmc.setCriticalOffHeapPercentage(high);
+    cache.setResourceManagerCreation(rmc);
+    testXml(cache);
+    {
+      c = getCache();
+      assertEquals(low, c.getResourceManager().getEvictionOffHeapPercentage(), 0);
+      assertEquals(high, c.getResourceManager().getCriticalOffHeapPercentage(), 0);
+    }
+    closeCache();
 
-      rmc = new ResourceManagerCreation();
-      rmc.setEvictionOffHeapPercentage(high);
-      rmc.setCriticalOffHeapPercentage(low);
-      cache.setResourceManagerCreation(rmc);
-      IgnoredException expectedException = IgnoredException.addIgnoredException(
-          LocalizedStrings.MemoryMonitor_EVICTION_PERCENTAGE_LTE_CRITICAL_PERCENTAGE
-              .toLocalizedString());
-      try {
-        testXml(cache);
-        assertTrue(false);
-      } catch (IllegalArgumentException expected) {
-      } finally {
-        expectedException.remove();
-        closeCache();
-      }
-
-      // Disable eviction
-      rmc = new ResourceManagerCreation();
-      rmc.setEvictionOffHeapPercentage(0);
-      rmc.setCriticalOffHeapPercentage(low);
-      cache.setResourceManagerCreation(rmc);
-      testXml(cache);
-      {
-        c = getCache();
-        assertEquals(0f, c.getResourceManager().getEvictionOffHeapPercentage(), 0);
-        assertEquals(low, c.getResourceManager().getCriticalOffHeapPercentage(), 0);
-      }
-      closeCache();
+    rmc = new ResourceManagerCreation();
+    // Set them to similar values
+    rmc.setEvictionOffHeapPercentage(low);
+    rmc.setCriticalOffHeapPercentage(low + 1);
+    cache.setResourceManagerCreation(rmc);
+    testXml(cache);
+    {
+      c = getCache();
+      assertEquals(low, c.getResourceManager().getEvictionOffHeapPercentage(), 0);
+      assertEquals(low + 1, c.getResourceManager().getCriticalOffHeapPercentage(), 0);
+    }
+    closeCache();
 
-      // Disable refusing ops in "red zone"
-      rmc = new ResourceManagerCreation();
-      rmc.setEvictionOffHeapPercentage(low);
-      rmc.setCriticalOffHeapPercentage(0);
-      cache.setResourceManagerCreation(rmc);
+    rmc = new ResourceManagerCreation();
+    rmc.setEvictionOffHeapPercentage(high);
+    rmc.setCriticalOffHeapPercentage(low);
+    cache.setResourceManagerCreation(rmc);
+    IgnoredException expectedException = IgnoredException.addIgnoredException(
+        LocalizedStrings.MemoryMonitor_EVICTION_PERCENTAGE_LTE_CRITICAL_PERCENTAGE
+            .toLocalizedString());
+    try {
       testXml(cache);
-      {
-        c = getCache();
-        assertEquals(low, c.getResourceManager().getEvictionOffHeapPercentage(), 0);
-        assertEquals(0f, c.getResourceManager().getCriticalOffHeapPercentage(), 0);
-      }
+      fail("Expected IllegalArgumentException to be thrown");
+    } catch (IllegalArgumentException expected) {
+    } finally {
+      expectedException.remove();
       closeCache();
+    }
 
-      // Disable both
-      rmc = new ResourceManagerCreation();
-      rmc.setEvictionOffHeapPercentage(0);
-      rmc.setCriticalOffHeapPercentage(0);
-      cache.setResourceManagerCreation(rmc);
-      testXml(cache);
+    // Disable eviction
+    rmc = new ResourceManagerCreation();
+    rmc.setEvictionOffHeapPercentage(0);
+    rmc.setCriticalOffHeapPercentage(low);
+    cache.setResourceManagerCreation(rmc);
+    testXml(cache);
+    {
       c = getCache();
       assertEquals(0f, c.getResourceManager().getEvictionOffHeapPercentage(), 0);
+      assertEquals(low, c.getResourceManager().getCriticalOffHeapPercentage(), 0);
+    }
+    closeCache();
+
+    // Disable refusing ops in "red zone"
+    rmc = new ResourceManagerCreation();
+    rmc.setEvictionOffHeapPercentage(low);
+    rmc.setCriticalOffHeapPercentage(0);
+    cache.setResourceManagerCreation(rmc);
+    testXml(cache);
+    {
+      c = getCache();
+      assertEquals(low, c.getResourceManager().getEvictionOffHeapPercentage(), 0);
       assertEquals(0f, c.getResourceManager().getCriticalOffHeapPercentage(), 0);
-    } finally {
-      System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + OFF_HEAP_MEMORY_SIZE);
     }
+    closeCache();
+
+    // Disable both
+    rmc = new ResourceManagerCreation();
+    rmc.setEvictionOffHeapPercentage(0);
+    rmc.setCriticalOffHeapPercentage(0);
+    cache.setResourceManagerCreation(rmc);
+    testXml(cache);
+    c = getCache();
+    assertEquals(0f, c.getResourceManager().getEvictionOffHeapPercentage(), 0);
+    assertEquals(0f, c.getResourceManager().getCriticalOffHeapPercentage(), 0);
   }
 
   @SuppressWarnings("rawtypes")
   @Test
-  public void testAsyncEventQueueIsForwardExpirationDestroyAttribute() {
-
-    final String regionName = "testAsyncEventQueueIsEnableEvictionAndExpirationAttribute";
+  public void testAsyncEventQueueIsForwardExpirationDestroyAttribute() throws Exception {
+    final String regionName = this.testName.getMethodName();
 
     // Create AsyncEventQueue with Listener
     final CacheCreation cache = new CacheCreation();
     AsyncEventQueueFactory factory = cache.createAsyncEventQueueFactory();
 
-
     AsyncEventListener listener = new MyAsyncEventListenerGeode10();
 
     // Test for default forwardExpirationDestroy attribute value (which is false)
@@ -315,12 +294,15 @@ public class CacheXmlGeode10DUnitTest extends CacheXml81DUnitTest {
 
   public static class MyAsyncEventListenerGeode10 implements AsyncEventListener, Declarable {
 
+    @Override
     public boolean processEvents(List<AsyncEvent> events) {
       return true;
     }
 
+    @Override
     public void close() {}
 
+    @Override
     public void init(Properties properties) {}
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/cache30/CacheXmlTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/CacheXmlTestCase.java b/geode-core/src/test/java/org/apache/geode/cache30/CacheXmlTestCase.java
index 938c56d..2951c7a 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/CacheXmlTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/CacheXmlTestCase.java
@@ -14,23 +14,31 @@
  */
 package org.apache.geode.cache30;
 
+import static org.apache.geode.test.dunit.Assert.*;
 import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
 
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.net.URL;
 import java.util.Properties;
 
+import org.apache.commons.io.FileUtils;
+import org.junit.Rule;
+
 import org.apache.geode.cache.Cache;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.extension.Extension;
 import org.apache.geode.internal.cache.xmlcache.CacheCreation;
 import org.apache.geode.internal.cache.xmlcache.CacheXml;
 import org.apache.geode.internal.cache.xmlcache.CacheXmlGenerator;
 import org.apache.geode.internal.cache.xmlcache.ClientCacheCreation;
-import org.apache.geode.test.dunit.Assert;
 import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
+import org.apache.geode.test.dunit.rules.DistributedRestoreSystemProperties;
+import org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder;
+import org.apache.geode.test.junit.rules.serializable.SerializableTestName;
 import org.apache.geode.util.test.TestUtil;
 
 public class CacheXmlTestCase extends JUnit4CacheTestCase {
@@ -41,6 +49,16 @@ public class CacheXmlTestCase extends JUnit4CacheTestCase {
   /** set this to false if a test needs a non-loner distributed system */
   static boolean lonerDistributedSystem = true;
 
+  @Rule
+  public DistributedRestoreSystemProperties restoreSystemProperties =
+      new DistributedRestoreSystemProperties();
+
+  @Rule
+  public SerializableTemporaryFolder temporaryFolder = new SerializableTemporaryFolder();
+
+  @Rule
+  public SerializableTestName testName = new SerializableTestName();
+
   @Override
   public final void postSetUp() throws Exception {
     disconnectAllFromDS();
@@ -49,6 +67,7 @@ public class CacheXmlTestCase extends JUnit4CacheTestCase {
   @Override
   public final void preTearDownCacheTestCase() throws Exception {
     this.xmlFile = null;
+    GemFireCacheImpl.testCacheXml = null;
   }
 
   @Override
@@ -79,11 +98,20 @@ public class CacheXmlTestCase extends JUnit4CacheTestCase {
   /**
    * Finds an XML file with the given name. Looks in $JTESTS.
    */
-  protected File findFile(String fileName) {
-    String path = TestUtil.getResourcePath(getClass(), fileName);
-    return new File(path);
+  protected File findFile(String fileName) throws IOException {
+    return copyResourceToDirectory(this.temporaryFolder.getRoot(), fileName);
+    // String path = TestUtil.getResourcePath(getClass(), fileName);
+    // return new File(path);
+  }
+
+  protected File copyResourceToDirectory(File directory, String fileName) throws IOException {
+    URL url = getClass().getResource(fileName);
+    File file = new File(directory, fileName);
+    FileUtils.copyURLToFile(url, file);
+    return file;
   }
 
+  @Override
   public Properties getDistributedSystemProperties() {
     Properties props = super.getDistributedSystemProperties();
     if (this.xmlFile != null) {
@@ -104,27 +132,22 @@ public class CacheXmlTestCase extends JUnit4CacheTestCase {
    * {@link CacheCreation}. It then creates a {@link Cache} from the XML and asserts that it is the
    * same as the cache described in the <code>CacheCreation</code>.
    */
-  protected void testXml(CacheCreation creation) {
+  protected void testXml(CacheCreation creation) throws IOException {
     testXml(creation, true);
   }
 
-  protected void testXml(CacheCreation creation, boolean checkSame) {
-
-    File dir = new File("XML_" + this.getGemFireVersion());
+  protected void testXml(CacheCreation creation, boolean checkSame) throws IOException {
+    File root = this.temporaryFolder.getRoot();
+    File dir = new File(root, "XML_" + getGemFireVersion());
     dir.mkdirs();
-    File file = new File(dir, this.getUniqueName() + ".xml");
+    File file = new File(dir, getUniqueName() + ".xml");
 
     final boolean useSchema = getUseSchema();
     final String version = getGemFireVersion();
-    try {
-      PrintWriter pw = new PrintWriter(new FileWriter(file), true);
-      CacheXmlGenerator.generate(creation, pw, useSchema, version);
-      pw.close();
 
-    } catch (IOException ex) {
-      String s = "While generating XML";
-      Assert.fail(s, ex);
-    }
+    PrintWriter pw = new PrintWriter(new FileWriter(file), true);
+    CacheXmlGenerator.generate(creation, pw, useSchema, version);
+    pw.close();
 
     setXmlFile(file);
 
@@ -142,7 +165,7 @@ public class CacheXmlTestCase extends JUnit4CacheTestCase {
       StringWriter sw = new StringWriter();
       CacheXmlGenerator.generate(creation, new PrintWriter(sw, true), useSchema, version);
       CacheXmlGenerator.generate(cache, new PrintWriter(sw, true), useSchema, version);
-      Assert.fail(sw.toString(), re);
+      fail(sw.toString(), re);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java
index 3f81bcd..2692650 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java
@@ -14,8 +14,41 @@
  */
 package org.apache.geode.distributed.internal.membership.gms.mgr;
 
+import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.junit.Assert.*;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Random;
+import java.util.Set;
+import java.util.Timer;
+
+import org.assertj.core.api.Assertions;
+import org.jgroups.util.UUID;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import org.apache.geode.distributed.DistributedSystemDisconnectedException;
-import org.apache.geode.distributed.internal.*;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DMStats;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.DistributionConfigImpl;
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DistributionMessage;
+import org.apache.geode.distributed.internal.HighPriorityAckedMessage;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.MembershipListener;
+import org.apache.geode.distributed.internal.ReplyProcessor21;
 import org.apache.geode.distributed.internal.direct.DirectChannel;
 import org.apache.geode.distributed.internal.membership.DistributedMembershipListener;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
@@ -35,21 +68,6 @@ import org.apache.geode.internal.admin.remote.RemoteTransportConfig;
 import org.apache.geode.internal.tcp.ConnectExceptions;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.MembershipTest;
-import org.assertj.core.api.Assertions;
-import org.jgroups.util.UUID;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.*;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.isA;
-import static org.mockito.Mockito.*;
 
 @Category({IntegrationTest.class, MembershipTest.class})
 public class GMSMembershipManagerJUnitTest {

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionEntryTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionEntryTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionEntryTest.java
index 2f372bc..63a7ba7 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionEntryTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionEntryTest.java
@@ -92,7 +92,7 @@ public class AbstractRegionEntryTest {
     }
 
     @Override
-    protected long getlastModifiedField() {
+    protected long getLastModifiedField() {
       return 0;
     }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionJUnitTest.java
index dd766a4..a90bdb9 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionJUnitTest.java
@@ -45,6 +45,7 @@ import org.apache.geode.cache.query.QueryInvocationTargetException;
 import org.apache.geode.cache.query.SelectResults;
 import org.apache.geode.cache.query.TypeMismatchException;
 import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.Version;
 import org.apache.geode.internal.cache.extension.ExtensionPoint;
 import org.apache.geode.internal.cache.extension.SimpleExtensionPoint;
@@ -78,7 +79,7 @@ public class AbstractRegionJUnitTest {
   private static class MockRegion extends AbstractRegion {
 
     /**
-     * @see AbstractRegion#AbstractRegion(GemFireCacheImpl, int, boolean, long, long)
+     * @see AbstractRegion#AbstractRegion(InternalCache, int, boolean, long, long)
      */
     @SuppressWarnings("deprecation")
     private MockRegion(GemFireCacheImpl cache, int serialNumber, boolean isPdxTypeRegion,
@@ -474,7 +475,7 @@ public class AbstractRegionJUnitTest {
     }
 
     @Override
-    protected DistributedMember getMyId() {
+    protected InternalDistributedMember getMyId() {
       throw new UnsupportedOperationException();
     }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java
index 5d81724..caa2ce5 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java
@@ -14,14 +14,11 @@
  */
 package org.apache.geode.internal.cache;
 
-import static junit.framework.TestCase.assertNotNull;
 import static org.apache.geode.distributed.ConfigurationProperties.CACHE_XML_FILE;
 import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
 import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
 import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.filefilter.DirectoryFileFilter;
@@ -58,20 +55,15 @@ import java.util.Collections;
 import java.util.Properties;
 import java.util.Random;
 
-/**
- *
- */
 @Category(IntegrationTest.class)
 public class BackupJUnitTest {
-  protected static GemFireCacheImpl cache = null;
-  protected static File TMP_DIR;
-  protected static File cacheXmlFile;
 
-  protected static DistributedSystem ds = null;
-  protected static Properties props = new Properties();
+  protected GemFireCacheImpl cache = null;
+  private File tmpDir;
+  protected File cacheXmlFile;
 
-  static {
-  }
+  protected DistributedSystem ds = null;
+  protected Properties props = new Properties();
 
   private File backupDir;
   private File[] diskDirs;
@@ -83,11 +75,11 @@ public class BackupJUnitTest {
 
   @Before
   public void setUp() throws Exception {
-    if (TMP_DIR == null) {
+    if (tmpDir == null) {
       props.setProperty(MCAST_PORT, "0");
       props.setProperty(LOCATORS, "");
       String tmpDirName = System.getProperty("java.io.tmpdir");
-      TMP_DIR = tmpDirName == null ? new File("") : new File(tmpDirName);
+      tmpDir = new File(tmpDirName == null ? "" : tmpDirName);
       try {
         URL url = BackupJUnitTest.class.getResource("BackupJUnitTest.cache.xml");
         cacheXmlFile = new File(url.toURI().getPath());
@@ -100,12 +92,12 @@ public class BackupJUnitTest {
 
     createCache();
 
-    backupDir = new File(TMP_DIR, getName() + "backup_Dir");
+    backupDir = new File(tmpDir, getName() + "backup_Dir");
     backupDir.mkdir();
     diskDirs = new File[2];
-    diskDirs[0] = new File(TMP_DIR, getName() + "_diskDir1");
+    diskDirs[0] = new File(tmpDir, getName() + "_diskDir1");
     diskDirs[0].mkdir();
-    diskDirs[1] = new File(TMP_DIR, getName() + "_diskDir2");
+    diskDirs[1] = new File(tmpDir, getName() + "_diskDir2");
     diskDirs[1].mkdir();
   }
 
@@ -134,8 +126,7 @@ public class BackupJUnitTest {
     backupAndRecover(new RegionCreator() {
       public Region createRegion() {
         DiskStoreImpl ds = createDiskStore();
-        Region region = BackupJUnitTest.this.createRegion();
-        return region;
+        return BackupJUnitTest.this.createRegion();
       }
     });
   }
@@ -151,8 +142,7 @@ public class BackupJUnitTest {
         DiskWriteAttributesFactory daf = new DiskWriteAttributesFactory();
         daf.setMaxOplogSize(1);
         rf.setDiskWriteAttributes(daf.create());
-        Region region = rf.create("region");
-        return region;
+        return rf.create("region");
       }
     });
   }
@@ -189,7 +179,7 @@ public class BackupJUnitTest {
     // restore the deleted entry.
     region.put(2047, getBytes(2047));
 
-    for (DiskStoreImpl store : cache.listDiskStoresIncludingRegionOwned()) {
+    for (DiskStore store : cache.listDiskStoresIncludingRegionOwned()) {
       store.flush();
     }
 
@@ -400,7 +390,7 @@ public class BackupJUnitTest {
     while ((line = br.readLine()) != null) {
       System.out.println("OUTPUT:" + line);
       // TODO validate output
-    } ;
+    }
 
     int result = process.waitFor();
     boolean isWindows = script.getName().endsWith("bat");
@@ -420,8 +410,7 @@ public class BackupJUnitTest {
     RegionFactory rf = new RegionFactory();
     rf.setDiskStoreName("diskStore");
     rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
-    Region region = rf.create("region");
-    return region;
+    return rf.create("region");
   }
 
   private Region createOverflowRegion() {
@@ -430,12 +419,11 @@ public class BackupJUnitTest {
     rf.setEvictionAttributes(
         EvictionAttributes.createLIFOEntryAttributes(1, EvictionAction.OVERFLOW_TO_DISK));
     rf.setDataPolicy(DataPolicy.NORMAL);
-    Region region = rf.create("region");
-    return region;
+    return rf.create("region");
   }
 
   private DiskStore findDiskStore() {
-    return this.cache.findDiskStore("diskStore");
+    return cache.findDiskStore("diskStore");
   }
 
   private DiskStoreImpl createDiskStore() {
@@ -443,12 +431,11 @@ public class BackupJUnitTest {
     dsf.setDiskDirs(diskDirs);
     dsf.setMaxOplogSize(1);
     String name = "diskStore";
-    DiskStoreImpl ds = (DiskStoreImpl) dsf.create(name);
-    return ds;
+    return (DiskStoreImpl) dsf.create(name);
   }
 
-  private static interface RegionCreator {
-    public Region createRegion();
+  private interface RegionCreator {
+    Region createRegion();
   }
 
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/internal/cache/CacheLifecycleListenerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/CacheLifecycleListenerJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheLifecycleListenerJUnitTest.java
index 02eaf06..995de03 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/CacheLifecycleListenerJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheLifecycleListenerJUnitTest.java
@@ -41,23 +41,19 @@ public class CacheLifecycleListenerJUnitTest {
 
   @Test
   public void testRemoveNonExistent() throws Exception {
-    final List<CacheLifecycleCallback> cacheCreatedCallbacks =
-        new ArrayList<CacheLifecycleCallback>();
-    final List<CacheLifecycleCallback> cacheClosedCallbacks =
-        new ArrayList<CacheLifecycleCallback>();
-    final TestCacheLifecycleListener listener =
+    List<CacheLifecycleCallback> cacheCreatedCallbacks = new ArrayList<>();
+    List<CacheLifecycleCallback> cacheClosedCallbacks = new ArrayList<>();
+    TestCacheLifecycleListener listener =
         new TestCacheLifecycleListener(cacheCreatedCallbacks, cacheClosedCallbacks);
     GemFireCacheImpl.removeCacheLifecycleListener(listener);
   }
 
   @Test
   public void testCallbacks() throws Exception {
-    final List<CacheLifecycleCallback> cacheCreatedCallbacks =
-        new ArrayList<CacheLifecycleCallback>();
-    final List<CacheLifecycleCallback> cacheClosedCallbacks =
-        new ArrayList<CacheLifecycleCallback>();
+    List<CacheLifecycleCallback> cacheCreatedCallbacks = new ArrayList<>();
+    List<CacheLifecycleCallback> cacheClosedCallbacks = new ArrayList<>();
 
-    final TestCacheLifecycleListener listener =
+    TestCacheLifecycleListener listener =
         new TestCacheLifecycleListener(cacheCreatedCallbacks, cacheClosedCallbacks);
     try {
       GemFireCacheImpl.addCacheLifecycleListener(listener);
@@ -67,11 +63,11 @@ public class CacheLifecycleListenerJUnitTest {
       // assert no close callback
       assertTrue(cacheClosedCallbacks.isEmpty());
 
-      final Properties props = new Properties();
+      Properties props = new Properties();
       props.setProperty(MCAST_PORT, "0");
       props.setProperty(LOCATORS, "");
 
-      final GemFireCacheImpl cache = (GemFireCacheImpl) new CacheFactory(props).create();
+      InternalCache cache = (InternalCache) new CacheFactory(props).create();
       try {
         // assert one create callback
         assertFalse(cacheCreatedCallbacks.isEmpty());
@@ -98,12 +94,10 @@ public class CacheLifecycleListenerJUnitTest {
 
   @Test
   public void testRemoveBeforeCreate() throws Exception {
-    final List<CacheLifecycleCallback> cacheCreatedCallbacks =
-        new ArrayList<CacheLifecycleCallback>();
-    final List<CacheLifecycleCallback> cacheClosedCallbacks =
-        new ArrayList<CacheLifecycleCallback>();
+    List<CacheLifecycleCallback> cacheCreatedCallbacks = new ArrayList<>();
+    List<CacheLifecycleCallback> cacheClosedCallbacks = new ArrayList<>();
 
-    final TestCacheLifecycleListener listener =
+    TestCacheLifecycleListener listener =
         new TestCacheLifecycleListener(cacheCreatedCallbacks, cacheClosedCallbacks);
     try {
       GemFireCacheImpl.addCacheLifecycleListener(listener);
@@ -114,11 +108,11 @@ public class CacheLifecycleListenerJUnitTest {
       // assert no close callback
       assertTrue(cacheClosedCallbacks.isEmpty());
 
-      final Properties props = new Properties();
+      Properties props = new Properties();
       props.setProperty(MCAST_PORT, "0");
       props.setProperty(LOCATORS, "");
 
-      final GemFireCacheImpl cache = (GemFireCacheImpl) new CacheFactory(props).create();
+      InternalCache cache = (InternalCache) new CacheFactory(props).create();
       try {
         // assert no create callback
         assertTrue(cacheCreatedCallbacks.isEmpty());
@@ -139,12 +133,10 @@ public class CacheLifecycleListenerJUnitTest {
 
   @Test
   public void testRemoveBeforeClose() throws Exception {
-    final List<CacheLifecycleCallback> cacheCreatedCallbacks =
-        new ArrayList<CacheLifecycleCallback>();
-    final List<CacheLifecycleCallback> cacheClosedCallbacks =
-        new ArrayList<CacheLifecycleCallback>();
+    List<CacheLifecycleCallback> cacheCreatedCallbacks = new ArrayList<>();
+    List<CacheLifecycleCallback> cacheClosedCallbacks = new ArrayList<>();
 
-    final TestCacheLifecycleListener listener =
+    TestCacheLifecycleListener listener =
         new TestCacheLifecycleListener(cacheCreatedCallbacks, cacheClosedCallbacks);
     try {
       GemFireCacheImpl.addCacheLifecycleListener(listener);
@@ -154,11 +146,11 @@ public class CacheLifecycleListenerJUnitTest {
       // assert no close callback
       assertTrue(cacheClosedCallbacks.isEmpty());
 
-      final Properties props = new Properties();
+      Properties props = new Properties();
       props.setProperty(MCAST_PORT, "0");
       props.setProperty(LOCATORS, "");
 
-      final GemFireCacheImpl cache = (GemFireCacheImpl) new CacheFactory(props).create();
+      InternalCache cache = (InternalCache) new CacheFactory(props).create();
       try {
         // assert one create callback
         assertFalse(cacheCreatedCallbacks.isEmpty());
@@ -184,12 +176,10 @@ public class CacheLifecycleListenerJUnitTest {
 
   @Test
   public void testCallbacksRepeat() throws Exception {
-    final List<CacheLifecycleCallback> cacheCreatedCallbacks =
-        new ArrayList<CacheLifecycleCallback>();
-    final List<CacheLifecycleCallback> cacheClosedCallbacks =
-        new ArrayList<CacheLifecycleCallback>();
+    List<CacheLifecycleCallback> cacheCreatedCallbacks = new ArrayList<>();
+    List<CacheLifecycleCallback> cacheClosedCallbacks = new ArrayList<>();
 
-    final TestCacheLifecycleListener listener =
+    TestCacheLifecycleListener listener =
         new TestCacheLifecycleListener(cacheCreatedCallbacks, cacheClosedCallbacks);
     try {
       GemFireCacheImpl.addCacheLifecycleListener(listener);
@@ -199,11 +189,11 @@ public class CacheLifecycleListenerJUnitTest {
       // assert no close callback
       assertTrue(cacheClosedCallbacks.isEmpty());
 
-      final Properties props = new Properties();
+      Properties props = new Properties();
       props.setProperty(MCAST_PORT, "0");
       props.setProperty(LOCATORS, "");
 
-      final GemFireCacheImpl cache1 = (GemFireCacheImpl) new CacheFactory(props).create();
+      InternalCache cache1 = (InternalCache) new CacheFactory(props).create();
       try {
         // assert one create callback
         assertFalse(cacheCreatedCallbacks.isEmpty());
@@ -224,7 +214,7 @@ public class CacheLifecycleListenerJUnitTest {
       assertEquals(1, cacheClosedCallbacks.size());
       assertEquals(cache1, cacheClosedCallbacks.get(0).getCache());
 
-      final GemFireCacheImpl cache2 = (GemFireCacheImpl) new CacheFactory(props).create();
+      InternalCache cache2 = (InternalCache) new CacheFactory(props).create();
       try {
         // assert two create callback
         assertFalse(cacheCreatedCallbacks.isEmpty());
@@ -256,23 +246,21 @@ public class CacheLifecycleListenerJUnitTest {
 
   @Test
   public void testAddAfterCreate() throws Exception {
-    final List<CacheLifecycleCallback> cacheCreatedCallbacks =
-        new ArrayList<CacheLifecycleCallback>();
-    final List<CacheLifecycleCallback> cacheClosedCallbacks =
-        new ArrayList<CacheLifecycleCallback>();
+    List<CacheLifecycleCallback> cacheCreatedCallbacks = new ArrayList<>();
+    List<CacheLifecycleCallback> cacheClosedCallbacks = new ArrayList<>();
 
-    final TestCacheLifecycleListener listener =
+    TestCacheLifecycleListener listener =
         new TestCacheLifecycleListener(cacheCreatedCallbacks, cacheClosedCallbacks);
     // assert no create callback
     assertTrue(cacheCreatedCallbacks.isEmpty());
     // assert no close callback
     assertTrue(cacheClosedCallbacks.isEmpty());
 
-    final Properties props = new Properties();
+    Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "");
 
-    final GemFireCacheImpl cache = (GemFireCacheImpl) new CacheFactory(props).create();
+    InternalCache cache = (InternalCache) new CacheFactory(props).create();
     try {
       try {
         // assert no create callback
@@ -296,25 +284,23 @@ public class CacheLifecycleListenerJUnitTest {
     }
   }
 
-  private static final class CacheLifecycleCallback {
+  private static class CacheLifecycleCallback {
 
-    private final GemFireCacheImpl cache;
-    private final long timeStamp;
+    private InternalCache cache;
 
-    CacheLifecycleCallback(GemFireCacheImpl cache) {
+    CacheLifecycleCallback(InternalCache cache) {
       this.cache = cache;
-      this.timeStamp = System.currentTimeMillis();
     }
 
-    GemFireCacheImpl getCache() {
+    InternalCache getCache() {
       return this.cache;
     }
   }
 
-  private static final class TestCacheLifecycleListener implements CacheLifecycleListener {
+  private static class TestCacheLifecycleListener implements CacheLifecycleListener {
 
-    private final List<CacheLifecycleCallback> cacheCreatedCallbacks;
-    private final List<CacheLifecycleCallback> cacheClosedCallbacks;
+    private List<CacheLifecycleCallback> cacheCreatedCallbacks;
+    private List<CacheLifecycleCallback> cacheClosedCallbacks;
 
     TestCacheLifecycleListener(List<CacheLifecycleCallback> cacheCreatedCallbacks,
         List<CacheLifecycleCallback> cacheClosedCallbacks) {
@@ -323,12 +309,12 @@ public class CacheLifecycleListenerJUnitTest {
     }
 
     @Override
-    public void cacheCreated(GemFireCacheImpl cache) {
+    public void cacheCreated(InternalCache cache) {
       this.cacheCreatedCallbacks.add(new CacheLifecycleCallback(cache));
     }
 
     @Override
-    public void cacheClosed(GemFireCacheImpl cache) {
+    public void cacheClosed(InternalCache cache) {
       this.cacheClosedCallbacks.add(new CacheLifecycleCallback(cache));
     }
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/internal/cache/DiskInitFileJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskInitFileJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskInitFileJUnitTest.java
index ec1b5cf..78527b5 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskInitFileJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskInitFileJUnitTest.java
@@ -21,6 +21,7 @@ import java.util.Collections;
 
 import org.jmock.Expectations;
 import org.jmock.Mockery;
+import org.jmock.lib.concurrent.Synchroniser;
 import org.jmock.lib.legacy.ClassImposteriser;
 import org.junit.Before;
 import org.junit.Rule;
@@ -39,6 +40,7 @@ public class DiskInitFileJUnitTest {
   private Mockery context = new Mockery() {
     {
       setImposteriser(ClassImposteriser.INSTANCE);
+      setThreadingPolicy(new Synchroniser());
     }
   };
 

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
index 5333726..913d56d 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
@@ -12,9 +12,6 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-/**
- * DiskRegionTestingBase: This class is extended to write more JUnit tests for Disk Regions.
- */
 package org.apache.geode.internal.cache;
 
 import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_TIME_STATISTICS;
@@ -51,6 +48,8 @@ import java.util.Iterator;
 import java.util.Properties;
 
 /**
+ * DiskRegionTestingBase: This class is extended to write more JUnit tests for Disk Regions.
+ * <p>
  * All disk region unit tests extend this base class , common method to be used in all tests are
  * present here.
  * 
@@ -144,14 +143,14 @@ public abstract class DiskRegionTestingBase {
             root.localDestroyRegion("teardown");
             logWriter.info(
                 "<ExpectedException action=remove>RegionDestroyedException</ExpectedException>");
-          } catch (RegionDestroyedException e) {
+          } catch (RegionDestroyedException ignore) {
             // ignore
           }
         }
       }
 
-      for (DiskStoreImpl dstore : ((GemFireCacheImpl) cache).listDiskStoresIncludingRegionOwned()) {
-        dstore.waitForClose();
+      for (DiskStore dstore : ((InternalCache) cache).listDiskStoresIncludingRegionOwned()) {
+        ((DiskStoreImpl) dstore).waitForClose();
       }
     } finally {
       closeCache();
@@ -216,7 +215,7 @@ public abstract class DiskRegionTestingBase {
             ioe = e;
             try {
               Thread.sleep(1000);
-            } catch (Exception igore) {
+            } catch (Exception ignore) {
             }
           }
         }
@@ -253,7 +252,7 @@ public abstract class DiskRegionTestingBase {
    */
   protected void put100Int() {
     for (int i = 0; i < 100; i++) {
-      region.put(new Integer(i), new Integer(i));
+      region.put(i, i);
     }
   }
 
@@ -266,7 +265,7 @@ public abstract class DiskRegionTestingBase {
       assertEquals(100, region.size());
     }
     for (int i = 0; i < 100; i++) {
-      Integer key = new Integer(i);
+      Integer key = i;
       assertTrue(region.containsKey(key));
       assertEquals(key, region.get(key));
     }
@@ -278,7 +277,7 @@ public abstract class DiskRegionTestingBase {
   protected void putTillOverFlow(Region region) {
     int i = 0;
     for (i = 0; i < 1010; i++) {
-      region.put(new Integer(i + 200), new Integer(i + 200));
+      region.put(i + 200, i + 200);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
index 0dbe75f..ee3d7f7 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
@@ -14,31 +14,29 @@
  */
 package org.apache.geode.internal.cache;
 
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.junit.Assert.*;
 
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileFilter;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.nio.file.Files;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-
-import org.apache.geode.internal.ClassPathLoader;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import java.util.regex.Pattern;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.filefilter.DirectoryFileFilter;
 import org.apache.commons.io.filefilter.RegexFileFilter;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import org.apache.geode.admin.AdminDistributedSystem;
 import org.apache.geode.admin.AdminDistributedSystemFactory;
 import org.apache.geode.admin.AdminException;
@@ -47,6 +45,7 @@ import org.apache.geode.admin.DistributedSystemConfig;
 import org.apache.geode.admin.internal.AdminDistributedSystemImpl;
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.DiskStore;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionFactory;
 import org.apache.geode.cache.RegionShortcut;
@@ -54,8 +53,8 @@ import org.apache.geode.cache.persistence.PersistentID;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.internal.ClassBuilder;
+import org.apache.geode.internal.ClassPathLoader;
 import org.apache.geode.internal.DeployedJar;
-import org.apache.geode.internal.JarDeployer;
 import org.apache.geode.internal.cache.persistence.BackupManager;
 import org.apache.geode.internal.util.IOUtils;
 import org.apache.geode.internal.util.TransformUtils;
@@ -68,22 +67,6 @@ import org.apache.geode.test.dunit.Wait;
 import org.apache.geode.test.dunit.WaitCriterion;
 import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.file.Files;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Pattern;
 
 /**
  * Tests for the incremental backup feature.
@@ -104,12 +87,12 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
   /**
    * End value for data load.
    */
-  private int dataEnd = dataStart + DATA_INCREMENT;
+  private int dataEnd = this.dataStart + DATA_INCREMENT;
 
   /**
    * Regular expression used to search for member operation log files.
    */
-  private final static String OPLOG_REGEX = ".*\\.[kdc]rf$";
+  private static final String OPLOG_REGEX = ".*\\.[kdc]rf$";
 
   /**
    * Creates test regions for a member.
@@ -123,22 +106,18 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
       getRegionFactory(cache).setDiskStoreName("fooStore").create("fooRegion");
       getRegionFactory(cache).setDiskStoreName("barStore").create("barRegion");
     }
-
   };
 
-  protected RegionFactory<Integer, String> getRegionFactory(Cache cache) {
+  private RegionFactory<Integer, String> getRegionFactory(Cache cache) {
     return cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT);
   }
 
   /**
    * A FileFilter that looks for a timestamped gemfire backup directory.
    */
-  private final static FileFilter backupDirFilter = new FileFilter() {
-    @Override
-    public boolean accept(File file) {
-      // This will break in about 90 years...
-      return (file.isDirectory() && file.getName().startsWith("20"));
-    }
+  private static final FileFilter backupDirFilter = file -> {
+    // This will break in about 90 years...
+    return file.isDirectory() && file.getName().startsWith("20");
   };
 
   /**
@@ -213,7 +192,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
   @SuppressWarnings("unchecked")
   private Set<PersistentID> getMissingMembers(VM vm) {
     return (Set<PersistentID>) vm.invoke(new SerializableCallable("getMissingMembers") {
-
+      @Override
       public Object call() {
         return AdminDistributedSystemImpl
             .getMissingPersistentMembers(getSystem().getDistributionManager());
@@ -229,7 +208,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
    */
   private BackupStatus baseline(VM vm) {
     return (BackupStatus) vm.invoke(new SerializableCallable("Backup all members.") {
-
+      @Override
       public Object call() {
         DistributedSystemConfig config;
         AdminDistributedSystem adminDS = null;
@@ -258,7 +237,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
    */
   private BackupStatus incremental(VM vm) {
     return (BackupStatus) vm.invoke(new SerializableCallable("Backup all members.") {
-
+      @Override
       public Object call() {
         DistributedSystemConfig config;
         AdminDistributedSystem adminDS = null;
@@ -287,7 +266,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
    */
   private BackupStatus incremental2(VM vm) {
     return (BackupStatus) vm.invoke(new SerializableCallable("Backup all members.") {
-
+      @Override
       public Object call() {
         DistributedSystemConfig config;
         AdminDistributedSystem adminDS = null;
@@ -343,23 +322,17 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
    * @return a PersistentID for a member's disk store.
    */
   private PersistentID getPersistentID(final VM vm, final String diskStoreName) {
-    final PersistentID id = (PersistentID) vm.invoke(new SerializableCallable() {
-      @Override
-      public Object call() {
-        PersistentID id = null;
-        Collection<DiskStoreImpl> diskStores = ((GemFireCacheImpl) getCache()).listDiskStores();
-        for (DiskStoreImpl diskStore : diskStores) {
-          if (diskStore.getName().equals(diskStoreName)) {
-            id = diskStore.getPersistentID();
-            break;
-          }
+    return vm.invoke(() -> {
+      PersistentID id = null;
+      Collection<DiskStore> diskStores = ((InternalCache) getCache()).listDiskStores();
+      for (DiskStore diskStore : diskStores) {
+        if (diskStore.getName().equals(diskStoreName)) {
+          id = ((DiskStoreImpl) diskStore).getPersistentID();
+          break;
         }
-
-        return id;
       }
+      return id;
     });
-
-    return id;
   }
 
   /**
@@ -380,22 +353,19 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
    *        disconnected).
    */
   private PersistentID disconnect(final VM disconnectVM, final VM testVM) {
-    final PersistentID id = (PersistentID) disconnectVM.invoke(new SerializableCallable() {
-      @Override
-      public Object call() {
-        PersistentID id = null;
-        Collection<DiskStoreImpl> diskStores = ((GemFireCacheImpl) getCache()).listDiskStores();
-        for (DiskStoreImpl diskStore : diskStores) {
-          if (diskStore.getName().equals("fooStore")) {
-            id = diskStore.getPersistentID();
-            break;
-          }
+    final PersistentID id = disconnectVM.invoke(() -> {
+      PersistentID persistentID = null;
+      Collection<DiskStore> diskStores = ((InternalCache) getCache()).listDiskStores();
+      for (DiskStore diskStore : diskStores) {
+        if (diskStore.getName().equals("fooStore")) {
+          persistentID = ((DiskStoreImpl) diskStore).getPersistentID();
+          break;
         }
+      }
 
-        getSystem().disconnect();
+      getSystem().disconnect();
 
-        return id;
-      }
+      return persistentID;
     });
 
     final Set<PersistentID> missingMembers = new HashSet<>();
@@ -405,7 +375,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
         missingMembers.clear();
         missingMembers.addAll(getMissingMembers(testVM));
 
-        return (missingMembers.contains(id));
+        return missingMembers.contains(id);
       }
 
       @Override
@@ -423,7 +393,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
    * @param vm a member of the distributed system.
    */
   private void openCache(VM vm) {
-    vm.invoke(createRegions);
+    vm.invoke(this.createRegions);
   }
 
   /**
@@ -435,15 +405,14 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
     vm.invoke(new SerializableRunnable() {
       @Override
       public void run() {
-        Collection<DiskStoreImpl> backupInProgress =
-            ((GemFireCacheImpl) getCache()).listDiskStores();
+        Collection<DiskStore> backupInProgress = ((InternalCache) getCache()).listDiskStores();
         List<DiskStoreImpl> backupCompleteList = new LinkedList<>();
 
         while (backupCompleteList.size() < backupInProgress.size()) {
-          for (DiskStoreImpl diskStore : backupInProgress) {
-            if ((null == diskStore.getInProgressBackup())
-                && (!backupCompleteList.contains(diskStore))) {
-              backupCompleteList.add(diskStore);
+          for (DiskStore diskStore : backupInProgress) {
+            if (((DiskStoreImpl) diskStore).getInProgressBackup() == null
+                && !backupCompleteList.contains(diskStore)) {
+              backupCompleteList.add((DiskStoreImpl) diskStore);
             }
           }
         }
@@ -470,9 +439,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
   }
 
   /**
-   * Peforms a second incremental backup.
-   * 
-   * @return
+   * Performs a second incremental backup.
    */
   private BackupStatus performIncremental2() {
     return incremental2(Host.getHost(0).getVM(1));
@@ -519,7 +486,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
     File[] memberDirs = dateDirs[0].listFiles(new FileFilter() {
       @Override
       public boolean accept(File file) {
-        return (file.isDirectory() && (file.getName().contains(memberId)));
+        return file.isDirectory() && file.getName().contains(memberId);
       }
     });
 
@@ -546,9 +513,8 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
    * 
    * @param command a shell command.
    * @return the exit value of processing the shell command.
-   * @throws Exception bad, really bad.
    */
-  private int execute(String command) throws Exception {
+  private int execute(String command) throws IOException, InterruptedException {
     final ProcessBuilder builder = new ProcessBuilder(command);
     builder.redirectErrorStream(true);
     final Process process = builder.start();
@@ -559,11 +525,11 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
     new Thread(new Runnable() {
       @Override
       public void run() {
-        BufferedReader reader = null;
 
         try {
-          reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
-          String line = null;
+          BufferedReader reader =
+              new BufferedReader(new InputStreamReader(process.getInputStream()));
+          String line;
 
           do {
             line = reader.readLine();
@@ -572,7 +538,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
 
           reader.close();
         } catch (IOException e) {
-          log("Excecute: error while reading standard in: " + e.getMessage());
+          log("Execute: error while reading standard in: " + e.getMessage());
         }
       }
     }).start();
@@ -583,11 +549,10 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
     new Thread(new Runnable() {
       @Override
       public void run() {
-        BufferedReader reader = null;
-
         try {
-          reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
-          String line = null;
+          BufferedReader reader =
+              new BufferedReader(new InputStreamReader(process.getErrorStream()));
+          String line;
 
           do {
             line = reader.readLine();
@@ -608,7 +573,8 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
    * 
    * @param backupDir the member's backup directory containing the restore script.
    */
-  private void performRestore(File memberDir, File backupDir) throws Exception {
+  private void performRestore(File memberDir, File backupDir)
+      throws IOException, InterruptedException {
     /*
      * The restore script will not restore if there is an if file in the copy to directory. Remove
      * these files first.
@@ -699,7 +665,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
   @Override
   public final void postSetUp() throws Exception {
     createDataRegions();
-    createRegions.run();
+    this.createRegions.run();
     loadMoreData();
 
     log("Data region created and populated.");
@@ -720,8 +686,6 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
    * present in both the baseline and member's disk store should not be copied during the
    * incremental backup. Additionally, the restore script should reference and copy operation logs
    * from the baseline backup.
-   * 
-   * @throws Exception
    */
   @Test
   public void testIncrementalBackup() throws Exception {
@@ -900,7 +864,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
       public boolean done() {
         missingMembers.clear();
         missingMembers.addAll(getMissingMembers(Host.getHost(0).getVM(1)));
-        return (!missingMembers.contains(missingMember));
+        return !missingMembers.contains(missingMember);
       }
 
       @Override
@@ -1028,13 +992,14 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
      * Custom incremental backup callable that retrieves the current baseline before deletion.
      */
     SerializableCallable callable = new SerializableCallable("Backup all members.") {
-      private File baselineDir = getBaselineBackupDir();
+      private final File baselineDir = getBaselineBackupDir();
 
+      @Override
       public Object call() {
-        DistributedSystemConfig config;
         AdminDistributedSystem adminDS = null;
         try {
-          config = AdminDistributedSystemFactory.defineDistributedSystem(getSystem(), "");
+          DistributedSystemConfig config =
+              AdminDistributedSystemFactory.defineDistributedSystem(getSystem(), "");
           adminDS = AdminDistributedSystemFactory.getDistributedSystem(config);
           adminDS.connect();
           return adminDS.backupAllMembers(getIncrementalDir(), this.baselineDir);
@@ -1079,8 +1044,6 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
 
   /**
    * Successful if a user deployed jar file is included as part of the backup.
-   * 
-   * @throws Exception
    */
   @Test
   public void testBackupUserDeployedJarFiles() throws Exception {
@@ -1094,13 +1057,10 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
     /*
      * Deploy a "dummy" jar to the VM.
      */
-    File deployedJarFile = (File) vm0.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws Exception {
-        DeployedJar deployedJar =
-            ClassPathLoader.getLatest().getJarDeployer().deploy(jarName, classBytes);
-        return deployedJar.getFile();
-      }
+    File deployedJarFile = vm0.invoke(() -> {
+      DeployedJar deployedJar =
+          ClassPathLoader.getLatest().getJarDeployer().deploy(jarName, classBytes);
+      return deployedJar.getFile();
     });
 
     assertTrue(deployedJarFile.exists());
@@ -1124,12 +1084,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
     /*
      * Get the VM's user directory.
      */
-    final String vmDir = (String) vm0.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws Exception {
-        return System.getProperty("user.dir");
-      }
-    });
+    final String vmDir = vm0.invoke(() -> System.getProperty("user.dir"));
 
     File backupDir = getBackupDirForMember(getBaselineDir(), getMemberId(vm0));
 
@@ -1138,7 +1093,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
     /*
      * Cleanup "dummy" jar from file system.
      */
-    Pattern pattern = Pattern.compile("^" + jarName + ".*#\\d++$");
+    Pattern pattern = Pattern.compile('^' + jarName + ".*#\\d++$");
     deleteMatching(new File("."), pattern);
 
     // Execute the restore
@@ -1179,7 +1134,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
     /*
      * Cleanup "dummy" jar from file system.
      */
-    pattern = Pattern.compile("^" + jarName + ".*#\\d++$");
+    pattern = Pattern.compile('^' + jarName + ".*#\\d++$");
     deleteMatching(new File(vmDir), pattern);
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/internal/cache/OplogRVVJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/OplogRVVJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/OplogRVVJUnitTest.java
index 65833c4..5c80db3 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/OplogRVVJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/OplogRVVJUnitTest.java
@@ -27,6 +27,7 @@ import org.apache.geode.internal.cache.versions.DiskRegionVersionVector;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.jmock.Expectations;
 import org.jmock.Mockery;
+import org.jmock.lib.concurrent.Synchroniser;
 import org.jmock.lib.legacy.ClassImposteriser;
 import org.junit.After;
 import org.junit.Before;
@@ -50,6 +51,7 @@ public class OplogRVVJUnitTest {
   private Mockery context = new Mockery() {
     {
       setImposteriser(ClassImposteriser.INSTANCE);
+      setThreadingPolicy(new Synchroniser());
     }
   };
 

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCacheCloseDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCacheCloseDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCacheCloseDUnitTest.java
index 81e9794..4027680 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCacheCloseDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCacheCloseDUnitTest.java
@@ -148,7 +148,7 @@ public class PartitionedRegionCacheCloseDUnitTest extends PartitionedRegionDUnit
 
           public void run2() {
 
-            Cache cache = getCache();
+            InternalCache cache = (InternalCache) getCache();
             LogWriter logger = cache.getLogger();
 
             final Region root = PartitionedRegionHelper.getPRRoot(cache);

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCreationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCreationDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCreationDUnitTest.java
index 9b8f400..692515e 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCreationDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionCreationDUnitTest.java
@@ -561,7 +561,7 @@ public class PartitionedRegionCreationDUnitTest extends PartitionedRegionDUnitTe
     registerPrRegion = new CacheSerializableRunnable("register") {
       @Override
       public void run2() throws CacheException {
-        Cache cache = getCache();
+        InternalCache cache = (InternalCache) getCache();
         Region root = PartitionedRegionHelper.getPRRoot(cache);
         // Region allPartitionedRegions = PartitionedRegionHelper
         // .getPRConfigRegion(root, cache);

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionDestroyDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionDestroyDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionDestroyDUnitTest.java
index 8a825d3..0ba103a 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionDestroyDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionDestroyDUnitTest.java
@@ -195,7 +195,7 @@ public class PartitionedRegionDestroyDUnitTest extends PartitionedRegionDUnitTes
 
           public void run2() throws CacheException {
 
-            Cache cache = getCache();
+            InternalCache cache = getCache();
             Region rootRegion = PartitionedRegionHelper.getPRRoot(cache);
             // Region allPRs = PartitionedRegionHelper.getPRConfigRegion(rootRegion,
             // getCache());

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionHAFailureAndRecoveryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionHAFailureAndRecoveryDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionHAFailureAndRecoveryDUnitTest.java
index 9364390..0d69fa6 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionHAFailureAndRecoveryDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionHAFailureAndRecoveryDUnitTest.java
@@ -124,8 +124,8 @@ public class PartitionedRegionHAFailureAndRecoveryDUnitTest extends PartitionedR
       private static final long serialVersionUID = 1L;
 
       public void run() {
-        Cache c = getCache();
-        Region rootReg = PartitionedRegionHelper.getPRRoot(c);
+        InternalCache cache = (InternalCache) getCache();
+        Region rootReg = PartitionedRegionHelper.getPRRoot(cache);
         rootReg.getAttributesMutator()
             .addCacheListener(new CertifiableTestCacheListener(LogWriterUtils.getLogWriter()));
       }
@@ -144,8 +144,8 @@ public class PartitionedRegionHAFailureAndRecoveryDUnitTest extends PartitionedR
 
           public void run() {
             try {
-              Cache c = getCache();
-              Region rootReg = PartitionedRegionHelper.getPRRoot(c);
+              InternalCache cache = getCache();
+              Region rootReg = PartitionedRegionHelper.getPRRoot(cache);
               CacheListener[] cls = rootReg.getAttributes().getCacheListeners();
               assertEquals(2, cls.length);
               CertifiableTestCacheListener ctcl = (CertifiableTestCacheListener) cls[1];
@@ -256,7 +256,7 @@ public class PartitionedRegionHAFailureAndRecoveryDUnitTest extends PartitionedR
     SerializableRunnable validator =
         new CacheSerializableRunnable("validateNodeFailMetaDataCleanUp") {
           public void run2() throws CacheException {
-            Cache cache = getCache();
+            InternalCache cache = getCache();
             Region rootReg = PartitionedRegionHelper.getPRRoot(cache);
             CacheListener[] cls = rootReg.getAttributes().getCacheListeners();
             assertEquals(2, cls.length);

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionQueryEvaluatorIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionQueryEvaluatorIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionQueryEvaluatorIntegrationTest.java
index f19ba1c..169e270 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionQueryEvaluatorIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionQueryEvaluatorIntegrationTest.java
@@ -153,7 +153,7 @@ public class PartitionedRegionQueryEvaluatorIntegrationTest {
   }
 
   private void clearAllPartitionedRegion(PartitionedRegion pr) {
-    Cache cache = pr.getCache();
+    InternalCache cache = pr.getCache();
     Region allPR = PartitionedRegionHelper.getPRRoot(cache);
     allPR.clear();
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionTestHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionTestHelper.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionTestHelper.java
index 2824d74..18bc2a1 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionTestHelper.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionTestHelper.java
@@ -37,7 +37,7 @@ import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
 public class PartitionedRegionTestHelper
 
 {
-  static Cache cache = null;
+  static InternalCache cache = null;
 
   /**
    * This method creates a partitioned region with all the default values. The cache created is a
@@ -194,18 +194,18 @@ public class PartitionedRegionTestHelper
    * 
    * @return
    */
-  public static synchronized Cache createCache() {
+  public static synchronized InternalCache createCache() {
     if (cache == null) {
       Properties dsp = new Properties();
       dsp.setProperty(MCAST_PORT, "0");
       dsp.setProperty(LOCATORS, "");
       DistributedSystem sys = DistributedSystem.connect(dsp);
       try {
-        cache = CacheFactory.create(sys);
+        cache = (InternalCache) CacheFactory.create(sys);
       } catch (CacheExistsException exp) {
-        cache = CacheFactory.getInstance(sys);
+        cache = (InternalCache) CacheFactory.getInstance(sys);
       } catch (RegionExistsException rex) {
-        cache = CacheFactory.getInstance(sys);
+        cache = (InternalCache) CacheFactory.getInstance(sys);
       }
     }
     return cache;

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/internal/cache/TXManagerImplTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/TXManagerImplTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/TXManagerImplTest.java
index 2e6225b..8eecaec 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/TXManagerImplTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/TXManagerImplTest.java
@@ -51,7 +51,7 @@ public class TXManagerImplTest {
 
   @Before
   public void setUp() {
-    Cache cache = Fakes.cache();
+    InternalCache cache = Fakes.cache();
     dm = mock(DistributionManager.class);
     txMgr = new TXManagerImpl(mock(CachePerfStats.class), cache);
     txid = new TXId(null, 0);

http://git-wip-us.apache.org/repos/asf/geode/blob/153db276/geode-core/src/test/java/org/apache/geode/internal/cache/execute/Bug51193DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/Bug51193DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/Bug51193DUnitTest.java
index 12b467c..0dfbe6c 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/Bug51193DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/Bug51193DUnitTest.java
@@ -56,7 +56,6 @@ import org.apache.geode.test.junit.categories.DistributedTest;
 @SuppressWarnings("serial")
 public class Bug51193DUnitTest extends JUnit4DistributedTestCase {
 
-
   private static final String REGION_NAME = "Bug51193DUnitTest_region";
 
   private static GemFireCacheImpl cache;


Mime
View raw message