Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-1930 864c92c9a -> a904acf66


Fix up two more tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/fa48aca0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/fa48aca0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/fa48aca0

Branch: refs/heads/feature/GEODE-1930
Commit: fa48aca0817bd953c310fd0de0a70fd5a3ae9b15
Parents: 864c92c
Author: Kirk Lund <kl...@apache.org>
Authored: Thu Oct 13 22:07:45 2016 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Thu Oct 13 22:07:45 2016 -0700

----------------------------------------------------------------------
 .../geode/management/QueryDataDUnitTest.java    | 672 +++++++++++--------
 .../management/RegionManagementDUnitTest.java   | 259 +++----
 2 files changed, 466 insertions(+), 465 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/fa48aca0/geode-core/src/test/java/org/apache/geode/management/QueryDataDUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/management/QueryDataDUnitTest.java 
b/geode-core/src/test/java/org/apache/geode/management/QueryDataDUnitTest.java
index e960166..aab1822 100644
--- 
a/geode-core/src/test/java/org/apache/geode/management/QueryDataDUnitTest.java
+++ 
b/geode-core/src/test/java/org/apache/geode/management/QueryDataDUnitTest.java
@@ -16,71 +16,69 @@
  */
 package org.apache.geode.management;
 
-import static org.apache.geode.cache.query.Utils.createPortfoliosAndPositions;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
 import static com.jayway.jsonpath.matchers.JsonPathMatchers.*;
+import static java.util.concurrent.TimeUnit.*;
+import static org.apache.geode.cache.FixedPartitionAttributes.*;
 import static org.apache.geode.cache.query.Utils.*;
+import static org.apache.geode.management.internal.ManagementConstants.*;
+import static org.apache.geode.management.internal.ManagementStrings.*;
+import static org.apache.geode.test.dunit.Host.*;
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertThat;
 
+import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+import javax.management.ObjectName;
 
+import com.jayway.awaitility.Awaitility;
+import com.jayway.awaitility.core.ConditionFactory;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
+import org.junit.Before;
 import org.junit.Rule;
 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.CacheFactory;
 import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.EntryOperation;
 import org.apache.geode.cache.FixedPartitionAttributes;
 import org.apache.geode.cache.PartitionAttributesFactory;
+import org.apache.geode.cache.PartitionResolver;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionFactory;
 import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.cache.query.data.Portfolio;
-import org.apache.geode.cache.query.dunit.QueryUsingFunctionContextDUnitTest;
-import org.apache.geode.cache30.CacheSerializableRunnable;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.internal.cache.BucketRegion;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.PartitionedRegionHelper;
 import 
org.apache.geode.internal.cache.partitioned.fixed.SingleHopQuarterPartitionResolver;
-import org.apache.geode.management.internal.ManagementConstants;
-import org.apache.geode.management.internal.ManagementStrings;
 import org.apache.geode.management.internal.SystemManagementService;
 import org.apache.geode.management.internal.beans.BeanUtilFuncs;
 import org.apache.geode.management.internal.cli.json.TypedJson;
 import org.apache.geode.pdx.PdxInstance;
 import org.apache.geode.pdx.PdxInstanceFactory;
 import org.apache.geode.pdx.internal.PdxInstanceFactoryImpl;
-import org.apache.geode.test.dunit.Wait;
-import org.apache.geode.test.dunit.WaitCriterion;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.FlakyTest;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.apache.geode.test.dunit.AsyncInvocation;
+import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.rules.DistributedUseJacksonForJsonPathRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.rules.serializable.SerializableTestName;
 
 /**
  * Distributed tests for {@link DistributedSystemMXBean#queryData(String, 
String, int)}.
- *
+ * <p>
  * <pre>
  * Test Basic Json Strings for Partitioned Regions
  * Test Basic Json Strings for Replicated Regions
@@ -102,258 +100,250 @@ import 
org.apache.geode.test.junit.categories.DistributedTest;
 @SuppressWarnings("serial")
 public class QueryDataDUnitTest extends ManagementTestBase {
 
-  private static final int MAX_WAIT = 100 * 1000;
-  private static final int COUNT_DESTINATION = 30;
-  private static final int COUNT_FROM = 0;
+  private static final int NUM_OF_BUCKETS = 20;
 
-  // PR 5 is co-located with 4
-  private static final String PARTITIONED_REGION_NAME1 = 
"TestPartitionedRegion1";
-  private static final String PARTITIONED_REGION_NAME2 = 
"TestPartitionedRegion2";
-  private static final String PARTITIONED_REGION_NAME3 = 
"TestPartitionedRegion3";
-  private static final String PARTITIONED_REGION_NAME4 = 
"TestPartitionedRegion4";
-  private static final String PARTITIONED_REGION_NAME5 = 
"TestPartitionedRegion5";
+  // PARTITIONED_REGION_NAME5 is co-located with PARTITIONED_REGION_NAME4
+  private static final String PARTITIONED_REGION_NAME1 = 
"PARTITIONED_REGION_NAME1";
+  private static final String PARTITIONED_REGION_NAME2 = 
"PARTITIONED_REGION_NAME2";
+  private static final String PARTITIONED_REGION_NAME3 = 
"PARTITIONED_REGION_NAME3";
+  private static final String PARTITIONED_REGION_NAME4 = 
"PARTITIONED_REGION_NAME4";
+  private static final String PARTITIONED_REGION_NAME5 = 
"PARTITIONED_REGION_NAME5";
 
-  private static final String REPLICATED_REGION_NAME1 = "TestRepRegion";
-  private static final String REPLICATED_REGION_NAME2 = "TestRepRegion2";
-  private static final String REPLICATED_REGION_NAME3 = "TestRepRegion3";
-  private static final String REPLICATED_REGION_NAME4 = "TestRepRegion4";
+  private static final String REPLICATE_REGION_NAME1 = 
"REPLICATE_REGION_NAME1";
+  private static final String REPLICATE_REGION_NAME2 = 
"REPLICATE_REGION_NAME2";
+  private static final String REPLICATE_REGION_NAME3 = 
"REPLICATE_REGION_NAME3";
+  private static final String REPLICATE_REGION_NAME4 = 
"REPLICATE_REGION_NAME4";
 
-  private static final String LOCAL_REGION_NAME = "TestLocalRegion";
+  private static final String LOCAL_REGION_NAME = "LOCAL_REGION_NAME";
+
+  private static final String BIG_COLLECTION_ELEMENT_ = 
"BIG_COLLECTION_ELEMENT_";
+  private static final String BIG_COLLECTION_ = "BIG_COLLECTION_";
 
   private static final String[] QUERIES = new String[] {
-    "select * from /" + PARTITIONED_REGION_NAME1 + " where ID>=0",
-    "Select * from /" + PARTITIONED_REGION_NAME1 + " r1, /" + 
PARTITIONED_REGION_NAME2 + " r2 where r1.ID = r2.ID",
-    "Select * from /" + PARTITIONED_REGION_NAME1 + " r1, /" + 
PARTITIONED_REGION_NAME2 + " r2 where r1.ID = r2.ID AND r1.status = r2.status",
-    "Select * from /" + PARTITIONED_REGION_NAME1 + " r1, /" + 
PARTITIONED_REGION_NAME2 + " r2, /" + PARTITIONED_REGION_NAME3 + " r3 where 
r1.ID = r2.ID and r2.ID = r3.ID",
-    "Select * from /" + PARTITIONED_REGION_NAME1 + " r1, /" + 
PARTITIONED_REGION_NAME2 + " r2, /" + PARTITIONED_REGION_NAME3 + " r3  , /" + 
REPLICATED_REGION_NAME1 + " r4 where r1.ID = r2.ID and r2.ID = r3.ID and r3.ID 
= r4.ID",
-    "Select * from /" + PARTITIONED_REGION_NAME4 + " r4, /" + 
PARTITIONED_REGION_NAME5 + " r5 where r4.ID = r5.ID"
+    "SELECT * FROM /" + PARTITIONED_REGION_NAME1 + " WHERE ID >= 0",
+    "SELECT * FROM /" + PARTITIONED_REGION_NAME1 + " r1, /" + 
PARTITIONED_REGION_NAME2 + " r2 WHERE r1.ID = r2.ID",
+    "SELECT * FROM /" + PARTITIONED_REGION_NAME1 + " r1, /" + 
PARTITIONED_REGION_NAME2 + " r2 WHERE r1.ID = r2.ID AND r1.status = r2.status",
+    "SELECT * FROM /" + PARTITIONED_REGION_NAME1 + " r1, /" + 
PARTITIONED_REGION_NAME2 + " r2, /" + PARTITIONED_REGION_NAME3 + " r3 WHERE 
r1.ID = r2.ID AND r2.ID = r3.ID",
+    "SELECT * FROM /" + PARTITIONED_REGION_NAME1 + " r1, /" + 
PARTITIONED_REGION_NAME2 + " r2, /" + PARTITIONED_REGION_NAME3 + " r3, /" + 
REPLICATE_REGION_NAME1 + " r4 WHERE r1.ID = r2.ID AND r2.ID = r3.ID AND r3.ID = 
r4.ID",
+    "SELECT * FROM /" + PARTITIONED_REGION_NAME4 + " r4, /" + 
PARTITIONED_REGION_NAME5 + " r5 WHERE r4.ID = r5.ID"
   };
 
   private static final String[] QUERIES_FOR_REPLICATED = new String[] {
-    "<trace> select * from /" + REPLICATED_REGION_NAME1 + " where ID>=0",
-    "Select * from /" + REPLICATED_REGION_NAME1 + " r1, /" + 
REPLICATED_REGION_NAME2 + " r2 where r1.ID = r2.ID",
-    "select * from /" + REPLICATED_REGION_NAME3 + " where ID>=0"
+    "<TRACE> SELECT * FROM /" + REPLICATE_REGION_NAME1 + " WHERE ID >= 0",
+    "SELECT * FROM /" + REPLICATE_REGION_NAME1 + " r1, /" + 
REPLICATE_REGION_NAME2 + " r2 WHERE r1.ID = r2.ID",
+    "SELECT * FROM /" + REPLICATE_REGION_NAME3 + " WHERE ID >= 0"
   };
 
   private static final String[] QUERIES_FOR_LIMIT = new String[] {
-    "select * from /" + REPLICATED_REGION_NAME4
+    "SELECT * FROM /" + REPLICATE_REGION_NAME4
   };
 
   private DistributedMember member1;
   private DistributedMember member2;
   private DistributedMember member3;
 
+  @Manager
+  private VM managerVM;
+
+  @Member
+  private VM[] memberVMs;
+
   @Rule
   public DistributedUseJacksonForJsonPathRule useJacksonForJsonPathRule = new 
DistributedUseJacksonForJsonPathRule();
 
-  @Override
-  protected final void postSetUpManagementTestBase() throws Exception {
-    initManagement(false);
+  @Rule
+  public SerializableTestName testName = new SerializableTestName();
+
+  @Before
+  public void before() throws Exception {
+    createMembersAndThenManager_tmp();
 
-    this.member1 = getMember(managedNode1);
-    this.member2 = getMember(managedNode2);
-    this.member3 = getMember(managedNode3);
+    this.managerVM = getHost(0).getVM(0);
+    this.memberVMs = new VM[3];
+    this.memberVMs[0] = getHost(0).getVM(1);
+    this.memberVMs[1] = getHost(0).getVM(2);
+    this.memberVMs[2] = getHost(0).getVM(3);
+
+    this.member1 = getDistributedMember_tmp(this.memberVMs[0]);
+    this.member2 = getDistributedMember_tmp(this.memberVMs[1]);
+    this.member3 = getDistributedMember_tmp(this.memberVMs[2]);
 
     createRegionsInNodes();
-    fillValuesInRegions();
+    generateValuesInRegions();
   }
 
   @Test
   public void testQueryOnPartitionedRegion() throws Exception {
-    this.managingNode.invoke("testQueryOnPartitionedRegion", () -> {
-      //Cache cache = getCache();
-      SystemManagementService service = (SystemManagementService) 
getManagementService();
-      DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
+    this.managerVM.invoke(this.testName.getMethodName(), () -> {
+      DistributedSystemMXBean distributedSystemMXBean = 
getSystemManagementService_tmp().getDistributedSystemMXBean();
 
-      assertNotNull(bean);
+      String jsonString = distributedSystemMXBean.queryData(QUERIES[0], null, 
10);
+      assertThat(jsonString).contains("result").doesNotContain("No Data 
Found");
 
       for (int i = 0; i < QUERIES.length; i++) {
-        String jsonString = null;
-        if (i == 0) {
-          jsonString = bean.queryData(QUERIES[i], null, 10);
-          assertThat("Query On Cluster should have result", 
jsonString.contains("result") && !jsonString.contains("No Data Found"), 
is(true));
-        } else {
-          jsonString = bean.queryData(QUERIES[i], member1.getId(), 10);
-          assertThat("Query On Member should have member", 
jsonString.contains("result"), is(true));
-          assertThat("Query On Member should have member", 
jsonString.contains("member"), is(true));
-          assertThat("QUERIES[" + i + "]", jsonString, 
isJson(withJsonPath("$..result", anything())));
-//          assertThat("QUERIES[" + i + "]", result,
-//            isJson(withJsonPath("$..member",
-//                                equalTo(JsonPath.compile(result)))));
-//                                //equalTo(new 
JSONObject().put(String.class.getName(), member1.getId())))));
-
-          //System.out.println("KIRK: " + JsonPath.read(jsonString, 
"$.result.*"));
-          // TODO: System.out.println("KIRK: " + JsonPath.read(jsonString, 
"$['result']['member']"));
-
-        }
-        assertIsValidJson(jsonString);
+        jsonString = distributedSystemMXBean.queryData(QUERIES[i], 
member1.getId(), 10);
+        assertThat(jsonString).contains("result");
+        assertThat(jsonString).contains("member");
+        assertThat("QUERIES[" + i + "]", jsonString, 
isJson(withJsonPath("$..result", anything())));
+
+        // TODO: better assertions
+        // assertThat("QUERIES[" + i + "]", result,
+        //            isJson(withJsonPath("$..member",
+        //                                equalTo(JsonPath.compile(result)))));
+        //                                //equalTo(new 
JSONObject().put(String.class.getName(), member1.getId())))));
+        //System.out.println(JsonPath.read(jsonString, "$.result.*"));
+        //System.out.println(JsonPath.read(jsonString, 
"$['result']['member']"));
+
+        verifyJsonIsValid(jsonString);
       }
     });
   }
 
   @Test
   public void testQueryOnReplicatedRegion() throws Exception {
-    this.managingNode.invoke("testQueryOnReplicatedRegion", () -> {
-      Cache cache = getCache();
-      SystemManagementService service = (SystemManagementService) 
getManagementService();
-      DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
-      assertNotNull(bean);
+    this.managerVM.invoke(this.testName.getMethodName(), () -> {
+      DistributedSystemMXBean distributedSystemMXBean = 
getSystemManagementService_tmp().getDistributedSystemMXBean();
+
+      String jsonString = 
distributedSystemMXBean.queryData(QUERIES_FOR_REPLICATED[0], null, 10);
+      assertThat(jsonString).contains("result").doesNotContain("No Data 
Found");
 
       for (int i = 0; i < QUERIES_FOR_REPLICATED.length; i++) {
-        String jsonString = bean.queryData(QUERIES_FOR_REPLICATED[i], null, 
10);
-        if (i == 0) {
-          assertThat("Query On Cluster should have result", 
jsonString.contains("result") && !jsonString.contains("No Data Found"), 
is(true));
-        } else {
-          assertThat("Join on Replicated did not work.", 
jsonString.contains("result"), is(true));
-        }
-        assertIsValidJson(jsonString);
+        assertThat(jsonString).contains("result");
+        verifyJsonIsValid(jsonString);
       }
     });
   }
 
   @Test
   public void testMemberWise() throws Exception {
-    this.managingNode.invoke("testMemberWise", () -> {
-      Cache cache = getCache();
-      SystemManagementService service = (SystemManagementService) 
getManagementService();
-      DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
-      assertNotNull(bean);
+    this.managerVM.invoke(this.testName.getMethodName(), () -> {
+      DistributedSystemMXBean distributedSystemMXBean = 
getSystemManagementService_tmp().getDistributedSystemMXBean();
 
-      byte[] bytes = 
bean.queryDataForCompressedResult(QUERIES_FOR_REPLICATED[0], member1.getId() + 
"," + member2.getId(), 2);
+      byte[] bytes = 
distributedSystemMXBean.queryDataForCompressedResult(QUERIES_FOR_REPLICATED[0], 
member1.getId() + "," + member2.getId(), 2);
       String jsonString = BeanUtilFuncs.decompress(bytes);
 
-      assertIsValidJson(jsonString);
+      verifyJsonIsValid(jsonString);
     });
   }
 
   @Test
   public void testLimitForQuery() throws Exception {
-    managedNode1.invoke("putBigInstances", () -> 
putBigInstances(REPLICATED_REGION_NAME4));
+    this.memberVMs[0].invoke("putBigInstances", () -> 
putBigInstances(REPLICATE_REGION_NAME4));
 
-    managingNode.invoke("testLimitForQuery", () -> {
-      SystemManagementService service = (SystemManagementService) 
getManagementService();
-      DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
-      assertNotNull(bean);
+    this.managerVM.invoke(this.testName.getMethodName(), () -> {
+      DistributedSystemMXBean distributedSystemMXBean = 
getSystemManagementService_tmp().getDistributedSystemMXBean();
 
       // Query With Default values
-      assertEquals(TypedJson.DEFAULT_COLLECTION_ELEMENT_LIMIT, 
bean.getQueryCollectionsDepth());
-      assertEquals(ManagementConstants.DEFAULT_QUERY_LIMIT, 
bean.getQueryResultSetLimit());
+      
assertThat(distributedSystemMXBean.getQueryCollectionsDepth()).isEqualTo(TypedJson.DEFAULT_COLLECTION_ELEMENT_LIMIT);
+      
assertThat(distributedSystemMXBean.getQueryResultSetLimit()).isEqualTo(DEFAULT_QUERY_LIMIT);
 
-      String jsonString = bean.queryData(QUERIES_FOR_LIMIT[0], null, 0);
+      String jsonString = 
distributedSystemMXBean.queryData(QUERIES_FOR_LIMIT[0], null, 0);
 
-      assertIsValidJson(jsonString);
-      assertThat(jsonString.contains("result") && !jsonString.contains("No 
Data Found"), is(true));
-      assertTrue(jsonString.contains("BigColl_1_ElemenNo_"));
+      verifyJsonIsValid(jsonString);
+      assertThat(jsonString).contains("result").doesNotContain("No Data 
Found");
+      assertThat(jsonString).contains(BIG_COLLECTION_ELEMENT_);
 
       JSONObject jsonObject = new JSONObject(jsonString);
       JSONArray jsonArray = jsonObject.getJSONArray("result");
-      assertEquals(ManagementConstants.DEFAULT_QUERY_LIMIT, 
jsonArray.length());
+      assertThat(jsonArray.length()).isEqualTo(DEFAULT_QUERY_LIMIT);
 
       // Get the first element
       JSONArray jsonArray1 = jsonArray.getJSONArray(0);
 
       // Get the ObjectValue
       JSONObject collectionObject = (JSONObject) jsonArray1.get(1);
-      assertEquals(100, collectionObject.length());
+      assertThat(collectionObject.length()).isEqualTo(100);
 
       // Query With Override Values
       int newQueryCollectionDepth = 150;
       int newQueryResultSetLimit = 500;
-      bean.setQueryCollectionsDepth(newQueryCollectionDepth);
-      bean.setQueryResultSetLimit(newQueryResultSetLimit);
 
-      assertEquals(newQueryCollectionDepth, bean.getQueryCollectionsDepth());
-      assertEquals(newQueryResultSetLimit, bean.getQueryResultSetLimit());
+      
distributedSystemMXBean.setQueryCollectionsDepth(newQueryCollectionDepth);
+      distributedSystemMXBean.setQueryResultSetLimit(newQueryResultSetLimit);
+
+      
assertThat(distributedSystemMXBean.getQueryCollectionsDepth()).isEqualTo(newQueryCollectionDepth);
+      
assertThat(distributedSystemMXBean.getQueryResultSetLimit()).isEqualTo(newQueryResultSetLimit);
 
-      jsonString = bean.queryData(QUERIES_FOR_LIMIT[0], null, 0);
+      jsonString = distributedSystemMXBean.queryData(QUERIES_FOR_LIMIT[0], 
null, 0);
 
-      assertIsValidJson(jsonString);
-      assertThat("Query On Cluster should have result", 
jsonString.contains("result") && !jsonString.contains("No Data Found"), 
is(true));
+      verifyJsonIsValid(jsonString);
+      assertThat(jsonString).contains("result").doesNotContain("No Data 
Found");
 
       jsonObject = new JSONObject(jsonString);
-      assertTrue(jsonString.contains("BigColl_1_ElemenNo_"));
+      assertThat(jsonString).contains(BIG_COLLECTION_ELEMENT_);
 
       jsonArray = jsonObject.getJSONArray("result");
-      assertEquals(newQueryResultSetLimit, jsonArray.length());
+      assertThat(jsonArray.length()).isEqualTo(newQueryResultSetLimit);
 
       // Get the first element
       jsonArray1 = jsonArray.getJSONArray(0);
 
       // Get the ObjectValue
       collectionObject = (JSONObject) jsonArray1.get(1);
-      assertEquals(newQueryCollectionDepth, collectionObject.length());
+      assertThat(collectionObject.length()).isEqualTo(newQueryCollectionDepth);
     });
   }
 
-  private static String generateJson(String key, String value) throws 
JSONException {
-    JSONObject jsonObject = new JSONObject();
-    jsonObject.put(key, value);
-    return jsonObject.toString();
-  }
-
   @Test
   public void testErrors() throws Exception {
-    this.managingNode.invoke("Test Error", () -> {
-      //Cache cache = getCache();
-      SystemManagementService service = (SystemManagementService) 
getManagementService();
-      DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
-
-      String invalidQuery = "Select * from " + PARTITIONED_REGION_NAME1;
-      String invalidQueryResult = bean.queryData(invalidQuery, null, 2);
-      assertThat(invalidQueryResult,
-        isJson(withJsonPath("$.message", 
equalTo(ManagementStrings.QUERY__MSG__INVALID_QUERY.toLocalizedString("Region 
mentioned in query probably missing /")))));
-
-      String regionsNotFoundQuery = "Select * from /PartitionedRegionName9 r1, 
PARTITIONED_REGION_NAME2 r2 where r1.ID = r2.ID";
-      String regionsNotFoundResult = bean.queryData(regionsNotFoundQuery, 
null, 2);
-      assertThat(regionsNotFoundResult,
-        isJson(withJsonPath("$.message", 
equalTo(ManagementStrings.QUERY__MSG__REGIONS_NOT_FOUND.toLocalizedString("/PartitionedRegionName9")))));
-
-      String region = "testTemp";
-      String regionsNotFoundOnMembersQuery = "Select * from /" + region;
-      RegionFactory regionFactory = 
getCache().createRegionFactory(RegionShortcut.REPLICATE);
-      regionFactory.create(region);
-      String regionsNotFoundOnMembersResult = 
bean.queryData(regionsNotFoundOnMembersQuery, member1.getId(), 2);
-      assertThat(regionsNotFoundOnMembersResult,
-        isJson(withJsonPath("$.message", 
equalTo(ManagementStrings.QUERY__MSG__REGIONS_NOT_FOUND_ON_MEMBERS.toLocalizedString("/"
 + region)))));
+    this.managerVM.invoke(this.testName.getMethodName(), () -> {
+      DistributedSystemMXBean distributedSystemMXBean = 
getSystemManagementService_tmp().getDistributedSystemMXBean();
+
+      String invalidQuery = "SELECT * FROM " + PARTITIONED_REGION_NAME1;
+      String invalidQueryResult = 
distributedSystemMXBean.queryData(invalidQuery, null, 2);
+      assertThat(invalidQueryResult, isJson(withJsonPath("$.message", 
equalTo(QUERY__MSG__INVALID_QUERY.toLocalizedString("Region mentioned in query 
probably missing /")))));
+
+      String nonexistentRegionName = this.testName.getMethodName() + 
"_NONEXISTENT_REGION";
+      String regionsNotFoundQuery = "SELECT * FROM /" + nonexistentRegionName 
+ " r1, PARTITIONED_REGION_NAME2 r2 WHERE r1.ID = r2.ID";
+      String regionsNotFoundResult = 
distributedSystemMXBean.queryData(regionsNotFoundQuery, null, 2);
+      assertThat(regionsNotFoundResult, isJson(withJsonPath("$.message", 
equalTo(QUERY__MSG__REGIONS_NOT_FOUND.toLocalizedString("/" + 
nonexistentRegionName)))));
+
+      String regionName = this.testName.getMethodName() + "_REGION";
+      String regionsNotFoundOnMembersQuery = "SELECT * FROM /" + regionName;
+
+      RegionFactory regionFactory = 
getCache_tmp().createRegionFactory(RegionShortcut.REPLICATE);
+      regionFactory.create(regionName);
+
+      String regionsNotFoundOnMembersResult = 
distributedSystemMXBean.queryData(regionsNotFoundOnMembersQuery, 
member1.getId(), 2);
+      assertThat(regionsNotFoundOnMembersResult, 
isJson(withJsonPath("$.message", 
equalTo(QUERY__MSG__REGIONS_NOT_FOUND_ON_MEMBERS.toLocalizedString("/" + 
regionName)))));
 
       String joinMissingMembersQuery = QUERIES[1];
-      String joinMissingMembersResult = 
bean.queryData(joinMissingMembersQuery, null, 2);
-      assertThat(joinMissingMembersResult,
-        isJson(withJsonPath("$.message", 
equalTo(ManagementStrings.QUERY__MSG__JOIN_OP_EX.toLocalizedString()))));
+      String joinMissingMembersResult = 
distributedSystemMXBean.queryData(joinMissingMembersQuery, null, 2);
+      assertThat(joinMissingMembersResult, isJson(withJsonPath("$.message", 
equalTo(QUERY__MSG__JOIN_OP_EX.toLocalizedString()))));
     });
   }
 
   @Test
   public void testNormalRegions() throws Exception {
-    this.managingNode.invoke("Test Error", () -> {
-      SystemManagementService service = (SystemManagementService) 
getManagementService();
-      DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
-      assertNotNull(bean);
+    this.managerVM.invoke(this.testName.getMethodName(), () -> {
+      DistributedSystemMXBean distributedSystemMXBean = 
getSystemManagementService_tmp().getDistributedSystemMXBean();
+
+      String normalRegionName1 = this.testName.getMethodName() + 
"_NORMAL_REGION_1";
+      String tempRegionName1 = this.testName.getMethodName() + 
"_TEMP_REGION_1";
 
-      final String testNormal = "testNormal";
-      final String testTemp = "testTemp";
+      String normalRegionName2 = this.testName.getMethodName() + 
"_NORMAL_REGION_2"; // to Reverse order of regions while getting Random region 
in QueryDataFunction [?]
+      String tempRegionName2 = this.testName.getMethodName() + 
"_TEMP_REGION_2";
 
-      final String testSNormal = "testSNormal"; // to Reverse order of regions 
while getting Random region in QueryDataFunction
-      final String testATemp = "testATemp";
+      Cache cache = getCache_tmp();
 
-      Cache cache = getCache();
       RegionFactory regionFactory = 
cache.createRegionFactory(RegionShortcut.LOCAL_HEAP_LRU);
-      regionFactory.create(testNormal);
-      regionFactory.create(testSNormal);
+      regionFactory.create(normalRegionName1);
+      regionFactory.create(normalRegionName2);
 
-      Region region = cache.getRegion("/" + testNormal);
-      assertTrue(region.getAttributes().getDataPolicy() == DataPolicy.NORMAL);
+      Region region = cache.getRegion("/" + normalRegionName1);
+      
assertThat(region.getAttributes().getDataPolicy()).isEqualTo(DataPolicy.NORMAL);
 
       RegionFactory regionFactory1 = 
cache.createRegionFactory(RegionShortcut.REPLICATE);
-      regionFactory1.create(testTemp);
-      regionFactory1.create(testATemp);
-      String query1 = "Select * from /testTemp r1,/testNormal r2 where r1.ID = 
r2.ID";
-      String query2 = "Select * from /testSNormal r1,/testATemp r2 where r1.ID 
= r2.ID";
-      String query3 = "Select * from /testSNormal";
+      regionFactory1.create(tempRegionName1);
+      regionFactory1.create(tempRegionName2);
 
-      bean.queryDataForCompressedResult(query1, null, 2);
-      bean.queryDataForCompressedResult(query2, null, 2);
-      bean.queryDataForCompressedResult(query3, null, 2);
+      String query1 = "SELECT * FROM /" + tempRegionName1 + " r1, /" + 
normalRegionName1 + " r2 WHERE r1.ID = r2.ID";
+      String query2 = "SELECT * FROM /" + normalRegionName2 + " r1, /" + 
tempRegionName2 + " r2 WHERE r1.ID = r2.ID";
+      String query3 = "SELECT * FROM /" + normalRegionName2;
+
+      distributedSystemMXBean.queryDataForCompressedResult(query1, null, 2);
+      distributedSystemMXBean.queryDataForCompressedResult(query2, null, 2);
+      distributedSystemMXBean.queryDataForCompressedResult(query3, null, 2);
 
       // TODO: assert results of queryDataForCompressedResult?
     });
@@ -361,15 +351,13 @@ public class QueryDataDUnitTest extends 
ManagementTestBase {
 
   @Test
   public void testRegionsLocalDataSet() throws Exception {
-    final String PartitionedRegionName6 = "LocalDataSetTest";
+    String partitionedRegionName = this.testName.getMethodName() + 
"_PARTITIONED_REGION";
 
-    final String[] valArray1 = new String[] { "val1", "val2", "val3" };
-    final String[] valArray2 = new String[] { "val4", "val5", "val6" };
+    String[] values1 = new String[] { "val1", "val2", "val3" };
+    String[] values2 = new String[] { "val4", "val5", "val6" };
 
-    this.managedNode1.invoke("testRegionsLocalDataSet:Create Region", () -> {
-      Cache cache = getCache();
+    this.memberVMs[0].invoke(this.testName.getMethodName() + " Create Region", 
() -> {
       PartitionAttributesFactory partitionAttributesFactory = new 
PartitionAttributesFactory();
-
       partitionAttributesFactory.setRedundantCopies(2).setTotalNumBuckets(12);
 
       List<FixedPartitionAttributes> fixedPartitionAttributesList = 
createFixedPartitionList(1);
@@ -378,19 +366,16 @@ public class QueryDataDUnitTest extends 
ManagementTestBase {
       }
       partitionAttributesFactory.setPartitionResolver(new 
SingleHopQuarterPartitionResolver());
 
-      RegionFactory regionFactory = 
cache.createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(partitionAttributesFactory.create());
-
-      Region region = regionFactory.create(PartitionedRegionName6);
+      RegionFactory regionFactory = 
getCache_tmp().createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(partitionAttributesFactory.create());
+      Region region = regionFactory.create(partitionedRegionName);
 
-      for (int i = 0; i < valArray1.length; i++) {
-        region.put(new Date(2013, 1, i + 5), valArray1[i]);
+      for (int i = 0; i < values1.length; i++) {
+        region.put(getDate(2013, 1, i + 5), values1[i]);
       }
     });
 
-    this.managedNode2.invoke("testRegionsLocalDataSet: Create Region", () -> {
-      Cache cache = getCache();
+    this.memberVMs[1].invoke(this.testName.getMethodName() + " Create Region", 
() -> {
       PartitionAttributesFactory partitionAttributesFactory = new 
PartitionAttributesFactory();
-
       partitionAttributesFactory.setRedundantCopies(2).setTotalNumBuckets(12);
 
       List<FixedPartitionAttributes> fixedPartitionAttributesList = 
createFixedPartitionList(2);
@@ -399,19 +384,16 @@ public class QueryDataDUnitTest extends 
ManagementTestBase {
       }
       partitionAttributesFactory.setPartitionResolver(new 
SingleHopQuarterPartitionResolver());
 
-      RegionFactory regionFactory = 
cache.createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(partitionAttributesFactory.create());
-
-      Region region = regionFactory.create(PartitionedRegionName6);
+      RegionFactory regionFactory = 
getCache_tmp().createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(partitionAttributesFactory.create());
+      Region region = regionFactory.create(partitionedRegionName);
 
-      for (int i = 0; i < valArray2.length; i++) {
-        region.put(new Date(2013, 5, i + 5), valArray2[i]);
+      for (int i = 0; i < values2.length; i++) {
+        region.put(getDate(2013, 5, i + 5), values2[i]);
       }
     });
 
-    this.managedNode3.invoke("testRegionsLocalDataSet: Create Region", () -> {
-      Cache cache = getCache();
+    this.memberVMs[2].invoke(this.testName.getMethodName() + " Create Region", 
() -> {
       PartitionAttributesFactory partitionAttributesFactory = new 
PartitionAttributesFactory();
-
       partitionAttributesFactory.setRedundantCopies(2).setTotalNumBuckets(12);
 
       List<FixedPartitionAttributes> fixedPartitionAttributesList = 
createFixedPartitionList(3);
@@ -420,95 +402,92 @@ public class QueryDataDUnitTest extends 
ManagementTestBase {
       }
       partitionAttributesFactory.setPartitionResolver(new 
SingleHopQuarterPartitionResolver());
 
-      RegionFactory regionFactory = 
cache.createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(partitionAttributesFactory.create());
-
-      Region region = regionFactory.create(PartitionedRegionName6);
+      RegionFactory regionFactory = 
getCache_tmp().createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(partitionAttributesFactory.create());
+      regionFactory.create(partitionedRegionName);
     });
 
-    final List<String> member1RealData = managedNode1.invoke(() -> 
getLocalDataSet(PartitionedRegionName6));
-    final List<String> member2RealData = managedNode2.invoke(() -> 
getLocalDataSet(PartitionedRegionName6));
-    final List<String> member3RealData = managedNode3.invoke(() -> 
getLocalDataSet(PartitionedRegionName6));
-
-    this.managingNode.invoke("testRegionsLocalDataSet", () -> {
-      SystemManagementService service = (SystemManagementService) 
getManagementService();
-      DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
-      assertNotNull(bean);
+    final List<String> member1RealData = this.memberVMs[0].invoke(() -> 
getLocalDataSet(partitionedRegionName));
+    final List<String> member2RealData = this.memberVMs[1].invoke(() -> 
getLocalDataSet(partitionedRegionName));
+    final List<String> member3RealData = this.memberVMs[2].invoke(() -> 
getLocalDataSet(partitionedRegionName));
 
-      DistributedRegionMXBean regionMBean = 
MBeanUtil.getDistributedRegionMbean("/" + PartitionedRegionName6, 3);
+    this.managerVM.invoke(this.testName.getMethodName(), () -> {
+      DistributedSystemMXBean distributedSystemMXBean = 
getSystemManagementService_tmp().getDistributedSystemMXBean();
+      DistributedRegionMXBean distributedRegionMXBean = 
awaitDistributedRegionMXBean("/" + partitionedRegionName, 3);
 
-      Wait.waitForCriterion(new WaitCriterion() {
-        @Override
-        public String description() {
-          return "Waiting for all entries to get reflected at managing node";
-        }
-        @Override
-        public boolean done() {
-          return regionMBean.getSystemRegionEntryCount() == (valArray1.length 
+ valArray2.length);
-        }
-      }, MAX_WAIT, 1000, true);
+      String alias = "Waiting for all entries to get reflected at managing 
node";
+      int expectedEntryCount = values1.length + values2.length;
+      await(alias).until(() -> 
assertThat(distributedRegionMXBean.getSystemRegionEntryCount()).isEqualTo(expectedEntryCount));
 
-      String query = "Select * from /" + PartitionedRegionName6;
+      String query = "Select * from /" + partitionedRegionName;
 
-      String member1Result = bean.queryData(query, member1.getId(), 0);
-      assertIsValidJson(member1Result);
+      String member1Result = distributedSystemMXBean.queryData(query, 
member1.getId(), 0);
+      verifyJsonIsValid(member1Result);
 
-      String member2Result = bean.queryData(query, member2.getId(), 0);
-      assertIsValidJson(member2Result);
+      String member2Result = distributedSystemMXBean.queryData(query, 
member2.getId(), 0);
+      verifyJsonIsValid(member2Result);
 
-      String member3Result = bean.queryData(query, member3.getId(), 0);
-      assertIsValidJson(member3Result);
+      String member3Result = distributedSystemMXBean.queryData(query, 
member3.getId(), 0);
+      verifyJsonIsValid(member3Result);
 
       for (String val : member1RealData) {
-        assertTrue(member1Result.contains(val));
+        assertThat(member1Result).contains(val);
       }
+
       for (String val : member2RealData) {
-        assertTrue(member2Result.contains(val));
+        assertThat(member2Result).contains(val);
       }
-      assertTrue(member3Result.contains("No Data Found"));
+
+      assertThat(member3Result).contains("No Data Found");
     });
   }
 
-  private static void assertIsValidJson(final String jsonString) throws 
JSONException {
+  private Date getDate(final int year, final int month, final int date) {
+    Calendar calendar = Calendar.getInstance();
+    calendar.set(year, month, date);
+    return calendar.getTime();
+  }
+
+  private void verifyJsonIsValid(final String jsonString) throws JSONException 
{
     assertThat(jsonString, isJson());
     assertThat(jsonString, hasJsonPath("$.result"));
-    assertThat(new JSONObject(jsonString), is(notNullValue()));
+    assertThat(new JSONObject(jsonString)).isNotNull();
   }
 
-  private void putDataInRegion(final String regionName,
-                               final Object[] portfolio,
-                               final int from,
-                               final int to) {
-    Cache cache = CacheFactory.getAnyInstance();
-    Region region = cache.getRegion(regionName);
+  private void putDataInRegion(final String regionName, final Object[] 
portfolio, final int from, final int to) {
+    Region region = getCache_tmp().getRegion(regionName);
     for (int i = from; i < to; i++) {
       region.put(new Integer(i), portfolio[i]);
     }
   }
 
-  private void fillValuesInRegions() {
+  private void generateValuesInRegions() {
+    int COUNT_DESTINATION = 30;
+    int COUNT_FROM = 0;
+
     // Create common Portfolios and NewPortfolios
     final Portfolio[] portfolio = 
createPortfoliosAndPositions(COUNT_DESTINATION);
 
     // Fill local region
-    managedNode1.invoke(() -> putDataInRegion(LOCAL_REGION_NAME, portfolio, 
COUNT_FROM, COUNT_DESTINATION));
+    this.memberVMs[0].invoke(() -> putDataInRegion(LOCAL_REGION_NAME, 
portfolio, COUNT_FROM, COUNT_DESTINATION));
 
     // Fill replicated region
-    managedNode1.invoke(() -> putDataInRegion(REPLICATED_REGION_NAME1, 
portfolio, COUNT_FROM, COUNT_DESTINATION));
-    managedNode2.invoke(() -> putDataInRegion(REPLICATED_REGION_NAME2, 
portfolio, COUNT_FROM, COUNT_DESTINATION));
+    this.memberVMs[0].invoke(() -> putDataInRegion(REPLICATE_REGION_NAME1, 
portfolio, COUNT_FROM, COUNT_DESTINATION));
+    this.memberVMs[1].invoke(() -> putDataInRegion(REPLICATE_REGION_NAME2, 
portfolio, COUNT_FROM, COUNT_DESTINATION));
 
     // Fill Partition Region
-    managedNode1.invoke(() -> putDataInRegion(PARTITIONED_REGION_NAME1, 
portfolio, COUNT_FROM, COUNT_DESTINATION));
-    managedNode1.invoke(() -> putDataInRegion(PARTITIONED_REGION_NAME2, 
portfolio, COUNT_FROM, COUNT_DESTINATION));
-    managedNode1.invoke(() -> putDataInRegion(PARTITIONED_REGION_NAME3, 
portfolio, COUNT_FROM, COUNT_DESTINATION));
-    managedNode1.invoke(() -> putDataInRegion(PARTITIONED_REGION_NAME4, 
portfolio, COUNT_FROM, COUNT_DESTINATION));
-    managedNode1.invoke(() -> putDataInRegion(PARTITIONED_REGION_NAME5, 
portfolio, COUNT_FROM, COUNT_DESTINATION));
+    this.memberVMs[0].invoke(() -> putDataInRegion(PARTITIONED_REGION_NAME1, 
portfolio, COUNT_FROM, COUNT_DESTINATION));
+    this.memberVMs[0].invoke(() -> putDataInRegion(PARTITIONED_REGION_NAME2, 
portfolio, COUNT_FROM, COUNT_DESTINATION));
+    this.memberVMs[0].invoke(() -> putDataInRegion(PARTITIONED_REGION_NAME3, 
portfolio, COUNT_FROM, COUNT_DESTINATION));
+    this.memberVMs[0].invoke(() -> putDataInRegion(PARTITIONED_REGION_NAME4, 
portfolio, COUNT_FROM, COUNT_DESTINATION));
+    this.memberVMs[0].invoke(() -> putDataInRegion(PARTITIONED_REGION_NAME5, 
portfolio, COUNT_FROM, COUNT_DESTINATION));
 
-    managedNode1.invoke(() -> putPdxInstances(REPLICATED_REGION_NAME3));
+    this.memberVMs[0].invoke(() -> putPdxInstances(REPLICATE_REGION_NAME3));
   }
 
   private void putPdxInstances(final String regionName) throws CacheException {
+    Region region = getCache_tmp().getRegion(regionName);
+
     PdxInstanceFactory pdxInstanceFactory = 
PdxInstanceFactoryImpl.newCreator("Portfolio", false);
-    Region region = getCache().getRegion(regionName);
     pdxInstanceFactory.writeInt("ID", 111);
     pdxInstanceFactory.writeString("status", "active");
     pdxInstanceFactory.writeString("secId", "IBM");
@@ -538,89 +517,186 @@ public class QueryDataDUnitTest extends 
ManagementTestBase {
   }
 
   private void putBigInstances(final String regionName) {
-    Region region = getCache().getRegion(regionName);
+    Region region = getCache_tmp().getRegion(regionName);
 
     for (int i = 0; i < 1200; i++) {
       List<String> bigCollection = new ArrayList<>();
       for (int j = 0; j < 200; j++) {
-        bigCollection.add("BigColl_1_ElemenNo_" + j);
+        bigCollection.add(BIG_COLLECTION_ELEMENT_ + j);
       }
-      region.put("BigColl_1_" + i, bigCollection);
+      region.put(BIG_COLLECTION_ + i, bigCollection);
     }
   }
 
-  private void createRegionsInNodes() throws InterruptedException {
+  private void createLocalRegion() {
+    
getCache_tmp().createRegionFactory(RegionShortcut.LOCAL).create(LOCAL_REGION_NAME);
+  }
+
+  private void createReplicatedRegion() {
+    
getCache_tmp().createRegionFactory(RegionShortcut.REPLICATE).create(REPLICATE_REGION_NAME1);
+  }
+
+  private void createColocatedPR() {
+    PartitionResolver testKeyBasedResolver = new TestPartitionResolver();
+    
getCache_tmp().createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(new
 
PartitionAttributesFactory().setTotalNumBuckets(NUM_OF_BUCKETS).setPartitionResolver(testKeyBasedResolver).create()).create(PARTITIONED_REGION_NAME1);
+    
getCache_tmp().createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(new
 
PartitionAttributesFactory().setTotalNumBuckets(NUM_OF_BUCKETS).setPartitionResolver(testKeyBasedResolver).setColocatedWith(PARTITIONED_REGION_NAME1).create()).create(PARTITIONED_REGION_NAME2);
+    
getCache_tmp().createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(new
 
PartitionAttributesFactory().setTotalNumBuckets(NUM_OF_BUCKETS).setPartitionResolver(testKeyBasedResolver).setColocatedWith(PARTITIONED_REGION_NAME2).create()).create(PARTITIONED_REGION_NAME3);
+    
getCache_tmp().createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(new
 
PartitionAttributesFactory().setTotalNumBuckets(NUM_OF_BUCKETS).setPartitionResolver(testKeyBasedResolver).create()).create(PARTITIONED_REGION_NAME4);
 // not collocated
+    
getCache_tmp().createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(new
 
PartitionAttributesFactory().setTotalNumBuckets(NUM_OF_BUCKETS).setPartitionResolver(testKeyBasedResolver).setColocatedWith(PARTITIONED_REGION_NAME4).create()).create(PARTITIONED_REGION_NAME5);
 // collocated with 4
+  }
 
+  private AsyncInvocation createDistributedRegionAsync_tmp(final VM memberVM, 
final String regionName) {
+    return memberVM.invokeAsync("createDistributedRegionAsync_tmp", () -> {
+      
getCache_tmp().createRegionFactory(RegionShortcut.REPLICATE).create(regionName);
+    });
+  }
+
+  private void createDistributedRegion_tmp(final VM memberVM, final String 
regionName) throws InterruptedException, TimeoutException, ExecutionException {
+    createDistributedRegionAsync_tmp(memberVM, regionName).await(2, MINUTES);
+  }
+
+  private void createRegionsInNodes() throws InterruptedException, 
TimeoutException, ExecutionException {
     // Create local Region on servers
-    managedNode1.invoke(() -> 
QueryUsingFunctionContextDUnitTest.createLocalRegion());
+    this.memberVMs[0].invoke(() -> createLocalRegion());
 
     // Create ReplicatedRegion on servers
-    managedNode1.invoke(() -> 
QueryUsingFunctionContextDUnitTest.createReplicatedRegion());
-    managedNode2.invoke(() -> 
QueryUsingFunctionContextDUnitTest.createReplicatedRegion());
-    managedNode3.invoke(() -> 
QueryUsingFunctionContextDUnitTest.createReplicatedRegion());
-
-    createDistributedRegion(managedNode2, REPLICATED_REGION_NAME2);
-    createDistributedRegion(managedNode1, REPLICATED_REGION_NAME3);
-    createDistributedRegion(managedNode1, REPLICATED_REGION_NAME4);
-
-    // Create two colocated PartitionedRegions On Servers.
-    managedNode1.invoke(() -> 
QueryUsingFunctionContextDUnitTest.createColocatedPR());
-    managedNode2.invoke(() -> 
QueryUsingFunctionContextDUnitTest.createColocatedPR());
-    managedNode3.invoke(() -> 
QueryUsingFunctionContextDUnitTest.createColocatedPR());
-
-    this.managingNode.invoke("Wait for all Region Proxies to get replicated", 
() -> {
-      Cache cache = getCache();
-      SystemManagementService service = (SystemManagementService) 
getManagementService();
-      DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
-
-      MBeanUtil.getDistributedRegionMbean("/" + PARTITIONED_REGION_NAME1, 3);
-      MBeanUtil.getDistributedRegionMbean("/" + PARTITIONED_REGION_NAME2, 3);
-      MBeanUtil.getDistributedRegionMbean("/" + PARTITIONED_REGION_NAME3, 3);
-      MBeanUtil.getDistributedRegionMbean("/" + PARTITIONED_REGION_NAME4, 3);
-      MBeanUtil.getDistributedRegionMbean("/" + PARTITIONED_REGION_NAME5, 3);
-      MBeanUtil.getDistributedRegionMbean("/" + REPLICATED_REGION_NAME1, 3);
-      MBeanUtil.getDistributedRegionMbean("/" + REPLICATED_REGION_NAME2, 1);
-      MBeanUtil.getDistributedRegionMbean("/" + REPLICATED_REGION_NAME3, 1);
-      MBeanUtil.getDistributedRegionMbean("/" + REPLICATED_REGION_NAME4, 1);
+    this.memberVMs[0].invoke(() -> createReplicatedRegion());
+    this.memberVMs[1].invoke(() -> createReplicatedRegion());
+    this.memberVMs[2].invoke(() -> createReplicatedRegion());
+
+    createDistributedRegion_tmp(this.memberVMs[1], REPLICATE_REGION_NAME2);
+    createDistributedRegion_tmp(this.memberVMs[0], REPLICATE_REGION_NAME3);
+    createDistributedRegion_tmp(this.memberVMs[0], REPLICATE_REGION_NAME4);
+
+    // Create two co-located PartitionedRegions On Servers.
+    this.memberVMs[0].invoke(() -> createColocatedPR());
+    this.memberVMs[1].invoke(() -> createColocatedPR());
+    this.memberVMs[2].invoke(() -> createColocatedPR());
+
+    this.managerVM.invoke("Wait for all Region Proxies to get replicated", () 
-> {
+      awaitDistributedRegionMXBean("/" + PARTITIONED_REGION_NAME1, 3);
+      awaitDistributedRegionMXBean("/" + PARTITIONED_REGION_NAME2, 3);
+      awaitDistributedRegionMXBean("/" + PARTITIONED_REGION_NAME3, 3);
+      awaitDistributedRegionMXBean("/" + PARTITIONED_REGION_NAME4, 3);
+      awaitDistributedRegionMXBean("/" + PARTITIONED_REGION_NAME5, 3);
+      awaitDistributedRegionMXBean("/" + REPLICATE_REGION_NAME1, 3);
+      awaitDistributedRegionMXBean("/" + REPLICATE_REGION_NAME2, 1);
+      awaitDistributedRegionMXBean("/" + REPLICATE_REGION_NAME3, 1);
+      awaitDistributedRegionMXBean("/" + REPLICATE_REGION_NAME4, 1);
     });
   }
 
-  private static List<String> getLocalDataSet(final String region) {
-    PartitionedRegion partitionedRegion = 
PartitionedRegionHelper.getPartitionedRegion(region, 
GemFireCacheImpl.getExisting());
+  private List<String> getLocalDataSet(final String region) {
+    PartitionedRegion partitionedRegion = 
PartitionedRegionHelper.getPartitionedRegion(region, getCache_tmp());
     Set<BucketRegion> localPrimaryBucketRegions = 
partitionedRegion.getDataStore().getAllLocalPrimaryBucketRegions();
     List<String> allPrimaryValues = new ArrayList<>();
 
-    for (BucketRegion brRegion : localPrimaryBucketRegions) {
-      for (Object obj : brRegion.values()) {
-        allPrimaryValues.add((String) obj);
+    for (BucketRegion bucketRegion : localPrimaryBucketRegions) {
+      for (Object value : bucketRegion.values()) {
+        allPrimaryValues.add((String) value);
       }
     }
 
     return allPrimaryValues;
   }
 
-  /**
-   * creates a Fixed Partition List to be used for Fixed Partition Region
-   *
-   * @param primaryIndex index for each fixed partition
-   */
-  private static List<FixedPartitionAttributes> createFixedPartitionList(final 
int primaryIndex) {
+  private List<FixedPartitionAttributes> createFixedPartitionList(final int 
primaryIndex) {
     List<FixedPartitionAttributes> fixedPartitionAttributesList = new 
ArrayList<>();
     if (primaryIndex == 1) {
-      
fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q1",
 true, 3));
-      
fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q2",
 3));
-      
fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q3",
 3));
+      fixedPartitionAttributesList.add(createFixedPartition("Q1", true, 3));
+      fixedPartitionAttributesList.add(createFixedPartition("Q2", 3));
+      fixedPartitionAttributesList.add(createFixedPartition("Q3", 3));
     }
     if (primaryIndex == 2) {
-      
fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q1",
 3));
-      
fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q2",
 true, 3));
-      
fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q3",
 3));
+      fixedPartitionAttributesList.add(createFixedPartition("Q1", 3));
+      fixedPartitionAttributesList.add(createFixedPartition("Q2", true, 3));
+      fixedPartitionAttributesList.add(createFixedPartition("Q3", 3));
     }
     if (primaryIndex == 3) {
-      
fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q1",
 3));
-      
fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q2",
 3));
-      
fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q3",
 true, 3));
+      fixedPartitionAttributesList.add(createFixedPartition("Q1", 3));
+      fixedPartitionAttributesList.add(createFixedPartition("Q2", 3));
+      fixedPartitionAttributesList.add(createFixedPartition("Q3", true, 3));
     }
     return fixedPartitionAttributesList;
   }
+
+  private void createMembersAndThenManager_tmp() throws Exception {
+    initManagement(false);
+  }
+
+  private Cache getCache_tmp() {
+    return getCache();
+  }
+
+  private SystemManagementService getSystemManagementService_tmp() {
+    return (SystemManagementService) getManagementService();
+  }
+
+  private ManagementService getManagementService_tmp() {
+    return getManagementService();
+  }
+
+  private DistributedMember getDistributedMember_tmp(final VM memberVM) {
+    return getMember(memberVM);
+  }
+
+  private MemberMXBean awaitMemberMXBeanProxy(final DistributedMember member) {
+    SystemManagementService service = getSystemManagementService_tmp();
+    ObjectName objectName = service.getMemberMBeanName(member);
+    String alias = "awaiting MemberMXBean proxy for " + member;
+
+    await(alias).until(() -> assertThat(service.getMBeanProxy(objectName, 
MemberMXBean.class)).isNotNull());
+
+    return service.getMBeanProxy(objectName, MemberMXBean.class);
+  }
+
+  private DistributedSystemMXBean awaitDistributedSystemMXBean() {
+    SystemManagementService service = getSystemManagementService_tmp();
+
+    await().until(() -> 
assertThat(service.getDistributedSystemMXBean()).isNotNull());
+
+    return service.getDistributedSystemMXBean();
+  }
+
+  private DistributedRegionMXBean awaitDistributedRegionMXBean(final String 
name) {
+    SystemManagementService service = getSystemManagementService_tmp();
+
+    await().until(() -> 
assertThat(service.getDistributedRegionMXBean(name)).isNotNull());
+
+    return service.getDistributedRegionMXBean(name);
+  }
+
+  private DistributedRegionMXBean awaitDistributedRegionMXBean(final String 
name, final int memberCount) {
+    SystemManagementService service = getSystemManagementService_tmp();
+
+    await().until(() -> 
assertThat(service.getDistributedRegionMXBean(name)).isNotNull());
+    await().until(() -> 
assertThat(service.getDistributedRegionMXBean(name).getMemberCount()).isEqualTo(memberCount));
+
+    return service.getDistributedRegionMXBean(name);
+  }
+
+  private ConditionFactory await() {
+    return Awaitility.await().atMost(2, MINUTES);
+  }
+
+  private ConditionFactory await(final String alias) {
+    return Awaitility.await(alias).atMost(2, MINUTES);
+  }
+
+  private class TestPartitionResolver implements PartitionResolver {
+
+    @Override
+    public void close() {
+    }
+
+    @Override
+    public Serializable getRoutingObject(EntryOperation opDetails) {
+      return (((Integer)opDetails.getKey()).intValue() % NUM_OF_BUCKETS);
+    }
+
+    @Override
+    public String getName() {
+      return getClass().getName();
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/fa48aca0/geode-core/src/test/java/org/apache/geode/management/RegionManagementDUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/management/RegionManagementDUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/management/RegionManagementDUnitTest.java
index 331f21b..ff643d4 100644
--- 
a/geode-core/src/test/java/org/apache/geode/management/RegionManagementDUnitTest.java
+++ 
b/geode-core/src/test/java/org/apache/geode/management/RegionManagementDUnitTest.java
@@ -125,17 +125,17 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
 
     for (VM memberVM : this.memberVMs) {
       createDistributedRegion(memberVM, REGION_NAME);
-      validateReplicateRegionAfterCreate(memberVM);
+      verifyReplicateRegionAfterCreate(memberVM);
     }
 
     verifyRemoteDistributedRegion(this.managerVM, 3);
 
     for (VM memberVM : this.memberVMs) {
       closeRegion(memberVM, REGION_PATH);
-      validateReplicatedRegionAfterClose(memberVM);
+      verifyReplicatedRegionAfterClose(memberVM);
     }
 
-    ensureProxyCleanup(this.managerVM);
+    verifyProxyCleanup(this.managerVM);
   }
 
   /**
@@ -154,14 +154,14 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
 
     for (VM memberVM : this.memberVMs) {
       createPartitionRegion(memberVM, PARTITIONED_REGION_NAME);
-      validatePartitionRegionAfterCreate(memberVM);
+      verifyPartitionRegionAfterCreate(memberVM);
     }
 
-    validateRemotePartitionRegion(this.managerVM);
+    verifyRemotePartitionRegion(this.managerVM);
 
     for (VM memberVM : this.memberVMs) {
       closeRegion(memberVM, PARTITIONED_REGION_PATH);
-      validatePartitionRegionAfterClose(memberVM);
+      verifyPartitionRegionAfterClose(memberVM);
     }
   }
 
@@ -176,18 +176,18 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
   public void testFixedPRRegionMBean() throws Exception {
     initManagement(false);
 
-    // Adding notif listener for remote cache memberVMs
+    // Adding notification listener for remote cache memberVMs
     addMemberNotificationListener(this.managerVM); // TODO: what does this do 
for us?
 
     int primaryIndex = 0;
-    for (VM vm : this.memberVMs) {
+    for (VM memberVM : this.memberVMs) {
       List<FixedPartitionAttributes> fixedPartitionAttributesList = 
createFixedPartitionList(primaryIndex + 1);
-      vm.invoke(() -> 
createFixedPartitionRegion(fixedPartitionAttributesList));
+      memberVM.invoke(() -> 
createFixedPartitionRegion(fixedPartitionAttributesList));
       primaryIndex++;
     }
 
-//    // Workaround for bug 46683. Renable validation when bug is fixed.
-//    validateRemoteFixedPartitionRegion(this.managerVM);
+//    // TODO: Workaround for bug 46683. Reenable validation when bug is fixed.
+//    verifyRemoteFixedPartitionRegion(this.managerVM);
 //
 //    for (VM vm : this.memberVMs) {
 //      closeFixedPartitionRegion(vm);
@@ -202,49 +202,49 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
   public void testRegionAggregate() throws Exception {
     initManagement(true);
 
-    // Adding notif listener for remote cache memberVMs
+    // Adding notification listener for remote cache memberVMs
     addDistributedSystemNotificationListener(this.managerVM); // TODO: what 
does this do for us?
 
-    for (VM vm : this.memberVMs) {
-      createDistributedRegion(vm, REGION_NAME);
+    for (VM memberVM : this.memberVMs) {
+      createDistributedRegion(memberVM, REGION_NAME);
     }
 
-    validateDistributedMBean(this.managerVM, 3);
+    verifyDistributedMBean(this.managerVM, 3);
     createDistributedRegion(this.managerVM, REGION_NAME);
-    validateDistributedMBean(this.managerVM, 4);
+    verifyDistributedMBean(this.managerVM, 4);
 
-    for (VM vm : this.memberVMs) {
-      closeRegion(vm, REGION_PATH);
+    for (VM memberVM : this.memberVMs) {
+      closeRegion(memberVM, REGION_PATH);
     }
 
-    ensureProxyCleanup(this.managerVM);
+    verifyProxyCleanup(this.managerVM);
 
-    validateDistributedMBean(this.managerVM, 1);
+    verifyDistributedMBean(this.managerVM, 1);
     closeRegion(this.managerVM, REGION_PATH);
-    validateDistributedMBean(this.managerVM, 0);
+    verifyDistributedMBean(this.managerVM, 0);
   }
 
   @Test
   public void testNavigationAPIS() throws Exception {
     initManagement(true);
 
-    for (VM vm : this.memberVMs) {
-      createDistributedRegion(vm, REGION_NAME);
-      createPartitionRegion(vm, PARTITIONED_REGION_NAME);
+    for (VM memberVM : this.memberVMs) {
+      createDistributedRegion(memberVM, REGION_NAME);
+      createPartitionRegion(memberVM, PARTITIONED_REGION_NAME);
     }
 
     createDistributedRegion(this.managerVM, REGION_NAME);
     createPartitionRegion(this.managerVM, PARTITIONED_REGION_NAME);
     List<String> memberIds = new ArrayList<>();
 
-    for (VM vm : this.memberVMs) {
-      memberIds.add(getMemberId(vm));
+    for (VM memberVM : this.memberVMs) {
+      memberIds.add(getMemberId(memberVM));
     }
 
-    checkNavigationApis(this.managerVM, memberIds);
+    verifyNavigationApis(this.managerVM, memberIds);
 
-    for (VM vm : this.memberVMs) {
-      closeRegion(vm, REGION_PATH);
+    for (VM memberVM : this.memberVMs) {
+      closeRegion(memberVM, REGION_PATH);
     }
     closeRegion(this.managerVM, REGION_PATH);
   }
@@ -254,18 +254,18 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
   public void testSubRegions() throws Exception {
     initManagement(false);
 
-    for (VM vm : this.memberVMs) {
-      createLocalRegion(vm, LOCAL_REGION_NAME);
-      createSubRegion(vm, LOCAL_REGION_NAME, LOCAL_SUB_REGION_NAME);
+    for (VM memberVM : this.memberVMs) {
+      createLocalRegion(memberVM, LOCAL_REGION_NAME);
+      createSubRegion(memberVM, LOCAL_REGION_NAME, LOCAL_SUB_REGION_NAME);
     }
 
-    for (VM vm : this.memberVMs) {
-      checkSubRegions(vm, LOCAL_SUB_REGION_PATH);
+    for (VM memberVM : this.memberVMs) {
+      verifySubRegions(memberVM, LOCAL_SUB_REGION_PATH);
     }
 
-    for (VM vm : this.memberVMs) {
-      closeRegion(vm, LOCAL_REGION_NAME);
-      checkNullRegions(vm, LOCAL_SUB_REGION_NAME);
+    for (VM memberVM : this.memberVMs) {
+      closeRegion(memberVM, LOCAL_REGION_NAME);
+      verifyNullRegions(memberVM, LOCAL_SUB_REGION_NAME);
     }
   }
 
@@ -274,34 +274,28 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
     initManagement(false);
     createSpecialRegion(this.memberVMs[0]);
     DistributedMember member = getMember(this.memberVMs[0]);
-    checkSpecialRegion(this.managerVM, member);
+    verifySpecialRegion(this.managerVM);
   }
 
   @Test
   public void testLruStats() throws Exception {
     initManagement(false);
-    for (VM vm : this.memberVMs) {
-      createDiskRegion(vm);
+    for (VM memberVM : this.memberVMs) {
+      createDiskRegion(memberVM);
     }
-    checkEntrySize(this.managerVM, 3);
+    verifyEntrySize(this.managerVM, 3);
   }
 
-  /**
-   * Invoked in all VMs
-   */
-  private void closeRegion(final VM vm, final String regionPath) {
-    vm.invoke("closeRegion", () -> {
+  private void closeRegion(final VM anyVM, final String regionPath) {
+    anyVM.invoke("closeRegion", () -> {
       GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
       Region region = cache.getRegion(regionPath);
       region.close();
     });
   }
 
-  /**
-   * Invoked in managedNode VM
-   */
-  private void createSpecialRegion(final VM vm) throws Exception {
-    vm.invoke("createSpecialRegion", () -> {
+  private void createSpecialRegion(final VM memberVM) throws Exception {
+    memberVM.invoke("createSpecialRegion", () -> {
       Cache cache = getCache();
       AttributesFactory attributesFactory = new AttributesFactory();
       attributesFactory.setValueConstraint(Portfolio.class);
@@ -312,21 +306,15 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
     });
   }
 
-  /**
-   * Invoked in this.managerVM VM
-   */
-  private void checkSpecialRegion(final VM vm, final DistributedMember member) 
throws Exception {
-    vm.invoke("checkSpecialRegion", () -> {
+  private void verifySpecialRegion(final VM managerVM) throws Exception {
+    managerVM.invoke("verifySpecialRegion", () -> {
       MBeanUtil.getDistributedRegionMbean("/p-os", 1); // TODO: do something?
       MBeanUtil.getDistributedRegionMbean("/p_os", 1);
     });
   }
 
-  /**
-   * Invoked in managedNode VMs
-   */
-  private void createDiskRegion(final VM vm) throws Exception {
-    vm.invoke("createDiskRegion", () -> {
+  private void createDiskRegion(final VM memberVM) throws Exception {
+    memberVM.invoke("createDiskRegion", () -> {
       AttributesFactory factory = new AttributesFactory();
       factory.setScope(Scope.LOCAL);
       
factory.setEvictionAttributes(EvictionAttributes.createLRUMemoryAttributes(20, 
new TestObjectSizerImpl(), EvictionAction.LOCAL_DESTROY));
@@ -349,42 +337,30 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
     });
   }
 
-  /**
-   * Invoked in this.managerVM VM
-   */
-  private void checkEntrySize(final VM vm, final int expectedMembers) throws 
Exception {
-    vm.invoke("checkEntrySize", () -> {
+  private void verifyEntrySize(final VM managerVM, final int expectedMembers) 
throws Exception {
+    managerVM.invoke("verifyEntrySize", () -> {
       DistributedRegionMXBean distributedRegionMXBean = 
MBeanUtil.getDistributedRegionMbean(REGION_PATH, expectedMembers);
       assertNotNull(distributedRegionMXBean);
       assertTrue(distributedRegionMXBean.getEntrySize() > 0);
     });
   }
 
-  /**
-   * Invoked in managedNode VMs
-   */
-  private void checkSubRegions(final VM vm, final String subRegionPath) throws 
Exception {
-    vm.invoke("checkSubRegions", () -> {
+  private void verifySubRegions(final VM memberVM, final String subRegionPath) 
throws Exception {
+    memberVM.invoke("verifySubRegions", () -> {
       RegionMXBean regionMXBean = 
managementService.getLocalRegionMBean(subRegionPath);
       assertNotNull(regionMXBean);
     });
   }
 
-  /**
-   * Invoked in managedNode VMs
-   */
-  private void checkNullRegions(final VM vm, final String subRegionPath) 
throws Exception {
-    vm.invoke("checkNullRegions", () -> {
+  private void verifyNullRegions(final VM memberVM, final String 
subRegionPath) throws Exception {
+    memberVM.invoke("verifyNullRegions", () -> {
       RegionMXBean regionMXBean = 
managementService.getLocalRegionMBean(subRegionPath);
       assertNull(regionMXBean);
     });
   }
 
-  /**
-   * Invoked in this.managerVM VM
-   */
-  private void checkNavigationApis(final VM vm, final List<String> 
managedNodeMemberIds) {
-    vm.invoke("checkNavigationApis", () -> {
+  private void verifyNavigationApis(final VM managerVM, final List<String> 
memberIds) {
+    managerVM.invoke("verifyNavigationApis", () -> {
       ManagementService service = getManagementService();
       assertNotNull(service.getDistributedSystemMXBean());
 
@@ -404,7 +380,7 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
       expectedName = 
MBeanJMXAdapter.getDistributedRegionMbeanName(REGION_PATH);
       assertEquals(expectedName, actualName);
 
-      for (String memberId : managedNodeMemberIds) {
+      for (String memberId : memberIds) {
         ObjectName memberMBeanName = 
MBeanJMXAdapter.getMemberMBeanName(memberId);
         waitForProxy(memberMBeanName, MemberMXBean.class);
 
@@ -421,7 +397,7 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
         assertTrue(listOfNames.contains(expectedName));
       }
 
-      for (String memberId : managedNodeMemberIds) {
+      for (String memberId : memberIds) {
         ObjectName memberMBeanName = 
MBeanJMXAdapter.getMemberMBeanName(memberId);
         waitForProxy(memberMBeanName, MemberMXBean.class);
 
@@ -442,10 +418,6 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
 
   /**
    * Invoked in controller VM
-   *
-   * Creates a Fixed Partition List to be used for Fixed Partition Region
-   *
-   * @param primaryIndex index for each fixed partition
    */
   private List<FixedPartitionAttributes> createFixedPartitionList(final int 
primaryIndex) {
     List<FixedPartitionAttributes> fixedPartitionAttributesList = new 
ArrayList<>();
@@ -468,11 +440,7 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
   }
 
   /**
-   * Invoked in managedNodes VMs
-   *
-   * Creates a Fixed Partitioned Region
-   *
-   * @param fixedPartitionAttributesList partition list
+   * Invoked in member VMs
    */
   private static void createFixedPartitionRegion(final 
List<FixedPartitionAttributes> fixedPartitionAttributesList) {
     GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
@@ -505,14 +473,16 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
 
     assertEquals(3, fixedPrData.length);
     for (int i = 0; i < fixedPrData.length; i++) {
-//      LogWriterUtils.getLogWriter().info("<ExpectedString> Fixed PR Data is 
" + fixedPrData[i] + "</ExpectedString> ");
+      //LogWriterUtils.getLogWriter().info("<ExpectedString> Fixed PR Data is 
" + fixedPrData[i] + "</ExpectedString> ");
     }
   }
 
   /**
-   * Invoked in this.managerVM VM
+   * Invoked in manager VM
+   *
+   * TODO: unused method
    */
-  private void validateRemoteFixedPartitionRegion(final VM vm) throws 
Exception {
+  private void verifyRemoteFixedPartitionRegion(final VM vm) throws Exception {
     vm.invoke("Verify Partition region", () -> {
       GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
       Set<DistributedMember> otherMemberSet = 
cache.getDistributionManager().getOtherNormalDistributionManagerIds();
@@ -528,17 +498,14 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
         assertEquals(3, fixedPrData.length);
 
         for (int i = 0; i < fixedPrData.length; i++) {
-//          LogWriterUtils.getLogWriter().info("<ExpectedString> Remote PR 
Data is " + fixedPrData[i] + "</ExpectedString> ");
+          //LogWriterUtils.getLogWriter().info("<ExpectedString> Remote PR 
Data is " + fixedPrData[i] + "</ExpectedString> ");
         }
       }
     });
   }
 
-  /**
-   * Invoked in this.managerVM VM
-   */
-  private void addMemberNotificationListener(final VM vm) {
-    vm.invoke("addMemberNotificationListener", () -> {
+  private void addMemberNotificationListener(final VM managerVM) {
+    managerVM.invoke("addMemberNotificationListener", () -> {
       GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
       Set<DistributedMember> otherMemberSet = 
cache.getDistributionManager().getOtherNormalDistributionManagerIds();
 
@@ -550,7 +517,7 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
         Set<ObjectName> names = service.queryMBeanNames(member);
         if (names != null) {
           for (ObjectName name : names) {
-//            LogWriterUtils.getLogWriter().info("<ExpectedString> ObjectNames 
arr" + name + "</ExpectedString> ");
+            //LogWriterUtils.getLogWriter().info("<ExpectedString> ObjectNames 
arr" + name + "</ExpectedString> ");
           }
         }
 
@@ -562,26 +529,21 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
   }
 
   /**
-   * Invoked in this.managerVM VM
-   *
    * Add a Notification listener to DistributedSystemMBean which should gather
    * all the notifications which are propagated through all individual
    * MemberMBeans Hence Region created/destroyed should be visible to this
    * listener
    */
-  private void addDistributedSystemNotificationListener(final VM vm) {
-    vm.invoke("addDistributedSystemNotificationListener", () -> {
+  private void addDistributedSystemNotificationListener(final VM managerVM) {
+    managerVM.invoke("addDistributedSystemNotificationListener", () -> {
       DistributedSystemNotificationListener listener = new 
DistributedSystemNotificationListener();
       ObjectName systemMBeanName = MBeanJMXAdapter.getDistributedSystemName();
       
ManagementFactory.getPlatformMBeanServer().addNotificationListener(systemMBeanName,
 listener, null, null);
     });
   }
 
-  /**
-   * Invoked in this.managerVM VM
-   */
-  private void ensureProxyCleanup(final VM vm) {
-    vm.invoke("ensureProxyCleanup", () -> {
+  private void verifyProxyCleanup(final VM managerVM) {
+    managerVM.invoke("verifyProxyCleanup", () -> {
       GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
       Set<DistributedMember> otherMemberSet = 
cache.getDistributionManager().getOtherNormalDistributionManagerIds();
 
@@ -594,11 +556,8 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
     });
   }
 
-  /**
-   * Invoked in this.managerVM VM
-   */
-  private void verifyRemoteDistributedRegion(final VM vm, final int 
expectedMembers) throws Exception {
-    vm.invoke("verifyRemoteDistributedRegion", () -> {
+  private void verifyRemoteDistributedRegion(final VM managerVM, final int 
expectedMembers) throws Exception {
+    managerVM.invoke("verifyRemoteDistributedRegion", () -> {
       GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
       Set<DistributedMember> otherMemberSet = 
cache.getDistributionManager().getOtherNormalDistributionManagerIds();
 
@@ -614,8 +573,8 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
         assertNotNull(membershipData);
         assertNotNull(evictionData);
 
-//        LogWriterUtils.getLogWriter().info("<ExpectedString> Membership Data 
is " + membershipData.toString() + "</ExpectedString> ");
-//        LogWriterUtils.getLogWriter().info("<ExpectedString> Eviction Data 
is " + membershipData.toString() + "</ExpectedString> ");
+        //LogWriterUtils.getLogWriter().info("<ExpectedString> Membership Data 
is " + membershipData.toString() + "</ExpectedString> ");
+        //LogWriterUtils.getLogWriter().info("<ExpectedString> Eviction Data 
is " + membershipData.toString() + "</ExpectedString> ");
       }
 
       DistributedRegionMXBean bean = null;
@@ -626,11 +585,8 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
     });
   }
 
-  /**
-   * Invoked in this.managerVM VM
-   */
-  private void validateDistributedMBean(final VM vm, final int 
expectedMembers) {
-    vm.invoke("validateDistributedMBean", () -> {
+  private void verifyDistributedMBean(final VM managerVM, final int 
expectedMembers) {
+    managerVM.invoke("verifyDistributedMBean", () -> {
       final ManagementService service = getManagementService();
 
       if (expectedMembers == 0) {
@@ -647,17 +603,14 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
       assertEquals(expectedMembers, bean.getMembers().length);
 
       // Check Stats related Data
-//      LogWriterUtils.getLogWriter().info("<ExpectedString> 
CacheListenerCallsAvgLatency is " + bean.getCacheListenerCallsAvgLatency() + 
"</ExpectedString> ");
-//      LogWriterUtils.getLogWriter().info("<ExpectedString> 
CacheWriterCallsAvgLatency is " + bean.getCacheWriterCallsAvgLatency() + 
"</ExpectedString> ");
-//      LogWriterUtils.getLogWriter().info("<ExpectedString> CreatesRate is " 
+ bean.getCreatesRate() + "</ExpectedString> ");
+      //LogWriterUtils.getLogWriter().info("<ExpectedString> 
CacheListenerCallsAvgLatency is " + bean.getCacheListenerCallsAvgLatency() + 
"</ExpectedString> ");
+      //LogWriterUtils.getLogWriter().info("<ExpectedString> 
CacheWriterCallsAvgLatency is " + bean.getCacheWriterCallsAvgLatency() + 
"</ExpectedString> ");
+      //LogWriterUtils.getLogWriter().info("<ExpectedString> CreatesRate is " 
+ bean.getCreatesRate() + "</ExpectedString> ");
     });
   }
 
-  /**
-   * Invoked in this.managerVM VM
-   */
-  private void validateRemotePartitionRegion(final VM vm) throws Exception {
-    vm.invoke("validateRemotePartitionRegion", () -> {
+  private void verifyRemotePartitionRegion(final VM managerVM) throws 
Exception {
+    managerVM.invoke("verifyRemotePartitionRegion", () -> {
       GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
       Set<DistributedMember> otherMemberSet = 
cache.getDistributionManager().getOtherNormalDistributionManagerIds();
 
@@ -673,12 +626,8 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
     });
   }
 
-
-  /**
-   * Invoked in member VMs
-   */
-  private void validateReplicateRegionAfterCreate(final VM memberVM) {
-    memberVM.invoke("Check Distributed region", () -> {
+  private void verifyReplicateRegionAfterCreate(final VM memberVM) {
+    memberVM.invoke("verifyReplicateRegionAfterCreate", () -> {
       GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
       String memberId = 
MBeanJMXAdapter.getMemberNameOrId(cache.getDistributedSystem().getDistributedMember());
       ObjectName memberMBeanName = 
ObjectName.getInstance("GemFire:type=Member,member=" + memberId);
@@ -704,11 +653,8 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
     });
   }
 
-  /**
-   * Invoked in managedNodes VMs
-   */
-  private void validatePartitionRegionAfterCreate(final VM vm) {
-    vm.invoke("validatePartitionRegionAfterCreate", () -> {
+  private void verifyPartitionRegionAfterCreate(final VM memberVM) {
+    memberVM.invoke("verifyPartitionRegionAfterCreate", () -> {
       GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
       Region partitionedRegion = cache.getRegion(PARTITIONED_REGION_PATH);
 
@@ -719,11 +665,8 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
     });
   }
 
-  /**
-   * Invoked in managedNode VMs
-   */
-  private void validateReplicatedRegionAfterClose(final VM vm) {
-    vm.invoke("validateReplicatedRegionAfterClose", () -> {
+  private void verifyReplicatedRegionAfterClose(final VM memberVM) {
+    memberVM.invoke("verifyReplicatedRegionAfterClose", () -> {
       SystemManagementService service = (SystemManagementService) 
getManagementService();
       RegionMXBean regionMXBean = service.getLocalRegionMBean(REGION_PATH);
       assertNull(regionMXBean);
@@ -734,11 +677,8 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
     });
   }
 
-  /**
-   * Invoked in managedNode VMs
-   */
-  private void validatePartitionRegionAfterClose(final VM vm) {
-    vm.invoke("validatePartitionRegionAfterClose", () -> {
+  private void verifyPartitionRegionAfterClose(final VM memberVM) {
+    memberVM.invoke("verifyPartitionRegionAfterClose", () -> {
       ManagementService service = getManagementService();
       RegionMXBean bean = service.getLocalRegionMBean(PARTITIONED_REGION_PATH);
       assertNull(bean);
@@ -748,21 +688,6 @@ public class RegionManagementDUnitTest extends 
ManagementTestBase {
   /**
    * Invoked in member VMs
    */
-  private void closeFixedPartitionRegion(final VM vm) {
-    vm.invoke("closeFixedPartitionRegion", () -> {
-      GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-      Region region = cache.getRegion(FIXED_PR_PATH);
-      region.close();
-
-      ManagementService service = getManagementService();
-      RegionMXBean regionMBean = service.getLocalRegionMBean(FIXED_PR_PATH);
-      assertNull(regionMBean);
-    });
-  }
-
-  /**
-   * Invoked in member VMs
-   */
   private static void assertPartitionData(final RegionAttributes 
expectedRegionAttributes, final PartitionAttributesData 
partitionAttributesData) {
     PartitionAttributes expectedPartitionAttributes = 
expectedRegionAttributes.getPartitionAttributes();
 

Reply via email to