geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [1/6] geode git commit: Safe refactorings [Forced Update!]
Date Tue, 25 Apr 2017 20:42:50 GMT
Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-2632-6-1 8ac3c0185 -> b605f5d3d (forced update)


http://git-wip-us.apache.org/repos/asf/geode/blob/c5b8cbe8/geode-core/src/test/java/org/apache/geode/TXWriterTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/TXWriterTestCase.java b/geode-core/src/test/java/org/apache/geode/TXWriterTestCase.java
index 987f22f..a75e167 100644
--- a/geode-core/src/test/java/org/apache/geode/TXWriterTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/TXWriterTestCase.java
@@ -14,30 +14,43 @@
  */
 package org.apache.geode;
 
-import org.apache.geode.cache.*;
-import org.apache.geode.cache.util.CacheListenerAdapter;
-import org.apache.geode.distributed.DistributedSystem;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import static org.apache.geode.distributed.ConfigurationProperties.*;
+
+import java.util.Properties;
+
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
 
-import java.util.Properties;
-
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import org.apache.geode.cache.AttributesFactory;
+import org.apache.geode.cache.AttributesMutator;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheException;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.CacheTransactionManager;
+import org.apache.geode.cache.CacheWriter;
+import org.apache.geode.cache.CacheWriterException;
+import org.apache.geode.cache.EntryEvent;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionEvent;
+import org.apache.geode.cache.Scope;
+import org.apache.geode.cache.TransactionEvent;
+import org.apache.geode.cache.TransactionListener;
+import org.apache.geode.cache.util.CacheListenerAdapter;
+import org.apache.geode.distributed.DistributedSystem;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
 
 /**
  * Extracted from TXWriterJUnitTest to share with TXWriterOOMEJUnitTest.
- * 
  */
 @SuppressWarnings("deprecation")
 public class TXWriterTestCase {
 
-  protected int cbCount;
-  protected int failedCommits = 0;
-  protected int afterCommits = 0;
-  protected int afterRollbacks = 0;
+  int cbCount;
+  int failedCommits = 0;
+  int afterCommits = 0;
+  int afterRollbacks = 0;
 
   protected GemFireCacheImpl cache;
   protected CacheTransactionManager txMgr;
@@ -46,10 +59,13 @@ public class TXWriterTestCase {
   protected void createCache() throws CacheException {
     Properties p = new Properties();
     p.setProperty(MCAST_PORT, "0"); // loner
+
     this.cache = (GemFireCacheImpl) CacheFactory.create(DistributedSystem.connect(p));
-    AttributesFactory<?, ?> af = new AttributesFactory<String, String>();
+
+    AttributesFactory<String, String> af = new AttributesFactory<>();
     af.setScope(Scope.DISTRIBUTED_NO_ACK);
     af.setIndexMaintenanceSynchronous(true);
+
     this.region = this.cache.createRegion("TXTest", af.create());
     this.txMgr = this.cache.getCacheTransactionManager();
   }
@@ -95,79 +111,96 @@ public class TXWriterTestCase {
     }
   }
 
-  protected void installCacheListenerAndWriter() {
+  void installCacheListenerAndWriter() {
     AttributesMutator<String, String> mutator = this.region.getAttributesMutator();
     mutator.setCacheListener(new CacheListenerAdapter<String, String>() {
+      @Override
       public void close() {
         cbCount++;
       }
 
+      @Override
       public void afterCreate(EntryEvent<String, String> event) {
         cbCount++;
       }
 
+      @Override
       public void afterUpdate(EntryEvent<String, String> event) {
         cbCount++;
       }
 
+      @Override
       public void afterInvalidate(EntryEvent<String, String> event) {
         cbCount++;
       }
 
+      @Override
       public void afterDestroy(EntryEvent<String, String> event) {
         cbCount++;
       }
 
+      @Override
       public void afterRegionInvalidate(RegionEvent<String, String> event) {
         cbCount++;
       }
 
+      @Override
       public void afterRegionDestroy(RegionEvent<String, String> event) {
         cbCount++;
       }
     });
     mutator.setCacheWriter(new CacheWriter<String, String>() {
+      @Override
       public void close() {
         cbCount++;
       }
 
+      @Override
       public void beforeUpdate(EntryEvent<String, String> event) throws CacheWriterException {
         cbCount++;
       }
 
+      @Override
       public void beforeCreate(EntryEvent<String, String> event) throws CacheWriterException {
         cbCount++;
       }
 
+      @Override
       public void beforeDestroy(EntryEvent<String, String> event) throws CacheWriterException {
         cbCount++;
       }
 
+      @Override
       public void beforeRegionDestroy(RegionEvent<String, String> event)
           throws CacheWriterException {
         cbCount++;
       }
 
+      @Override
       public void beforeRegionClear(RegionEvent<String, String> event) throws CacheWriterException {
         cbCount++;
       }
     });
   }
 
-  protected void installTransactionListener() {
-    ((CacheTransactionManager) this.txMgr).setListener(new TransactionListener() {
+  void installTransactionListener() {
+    this.txMgr.setListener(new TransactionListener() {
+      @Override
       public void afterFailedCommit(TransactionEvent event) {
         failedCommits++;
       }
 
+      @Override
       public void afterCommit(TransactionEvent event) {
         afterCommits++;
       }
 
+      @Override
       public void afterRollback(TransactionEvent event) {
         afterRollbacks++;
       }
 
+      @Override
       public void close() {}
     });
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/c5b8cbe8/geode-core/src/test/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
index 903b212..15cfaa7 100755
--- a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
@@ -946,8 +946,7 @@ public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCa
     server.invoke(new SerializableCallable() {
       public Object call() throws Exception {
         GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
-        cache.TEST_MAX_QUERY_EXECUTION_TIME_OVERRIDE_EXCEPTION = false;
-        cache.TEST_MAX_QUERY_EXECUTION_TIME = -1;
+        cache.testMaxQueryExecutionTime = -1;
         return null;
       }
     });
@@ -972,11 +971,9 @@ public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCa
         GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
 
         if (queryTimeout != -1) {
-          cache.TEST_MAX_QUERY_EXECUTION_TIME_OVERRIDE_EXCEPTION = true;
-          cache.TEST_MAX_QUERY_EXECUTION_TIME = queryTimeout;
+          cache.testMaxQueryExecutionTime = queryTimeout;
         } else {
-          cache.TEST_MAX_QUERY_EXECUTION_TIME_OVERRIDE_EXCEPTION = false;
-          cache.TEST_MAX_QUERY_EXECUTION_TIME = -1;
+          cache.testMaxQueryExecutionTime = -1;
         }
 
         if (criticalThreshold != 0) {
@@ -1074,7 +1071,7 @@ public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCa
   private boolean isExceptionDueToTimeout(QueryException e, long queryTimeout) {
     String message = e.getMessage();
     // -1 needs to be matched due to client/server set up, BaseCommand uses the
-    // MAX_QUERY_EXECUTION_TIME and not the TEST_MAX_QUERY_EXECUTION_TIME
+    // MAX_QUERY_EXECUTION_TIME and not the testMaxQueryExecutionTime
     return (message.contains("The QueryMonitor thread may be sleeping longer than")
         || message.contains(LocalizedStrings.QueryMonitor_LONG_RUNNING_QUERY_CANCELED
             .toLocalizedString(queryTimeout))

http://git-wip-us.apache.org/repos/asf/geode/blob/c5b8cbe8/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/NewDeclarativeIndexCreationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/NewDeclarativeIndexCreationJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/NewDeclarativeIndexCreationJUnitTest.java
index 8a0f31c..e7f5c08 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/NewDeclarativeIndexCreationJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/NewDeclarativeIndexCreationJUnitTest.java
@@ -12,161 +12,154 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-/**
- * 
- */
 package org.apache.geode.cache.query.internal.index;
 
-import org.apache.geode.cache.*;
+import static org.apache.geode.distributed.ConfigurationProperties.CACHE_XML_FILE;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.geode.InternalGemFireException;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.CacheXmlException;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionAttributes;
 import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.util.test.TestUtil;
 import org.junit.After;
-import org.junit.Assert;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
 
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.Collection;
+import java.io.File;
 import java.util.Properties;
 
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
 /**
- *
  * @since GemFire 6.6.1
  */
 @Category(IntegrationTest.class)
 public class NewDeclarativeIndexCreationJUnitTest {
 
-  private Cache cache = null;
+  private static final String CACHE_XML_FILE_NAME = "cachequeryindex.xml";
+
+  private Cache cache;
+  private File cacheXmlFile;
+
+  @Rule
+  public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
   @Before
   public void setUp() throws Exception {
-    // Read the Cache.xml placed in test.lib folder
+    this.cacheXmlFile = this.temporaryFolder.newFile(CACHE_XML_FILE_NAME);
+    FileUtils.copyURLToFile(getClass().getResource(CACHE_XML_FILE_NAME), this.cacheXmlFile);
+    assertThat(this.cacheXmlFile).exists(); // precondition
+
     Properties props = new Properties();
-    props.setProperty(CACHE_XML_FILE, TestUtil.getResourcePath(getClass(), "cachequeryindex.xml"));
+    props.setProperty(CACHE_XML_FILE, this.cacheXmlFile.getAbsolutePath());
     props.setProperty(MCAST_PORT, "0");
     DistributedSystem ds = DistributedSystem.connect(props);
-    cache = CacheFactory.create(ds);
+    this.cache = CacheFactory.create(ds);
   }
 
   @After
   public void tearDown() throws Exception {
-    if (!cache.isClosed())
-      cache.close();
+    if (this.cache != null) {
+      this.cache.close();
+    }
   }
 
   @Test
   public void testAsynchronousIndexCreatedOnRoot_PortfoliosRegion() {
-    Region root = cache.getRegion("/root/portfolios");
+    Region root = this.cache.getRegion("/root/portfolios");
     IndexManager im = IndexUtils.getIndexManager(root, true);
-    Collection coll = im.getIndexes();
-    if (coll.size() > 0) {
-      Assert.assertTrue(true);
-      // System.out.println("List of indexes= " + im.toString());
-      RegionAttributes ra = root.getAttributes();
-      Assert.assertTrue(!ra.getIndexMaintenanceSynchronous());
-    } else
-      Assert.fail(
-          "NewDeclarativeIndexCreationJUnitTest::testAsynchronousIndexCreatedOnRoot_PortfoliosRegion:No index found in the root region");
+    assertThat(im.getIndexes()).isNotEmpty();
+
+    RegionAttributes ra = root.getAttributes();
+    assertThat(ra.getIndexMaintenanceSynchronous()).isFalse();
   }
 
   @Test
   public void testSynchronousIndexCreatedOnRoot_StringRegion() {
-    Region root = cache.getRegion("/root/string");
-    IndexManager im = IndexUtils.getIndexManager(root, true);;
-    Collection coll = im.getIndexes();
-    if (coll.size() > 0) {
-      Assert.assertTrue(true);
-      // System.out.println("List of indexes= " + im.toString());
-      RegionAttributes ra = root.getAttributes();
-      Assert.assertTrue(ra.getIndexMaintenanceSynchronous());
-    } else
-      Assert.fail(
-          "NewDeclarativeIndexCreationJUnitTest::testSynchronousIndexCreatedOnRoot_StringRegion Region:No index found in the root region");
-    root = cache.getRegion("/root/string1");
+    Region root = this.cache.getRegion("/root/string");
+    IndexManager im = IndexUtils.getIndexManager(root, true);
+    assertThat(im.getIndexes()).isNotEmpty();
+
+    RegionAttributes ra = root.getAttributes();
+    assertThat(ra.getIndexMaintenanceSynchronous()).isTrue();
+
+    root = this.cache.getRegion("/root/string1");
     im = IndexUtils.getIndexManager(root, true);
-    if (!im.isIndexMaintenanceTypeSynchronous())
-      Assert.fail(
-          "NewDeclarativeIndexCreationJUnitTest::testSynchronousIndexCreatedOnRoot_StringRegion: The index update type not synchronous if no index-update-type attribuet specified in cache.cml");
+    assertThat(im.isIndexMaintenanceTypeSynchronous()).isTrue();
   }
 
   @Test
   public void testSynchronousIndexCreatedOnRootRegion() {
-    Region root = cache.getRegion("/root");
+    Region root = this.cache.getRegion("/root");
     IndexManager im = IndexUtils.getIndexManager(root, true);
-    Collection coll = im.getIndexes();
-    if (coll.size() > 0) {
-      Assert.assertTrue(true);
-      // System.out.println("List of indexes= " + im.toString());
-      RegionAttributes ra = root.getAttributes();
-      Assert.assertTrue(ra.getIndexMaintenanceSynchronous());
-    } else
-      Assert.fail(
-          "NewDeclarativeIndexCreationJUnitTest::testAsynchronousIndexCreatedOnRoot_PortfoliosRegion:No index found in the root region");
+    assertThat(im.getIndexes()).isNotEmpty();
+
+    RegionAttributes ra = root.getAttributes();
+    assertThat(ra.getIndexMaintenanceSynchronous()).isTrue();
   }
 
 
-  // Index creation tests for new DTD changes for Index tag for 6.6.1 with no function/primary-key
-  // tag
+  /**
+   * Index creation tests for new DTD changes for Index tag for 6.6.1 with no function/primary-key
+   * tag
+   */
   @Test
   public void testAsynchronousIndexCreatedOnPortfoliosRegionWithNewDTD() {
-    Region root = cache.getRegion("/root/portfolios2");
+    Region root = this.cache.getRegion("/root/portfolios2");
     IndexManager im = IndexUtils.getIndexManager(root, true);
-    Collection coll = im.getIndexes();
-    if (coll.size() > 0) {
-      Assert.assertTrue(true);
-      // System.out.println("List of indexes= " + im.toString());
-      RegionAttributes ra = root.getAttributes();
-      Assert.assertTrue(!ra.getIndexMaintenanceSynchronous());
-    } else
-      Assert.fail(
-          "NewDeclarativeIndexCreationJUnitTest::testAsynchronousIndexCreatedOnRoot_PortfoliosRegion:No index found in the root region");
+    assertThat(im.getIndexes()).isNotEmpty();
+
+    RegionAttributes ra = root.getAttributes();
+    assertThat(ra.getIndexMaintenanceSynchronous()).isFalse();
   }
 
   @Test
   public void testSynchronousIndexCreatedOnStringRegionWithNewDTD() {
-    Region root = cache.getRegion("/root/string2");
+    Region root = this.cache.getRegion("/root/string2");
     IndexManager im = IndexUtils.getIndexManager(root, true);;
-    Collection coll = im.getIndexes();
-    if (coll.size() > 0) {
-      Assert.assertTrue(true);
-      // System.out.println("List of indexes= " + im.toString());
-      RegionAttributes ra = root.getAttributes();
-      Assert.assertTrue(ra.getIndexMaintenanceSynchronous());
-    } else
-      Assert.fail(
-          "NewDeclarativeIndexCreationJUnitTest::testSynchronousIndexCreatedOnRoot_StringRegion Region:No index found in the root region");
-    root = cache.getRegion("/root/string1");
+    assertThat(im.getIndexes()).isNotEmpty();
+
+    RegionAttributes ra = root.getAttributes();
+    assertThat(ra.getIndexMaintenanceSynchronous()).isTrue();
+
+    root = this.cache.getRegion("/root/string1");
     im = IndexUtils.getIndexManager(root, true);
-    if (!im.isIndexMaintenanceTypeSynchronous())
-      Assert.fail(
-          "DeclarativeIndexCreationTest::testSynchronousIndexCreatedOnRoot_StringRegion: The index update type not synchronous if no index-update-type attribuet specified in cache.cml");
+    assertThat(im.isIndexMaintenanceTypeSynchronous()).isTrue();
   }
 
+  /**
+   * TODO: move this to a different test class because it requires different setup
+   */
   @Test
-  public void testIndexCreationExceptionOnRegionWithNewDTD()
-      throws IOException, URISyntaxException {
-    if (cache != null && !cache.isClosed())
-      cache.close();
+  public void testIndexCreationExceptionOnRegionWithNewDTD() throws Exception {
+    if (this.cache != null && !this.cache.isClosed()) {
+      this.cache.close();
+    }
+
+    this.cacheXmlFile = this.temporaryFolder.newFile("cachequeryindexwitherror.xml");
+    FileUtils.copyURLToFile(getClass().getResource("cachequeryindexwitherror.xml"),
+        this.cacheXmlFile);
+    assertThat(this.cacheXmlFile).exists(); // precondition
+
     Properties props = new Properties();
-    props.setProperty(CACHE_XML_FILE,
-        TestUtil.getResourcePath(getClass(), "cachequeryindexwitherror.xml"));
+    props.setProperty(CACHE_XML_FILE, this.cacheXmlFile.getAbsolutePath());
     props.setProperty(MCAST_PORT, "0");
+
     DistributedSystem ds = DistributedSystem.connect(props);
-    try {
-      Cache cache = CacheFactory.create(ds);
-    } catch (CacheXmlException e) {
-      if (!e.getCause().getMessage()
-          .contains("CacheXmlParser::endIndex:Index creation attribute not correctly specified.")) {
-        e.printStackTrace();
-        Assert.fail(
-            "NewDeclarativeIndexCreationJUnitTest::setup: Index creation should have thrown exception for index on /root/portfolios3 region.");
-      }
-      return;
-    }
+
+    // TODO: refactoring GemFireCacheImpl.initializeDeclarativeCache requires change here
+    assertThatThrownBy(() -> CacheFactory.create(ds)).isExactlyInstanceOf(CacheXmlException.class)
+        .hasCauseInstanceOf(InternalGemFireException.class);
+
+    // hasCauseMessageContaining("CacheXmlParser::endIndex:Index creation attribute not correctly
+    // specified.");
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/c5b8cbe8/geode-core/src/test/java/org/apache/geode/disttx/DistTXDebugDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/disttx/DistTXDebugDUnitTest.java b/geode-core/src/test/java/org/apache/geode/disttx/DistTXDebugDUnitTest.java
index 0d2f2b6..e72823e 100644
--- a/geode-core/src/test/java/org/apache/geode/disttx/DistTXDebugDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/disttx/DistTXDebugDUnitTest.java
@@ -46,7 +46,6 @@ import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
 import org.apache.geode.test.junit.categories.DistributedTest;
 
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -60,7 +59,7 @@ public class DistTXDebugDUnitTest extends JUnit4CacheTestCase {
   protected VM accessor = null;
   protected VM dataStore1 = null;
   protected VM dataStore2 = null;
-  protected VM dataStore3 = null;
+  private VM dataStore3 = null;
 
   @Override
   public final void postSetUp() throws Exception {
@@ -106,30 +105,28 @@ public class DistTXDebugDUnitTest extends JUnit4CacheTestCase {
   public static void createPR(String partitionedRegionName, Integer redundancy,
       Integer localMaxMemory, Integer totalNumBuckets, Object colocatedWith,
       Boolean isPartitionResolver, Boolean concurrencyChecks) {
-    PartitionAttributesFactory paf = new PartitionAttributesFactory();
-
-    paf.setRedundantCopies(redundancy.intValue());
+    PartitionAttributesFactory<String, String> paf = new PartitionAttributesFactory();
+    paf.setRedundantCopies(redundancy);
     if (localMaxMemory != null) {
-      paf.setLocalMaxMemory(localMaxMemory.intValue());
+      paf.setLocalMaxMemory(localMaxMemory);
     }
     if (totalNumBuckets != null) {
-      paf.setTotalNumBuckets(totalNumBuckets.intValue());
+      paf.setTotalNumBuckets(totalNumBuckets);
     }
     if (colocatedWith != null) {
       paf.setColocatedWith((String) colocatedWith);
     }
-    if (isPartitionResolver.booleanValue()) {
+    if (isPartitionResolver) {
       paf.setPartitionResolver(new CustomerIDPartitionResolver("CustomerIDPartitionResolver"));
     }
-    PartitionAttributes prAttr = paf.create();
-    AttributesFactory attr = new AttributesFactory();
+    PartitionAttributes<String, String> prAttr = paf.create();
+
+    AttributesFactory<String, String> attr = new AttributesFactory();
     attr.setPartitionAttributes(prAttr);
     attr.setConcurrencyChecksEnabled(concurrencyChecks);
-    // assertNotNull(basicGetCache());
-    // Region pr = basicGetCache().createRegion(partitionedRegionName,
-    // attr.create());
+
     assertNotNull(basicGetCache());
-    Region pr = basicGetCache().createRegion(partitionedRegionName, attr.create());
+    Region<String, String> pr = basicGetCache().createRegion(partitionedRegionName, attr.create());
     assertNotNull(pr);
     LogWriterUtils.getLogWriter().info(
         "Partitioned Region " + partitionedRegionName + " created Successfully :" + pr.toString());
@@ -912,55 +909,54 @@ public class DistTXDebugDUnitTest extends JUnit4CacheTestCase {
   public void testTXRR2_dataNodeAsCoordinator() throws Exception {
     performTXRRtestOps(true);
   }
-}
-
 
-class DummyKeyBasedRoutingResolver implements PartitionResolver, DataSerializable {
-  Integer dummyID;
+  private static class DummyKeyBasedRoutingResolver implements PartitionResolver, DataSerializable {
+    Integer dummyID;
 
-  public DummyKeyBasedRoutingResolver() {}
+    public DummyKeyBasedRoutingResolver() {}
 
-  public DummyKeyBasedRoutingResolver(int id) {
-    this.dummyID = new Integer(id);
-  }
+    public DummyKeyBasedRoutingResolver(int id) {
+      this.dummyID = new Integer(id);
+    }
 
-  public String getName() {
-    // TODO Auto-generated method stub
-    return null;
-  }
+    public String getName() {
+      // TODO Auto-generated method stub
+      return null;
+    }
 
-  public Serializable getRoutingObject(EntryOperation opDetails) {
-    return (Serializable) opDetails.getKey();
-  }
+    public Serializable getRoutingObject(EntryOperation opDetails) {
+      return (Serializable) opDetails.getKey();
+    }
 
-  public void close() {
-    // TODO Auto-generated method stub
-  }
+    public void close() {
+      // TODO Auto-generated method stub
+    }
 
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    this.dummyID = DataSerializer.readInteger(in);
-  }
+    public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+      this.dummyID = DataSerializer.readInteger(in);
+    }
 
-  public void toData(DataOutput out) throws IOException {
-    DataSerializer.writeInteger(this.dummyID, out);
-  }
+    public void toData(DataOutput out) throws IOException {
+      DataSerializer.writeInteger(this.dummyID, out);
+    }
 
-  @Override
-  public int hashCode() {
-    int i = this.dummyID.intValue();
-    return i;
-  }
+    @Override
+    public int hashCode() {
+      int i = this.dummyID.intValue();
+      return i;
+    }
 
-  @Override
-  public boolean equals(Object o) {
-    if (this == o)
-      return true;
+    @Override
+    public boolean equals(Object o) {
+      if (this == o)
+        return true;
 
-    if (!(o instanceof DummyKeyBasedRoutingResolver))
-      return false;
+      if (!(o instanceof DummyKeyBasedRoutingResolver))
+        return false;
 
-    DummyKeyBasedRoutingResolver otherDummyID = (DummyKeyBasedRoutingResolver) o;
-    return (otherDummyID.dummyID.equals(dummyID));
+      DummyKeyBasedRoutingResolver otherDummyID = (DummyKeyBasedRoutingResolver) o;
+      return (otherDummyID.dummyID.equals(dummyID));
 
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/c5b8cbe8/geode-core/src/test/java/org/apache/geode/disttx/DistTXJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/disttx/DistTXJUnitTest.java b/geode-core/src/test/java/org/apache/geode/disttx/DistTXJUnitTest.java
index 8abccc6..754b554 100644
--- a/geode-core/src/test/java/org/apache/geode/disttx/DistTXJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/disttx/DistTXJUnitTest.java
@@ -14,6 +14,15 @@
  */
 package org.apache.geode.disttx;
 
+import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import org.apache.geode.TXJUnitTest;
 import org.apache.geode.cache.CacheException;
 import org.apache.geode.cache.CacheFactory;
@@ -21,51 +30,33 @@ import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.test.junit.categories.DistributedTransactionsTest;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.Properties;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
 
 /**
  * Run the basic transaction functionality tests in TXJUnitTest after setting
  * "distributed-transactions" property to true
- *
  */
 @Category({IntegrationTest.class, DistributedTransactionsTest.class})
 public class DistTXJUnitTest extends TXJUnitTest {
 
-  public DistTXJUnitTest() {}
-
   @Override
   protected void createCache() throws Exception {
     Properties p = new Properties();
     p.setProperty(MCAST_PORT, "0"); // loner
     p.setProperty(DISTRIBUTED_TRANSACTIONS, "true");
+
     this.cache = (GemFireCacheImpl) CacheFactory.create(DistributedSystem.connect(p));
+
     createRegion();
     this.txMgr = this.cache.getCacheTransactionManager();
-    assert (this.txMgr.isDistributed());
+
+    assertTrue(this.txMgr.isDistributed());
+
     this.listenerAfterCommit = 0;
     this.listenerAfterFailedCommit = 0;
     this.listenerAfterRollback = 0;
     this.listenerClose = 0;
   }
 
-  @Before
-  public void setUp() throws Exception {
-    createCache();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    closeCache();
-  }
-
   @Override
   @Test
   @Ignore

http://git-wip-us.apache.org/repos/asf/geode/blob/c5b8cbe8/geode-core/src/test/java/org/apache/geode/disttx/DistTXPersistentDebugDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/disttx/DistTXPersistentDebugDUnitTest.java b/geode-core/src/test/java/org/apache/geode/disttx/DistTXPersistentDebugDUnitTest.java
index 5753f5c..d999da9 100644
--- a/geode-core/src/test/java/org/apache/geode/disttx/DistTXPersistentDebugDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/disttx/DistTXPersistentDebugDUnitTest.java
@@ -16,6 +16,9 @@ package org.apache.geode.disttx;
 
 import static org.apache.geode.test.dunit.Assert.*;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import org.apache.geode.cache.AttributesFactory;
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheTransactionManager;
@@ -31,8 +34,6 @@ import org.apache.geode.test.dunit.Invoke;
 import org.apache.geode.test.dunit.LogWriterUtils;
 import org.apache.geode.test.dunit.SerializableCallable;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
 
 @Category(DistributedTest.class)
 public class DistTXPersistentDebugDUnitTest extends DistTXDebugDUnitTest {
@@ -61,7 +62,7 @@ public class DistTXPersistentDebugDUnitTest extends DistTXDebugDUnitTest {
     });
   }
 
-  protected void createPesistentPR(Object[] attributes) {
+  private void createPersistentPR(Object[] attributes) {
     dataStore1.invoke(DistTXPersistentDebugDUnitTest.class, "createPersistentPR", attributes);
     dataStore2.invoke(DistTXPersistentDebugDUnitTest.class, "createPersistentPR", attributes);
     // dataStore3.invoke(TxPersistentDebugDUnit.class, "createPR", attributes);
@@ -76,7 +77,7 @@ public class DistTXPersistentDebugDUnitTest extends DistTXDebugDUnitTest {
         getPersistentPRAttributes(1, -1, basicGetCache(), 113, true));
   }
 
-  protected static RegionAttributes getPersistentPRAttributes(final int redundancy,
+  private static RegionAttributes getPersistentPRAttributes(final int redundancy,
       final int recoveryDelay, Cache cache, int numBuckets, boolean synchronous) {
     DiskStore ds = cache.findDiskStore("disk");
     if (ds == null) {
@@ -92,8 +93,7 @@ public class DistTXPersistentDebugDUnitTest extends DistTXDebugDUnitTest {
     af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
     af.setDiskStoreName("disk");
     af.setDiskSynchronous(synchronous);
-    RegionAttributes attr = af.create();
-    return attr;
+    return af.create();
   }
 
   @Test
@@ -101,7 +101,8 @@ public class DistTXPersistentDebugDUnitTest extends DistTXDebugDUnitTest {
     createCacheInAllVms();
     final String regionName = "persistentCustomerPRRegion";
     Object[] attrs = new Object[] {regionName};
-    createPesistentPR(attrs);
+    createPersistentPR(attrs);
+
     SerializableCallable TxOps = new SerializableCallable() {
       @Override
       public Object call() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/c5b8cbe8/geode-core/src/test/java/org/apache/geode/disttx/DistTXWriterJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/disttx/DistTXWriterJUnitTest.java b/geode-core/src/test/java/org/apache/geode/disttx/DistTXWriterJUnitTest.java
index 0a61b1f..dec2f88 100644
--- a/geode-core/src/test/java/org/apache/geode/disttx/DistTXWriterJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/disttx/DistTXWriterJUnitTest.java
@@ -14,6 +14,13 @@
  */
 package org.apache.geode.disttx;
 
+import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+
+import org.junit.experimental.categories.Category;
+
 import org.apache.geode.TXWriterJUnitTest;
 import org.apache.geode.cache.AttributesFactory;
 import org.apache.geode.cache.CacheException;
@@ -24,11 +31,6 @@ import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.test.junit.categories.DistributedTransactionsTest;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.junit.experimental.categories.Category;
-
-import java.util.Properties;
-
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
 
 /**
  * Same tests as that of {@link TXWriterJUnitTest} after setting "distributed-transactions" property
@@ -37,19 +39,22 @@ import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
 @Category({IntegrationTest.class, DistributedTransactionsTest.class})
 public class DistTXWriterJUnitTest extends TXWriterJUnitTest {
 
-  public DistTXWriterJUnitTest() {}
-
+  @Override
   protected void createCache() throws CacheException {
-    Properties p = new Properties();
-    p.setProperty(MCAST_PORT, "0"); // loner
-    p.setProperty(ConfigurationProperties.DISTRIBUTED_TRANSACTIONS, "true");
-    this.cache = (GemFireCacheImpl) CacheFactory.create(DistributedSystem.connect(p));
-    AttributesFactory<?, ?> af = new AttributesFactory<String, String>();
-    af.setScope(Scope.DISTRIBUTED_NO_ACK);
-    af.setIndexMaintenanceSynchronous(true);
-    this.region = this.cache.createRegion("TXTest", af.create());
+    Properties properties = new Properties();
+    properties.setProperty(MCAST_PORT, "0"); // loner
+    properties.setProperty(ConfigurationProperties.DISTRIBUTED_TRANSACTIONS, "true");
+
+    this.cache = (GemFireCacheImpl) CacheFactory.create(DistributedSystem.connect(properties));
+
+    AttributesFactory<String, String> attributesFactory = new AttributesFactory<>();
+    attributesFactory.setScope(Scope.DISTRIBUTED_NO_ACK);
+    attributesFactory.setIndexMaintenanceSynchronous(true);
+
+    this.region = this.cache.createRegion("TXTest", attributesFactory.create());
     this.txMgr = this.cache.getCacheTransactionManager();
-    assert (this.txMgr.isDistributed());
+
+    assertTrue(this.txMgr.isDistributed());
   }
 
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/c5b8cbe8/geode-core/src/test/java/org/apache/geode/disttx/DistTXWriterOOMEJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/disttx/DistTXWriterOOMEJUnitTest.java b/geode-core/src/test/java/org/apache/geode/disttx/DistTXWriterOOMEJUnitTest.java
index b99d3fd..896530d 100644
--- a/geode-core/src/test/java/org/apache/geode/disttx/DistTXWriterOOMEJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/disttx/DistTXWriterOOMEJUnitTest.java
@@ -14,21 +14,23 @@
  */
 package org.apache.geode.disttx;
 
+import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+
+import org.junit.experimental.categories.Category;
+
 import org.apache.geode.TXWriterOOMEJUnitTest;
 import org.apache.geode.cache.AttributesFactory;
 import org.apache.geode.cache.CacheException;
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.Scope;
-import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.distributed.ConfigurationProperties;
+import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.test.junit.categories.DistributedTransactionsTest;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.junit.experimental.categories.Category;
-
-import java.util.Properties;
-
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
 
 /**
  * Same tests as that of {@link TXWriterOOMEJUnitTest} after setting "distributed-transactions"
@@ -37,19 +39,22 @@ import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
 @Category({IntegrationTest.class, DistributedTransactionsTest.class})
 public class DistTXWriterOOMEJUnitTest extends TXWriterOOMEJUnitTest {
 
-  public DistTXWriterOOMEJUnitTest() {}
-
+  @Override
   protected void createCache() throws CacheException {
-    Properties p = new Properties();
-    p.setProperty(MCAST_PORT, "0"); // loner
-    p.setProperty(ConfigurationProperties.DISTRIBUTED_TRANSACTIONS, "true");
-    this.cache = (GemFireCacheImpl) CacheFactory.create(DistributedSystem.connect(p));
-    AttributesFactory<?, ?> af = new AttributesFactory<String, String>();
-    af.setScope(Scope.DISTRIBUTED_NO_ACK);
-    af.setIndexMaintenanceSynchronous(true);
-    this.region = this.cache.createRegion("TXTest", af.create());
+    Properties properties = new Properties();
+    properties.setProperty(MCAST_PORT, "0"); // loner
+    properties.setProperty(ConfigurationProperties.DISTRIBUTED_TRANSACTIONS, "true");
+
+    this.cache = (GemFireCacheImpl) CacheFactory.create(DistributedSystem.connect(properties));
+
+    AttributesFactory<String, String> attributesFactory = new AttributesFactory<>();
+    attributesFactory.setScope(Scope.DISTRIBUTED_NO_ACK);
+    attributesFactory.setIndexMaintenanceSynchronous(true);
+
+    this.region = this.cache.createRegion("TXTest", attributesFactory.create());
     this.txMgr = this.cache.getCacheTransactionManager();
-    assert (this.txMgr.isDistributed());
+
+    assertTrue(this.txMgr.isDistributed());
   }
 
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/c5b8cbe8/geode-core/src/test/java/org/apache/geode/disttx/DistributedTransactionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/disttx/DistributedTransactionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/disttx/DistributedTransactionDUnitTest.java
index 5471565..fe79801 100644
--- a/geode-core/src/test/java/org/apache/geode/disttx/DistributedTransactionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/disttx/DistributedTransactionDUnitTest.java
@@ -44,7 +44,6 @@ import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.i18n.LogWriterI18n;
 import org.apache.geode.internal.AvailablePort;
 import org.apache.geode.internal.cache.BucketRegion;
-import org.apache.geode.internal.cache.CacheServerImpl;
 import org.apache.geode.internal.cache.DistTXState;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.LocalRegion;
@@ -1383,7 +1382,7 @@ public class DistributedTransactionDUnitTest extends JUnit4CacheTestCase {
       @Override
       public Object call() throws Exception {
         CountDownLatch cdl = new CountDownLatch(1);
-        GemFireCacheImpl.internalBeforeApplyChanges = new WaitRelease(cdl, "TX OP");
+        DistTXState.internalBeforeApplyChanges = new WaitRelease(cdl, "TX OP");
         return null;
       }
     };
@@ -1396,7 +1395,7 @@ public class DistributedTransactionDUnitTest extends JUnit4CacheTestCase {
       @Override
       public Object call() throws Exception {
         CountDownLatch cdl = new CountDownLatch(1);
-        GemFireCacheImpl.internalBeforeNonTXBasicPut = new WaitRelease(cdl, "NON TX OP");
+        DistTXState.internalBeforeNonTXBasicPut = new WaitRelease(cdl, "NON TX OP");
         return null;
       }
     };
@@ -1457,7 +1456,7 @@ public class DistributedTransactionDUnitTest extends JUnit4CacheTestCase {
     execute(secondary, new SerializableCallable() {
       @Override
       public Object call() throws Exception {
-        Runnable r = GemFireCacheImpl.internalBeforeNonTXBasicPut;
+        Runnable r = DistTXState.internalBeforeNonTXBasicPut;
         assert (r != null && r instanceof WaitRelease);
         WaitRelease e = (WaitRelease) r;
         e.release();
@@ -1469,7 +1468,7 @@ public class DistributedTransactionDUnitTest extends JUnit4CacheTestCase {
     execute(secondary, new SerializableCallable() {
       @Override
       public Object call() throws Exception {
-        Runnable r = GemFireCacheImpl.internalBeforeApplyChanges;
+        Runnable r = DistTXState.internalBeforeApplyChanges;
         assert (r != null && r instanceof WaitRelease);
         WaitRelease e = (WaitRelease) r;
         e.release();

http://git-wip-us.apache.org/repos/asf/geode/blob/c5b8cbe8/geode-core/src/test/java/org/apache/geode/disttx/PRDistTXJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/disttx/PRDistTXJUnitTest.java b/geode-core/src/test/java/org/apache/geode/disttx/PRDistTXJUnitTest.java
index f27c099..268a733 100644
--- a/geode-core/src/test/java/org/apache/geode/disttx/PRDistTXJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/disttx/PRDistTXJUnitTest.java
@@ -14,6 +14,15 @@
  */
 package org.apache.geode.disttx;
 
+import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import org.apache.geode.cache.CacheException;
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.distributed.ConfigurationProperties;
@@ -22,33 +31,27 @@ import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.PRTXJUnitTest;
 import org.apache.geode.test.junit.categories.DistributedTransactionsTest;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.Properties;
-
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
 
 /**
  * Same tests as that of {@link PRTXJUnitTest} after setting "distributed-transactions" property to
  * true
- *
  */
 @Category({IntegrationTest.class, DistributedTransactionsTest.class})
 public class PRDistTXJUnitTest extends PRTXJUnitTest {
 
-  public PRDistTXJUnitTest() {}
-
   @Override
   protected void createCache() throws Exception {
     Properties p = new Properties();
     p.setProperty(MCAST_PORT, "0"); // loner
     p.setProperty(ConfigurationProperties.DISTRIBUTED_TRANSACTIONS, "true");
+
     this.cache = (GemFireCacheImpl) CacheFactory.create(DistributedSystem.connect(p));
+
     createRegion();
     this.txMgr = this.cache.getCacheTransactionManager();
-    assert (this.txMgr.isDistributed());
+
+    assertTrue(this.txMgr.isDistributed());
+
     this.listenerAfterCommit = 0;
     this.listenerAfterFailedCommit = 0;
     this.listenerAfterRollback = 0;

http://git-wip-us.apache.org/repos/asf/geode/blob/c5b8cbe8/geode-core/src/test/java/org/apache/geode/internal/cache/PRTXJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PRTXJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PRTXJUnitTest.java
index d2bad64..1caffbd 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PRTXJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PRTXJUnitTest.java
@@ -12,9 +12,6 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-/**
- * 
- */
 package org.apache.geode.internal.cache;
 
 import org.junit.Ignore;
@@ -30,132 +27,83 @@ import org.apache.geode.cache.PartitionAttributesFactory;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionAttributes;
 import org.apache.geode.cache.query.QueryException;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.cache.InternalRegionArguments;
-import org.apache.geode.internal.cache.LocalRegion;
-import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 
-/**
- *
- */
 @Category(IntegrationTest.class)
 public class PRTXJUnitTest extends TXJUnitTest {
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.TXTest#createRegion()
-   */
   @Override
   protected void createRegion() throws Exception {
-    AttributesFactory af = new AttributesFactory();
-    af.setConcurrencyChecksEnabled(false); // test validation expects this behavior
-    af.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(3).create());
-    // this.region = this.cache.createRegion("PRTXJUnitTest", af.create());
-    this.region = new PRWithLocalOps("PRTXJUnitTest", af.create(), null, this.cache,
-        new InternalRegionArguments().setDestroyLockFlag(true).setRecreateFlag(false)
+    AttributesFactory attributesFactory = new AttributesFactory();
+    // test validation expects this behavior
+    attributesFactory.setConcurrencyChecksEnabled(false);
+    attributesFactory
+        .setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(3).create());
+
+    this.region = new PRWithLocalOps(getClass().getSimpleName(), attributesFactory.create(), null,
+        this.cache, new InternalRegionArguments().setDestroyLockFlag(true).setRecreateFlag(false)
             .setSnapshotInputStream(null).setImageTarget(null));
+
     ((PartitionedRegion) this.region).initialize(null, null, null);
     ((PartitionedRegion) this.region).postCreateRegion();
     this.cache.setRegionByPath(this.region.getFullPath(), (LocalRegion) this.region);
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.TXTest#checkUserAttributeConflict(org.apache.geode.internal.cache.
-   * TXManagerImpl)
-   */
   @Override
   protected void checkUserAttributeConflict(CacheTransactionManager txMgrImpl) {}
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * org.apache.geode.TXTest#checkSubRegionCollecection(org.apache.geode.internal.cache.LocalRegion)
-   */
   @Override
-  protected void checkSubRegionCollecection(Region reg1) {}
+  protected void checkSubRegionCollection(Region reg1) {}
 
   @Override
   @Ignore
   @Test
-  public void testTXAndQueries() throws CacheException, QueryException {
-    // TODO fix this?
-  }
+  public void testTXAndQueries() throws CacheException, QueryException {}
 
   @Override
   @Ignore
   @Test
-  public void testCollections() throws CacheException {
-    // TODO make PR iterators tx aware
-  }
+  public void testCollections() throws CacheException {}
 
   @Override
   @Ignore
   @Test
-  public void testTxAlgebra() throws CacheException {
-    // TODO Auto-generated method stub
-  }
+  public void testTxAlgebra() throws CacheException {}
 
   @Test
   public void testTxId() {
-    AttributesFactory<Integer, String> af = new AttributesFactory<Integer, String>();
-    af.setPartitionAttributes(
+    AttributesFactory<String, Integer> attributesFactory = new AttributesFactory<>();
+    attributesFactory.setPartitionAttributes(
         new PartitionAttributesFactory<String, Integer>().setTotalNumBuckets(2).create());
-    Region<String, Integer> r = this.cache.createRegion("testTxId", af.create());
-    r.put("one", 1);
-    CacheTransactionManager mgr = this.cache.getTxManager();
-    mgr.begin();
-    r.put("two", 2);
-    mgr.getTransactionId();
-    mgr.rollback();
+
+    Region<String, Integer> region =
+        this.cache.createRegion("testTxId", attributesFactory.create());
+    region.put("one", 1);
+
+    CacheTransactionManager txManager = this.cache.getTxManager();
+    txManager.begin();
+    region.put("two", 2);
+    txManager.getTransactionId();
+    txManager.rollback();
   }
 
   private static class PRWithLocalOps extends PartitionedRegion {
 
-    /**
-     * @param regionname
-     * @param ra
-     * @param parentRegion
-     * @param cache
-     * @param internalRegionArgs
-     */
-    public PRWithLocalOps(String regionname, RegionAttributes ra, LocalRegion parentRegion,
+    PRWithLocalOps(String regionName, RegionAttributes ra, LocalRegion parentRegion,
         GemFireCacheImpl cache, InternalRegionArguments internalRegionArgs) {
-      super(regionname, ra, parentRegion, cache, internalRegionArgs);
+      super(regionName, ra, parentRegion, cache, internalRegionArgs);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.geode.internal.cache.PartitionedRegion#localDestroy(java.lang.Object,
-     * java.lang.Object)
-     */
     @Override
     public void localDestroy(Object key, Object callbackArgument) throws EntryNotFoundException {
       super.destroy(key, callbackArgument);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.geode.internal.cache.PartitionedRegion#localInvalidate(java.lang.Object,
-     * java.lang.Object)
-     */
     @Override
     public void localInvalidate(Object key, Object callbackArgument) throws EntryNotFoundException {
       super.invalidate(key, callbackArgument);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.geode.internal.cache.PartitionedRegion#localInvalidateRegion(java.lang.Object)
-     */
     @Override
     public void localInvalidateRegion(Object callbackArgument) {
       super.invalidateRegion(callbackArgument);

http://git-wip-us.apache.org/repos/asf/geode/blob/c5b8cbe8/geode-core/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelQueueRemovalMessageJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelQueueRemovalMessageJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelQueueRemovalMessageJUnitTest.java
index d57ce12..b7ee5c8 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelQueueRemovalMessageJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelQueueRemovalMessageJUnitTest.java
@@ -14,31 +14,59 @@
  */
 package org.apache.geode.internal.cache.wan.parallel;
 
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import org.apache.geode.CancelCriterion;
-import org.apache.geode.cache.*;
-import org.apache.geode.internal.cache.*;
+import org.apache.geode.cache.AttributesFactory;
+import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.EvictionAction;
+import org.apache.geode.cache.EvictionAttributes;
+import org.apache.geode.cache.PartitionAttributes;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.Scope;
+import org.apache.geode.internal.cache.BucketAdvisor;
+import org.apache.geode.internal.cache.BucketRegionQueue;
+import org.apache.geode.internal.cache.BucketRegionQueueHelper;
+import org.apache.geode.internal.cache.EvictionAttributesImpl;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalRegionArguments;
+import org.apache.geode.internal.cache.KeyInfo;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.internal.cache.PartitionedRegionDataStore;
+import org.apache.geode.internal.cache.PartitionedRegionHelper;
+import org.apache.geode.internal.cache.PartitionedRegionStats;
+import org.apache.geode.internal.cache.ProxyBucketRegion;
+import org.apache.geode.internal.cache.RegionQueue;
 import org.apache.geode.internal.cache.lru.LRUAlgorithm;
 import org.apache.geode.internal.cache.partitioned.RegionAdvisor;
 import org.apache.geode.internal.cache.wan.AbstractGatewaySender;
 import org.apache.geode.internal.cache.wan.GatewaySenderEventImpl;
 import org.apache.geode.test.fake.Fakes;
 import org.apache.geode.test.junit.categories.UnitTest;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.*;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 
 @Category(UnitTest.class)
 public class ParallelQueueRemovalMessageJUnitTest {
 
+  private static final String GATEWAY_SENDER_ID = "ny";
+  private static final int BUCKET_ID = 85;
+  private static final long KEY = 198;
+
   private GemFireCacheImpl cache;
   private PartitionedRegion queueRegion;
   private AbstractGatewaySender sender;
@@ -46,10 +74,6 @@ public class ParallelQueueRemovalMessageJUnitTest {
   private BucketRegionQueue bucketRegionQueue;
   private BucketRegionQueueHelper bucketRegionQueueHelper;
 
-  private static String GATEWAY_SENDER_ID = "ny";
-  private static int BUCKET_ID = 85;
-  private static long KEY = 198l;
-
   @Before
   public void setUpGemFire() {
     createCache();
@@ -115,10 +139,10 @@ public class ParallelQueueRemovalMessageJUnitTest {
     when(this.queueRegion.getPartitionAttributes()).thenReturn(pa);
     when(this.queueRegion.getDataPolicy()).thenReturn(DataPolicy.PARTITION);
     when(pa.getColocatedWith()).thenReturn(null);
-    ProxyBucketRegion pbr = new ProxyBucketRegion(BUCKET_ID, this.queueRegion, pbrIra); // final
-                                                                                        // classes
-                                                                                        // cannot be
-                                                                                        // mocked
+
+    // final classes cannot be mocked
+    ProxyBucketRegion pbr = new ProxyBucketRegion(BUCKET_ID, this.queueRegion, pbrIra);
+
     when(ba.getProxyBucketRegion()).thenReturn(pbr);
 
     // Create RegionAttributes
@@ -182,11 +206,11 @@ public class ParallelQueueRemovalMessageJUnitTest {
     assertFalse(this.bucketRegionQueue.isInitialized());
 
     // Create a real ConcurrentParallelGatewaySenderQueue
-    ParallelGatewaySenderEventProcessor pgsep = createConcurrentParallelGatewaySenderQueue();
+    ParallelGatewaySenderEventProcessor processor = createConcurrentParallelGatewaySenderQueue();
 
     // Add a mock GatewaySenderEventImpl to the temp queue
     BlockingQueue<GatewaySenderEventImpl> tempQueue =
-        createTempQueueAndAddEvent(pgsep, mock(GatewaySenderEventImpl.class));
+        createTempQueueAndAddEvent(processor, mock(GatewaySenderEventImpl.class));
     assertEquals(1, tempQueue.size());
 
     // Create and process a ParallelQueueRemovalMessage (causes the failedBatchRemovalMessageKeys to
@@ -204,14 +228,14 @@ public class ParallelQueueRemovalMessageJUnitTest {
     assertEquals(0, this.bucketRegionQueue.size());
 
     // Create a real ConcurrentParallelGatewaySenderQueue
-    ParallelGatewaySenderEventProcessor pgsep = createConcurrentParallelGatewaySenderQueue();
+    ParallelGatewaySenderEventProcessor processor = createConcurrentParallelGatewaySenderQueue();
 
     // Add an event to the BucketRegionQueue and verify BucketRegionQueue state
-    GatewaySenderEventImpl gsei = this.bucketRegionQueueHelper.addEvent(KEY);
+    GatewaySenderEventImpl event = this.bucketRegionQueueHelper.addEvent(KEY);
     assertEquals(1, this.bucketRegionQueue.size());
 
     // Add a mock GatewaySenderEventImpl to the temp queue
-    BlockingQueue<GatewaySenderEventImpl> tempQueue = createTempQueueAndAddEvent(pgsep, gsei);
+    BlockingQueue<GatewaySenderEventImpl> tempQueue = createTempQueueAndAddEvent(processor, event);
     assertEquals(1, tempQueue.size());
 
     // Create and process a ParallelQueueRemovalMessage (causes the value of the entry to be set to
@@ -230,9 +254,9 @@ public class ParallelQueueRemovalMessageJUnitTest {
   }
 
   private void createAndProcessParallelQueueRemovalMessage() {
-    ParallelQueueRemovalMessage pqrm =
+    ParallelQueueRemovalMessage message =
         new ParallelQueueRemovalMessage(createRegionToDispatchedKeysMap());
-    pqrm.process(null);
+    message.process(null);
   }
 
   private HashMap<String, Map<Integer, List<Long>>> createRegionToDispatchedKeysMap() {
@@ -246,23 +270,23 @@ public class ParallelQueueRemovalMessageJUnitTest {
   }
 
   private ParallelGatewaySenderEventProcessor createConcurrentParallelGatewaySenderQueue() {
-    ParallelGatewaySenderEventProcessor pgsep = new ParallelGatewaySenderEventProcessor(sender);
-    ConcurrentParallelGatewaySenderQueue cpgsq = new ConcurrentParallelGatewaySenderQueue(sender,
-        new ParallelGatewaySenderEventProcessor[] {pgsep});
+    ParallelGatewaySenderEventProcessor processor = new ParallelGatewaySenderEventProcessor(sender);
+    ConcurrentParallelGatewaySenderQueue queue = new ConcurrentParallelGatewaySenderQueue(sender,
+        new ParallelGatewaySenderEventProcessor[] {processor});
     Set<RegionQueue> queues = new HashSet<>();
-    queues.add(cpgsq);
+    queues.add(queue);
     when(this.sender.getQueues()).thenReturn(queues);
-    return pgsep;
+    return processor;
   }
 
   private BlockingQueue<GatewaySenderEventImpl> createTempQueueAndAddEvent(
-      ParallelGatewaySenderEventProcessor pgsep, GatewaySenderEventImpl gsei) {
-    ParallelGatewaySenderQueue pgsq = (ParallelGatewaySenderQueue) pgsep.getQueue();
+      ParallelGatewaySenderEventProcessor processor, GatewaySenderEventImpl event) {
+    ParallelGatewaySenderQueue queue = (ParallelGatewaySenderQueue) processor.getQueue();
     Map<Integer, BlockingQueue<GatewaySenderEventImpl>> tempQueueMap =
-        pgsq.getBucketToTempQueueMap();
-    BlockingQueue<GatewaySenderEventImpl> tempQueue = new LinkedBlockingQueue();
-    when(gsei.getShadowKey()).thenReturn(KEY);
-    tempQueue.add(gsei);
+        queue.getBucketToTempQueueMap();
+    BlockingQueue<GatewaySenderEventImpl> tempQueue = new LinkedBlockingQueue<>();
+    when(event.getShadowKey()).thenReturn(KEY);
+    tempQueue.add(event);
     tempQueueMap.put(BUCKET_ID, tempQueue);
     return tempQueue;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/c5b8cbe8/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java
index 570c06c..54cadcb 100644
--- a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java
+++ b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java
@@ -776,7 +776,7 @@ public final class CqServiceImpl implements CqService {
     if (clientProxyId == null) {
       throw new CqException(
           LocalizedStrings.CqService_UNABLE_TO_RETRIEVE_DURABLE_CQS_FOR_CLIENT_PROXY_ID
-              .toLocalizedString(null));
+              .toLocalizedString());
     }
     List<ServerCQ> cqs = getAllClientCqs(clientProxyId);
     ArrayList<String> durableClientCqs = new ArrayList<>();

http://git-wip-us.apache.org/repos/asf/geode/blob/c5b8cbe8/geode-cq/src/test/java/org/apache/geode/cache/query/dunit/QueryMonitorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/org/apache/geode/cache/query/dunit/QueryMonitorDUnitTest.java b/geode-cq/src/test/java/org/apache/geode/cache/query/dunit/QueryMonitorDUnitTest.java
index f298fae..9332388 100644
--- a/geode-cq/src/test/java/org/apache/geode/cache/query/dunit/QueryMonitorDUnitTest.java
+++ b/geode-cq/src/test/java/org/apache/geode/cache/query/dunit/QueryMonitorDUnitTest.java
@@ -220,12 +220,12 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
       Assert.fail("While starting CacheServer", ex);
     }
     Cache cache = getCache();
-    GemFireCacheImpl.getInstance().TEST_MAX_QUERY_EXECUTION_TIME = queryMonitorTime;
+    GemFireCacheImpl.getInstance().testMaxQueryExecutionTime = queryMonitorTime;
     cache.getLogger().fine("#### RUNNING TEST : " + testName);
     DefaultQuery.testHook = new QueryTimeoutHook(queryMonitorTime);
-    // ((GemFireCache)cache).TEST_MAX_QUERY_EXECUTION_TIME = queryMonitorTime;
+    // ((GemFireCache)cache).testMaxQueryExecutionTime = queryMonitorTime;
     System.out.println("MAX_QUERY_EXECUTION_TIME is set to: "
-        + ((GemFireCacheImpl) cache).TEST_MAX_QUERY_EXECUTION_TIME);
+        + ((GemFireCacheImpl) cache).testMaxQueryExecutionTime);
     return port;
   }
 
@@ -236,10 +236,10 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
         // Reset the test flag.
         Cache cache = getCache();
         DefaultQuery.testHook = null;
-        GemFireCacheImpl.getInstance().TEST_MAX_QUERY_EXECUTION_TIME = -1;
+        GemFireCacheImpl.getInstance().testMaxQueryExecutionTime = -1;
         stopBridgeServer(getCache());
         System.out.println("MAX_QUERY_EXECUTION_TIME is set to: "
-            + ((GemFireCacheImpl) cache).TEST_MAX_QUERY_EXECUTION_TIME);
+            + ((GemFireCacheImpl) cache).testMaxQueryExecutionTime);
       }
     };
     server.invoke(stopServer);
@@ -333,7 +333,7 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
   private void executeQueriesFromClient(int timeout) {
     try {
       ClientCache anyInstance = ClientCacheFactory.getAnyInstance();
-      ((GemFireCacheImpl) anyInstance).TEST_MAX_QUERY_EXECUTION_TIME = timeout;
+      ((GemFireCacheImpl) anyInstance).testMaxQueryExecutionTime = timeout;
       Pool pool = PoolManager.find(poolName);
       QueryService queryService = pool.getQueryService();
       executeQueriesAgainstQueryService(queryService);
@@ -882,7 +882,7 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
   protected CqQueryDUnitTest cqDUnitTest = new CqQueryDUnitTest();
 
   /**
-   * The following CQ test is added to make sure TEST_MAX_QUERY_EXECUTION_TIME is reset and is not
+   * The following CQ test is added to make sure testMaxQueryExecutionTime is reset and is not
    * affecting other query related tests.
    * 
    * @throws Exception
@@ -917,7 +917,7 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
       public void run2() throws CacheException {
         Cache cache = getCache();
         System.out.println("TEST CQ MAX_QUERY_EXECUTION_TIME is set to: "
-            + ((GemFireCacheImpl) cache).TEST_MAX_QUERY_EXECUTION_TIME);
+            + ((GemFireCacheImpl) cache).testMaxQueryExecutionTime);
 
         Region region1 = getRootRegion().getSubregion(cqDUnitTest.regions[0]);
         for (int i = 1; i <= 5; i++) {
@@ -942,7 +942,7 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
       public void run2() throws CacheException {
         Cache cache = getCache();
         System.out.println("TEST CQ MAX_QUERY_EXECUTION_TIME is set to: "
-            + ((GemFireCacheImpl) cache).TEST_MAX_QUERY_EXECUTION_TIME);
+            + ((GemFireCacheImpl) cache).testMaxQueryExecutionTime);
 
         Region region1 = getRootRegion().getSubregion(cqDUnitTest.regions[0]);
         for (int i = 1; i <= 5; i++) {
@@ -1127,7 +1127,7 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
               }
               break;
             }
-            // ((GemFireCache)cache).TEST_MAX_QUERY_EXECUTION_TIME = queryMonitorTime;
+            // ((GemFireCache)cache).testMaxQueryExecutionTime = queryMonitorTime;
           }
         };
     vm.invoke(validateThreadCnt);

http://git-wip-us.apache.org/repos/asf/geode/blob/c5b8cbe8/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/CommonCrudController.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/CommonCrudController.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/CommonCrudController.java
index 0449a45..3190cd7 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/CommonCrudController.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/CommonCrudController.java
@@ -38,7 +38,7 @@ import org.apache.geode.cache.execute.Execution;
 import org.apache.geode.cache.execute.FunctionException;
 import org.apache.geode.cache.execute.FunctionService;
 import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.execute.util.FindRestEnabledServersFunction;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.rest.internal.web.controllers.support.RestServersResultCollector;
 import org.apache.geode.rest.internal.web.exception.GemfireRestException;
@@ -193,7 +193,7 @@ public abstract class CommonCrudController extends AbstractBaseController {
 
     try {
       final ResultCollector<?, ?> results = function.withCollector(new RestServersResultCollector())
-          .execute(GemFireCacheImpl.FIND_REST_ENABLED_SERVERS_FUNCTION_ID);
+          .execute(FindRestEnabledServersFunction.FIND_REST_ENABLED_SERVERS_FUNCTION_ID);
       Object functionResult = results.getResult();
 
       if (functionResult instanceof List<?>) {


Mime
View raw message