You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/10/10 21:19:55 UTC

[2/8] incubator-geode git commit: Most ManagementTestCase classes are now using ManagementTestRule

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/864c92c9/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 f042f2c..331f21b 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
@@ -16,20 +16,24 @@
  */
 package org.apache.geode.management;
 
+import static com.jayway.awaitility.Awaitility.*;
+import static org.apache.geode.cache.Region.*;
+import static org.apache.geode.test.dunit.Host.*;
 import static org.junit.Assert.*;
 
+import java.lang.management.ManagementFactory;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
 
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
 import javax.management.Notification;
 import javax.management.NotificationListener;
 import javax.management.ObjectName;
 
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -46,1406 +50,882 @@ import org.apache.geode.cache.RegionAttributes;
 import org.apache.geode.cache.Scope;
 import org.apache.geode.cache.query.data.Portfolio;
 import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.internal.cache.AbstractRegion;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.internal.cache.TestObjectSizerImpl;
 import org.apache.geode.internal.cache.lru.LRUStatistics;
 import org.apache.geode.internal.cache.partitioned.fixed.SingleHopQuarterPartitionResolver;
 import org.apache.geode.management.internal.MBeanJMXAdapter;
 import org.apache.geode.management.internal.SystemManagementService;
-import org.apache.geode.test.dunit.Assert;
-import org.apache.geode.test.dunit.LogWriterUtils;
-import org.apache.geode.test.dunit.SerializableRunnable;
 import org.apache.geode.test.dunit.VM;
-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;
 
 /**
  * This class checks and verifies various data and operations exposed through
  * RegionMXBean interface.
- * 
+ * <p>
  * Goal of the Test : RegionMBean gets created once region is created. Data like
  * Region Attributes data and stats are of proper value
- * 
- * 
  */
 @Category(DistributedTest.class)
+@SuppressWarnings("serial")
 public class RegionManagementDUnitTest extends ManagementTestBase {
+//public class RegionManagementDUnitTest extends JUnit4DistributedTestCase {
 
-  private static final long serialVersionUID = 1L;
+  private static final int MAX_WAIT_MILLIS = 70 * 1000;
 
-  private final String VERIFY_CONFIG_METHOD = "verifyConfigData";
+  private static final String REGION_NAME = "MANAGEMENT_TEST_REGION";
+  private static final String PARTITIONED_REGION_NAME = "MANAGEMENT_PAR_REGION";
+  private static final String FIXED_PR_NAME = "MANAGEMENT_FIXED_PR";
+  private static final String LOCAL_REGION_NAME = "TEST_LOCAL_REGION";
+  private static final String LOCAL_SUB_REGION_NAME = "TEST_LOCAL_SUB_REGION";
 
-  private final String VERIFY_REMOTE_CONFIG_METHOD = "verifyConfigDataRemote";
+  private static final String REGION_PATH = SEPARATOR + REGION_NAME;
+  private static final String PARTITIONED_REGION_PATH = SEPARATOR + PARTITIONED_REGION_NAME;
+  private static final String FIXED_PR_PATH = SEPARATOR + FIXED_PR_NAME;
+  private static final String LOCAL_SUB_REGION_PATH = SEPARATOR + LOCAL_REGION_NAME + SEPARATOR + LOCAL_SUB_REGION_NAME;
 
-  static final String REGION_NAME = "MANAGEMENT_TEST_REGION";
+  // fields used in managedNode VMs
+  private static Region fixedPartitionedRegion;
 
-  static final String PARTITIONED_REGION_NAME = "MANAGEMENT_PAR_REGION";
+  // this.managerVM is VM 0
+  // managedNodes are VMs 1-3
 
-  static final String FIXED_PR_NAME = "MANAGEMENT_FIXED_PR";
-  
-  static final String REGION_PATH = "/MANAGEMENT_TEST_REGION";
+  private VM managerVM;
+  private VM[] memberVMs;
 
-  static final String PARTITIONED_REGION_PATH = "/MANAGEMENT_PAR_REGION";
+  @Before
+  public void before() throws Exception {
+    this.managerVM = getHost(0).getVM(0);
 
-  static final String FIXED_PR_PATH = "/MANAGEMENT_FIXED_PR";
-  
-  static final String LOCAL_REGION_NAME = "TEST_LOCAL_REGION";
-  static final String LOCAL_SUB_REGION_NAME = "TEST_LOCAL_SUB_REGION";
-  static final String LOCAL_REGION_PATH = "/TEST_LOCAL_REGION";
-  static final String LOCAL_SUB_REGION_PATH = "/TEST_LOCAL_REGION/TEST_LOCAL_SUB_REGION";
-  
-  private static final int MAX_WAIT = 70 * 1000;
-
-  protected static final Region DiskRegion = null;
-
-  static List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
-
-
-  private static Region fixedPrRegion;
-
-
-  public RegionManagementDUnitTest() {
-    super();
+    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);
+  }
 
+  @After
+  public void after() throws Exception {
+    disconnectAllFromDS();
   }
 
   /**
    * Tests all Region MBean related Management APIs
-   * 
+   * <p>
    * a) Notification propagated to member MBean while a region is created
-   * 
+   * <p>
    * b) Creates and check a Distributed Region
-   * 
-   * 
-   * @throws Exception
    */
-
-  @Category(FlakyTest.class) // GEODE-1538
   @Test
   public void testDistributedRegion() throws Exception {
-
     initManagement(false);
 
+    // Adding notification listener for remote cache memberVMs
+    addMemberNotificationListener(this.managerVM); // TODO: what does this do for us?
 
-    VM[] managedNodes = new VM[getManagedNodeList()
-        .size()];
-
-    getManagedNodeList().toArray(managedNodes);
-    // Adding notif listener for remote cache members
-    addMemberListener(managingNode);
-
-    for (int j = 0; j < managedNodes.length; j++) {
-
-      VM vm = managedNodes[j];
-
-      createDistributedRegion(vm, REGION_NAME);
-      validateReplicateRegionAfterCreate(vm);
-
+    for (VM memberVM : this.memberVMs) {
+      createDistributedRegion(memberVM, REGION_NAME);
+      validateReplicateRegionAfterCreate(memberVM);
     }
 
-    verifyRemoteDistributedRegion(managingNode, 3);
-
+    verifyRemoteDistributedRegion(this.managerVM, 3);
 
-    for (VM vm : getManagedNodeList()) {
-      closeRegion(vm, REGION_PATH);
-      validateReplicatedRegionAfterClose(vm);
+    for (VM memberVM : this.memberVMs) {
+      closeRegion(memberVM, REGION_PATH);
+      validateReplicatedRegionAfterClose(memberVM);
     }
-    
-    ensureProxyCleanup(managingNode);
+
+    ensureProxyCleanup(this.managerVM);
   }
-  
+
   /**
    * Tests all Region MBean related Management APIs
-   * 
+   * <p>
    * a) Notification propagated to member MBean while a region is created
-   * 
+   * <p>
    * b) Created and check a Partitioned Region
-   * 
-   * @throws Exception
    */
   @Test
   public void testPartitionedRegion() throws Exception {
     initManagement(false);
 
-    VM managingNode = getManagingNode();
-
-    VM[] managedNodes = new VM[getManagedNodeList()
-        .size()];
-
-    getManagedNodeList().toArray(managedNodes);
-    // Adding notif listener for remote cache members
+    // Adding notification listener for remote cache memberVMs
+    addMemberNotificationListener(this.managerVM); // TODO: what does this do for us?
 
-    addMemberListener(managingNode);
-
-    for (int j = 0; j < managedNodes.length; j++) {
-
-      VM vm = managedNodes[j];
-      createPartitionRegion(vm, PARTITIONED_REGION_NAME);
-      validatePartitionRegionAfterCreate(vm);
+    for (VM memberVM : this.memberVMs) {
+      createPartitionRegion(memberVM, PARTITIONED_REGION_NAME);
+      validatePartitionRegionAfterCreate(memberVM);
     }
-    
-
-    validateRemotePartitionRegion(managingNode);
 
-    for (VM vm : getManagedNodeList()) {
+    validateRemotePartitionRegion(this.managerVM);
 
-      closeRegion(vm, PARTITIONED_REGION_PATH);
-      validatePartitionRegionAfterClose(vm);
+    for (VM memberVM : this.memberVMs) {
+      closeRegion(memberVM, PARTITIONED_REGION_PATH);
+      validatePartitionRegionAfterClose(memberVM);
     }
   }
-  
+
   /**
    * Tests all Region MBean related Management APIs
-   * 
+   * <p>
    * a) Notification propagated to member MBean while a region is created
-   * 
+   * <p>
    * b) Creates and check a Fixed Partitioned Region
-   * 
-   * @throws Exception
    */
   @Test
   public void testFixedPRRegionMBean() throws Exception {
-
     initManagement(false);
 
-    VM managingNode = getManagingNode();
-
-    VM[] managedNodes = new VM[getManagedNodeList()
-        .size()];
-
-    getManagedNodeList().toArray(managedNodes);
-    // Adding notif listener for remote cache members
-    addMemberListener(managingNode);
-
-    for (int j = 0; j < managedNodes.length; j++) {
-
-      VM vm = managedNodes[j];
-
-      createFixedPartitionList(j + 1);
-      Object[] args = new Object[1];
-      args[0] = fpaList;
-      vm.invoke(RegionManagementDUnitTest.class, "createFixedPartitionRegion",
-          args);
+    // Adding notif listener for remote cache memberVMs
+    addMemberNotificationListener(this.managerVM); // TODO: what does this do for us?
 
+    int primaryIndex = 0;
+    for (VM vm : this.memberVMs) {
+      List<FixedPartitionAttributes> fixedPartitionAttributesList = createFixedPartitionList(primaryIndex + 1);
+      vm.invoke(() -> createFixedPartitionRegion(fixedPartitionAttributesList));
+      primaryIndex++;
     }
-    // Workaround for bug 46683. Renable validation when bug is fixed.
-    validateRemoteFixedPartitionRegion(managingNode);
 
-    for (VM vm : getManagedNodeList()) {
-      closeFixedPartitionRegion(vm);
-    }
+//    // Workaround for bug 46683. Renable validation when bug is fixed.
+//    validateRemoteFixedPartitionRegion(this.managerVM);
+//
+//    for (VM vm : this.memberVMs) {
+//      closeFixedPartitionRegion(vm);
+//    }
   }
 
   /**
    * Tests a Distributed Region at Managing Node side
    * while region is created in a member node asynchronously.
-   * @throws Exception
    */
   @Test
-  public void testRegionAggregate() throws Exception{
+  public void testRegionAggregate() throws Exception {
     initManagement(true);
 
-    VM managingNode = getManagingNode();
-
-    VM[] managedNodes = new VM[getManagedNodeList()
-        .size()];
-
-    getManagedNodeList().toArray(managedNodes);
-    // Adding notif listener for remote cache members
-    addDistrListener(managingNode);
-
-
-    for (int j = 0; j < managedNodes.length; j++) {
-
-      VM vm = managedNodes[j];
+    // Adding notif listener for remote cache memberVMs
+    addDistributedSystemNotificationListener(this.managerVM); // TODO: what does this do for us?
 
+    for (VM vm : this.memberVMs) {
       createDistributedRegion(vm, REGION_NAME);
-
     }
 
-    
-    validateDistributedMBean(managingNode, 3);
-    
-    createDistributedRegion(managingNode, REGION_NAME);
-    validateDistributedMBean(managingNode, 4);
-    
-
-
-    for (int j = 0; j < managedNodes.length; j++) {
-
-      VM vm = managedNodes[j];
+    validateDistributedMBean(this.managerVM, 3);
+    createDistributedRegion(this.managerVM, REGION_NAME);
+    validateDistributedMBean(this.managerVM, 4);
 
+    for (VM vm : this.memberVMs) {
       closeRegion(vm, REGION_PATH);
-
     }
-    ensureProxyCleanup(managingNode);
-    
-    validateDistributedMBean(managingNode, 1);
-    
-    closeRegion(managingNode, REGION_PATH);
-    validateDistributedMBean(managingNode, 0);
-    
 
+    ensureProxyCleanup(this.managerVM);
+
+    validateDistributedMBean(this.managerVM, 1);
+    closeRegion(this.managerVM, REGION_PATH);
+    validateDistributedMBean(this.managerVM, 0);
   }
-  
+
   @Test
   public void testNavigationAPIS() throws Exception {
     initManagement(true);
-    for(VM vm : managedNodeList){
+
+    for (VM vm : this.memberVMs) {
       createDistributedRegion(vm, REGION_NAME);
       createPartitionRegion(vm, PARTITIONED_REGION_NAME);
     }
-    createDistributedRegion(managingNode, REGION_NAME);
-    createPartitionRegion(managingNode, PARTITIONED_REGION_NAME);
-    List<String> memberIds = new ArrayList<String>();
-    
-    for(VM vm : managedNodeList){
+
+    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));
     }
-    checkNavigationAPIS(managingNode, memberIds);
-    
 
+    checkNavigationApis(this.managerVM, memberIds);
 
-    for(VM vm : managedNodeList){
+    for (VM vm : this.memberVMs) {
       closeRegion(vm, REGION_PATH);
     }
- 
-    closeRegion(managingNode, REGION_PATH);
-
+    closeRegion(this.managerVM, REGION_PATH);
   }
 
- 
-  
+
   @Test
-  public void testSubRegions() throws Exception{
+  public void testSubRegions() throws Exception {
     initManagement(false);
-    for (VM vm : managedNodeList) {
+
+    for (VM vm : this.memberVMs) {
       createLocalRegion(vm, LOCAL_REGION_NAME);
       createSubRegion(vm, LOCAL_REGION_NAME, LOCAL_SUB_REGION_NAME);
     }
-    
-    for (VM vm : managedNodeList) {
+
+    for (VM vm : this.memberVMs) {
       checkSubRegions(vm, LOCAL_SUB_REGION_PATH);
     }
-    
-    for (VM vm : managedNodeList) {
+
+    for (VM vm : this.memberVMs) {
       closeRegion(vm, LOCAL_REGION_NAME);
       checkNullRegions(vm, LOCAL_SUB_REGION_NAME);
     }
-    
   }
-  
-  
-  
-  
+
   @Test
-  public void testSpecialRegions() throws Exception{
+  public void testSpecialRegions() throws Exception {
     initManagement(false);
-    createSpecialRegion(managedNodeList.get(0));
-    DistributedMember member = getMember(managedNodeList.get(0));
-    checkSpecialRegion(managingNode,member);
+    createSpecialRegion(this.memberVMs[0]);
+    DistributedMember member = getMember(this.memberVMs[0]);
+    checkSpecialRegion(this.managerVM, member);
   }
-  
-  
-  public void createSpecialRegion(VM vm1) throws Exception{
-    {
-      vm1.invoke(new SerializableRunnable("Check Sub Regions") {
-
-        public void run() {
-          Cache cache = getCache();
-          AttributesFactory attributesFactory = new AttributesFactory();
-          attributesFactory.setValueConstraint(Portfolio.class);
-          RegionAttributes regionAttributes = attributesFactory.create();
-          
-          cache.createRegion("p-os",regionAttributes);
-          cache.createRegion("p_os",regionAttributes);
-        }
-      });
 
-    }
-  }
-  
-  public void checkSpecialRegion(VM vm1, final DistributedMember member)
-      throws Exception {
-    {
-      vm1.invoke(new SerializableRunnable("Check Sub Regions") {
-
-        public void run() {
-
-          ManagementService service = getManagementService();
-          
-          try {
-            MBeanUtil.getDistributedRegionMbean("/p-os", 1);
-            MBeanUtil.getDistributedRegionMbean("/p_os", 1);
-
-          } catch (Exception e) {
-            InternalDistributedSystem.getLoggerI18n().fine(
-                "Undesired Result , DistributedRegionMXBean Should not be null"
-                    + e);
-          }
-
-        }
-      });
-
-    }
-
-  }
-  
   @Test
-  public void testLruStats() throws Exception{
+  public void testLruStats() throws Exception {
     initManagement(false);
-    for (VM vm : managedNodeList) {
+    for (VM vm : this.memberVMs) {
       createDiskRegion(vm);
-
     }
-    checkEntrySize(managingNode,3);
+    checkEntrySize(this.managerVM, 3);
   }
-  
-  public void createDiskRegion(VM vm1) throws Exception{
-    {
-      vm1.invoke(new SerializableRunnable("Check Sub Regions") {
-
-        public void run() {
-          AttributesFactory factory = new AttributesFactory();
-          factory.setScope(Scope.LOCAL);
-          factory.setEvictionAttributes(EvictionAttributes
-                .createLRUMemoryAttributes(20, new TestObjectSizerImpl(),
-                    EvictionAction.LOCAL_DESTROY));
-          /*File d = new File("DiskRegions" + OSProcess.getId());
-          d.mkdirs();
-
-          DiskStoreFactory dsf = getCache().createDiskStoreFactory();
-          dsf.setDiskDirs(new File[]{d});
-          factory.setDiskSynchronous(true);
-          DiskStore ds = dsf.create(REGION_NAME);
-          factory.setDiskStoreName(ds.getName());
-*/
-          Region region = getCache().createRegion(REGION_NAME, factory.create());
-
-          LRUStatistics lruStats = getLRUStats(region);
-
-          assertNotNull(lruStats);
-          
-          RegionMXBean bean = managementService.getLocalRegionMBean(REGION_PATH);
-          
-          assertNotNull(bean);
-          
-          int total;
-          for (total = 0; total < 10000; total++) {
-            int[] array = new int[250];
-            array[0] = total;
-            region.put(new Integer(total), array);
-          }
-          assertTrue(bean.getEntrySize() > 0);
-          LogWriterUtils.getLogWriter().info("DEBUG: EntrySize =" + bean.getEntrySize());
-          
 
+  /**
+   * Invoked in all VMs
+   */
+  private void closeRegion(final VM vm, final String regionPath) {
+    vm.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", () -> {
+      Cache cache = getCache();
+      AttributesFactory attributesFactory = new AttributesFactory();
+      attributesFactory.setValueConstraint(Portfolio.class);
+      RegionAttributes regionAttributes = attributesFactory.create();
 
-    }
-    
+      cache.createRegion("p-os", regionAttributes);
+      cache.createRegion("p_os", regionAttributes);
+    });
   }
 
-  public void checkEntrySize(VM vm1, final int expectedMembers)
-      throws Exception {
-    {
-      vm1.invoke(new SerializableRunnable("Check Sub Regions") {
-
-        public void run() {
-
-          DistributedRegionMXBean bean = null;
-          try {
-            bean = MBeanUtil.getDistributedRegionMbean(REGION_PATH,
-                expectedMembers);
-          } catch (Exception e) {
-            InternalDistributedSystem.getLoggerI18n().fine(
-                "Undesired Result , DistributedRegionMXBean Should not be null"
-                    + e);
-          }
+  /**
+   * Invoked in this.managerVM VM
+   */
+  private void checkSpecialRegion(final VM vm, final DistributedMember member) throws Exception {
+    vm.invoke("checkSpecialRegion", () -> {
+      MBeanUtil.getDistributedRegionMbean("/p-os", 1); // TODO: do something?
+      MBeanUtil.getDistributedRegionMbean("/p_os", 1);
+    });
+  }
 
-          assertNotNull(bean);
+  /**
+   * Invoked in managedNode VMs
+   */
+  private void createDiskRegion(final VM vm) throws Exception {
+    vm.invoke("createDiskRegion", () -> {
+      AttributesFactory factory = new AttributesFactory();
+      factory.setScope(Scope.LOCAL);
+      factory.setEvictionAttributes(EvictionAttributes.createLRUMemoryAttributes(20, new TestObjectSizerImpl(), EvictionAction.LOCAL_DESTROY));
 
-          assertTrue(bean.getEntrySize() > 0);
-          LogWriterUtils.getLogWriter().info("DEBUG: EntrySize =" + bean.getEntrySize());
-        }
-      });
+      Region region = getCache().createRegion(REGION_NAME, factory.create());
 
-    }
+      LRUStatistics lruStats = ((AbstractRegion) region).getEvictionController().getLRUHelper().getStats();
+      assertNotNull(lruStats);
 
+      RegionMXBean regionMXBean = managementService.getLocalRegionMBean(REGION_PATH);
+      assertNotNull(regionMXBean);
+
+      int total;
+      for (total = 0; total < 10000; total++) { // TODO: what is this?
+        int[] array = new int[250];
+        array[0] = total;
+        region.put(new Integer(total), array);
+      }
+      assertTrue(regionMXBean.getEntrySize() > 0);
+    });
   }
-  
-  protected LRUStatistics getLRUStats(Region region) {
-    final LocalRegion l = (LocalRegion) region;
-    return l.getEvictionController().getLRUHelper().getStats();
+
+  /**
+   * Invoked in this.managerVM VM
+   */
+  private void checkEntrySize(final VM vm, final int expectedMembers) throws Exception {
+    vm.invoke("checkEntrySize", () -> {
+      DistributedRegionMXBean distributedRegionMXBean = MBeanUtil.getDistributedRegionMbean(REGION_PATH, expectedMembers);
+      assertNotNull(distributedRegionMXBean);
+      assertTrue(distributedRegionMXBean.getEntrySize() > 0);
+    });
   }
-  
-  @SuppressWarnings("serial")
-  public void checkSubRegions(VM vm1, final String subRegionPath) throws Exception {
-    {
-      vm1.invoke(new SerializableRunnable("Check Sub Regions") {
 
-        public void run() {
+  /**
+   * Invoked in managedNode VMs
+   */
+  private void checkSubRegions(final VM vm, final String subRegionPath) throws Exception {
+    vm.invoke("checkSubRegions", () -> {
+      RegionMXBean regionMXBean = managementService.getLocalRegionMBean(subRegionPath);
+      assertNotNull(regionMXBean);
+    });
+  }
 
-          RegionMXBean bean = managementService
-              .getLocalRegionMBean(subRegionPath);
-          assertNotNull(bean);
+  /**
+   * Invoked in managedNode VMs
+   */
+  private void checkNullRegions(final VM vm, final String subRegionPath) throws Exception {
+    vm.invoke("checkNullRegions", () -> {
+      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", () -> {
+      ManagementService service = getManagementService();
+      assertNotNull(service.getDistributedSystemMXBean());
 
-    }
-  }
-  
-  @SuppressWarnings("serial")
-  public void checkNullRegions(VM vm1, final String subRegionPath) throws Exception {
-    {
-      vm1.invoke(new SerializableRunnable("Check Sub Regions") {
+      waitForAllMembers(4);
 
-        public void run() {
+      DistributedSystemMXBean distributedSystemMXBean = service.getDistributedSystemMXBean();
+      assertTrue(distributedSystemMXBean.listDistributedRegionObjectNames().length == 2);
 
-          RegionMXBean bean = managementService
-              .getLocalRegionMBean(subRegionPath);
-          assertNull(bean);
+      assertNotNull(distributedSystemMXBean.fetchDistributedRegionObjectName(PARTITIONED_REGION_PATH));
+      assertNotNull(distributedSystemMXBean.fetchDistributedRegionObjectName(REGION_PATH));
 
-        }
-      });
+      ObjectName actualName = distributedSystemMXBean.fetchDistributedRegionObjectName(PARTITIONED_REGION_PATH);
+      ObjectName expectedName = MBeanJMXAdapter.getDistributedRegionMbeanName(PARTITIONED_REGION_PATH);
+      assertEquals(expectedName, actualName);
 
-    }
-  }
+      actualName = distributedSystemMXBean.fetchDistributedRegionObjectName(REGION_PATH);
+      expectedName = MBeanJMXAdapter.getDistributedRegionMbeanName(REGION_PATH);
+      assertEquals(expectedName, actualName);
 
-  
-  
-  
-  protected void checkNavigationAPIS(final VM vm,
-      final List<String> managedNodeMemberIds) {
-    SerializableRunnable checkNavigationAPIS = new SerializableRunnable(
-        "checkNavigationAPIS") {
-      public void run() {
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-        ManagementService service = getManagementService();
-        final DistributedSystemMXBean bean = service
-            .getDistributedSystemMXBean();
-
-        assertNotNull(service.getDistributedSystemMXBean());
-
-        waitForAllMembers(4);
-        assertTrue(bean.listDistributedRegionObjectNames().length == 2);
-        try {
-          assertNotNull(bean
-              .fetchDistributedRegionObjectName(PARTITIONED_REGION_PATH));
-          assertNotNull(bean.fetchDistributedRegionObjectName(REGION_PATH));
-          ObjectName actualName = bean
-              .fetchDistributedRegionObjectName(PARTITIONED_REGION_PATH);
-          ObjectName expectedName = MBeanJMXAdapter
-              .getDistributedRegionMbeanName(PARTITIONED_REGION_PATH);
-          assertEquals(expectedName, actualName);
-
-          actualName = bean.fetchDistributedRegionObjectName(REGION_PATH);
-          expectedName = MBeanJMXAdapter
-              .getDistributedRegionMbeanName(REGION_PATH);
-          assertEquals(expectedName, actualName);
-
-        } catch (Exception e) {
-          fail("fetchDistributedRegionObjectName () Unsuccessful " + e);
-        }
+      for (String memberId : managedNodeMemberIds) {
+        ObjectName memberMBeanName = MBeanJMXAdapter.getMemberMBeanName(memberId);
+        waitForProxy(memberMBeanName, MemberMXBean.class);
 
-        for (String memberId : managedNodeMemberIds) {
-          ObjectName memberMBeanName = MBeanJMXAdapter
-              .getMemberMBeanName(memberId);
-          ObjectName expectedName;
-          try {
-            waitForProxy(memberMBeanName, MemberMXBean.class);
-            
-            ObjectName[] regionMBeanNames = bean
-                .fetchRegionObjectNames(memberMBeanName);
-            assertNotNull(regionMBeanNames);
-            assertTrue(regionMBeanNames.length == 2);
-            List<ObjectName> listOfNames = Arrays.asList(regionMBeanNames);
-
-            expectedName = MBeanJMXAdapter.getRegionMBeanName(memberId,
-                PARTITIONED_REGION_PATH);
-            listOfNames.contains(expectedName);
-            expectedName = MBeanJMXAdapter.getRegionMBeanName(memberId,
-                REGION_PATH);
-            listOfNames.contains(expectedName);
-          } catch (Exception e) {
-            fail("fetchRegionObjectNames () Unsuccessful " + e);
-          }
-        }
+        ObjectName[] regionMBeanNames = distributedSystemMXBean.fetchRegionObjectNames(memberMBeanName);
+        assertNotNull(regionMBeanNames);
+        assertTrue(regionMBeanNames.length == 2);
 
-        for (String memberId : managedNodeMemberIds) {
-          ObjectName expectedName;
-          ObjectName actualName;
-          ObjectName memberMBeanName = MBeanJMXAdapter
-          .getMemberMBeanName(memberId);
-          try {
-            waitForProxy(memberMBeanName, MemberMXBean.class);
-            expectedName = MBeanJMXAdapter.getRegionMBeanName(memberId,
-                PARTITIONED_REGION_PATH);
-            waitForProxy(expectedName, RegionMXBean.class);
-            actualName = bean.fetchRegionObjectName(memberId,
-                PARTITIONED_REGION_PATH);
-
-            assertEquals(expectedName, actualName);
-            expectedName = MBeanJMXAdapter.getRegionMBeanName(memberId,
-                REGION_PATH);
-            waitForProxy(expectedName, RegionMXBean.class);
-            actualName = bean.fetchRegionObjectName(memberId, REGION_PATH);
-
-            assertEquals(expectedName, actualName);
-          } catch (Exception e) {
-            fail("fetchRegionObjectName () Unsuccessful ");
-          }
-        }
+        List<ObjectName> listOfNames = Arrays.asList(regionMBeanNames);
 
+        expectedName = MBeanJMXAdapter.getRegionMBeanName(memberId, PARTITIONED_REGION_PATH);
+        assertTrue(listOfNames.contains(expectedName));
+
+        expectedName = MBeanJMXAdapter.getRegionMBeanName(memberId, REGION_PATH);
+        assertTrue(listOfNames.contains(expectedName));
       }
-    };
-    vm.invoke(checkNavigationAPIS);
-  }
-  
-  
-  protected void putBulkData(final VM vm, final int numKeys) {
-    SerializableRunnable putBulkData = new SerializableRunnable("putBulkData") {
-      public void run() {
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-        Region region = cache.getRegion(REGION_PATH);
-        for (int i = 0; i < numKeys; i++) {
-          region.put(i, i * i);
-        }
 
+      for (String memberId : managedNodeMemberIds) {
+        ObjectName memberMBeanName = MBeanJMXAdapter.getMemberMBeanName(memberId);
+        waitForProxy(memberMBeanName, MemberMXBean.class);
+
+        expectedName = MBeanJMXAdapter.getRegionMBeanName(memberId, PARTITIONED_REGION_PATH);
+        waitForProxy(expectedName, RegionMXBean.class);
+
+        actualName = distributedSystemMXBean.fetchRegionObjectName(memberId, PARTITIONED_REGION_PATH);
+        assertEquals(expectedName, actualName);
+
+        expectedName = MBeanJMXAdapter.getRegionMBeanName(memberId, REGION_PATH);
+        waitForProxy(expectedName, RegionMXBean.class);
+
+        actualName = distributedSystemMXBean.fetchRegionObjectName(memberId, REGION_PATH);
+        assertEquals(expectedName, actualName);
       }
-    };
-    vm.invoke(putBulkData);
+    });
   }
- 
-  
 
   /**
-   * creates a Fixed Partition List to be used for Fixed Partition Region
-   * 
-   * @param primaryIndex
-   *          index for each fixed partition
+   * Invoked in controller VM
+   *
+   * Creates a Fixed Partition List to be used for Fixed Partition Region
+   *
+   * @param primaryIndex index for each fixed partition
    */
-  private static void createFixedPartitionList(int primaryIndex) {
-    fpaList.clear();
+  private List<FixedPartitionAttributes> createFixedPartitionList(final int primaryIndex) {
+    List<FixedPartitionAttributes> fixedPartitionAttributesList = new ArrayList<>();
     if (primaryIndex == 1) {
-      fpaList.add(FixedPartitionAttributes.createFixedPartition("Q1", true, 3));
-      fpaList.add(FixedPartitionAttributes.createFixedPartition("Q2", 3));
-      fpaList.add(FixedPartitionAttributes.createFixedPartition("Q3", 3));
+      fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q1", true, 3));
+      fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q2", 3));
+      fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q3", 3));
     }
     if (primaryIndex == 2) {
-      fpaList.add(FixedPartitionAttributes.createFixedPartition("Q1", 3));
-      fpaList.add(FixedPartitionAttributes.createFixedPartition("Q2", true, 3));
-      fpaList.add(FixedPartitionAttributes.createFixedPartition("Q3", 3));
+      fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q1", 3));
+      fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q2", true, 3));
+      fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q3", 3));
     }
     if (primaryIndex == 3) {
-      fpaList.add(FixedPartitionAttributes.createFixedPartition("Q1", 3));
-      fpaList.add(FixedPartitionAttributes.createFixedPartition("Q2", 3));
-      fpaList.add(FixedPartitionAttributes.createFixedPartition("Q3", true, 3));
+      fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q1", 3));
+      fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q2", 3));
+      fixedPartitionAttributesList.add(FixedPartitionAttributes.createFixedPartition("Q3", true, 3));
     }
-
+    return fixedPartitionAttributesList;
   }
-  
-
 
   /**
+   * Invoked in managedNodes VMs
+   *
    * Creates a Fixed Partitioned Region
-   * @param fpaList partition list
+   *
+   * @param fixedPartitionAttributesList partition list
    */
-  protected static void createFixedPartitionRegion(
-      List<FixedPartitionAttributes> fpaList) {
+  private static void createFixedPartitionRegion(final List<FixedPartitionAttributes> fixedPartitionAttributesList) {
     GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-    SystemManagementService service = (SystemManagementService)getManagementService();
+    SystemManagementService service = (SystemManagementService) getManagementService();
 
     PartitionAttributesFactory paf = new PartitionAttributesFactory();
 
     paf.setRedundantCopies(2).setTotalNumBuckets(12);
-    for (FixedPartitionAttributes fpa : fpaList) {
+    for (FixedPartitionAttributes fpa : fixedPartitionAttributesList) {
       paf.addFixedPartitionAttributes(fpa);
     }
     paf.setPartitionResolver(new SingleHopQuarterPartitionResolver());
 
     AttributesFactory attr = new AttributesFactory();
     attr.setPartitionAttributes(paf.create());
-    fixedPrRegion = cache.createRegion(FIXED_PR_NAME, attr.create());
-    assertNotNull(fixedPrRegion);
-    LogWriterUtils.getLogWriter().info(
-        "Partitioned Region " + FIXED_PR_NAME + " created Successfully :"
-            + fixedPrRegion.toString());
 
-    RegionMXBean bean = service.getLocalRegionMBean(FIXED_PR_PATH);
-    RegionAttributes regAttrs = fixedPrRegion.getAttributes();
+    fixedPartitionedRegion = cache.createRegion(FIXED_PR_NAME, attr.create());
+    assertNotNull(fixedPartitionedRegion);
 
-    LogWriterUtils.getLogWriter().info(
-        "FixedPartitionAttribute From GemFire :"
-            + regAttrs.getPartitionAttributes().getFixedPartitionAttributes());
-
-    RegionAttributesData data = bean.listRegionAttributes();
+    RegionMXBean bean = service.getLocalRegionMBean(FIXED_PR_PATH);
+    RegionAttributes regAttrs = fixedPartitionedRegion.getAttributes();
 
     PartitionAttributesData parData = bean.listPartitionAttributes();
 
     assertPartitionData(regAttrs, parData);
 
-    FixedPartitionAttributesData[] fixedPrData = bean
-        .listFixedPartitionAttributes();
+    FixedPartitionAttributesData[] fixedPrData = bean.listFixedPartitionAttributes();
 
     assertNotNull(fixedPrData);
 
     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> ");
     }
   }
 
   /**
-   * Verifies the Fixed Partition Region for partition related attributes
-   * 
-   * @param vm
+   * Invoked in this.managerVM VM
    */
-  protected void validateRemoteFixedPartitionRegion(final VM vm) throws Exception {
-    SerializableRunnable verifyFixedRegion = new SerializableRunnable(
-        "Verify Partition region") {
-      public void run() {
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-        Set<DistributedMember> otherMemberSet = cache.getDistributionManager()
-            .getOtherNormalDistributionManagerIds();
-
-        for (DistributedMember member : otherMemberSet) {
-          RegionMXBean bean = null;
-          try {
-            bean = MBeanUtil.getRegionMbeanProxy(member, FIXED_PR_PATH);
-          } catch (Exception e) {
-            InternalDistributedSystem.getLoggerI18n().fine(
-                "Undesired Result , RegionMBean Should not be null");
-          }
-          PartitionAttributesData data = bean.listPartitionAttributes();
-          assertNotNull(data);
-          FixedPartitionAttributesData[] fixedPrData = bean
-              .listFixedPartitionAttributes();
-          assertNotNull(fixedPrData);
-          assertEquals(3, fixedPrData.length);
-          for (int i = 0; i < fixedPrData.length; i++) {
-            LogWriterUtils.getLogWriter().info(
-                "<ExpectedString> Remote PR Data is " + fixedPrData[i]
-                    + "</ExpectedString> ");
-          }
-        }
+  private void validateRemoteFixedPartitionRegion(final VM vm) throws Exception {
+    vm.invoke("Verify Partition region", () -> {
+      GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+      Set<DistributedMember> otherMemberSet = cache.getDistributionManager().getOtherNormalDistributionManagerIds();
 
-      }
+      for (DistributedMember member : otherMemberSet) {
+        RegionMXBean bean = MBeanUtil.getRegionMbeanProxy(member, FIXED_PR_PATH);
+
+        PartitionAttributesData data = bean.listPartitionAttributes();
+        assertNotNull(data);
 
-    };
-    vm.invoke(verifyFixedRegion);
+        FixedPartitionAttributesData[] fixedPrData = bean.listFixedPartitionAttributes();
+        assertNotNull(fixedPrData);
+        assertEquals(3, fixedPrData.length);
+
+        for (int i = 0; i < fixedPrData.length; i++) {
+//          LogWriterUtils.getLogWriter().info("<ExpectedString> Remote PR Data is " + fixedPrData[i] + "</ExpectedString> ");
+        }
+      }
+    });
   }
 
   /**
-   * Add a Notification listener to MemberMBean 
-   * @param vm
+   * Invoked in this.managerVM VM
    */
-  protected void addMemberListener(final VM vm) {
-    SerializableRunnable addMemberListener = new SerializableRunnable(
-        "addMemberListener") {
-      public void run() {
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-        
-        SystemManagementService service = (SystemManagementService) getManagementService();
-
-        Set<DistributedMember> otherMemberSet = cache.getDistributionManager()
-            .getOtherNormalDistributionManagerIds();
-         
-        for (DistributedMember member : otherMemberSet) {
-          
-          MBeanServer mbeanServer = MBeanJMXAdapter.mbeanServer;
-
-          RegionNotif regionCreate = new RegionNotif();
-
-          ObjectName memberMBeanName;
-          try {
-            memberMBeanName = service.getMemberMBeanName(member);
-            Set<ObjectName> names = service.queryMBeanNames(member);
-            if(names != null){
-              for(ObjectName name : names){
-                LogWriterUtils.getLogWriter().info(
-                    "<ExpectedString> ObjectNames arr" + name
-                        + "</ExpectedString> ");
-              }
-            }
-            waitForProxy(memberMBeanName, MemberMXBean.class);
-            mbeanServer.addNotificationListener(memberMBeanName, regionCreate,
-                null, null);
-          } catch (NullPointerException e) {
-            Assert.fail("FAILED WITH EXCEPION", e);
-          } catch (InstanceNotFoundException e) {
-            Assert.fail("FAILED WITH EXCEPION", e);
-          } catch (Exception e) {
-            Assert.fail("FAILED WITH EXCEPION", e);
+  private void addMemberNotificationListener(final VM vm) {
+    vm.invoke("addMemberNotificationListener", () -> {
+      GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+      Set<DistributedMember> otherMemberSet = cache.getDistributionManager().getOtherNormalDistributionManagerIds();
+
+      SystemManagementService service = (SystemManagementService) getManagementService();
+
+      for (DistributedMember member : otherMemberSet) {
+        MemberNotificationListener listener = new MemberNotificationListener();
+        ObjectName memberMBeanName = service.getMemberMBeanName(member);
+        Set<ObjectName> names = service.queryMBeanNames(member);
+        if (names != null) {
+          for (ObjectName name : names) {
+//            LogWriterUtils.getLogWriter().info("<ExpectedString> ObjectNames arr" + name + "</ExpectedString> ");
           }
-
         }
 
-      }
-    };
-    vm.invoke(addMemberListener);
+        waitForProxy(memberMBeanName, MemberMXBean.class);
 
+        ManagementFactory.getPlatformMBeanServer().addNotificationListener(memberMBeanName, listener, null, null);
+      }
+    });
   }
 
   /**
+   * 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
-   * 
-   * @param vm
    */
-  protected void addDistrListener(final VM vm) {
-    SerializableRunnable addDistrListener = new SerializableRunnable(
-        "addDistrListener") {
-      public void run() {
-        MBeanServer mbeanServer = MBeanJMXAdapter.mbeanServer;
-
-        DistrNotif regionCreate = new DistrNotif();
-
-        ObjectName systemMBeanName;
-        try {
-          systemMBeanName = MBeanJMXAdapter.getDistributedSystemName();
-          mbeanServer.addNotificationListener(systemMBeanName, regionCreate,
-              null, null);
-
-        } catch (NullPointerException e) {
-          Assert.fail("FAILED WITH EXCEPION", e);
-        } catch (InstanceNotFoundException e) {
-          Assert.fail("FAILED WITH EXCEPION", e);
-
-        }
-
-      }
-    };
-    vm.invoke(addDistrListener);
-
+  private void addDistributedSystemNotificationListener(final VM vm) {
+    vm.invoke("addDistributedSystemNotificationListener", () -> {
+      DistributedSystemNotificationListener listener = new DistributedSystemNotificationListener();
+      ObjectName systemMBeanName = MBeanJMXAdapter.getDistributedSystemName();
+      ManagementFactory.getPlatformMBeanServer().addNotificationListener(systemMBeanName, listener, null, null);
+    });
   }
-  
-  public void ensureProxyCleanup(final VM vm) {
-
-    SerializableRunnable ensureProxyCleanup = new SerializableRunnable(
-        "Ensure Proxy cleanup") {
-      public void run() {
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-        Set<DistributedMember> otherMemberSet = cache.getDistributionManager()
-            .getOtherNormalDistributionManagerIds();
-
-        final SystemManagementService service = (SystemManagementService) getManagementService();
-
-        for (final DistributedMember member : otherMemberSet) {
-          RegionMXBean bean = null;
-          try {
 
-            Wait.waitForCriterion(new WaitCriterion() {
-
-              RegionMXBean bean = null;
-
-              public String description() {
-                return "Waiting for the proxy to get deleted at managing node";
-              }
-
-              public boolean done() {
-                ObjectName objectName = service.getRegionMBeanName(member, REGION_PATH);
-                bean = service.getMBeanProxy(objectName, RegionMXBean.class);
-                boolean done = (bean == null);
-                return done;
-              }
-
-            }, MAX_WAIT, 500, true);
-
-          } catch (Exception e) {
-            fail("could not remove proxies in required time");
-
-          }
-          assertNull(bean);
+  /**
+   * Invoked in this.managerVM VM
+   */
+  private void ensureProxyCleanup(final VM vm) {
+    vm.invoke("ensureProxyCleanup", () -> {
+      GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+      Set<DistributedMember> otherMemberSet = cache.getDistributionManager().getOtherNormalDistributionManagerIds();
 
-        }
+      final SystemManagementService service = (SystemManagementService) getManagementService();
 
+      for (final DistributedMember member : otherMemberSet) {
+        String alias = "Waiting for the proxy to get deleted at managing node";
+        await(alias).atMost(MAX_WAIT_MILLIS, TimeUnit.MILLISECONDS).until(() -> assertNull(service.getMBeanProxy(service.getRegionMBeanName(member, REGION_PATH), RegionMXBean.class)));
       }
-    };
-    vm.invoke(ensureProxyCleanup);
+    });
   }
 
   /**
-   * Verifies a Remote Distributed Region
-   * 
-   * @param vm
+   * Invoked in this.managerVM VM
    */
-  protected void verifyRemoteDistributedRegion(final VM vm, final int expectedMembers) throws Exception {
-    SerializableRunnable verifyRegion = new SerializableRunnable(
-        "Verify Distributed region") {
-      public void run() {
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-        Set<DistributedMember> otherMemberSet = cache.getDistributionManager()
-            .getOtherNormalDistributionManagerIds();
-
-        for (DistributedMember member : otherMemberSet) {
-          RegionMXBean bean = null;
-          try {
-            bean = MBeanUtil.getRegionMbeanProxy(member, REGION_PATH);
-          } catch (Exception e) {
-            InternalDistributedSystem.getLoggerI18n().fine(
-                "Undesired Result , RegionMBean Should not be null" + e);
-
-          }
-          assertNotNull(bean);
-
-          RegionAttributesData data = bean.listRegionAttributes();
-          assertNotNull(data);
-          MembershipAttributesData membershipData = bean
-              .listMembershipAttributes();
-          EvictionAttributesData evictionData = bean.listEvictionAttributes();
-          assertNotNull(membershipData);
-          assertNotNull(evictionData);
-          LogWriterUtils.getLogWriter().info(
-              "<ExpectedString> Membership Data is "
-                  + membershipData.toString() + "</ExpectedString> ");
-          LogWriterUtils.getLogWriter().info(
-              "<ExpectedString> Eviction Data is " + membershipData.toString()
-                  + "</ExpectedString> ");
- 
-        }
-        DistributedRegionMXBean bean = null;
-        try {
-          bean = MBeanUtil.getDistributedRegionMbean(REGION_PATH, expectedMembers);
-        } catch (Exception e) {
-          InternalDistributedSystem.getLoggerI18n().fine(
-              "Undesired Result , DistributedRegionMXBean Should not be null"
-                  + e);
-        }
+  private void verifyRemoteDistributedRegion(final VM vm, final int expectedMembers) throws Exception {
+    vm.invoke("verifyRemoteDistributedRegion", () -> {
+      GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+      Set<DistributedMember> otherMemberSet = cache.getDistributionManager().getOtherNormalDistributionManagerIds();
 
+      for (DistributedMember member : otherMemberSet) {
+        RegionMXBean bean = MBeanUtil.getRegionMbeanProxy(member, REGION_PATH);
         assertNotNull(bean);
-        assertEquals(REGION_PATH, bean.getFullPath());
-        
 
-      }
-    };
-    vm.invoke(verifyRegion);
-  }
-
-  
-  protected void validateDistributedMBean(final VM vm, final int expectedMembers) {
-    SerializableRunnable verifyRegion = new SerializableRunnable(
-        "Verify Distributed region") {
-      public void run() {
-        DistributedRegionMXBean bean = null;
-        DistributedSystemMXBean sysMBean = null;
-        final ManagementService service = getManagementService();
-
-        if (expectedMembers == 0) {
-          try {
-            Wait.waitForCriterion(new WaitCriterion() {
-
-              RegionMXBean bean = null;
-
-              public String description() {
-                return "Waiting for the proxy to get deleted at managing node";
-              }
+        RegionAttributesData data = bean.listRegionAttributes();
+        assertNotNull(data);
 
-              public boolean done() {
-                DistributedRegionMXBean bean = service
-                    .getDistributedRegionMXBean(REGION_PATH);
-                boolean done = (bean == null);
-                return done;
-              }
+        MembershipAttributesData membershipData = bean.listMembershipAttributes();
+        EvictionAttributesData evictionData = bean.listEvictionAttributes();
+        assertNotNull(membershipData);
+        assertNotNull(evictionData);
 
-            }, MAX_WAIT, 500, true);
+//        LogWriterUtils.getLogWriter().info("<ExpectedString> Membership Data is " + membershipData.toString() + "</ExpectedString> ");
+//        LogWriterUtils.getLogWriter().info("<ExpectedString> Eviction Data is " + membershipData.toString() + "</ExpectedString> ");
+      }
 
-          } catch (Exception e) {
-            fail("could not remove Aggregate Bean in required time");
+      DistributedRegionMXBean bean = null;
+      bean = MBeanUtil.getDistributedRegionMbean(REGION_PATH, expectedMembers);
 
-          }
-          return;
-        }
+      assertNotNull(bean);
+      assertEquals(REGION_PATH, bean.getFullPath());
+    });
+  }
 
-        try {
-          bean = MBeanUtil.getDistributedRegionMbean(REGION_PATH,
-              expectedMembers);
-          sysMBean = service.getDistributedSystemMXBean();
-        } catch (Exception e) {
-          InternalDistributedSystem.getLoggerI18n().fine(
-              "Undesired Result , DistributedRegionMXBean Should not be null"
-                  + e);
-        }
+  /**
+   * Invoked in this.managerVM VM
+   */
+  private void validateDistributedMBean(final VM vm, final int expectedMembers) {
+    vm.invoke("validateDistributedMBean", () -> {
+      final ManagementService service = getManagementService();
+
+      if (expectedMembers == 0) {
+        String alias = "Waiting for the proxy to get deleted at managing node";
+        await(alias).atMost(MAX_WAIT_MILLIS, TimeUnit.MILLISECONDS).until(() -> assertNull(service.getDistributedRegionMXBean(REGION_PATH)));
+        return;
+      }
 
-        assertNotNull(bean);
-        assertEquals(REGION_PATH, bean.getFullPath());
-        assertEquals(expectedMembers, bean.getMemberCount());
-        assertEquals(expectedMembers, bean.getMembers().length);
-
-        // Check Stats related Data
-        // Add Mock testing
-        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> ");
+      DistributedRegionMXBean bean = MBeanUtil.getDistributedRegionMbean(REGION_PATH, expectedMembers);
 
-      }
-    };
-    // Test DistributedRegionMXBean
+      assertNotNull(bean);
+      assertEquals(REGION_PATH, bean.getFullPath());
+      assertEquals(expectedMembers, bean.getMemberCount());
+      assertEquals(expectedMembers, bean.getMembers().length);
 
-    vm.invoke(verifyRegion);
+      // 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> ");
+    });
   }
+
   /**
-   * Verifies a Remote Partition Region
-   * 
-   * @param vm
+   * Invoked in this.managerVM VM
    */
-  protected void validateRemotePartitionRegion(final VM vm) throws Exception {
-    SerializableRunnable verifyRegion = new SerializableRunnable(
-        "Verify Partition region") {
-      public void run() {
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-        Set<DistributedMember> otherMemberSet = cache.getDistributionManager()
-            .getOtherNormalDistributionManagerIds();
-
-        for (DistributedMember member : otherMemberSet) {
-          RegionMXBean bean = null;
-          try {
-            bean = MBeanUtil.getRegionMbeanProxy(member,
-                PARTITIONED_REGION_PATH);
-          } catch (Exception e) {
-            InternalDistributedSystem.getLoggerI18n().fine(
-                "Undesired Result , RegionMBean Should not be null");
-          }
-          PartitionAttributesData data = bean.listPartitionAttributes();
-          assertNotNull(data);
-        }
-        
-        ManagementService service = getManagementService();
-        DistributedRegionMXBean bean = service.getDistributedRegionMXBean(PARTITIONED_REGION_PATH);
-        assertEquals(3,bean.getMembers().length);
-
+  private void validateRemotePartitionRegion(final VM vm) throws Exception {
+    vm.invoke("validateRemotePartitionRegion", () -> {
+      GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+      Set<DistributedMember> otherMemberSet = cache.getDistributionManager().getOtherNormalDistributionManagerIds();
+
+      for (DistributedMember member : otherMemberSet) {
+        RegionMXBean regionMXBean = MBeanUtil.getRegionMbeanProxy(member, PARTITIONED_REGION_PATH);
+        PartitionAttributesData partitionAttributesData = regionMXBean.listPartitionAttributes();
+        assertNotNull(partitionAttributesData);
       }
 
-    };
-    vm.invoke(verifyRegion);
+      ManagementService service = getManagementService();
+      DistributedRegionMXBean distributedRegionMXBean = service.getDistributedRegionMXBean(PARTITIONED_REGION_PATH);
+      assertEquals(3, distributedRegionMXBean.getMembers().length);
+    });
   }
 
 
-  
-  
-
   /**
-   * Creates a Distributed Region
-   * 
-   * @param vm
+   * Invoked in member VMs
    */
-  protected void validateReplicateRegionAfterCreate(final VM vm) {
-    SerializableRunnable checkDistributedRegion = new SerializableRunnable(
-        "Check Distributed region") {
-      public void run() {
-
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-        SystemManagementService service = (SystemManagementService)getManagementService();
-
-        MBeanServer mbeanServer = MBeanJMXAdapter.mbeanServer;
-        RegionNotif test = new RegionNotif();
+  private void validateReplicateRegionAfterCreate(final VM memberVM) {
+    memberVM.invoke("Check Distributed region", () -> {
+      GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+      String memberId = MBeanJMXAdapter.getMemberNameOrId(cache.getDistributedSystem().getDistributedMember());
+      ObjectName memberMBeanName = ObjectName.getInstance("GemFire:type=Member,member=" + memberId);
 
-        String memberId = MBeanJMXAdapter.getMemberNameOrId(cache
-            .getDistributedSystem().getDistributedMember());
+      MemberNotificationListener listener = new MemberNotificationListener();
+      ManagementFactory.getPlatformMBeanServer().addNotificationListener(memberMBeanName, listener, null, null);
 
-        ObjectName memberMBeanName;
-        try {
-          memberMBeanName = ObjectName
-              .getInstance("GemFire:type=Member,member=" + memberId);
-          mbeanServer
-              .addNotificationListener(memberMBeanName, test, null, null);
-        } catch (MalformedObjectNameException e) {
+      SystemManagementService service = (SystemManagementService) getManagementService();
+      RegionMXBean regionMXBean = service.getLocalRegionMBean(REGION_PATH);
+      assertNotNull(regionMXBean);
 
-          Assert.fail("FAILED WITH EXCEPION", e);
-        } catch (NullPointerException e) {
-          Assert.fail("FAILED WITH EXCEPION", e);
+      Region region = cache.getRegion(REGION_PATH);
+      RegionAttributes regionAttributes = region.getAttributes();
 
-        } catch (InstanceNotFoundException e) {
-          Assert.fail("FAILED WITH EXCEPION", e);
+      RegionAttributesData regionAttributesData = regionMXBean.listRegionAttributes();
+      assertRegionAttributes(regionAttributes, regionAttributesData);
 
-        }
-
-        assertNotNull(service.getLocalRegionMBean(REGION_PATH));
-
-        RegionMXBean bean = service.getLocalRegionMBean(REGION_PATH);
-        Region region = cache.getRegion(REGION_PATH);
-
-        RegionAttributes regAttrs = region.getAttributes();
+      MembershipAttributesData membershipData = regionMXBean.listMembershipAttributes();
+      assertNotNull(membershipData);
 
-        RegionAttributesData data = bean.listRegionAttributes();
-
-        assertRegionAttributes(regAttrs, data);
-        MembershipAttributesData membershipData = bean
-            .listMembershipAttributes();
-        EvictionAttributesData evictionData = bean.listEvictionAttributes();
-        assertNotNull(membershipData);
-        assertNotNull(evictionData);
-        LogWriterUtils.getLogWriter().info(
-            "<ExpectedString> Membership Data is " + membershipData.toString()
-                + "</ExpectedString> ");
-        LogWriterUtils.getLogWriter().info(
-            "<ExpectedString> Eviction Data is " + membershipData.toString()
-                + "</ExpectedString> ");
-      }
-    };
-    vm.invoke(checkDistributedRegion);
+      EvictionAttributesData evictionData = regionMXBean.listEvictionAttributes();
+      assertNotNull(evictionData);
+    });
   }
 
   /**
-   * Creates a partition Region
-   * 
-   * @param vm
+   * Invoked in managedNodes VMs
    */
-  protected void validatePartitionRegionAfterCreate(final VM vm) {
-    SerializableRunnable createParRegion = new SerializableRunnable(
-        "Create Partitioned region") {
-      public void run() {
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-        SystemManagementService service = (SystemManagementService)getManagementService();
-        assertNotNull(service.getLocalRegionMBean(PARTITIONED_REGION_PATH));
-        RegionMXBean bean = service
-            .getLocalRegionMBean(PARTITIONED_REGION_PATH);
-        Region partitionedRegion = cache.getRegion(PARTITIONED_REGION_PATH);
-        RegionAttributes regAttrs = partitionedRegion.getAttributes();
-        RegionAttributesData data = bean.listRegionAttributes();
-        PartitionAttributesData parData = bean.listPartitionAttributes();
-        assertPartitionData(regAttrs, parData);
-        
-      }
-    };
-    vm.invoke(createParRegion);
+  private void validatePartitionRegionAfterCreate(final VM vm) {
+    vm.invoke("validatePartitionRegionAfterCreate", () -> {
+      GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+      Region partitionedRegion = cache.getRegion(PARTITIONED_REGION_PATH);
+
+      SystemManagementService service = (SystemManagementService) getManagementService();
+      RegionMXBean regionMBean = service.getLocalRegionMBean(PARTITIONED_REGION_PATH);
+
+      assertPartitionData(partitionedRegion.getAttributes(), regionMBean.listPartitionAttributes());
+    });
   }
 
   /**
-   * closes a Distributed Region
-   * 
-   * @param vm
+   * Invoked in managedNode VMs
    */
-  protected void validateReplicatedRegionAfterClose(final VM vm) {
-    SerializableRunnable closeRegion = new SerializableRunnable(
-        "Close Distributed region") {
-      public void run() {
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-        SystemManagementService service = (SystemManagementService)getManagementService();
-        RegionMXBean bean = null;
-        try {
-          bean = service.getLocalRegionMBean(REGION_PATH);
-        } catch (ManagementException mgtEx) {
-          LogWriterUtils.getLogWriter().info(
-              "<ExpectedString> Expected Exception  "
-                  + mgtEx.getLocalizedMessage() + "</ExpectedString> ");
-        }
-        assertNull(bean);
-        ObjectName regionObjectName = service.getRegionMBeanName(cache
-            .getDistributedSystem().getDistributedMember(), REGION_PATH);
-        assertNull(service.getLocalManager().getManagementResourceRepo()
-            .getEntryFromLocalMonitoringRegion(regionObjectName));
-      }
-    };
-    vm.invoke(closeRegion);
+  private void validateReplicatedRegionAfterClose(final VM vm) {
+    vm.invoke("validateReplicatedRegionAfterClose", () -> {
+      SystemManagementService service = (SystemManagementService) getManagementService();
+      RegionMXBean regionMXBean = service.getLocalRegionMBean(REGION_PATH);
+      assertNull(regionMXBean);
+
+      GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+      ObjectName regionObjectName = service.getRegionMBeanName(cache.getDistributedSystem().getDistributedMember(), REGION_PATH);
+      assertNull(service.getLocalManager().getManagementResourceRepo().getEntryFromLocalMonitoringRegion(regionObjectName));
+    });
   }
 
   /**
-   * close a partition Region
-   * 
-   * @param vm
+   * Invoked in managedNode VMs
    */
-  protected void validatePartitionRegionAfterClose(final VM vm) {
-    SerializableRunnable closeParRegion = new SerializableRunnable(
-        "Close Partition region") {
-      public void run() {
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-        ManagementService service = getManagementService();
-        LogWriterUtils.getLogWriter().info("Closing Par Region");
-        RegionMXBean bean = null;
-        try {
-          bean = service.getLocalRegionMBean(PARTITIONED_REGION_PATH);
-        } catch (ManagementException mgtEx) {
-          LogWriterUtils.getLogWriter().info(
-              "<ExpectedString> Expected Exception  "
-                  + mgtEx.getLocalizedMessage() + "</ExpectedString> ");
-        }
-        assertNull(bean);
-      }
-    };
-    vm.invoke(closeParRegion);
+  private void validatePartitionRegionAfterClose(final VM vm) {
+    vm.invoke("validatePartitionRegionAfterClose", () -> {
+      ManagementService service = getManagementService();
+      RegionMXBean bean = service.getLocalRegionMBean(PARTITIONED_REGION_PATH);
+      assertNull(bean);
+    });
   }
 
   /**
-   * Closes Fixed Partition region
-   * 
-   * @param vm
+   * Invoked in member VMs
    */
-  protected void closeFixedPartitionRegion(final VM vm) {
-    SerializableRunnable closeParRegion = new SerializableRunnable(
-        "Close Fixed Partition region") {
-      public void run() {
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-        ManagementService service = getManagementService();
-        LogWriterUtils.getLogWriter().info("Closing Fixed Par Region");
-        Region region = cache.getRegion(FIXED_PR_PATH);
-        region.close();
-        RegionMXBean bean = null;
-        try {
-          bean = service.getLocalRegionMBean(FIXED_PR_PATH);
-        } catch (ManagementException mgtEx) {
-          LogWriterUtils.getLogWriter().info(
-              "<ExpectedString> Expected Exception  "
-                  + mgtEx.getLocalizedMessage() + "</ExpectedString> ");
-        }
-        assertNull(bean);
-      }
-    };
-    vm.invoke(closeParRegion);
+  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);
+    });
   }
 
   /**
-   * Asserts and verifies all the partition related data
-   * 
-   * @param regAttrs
-   * @param partitionAttributesData
+   * Invoked in member VMs
    */
+  private static void assertPartitionData(final RegionAttributes expectedRegionAttributes, final PartitionAttributesData partitionAttributesData) {
+    PartitionAttributes expectedPartitionAttributes = expectedRegionAttributes.getPartitionAttributes();
 
-  protected static void assertPartitionData(RegionAttributes regAttrs,
-      PartitionAttributesData partitionAttributesData) {
-    PartitionAttributesData data = partitionAttributesData;
+    assertEquals(expectedPartitionAttributes.getRedundantCopies(), partitionAttributesData.getRedundantCopies());
 
-    PartitionAttributes partAttrs = regAttrs.getPartitionAttributes();
+    assertEquals(expectedPartitionAttributes.getTotalMaxMemory(), partitionAttributesData.getTotalMaxMemory());
 
-    int redundantCopies = partAttrs.getRedundantCopies();
-    assertEquals(redundantCopies, data.getRedundantCopies());
-    long totalMaxMemory = partAttrs.getTotalMaxMemory();
-    assertEquals(totalMaxMemory, data.getTotalMaxMemory());
     // Total number of buckets for whole region
-    int totalNumBuckets = partAttrs.getTotalNumBuckets();
-    assertEquals(totalNumBuckets, data.getTotalNumBuckets());
+    assertEquals(expectedPartitionAttributes.getTotalNumBuckets(), partitionAttributesData.getTotalNumBuckets());
 
-    int localMaxMemory = partAttrs.getLocalMaxMemory();
-    assertEquals(localMaxMemory, data.getLocalMaxMemory());
+    assertEquals(expectedPartitionAttributes.getLocalMaxMemory(), partitionAttributesData.getLocalMaxMemory());
 
-    String colocatedWith = partAttrs.getColocatedWith();
-    assertEquals(colocatedWith, data.getColocatedWith());
+    assertEquals(expectedPartitionAttributes.getColocatedWith(), partitionAttributesData.getColocatedWith());
 
     String partitionResolver = null;
-    if (partAttrs.getPartitionResolver() != null) {
-      partitionResolver = partAttrs.getPartitionResolver().getName();
+    if (expectedPartitionAttributes.getPartitionResolver() != null) { // TODO: these conditionals should be deterministic
+      partitionResolver = expectedPartitionAttributes.getPartitionResolver().getName();
     }
+    assertEquals(partitionResolver, partitionAttributesData.getPartitionResolver());
 
-    assertEquals(partitionResolver, data.getPartitionResolver());
-
-    long recoveryDelay = partAttrs.getRecoveryDelay();
-    assertEquals(recoveryDelay, data.getRecoveryDelay());
+    assertEquals(expectedPartitionAttributes.getRecoveryDelay(), partitionAttributesData.getRecoveryDelay());
 
-    long startupRecoveryDelay = partAttrs.getStartupRecoveryDelay();
-    assertEquals(startupRecoveryDelay, data.getStartupRecoveryDelay());
+    assertEquals(expectedPartitionAttributes.getStartupRecoveryDelay(), partitionAttributesData.getStartupRecoveryDelay());
 
-    if (partAttrs.getPartitionListeners() != null) {
-      for (int i = 0; i < partAttrs.getPartitionListeners().length; i++) {
-        assertEquals((partAttrs.getPartitionListeners())[i].getClass()
-            .getCanonicalName(), data.getPartitionListeners()[i]);
+    if (expectedPartitionAttributes.getPartitionListeners() != null) {
+      for (int i = 0; i < expectedPartitionAttributes.getPartitionListeners().length; i++) {
+        assertEquals((expectedPartitionAttributes.getPartitionListeners())[i].getClass().getCanonicalName(), partitionAttributesData.getPartitionListeners()[i]);
       }
-
     }
-
   }
 
   /**
-   * Checks all Region Attributes
-   * 
-   * @param regAttrs
-   * @param data
+   * Invoked in member VMs
    */
-  protected static void assertRegionAttributes(RegionAttributes regAttrs,
-      RegionAttributesData data) {
-
+  private static void assertRegionAttributes(final RegionAttributes regionAttributes, final RegionAttributesData regionAttributesData) {
     String compressorClassName = null;
-    if (regAttrs.getCompressor() != null) {
-      compressorClassName = regAttrs.getCompressor().getClass()
-          .getCanonicalName();
+    if (regionAttributes.getCompressor() != null) { // TODO: these conditionals should be deterministic
+      compressorClassName = regionAttributes.getCompressor().getClass().getCanonicalName();
     }
-    assertEquals(compressorClassName, data.getCompressorClassName());
+    assertEquals(compressorClassName, regionAttributesData.getCompressorClassName());
+
     String cacheLoaderClassName = null;
-    if (regAttrs.getCacheLoader() != null) {
-      cacheLoaderClassName = regAttrs.getCacheLoader().getClass()
-          .getCanonicalName();
+    if (regionAttributes.getCacheLoader() != null) {
+      cacheLoaderClassName = regionAttributes.getCacheLoader().getClass().getCanonicalName();
     }
-    assertEquals(cacheLoaderClassName, data.getCacheLoaderClassName());
+    assertEquals(cacheLoaderClassName, regionAttributesData.getCacheLoaderClassName());
+
     String cacheWriteClassName = null;
-    if (regAttrs.getCacheWriter() != null) {
-      cacheWriteClassName = regAttrs.getCacheWriter().getClass()
-          .getCanonicalName();
+    if (regionAttributes.getCacheWriter() != null) {
+      cacheWriteClassName = regionAttributes.getCacheWriter().getClass().getCanonicalName();
     }
-    assertEquals(cacheWriteClassName, data.getCacheWriterClassName());
+    assertEquals(cacheWriteClassName, regionAttributesData.getCacheWriterClassName());
+
     String keyConstraintClassName = null;
-    if (regAttrs.getKeyConstraint() != null) {
-      keyConstraintClassName = regAttrs.getKeyConstraint().getName();
+    if (regionAttributes.getKeyConstraint() != null) {
+      keyConstraintClassName = regionAttributes.getKeyConstraint().getName();
     }
-    assertEquals(keyConstraintClassName, data.getKeyConstraintClassName());
+    assertEquals(keyConstraintClassName, regionAttributesData.getKeyConstraintClassName());
+
     String valueContstaintClassName = null;
-    if (regAttrs.getValueConstraint() != null) {
-      valueContstaintClassName = regAttrs.getValueConstraint().getName();
+    if (regionAttributes.getValueConstraint() != null) {
+      valueContstaintClassName = regionAttributes.getValueConstraint().getName();
     }
-    assertEquals(valueContstaintClassName, data.getValueConstraintClassName());
-    CacheListener[] listeners = regAttrs.getCacheListeners();
-    
+    assertEquals(valueContstaintClassName, regionAttributesData.getValueConstraintClassName());
 
+    CacheListener[] listeners = regionAttributes.getCacheListeners();
     if (listeners != null) {
-      String[] value = data.getCacheListeners();
+      String[] value = regionAttributesData.getCacheListeners();
       for (int i = 0; i < listeners.length; i++) {
         assertEquals(value[i], listeners[i].getClass().getName());
       }
-      
     }
-    
- 
-    
-
-    int regionTimeToLive = regAttrs.getRegionTimeToLive().getTimeout();
-
-    assertEquals(regionTimeToLive, data.getRegionTimeToLive());
 
-    int regionIdleTimeout = regAttrs.getRegionIdleTimeout().getTimeout();
+    assertEquals(regionAttributes.getRegionTimeToLive().getTimeout(), regionAttributesData.getRegionTimeToLive());
 
-    assertEquals(regionIdleTimeout, data.getRegionIdleTimeout());
+    assertEquals(regionAttributes.getRegionIdleTimeout().getTimeout(), regionAttributesData.getRegionIdleTimeout());
 
-    int entryTimeToLive = regAttrs.getEntryTimeToLive().getTimeout();
+    assertEquals(regionAttributes.getEntryTimeToLive().getTimeout(), regionAttributesData.getEntryTimeToLive());
 
-    assertEquals(entryTimeToLive, data.getEntryTimeToLive());
+    assertEquals(regionAttributes.getEntryIdleTimeout().getTimeout(), regionAttributesData.getEntryIdleTimeout());
 
-    int entryIdleTimeout = regAttrs.getEntryIdleTimeout().getTimeout();
-
-    assertEquals(entryIdleTimeout, data.getEntryIdleTimeout());
     String customEntryTimeToLive = null;
-    Object o1 = regAttrs.getCustomEntryTimeToLive();
+    Object o1 = regionAttributes.getCustomEntryTimeToLive();
     if (o1 != null) {
       customEntryTimeToLive = o1.toString();
     }
-    assertEquals(customEntryTimeToLive, data.getCustomEntryTimeToLive());
+    assertEquals(customEntryTimeToLive, regionAttributesData.getCustomEntryTimeToLive());
 
     String customEntryIdleTimeout = null;
-    Object o2 = regAttrs.getCustomEntryIdleTimeout();
+    Object o2 = regionAttributes.getCustomEntryIdleTimeout();
     if (o2 != null) {
       customEntryIdleTimeout = o2.toString();
     }
-    assertEquals(customEntryIdleTimeout, data.getCustomEntryIdleTimeout());
+    assertEquals(customEntryIdleTimeout, regionAttributesData.getCustomEntryIdleTimeout());
 
-    boolean ignoreJTA = regAttrs.getIgnoreJTA();
-    assertEquals(ignoreJTA, data.isIgnoreJTA());
+    assertEquals(regionAttributes.getIgnoreJTA(), regionAttributesData.isIgnoreJTA());
 
-    String dataPolicy = regAttrs.getDataPolicy().toString();
-    assertEquals(dataPolicy, data.getDataPolicy());
+    assertEquals(regionAttributes.getDataPolicy().toString(), regionAttributesData.getDataPolicy());
 
-    String scope = regAttrs.getScope().toString();
-    assertEquals(scope, data.getScope());
+    assertEquals(regionAttributes.getScope().toString(), regionAttributesData.getScope());
 
-    int initialCapacity = regAttrs.getInitialCapacity();
-    assertEquals(initialCapacity, data.getInitialCapacity());
-    float loadFactor = regAttrs.getLoadFactor();
-    assertEquals(loadFactor, data.getLoadFactor(),0);
+    assertEquals(regionAttributes.getInitialCapacity(), regionAttributesData.getInitialCapacity());
 
-    boolean lockGrantor = regAttrs.isLockGrantor();
-    assertEquals(lockGrantor, data.isLockGrantor());
+    assertEquals(regionAttributes.getLoadFactor(), regionAttributesData.getLoadFactor(), 0);
 
-    boolean multicastEnabled = regAttrs.getMulticastEnabled();
-    assertEquals(multicastEnabled, data.isMulticastEnabled());
+    assertEquals(regionAttributes.isLockGrantor(), regionAttributesData.isLockGrantor());
 
-    int concurrencyLevel = regAttrs.getConcurrencyLevel();
-    assertEquals(concurrencyLevel, data.getConcurrencyLevel());
+    assertEquals(regionAttributes.getMulticastEnabled(), regionAttributesData.isMulticastEnabled());
 
-    boolean indexMaintenanceSynchronous = regAttrs
-        .getIndexMaintenanceSynchronous();
-    assertEquals(indexMaintenanceSynchronous, data
-        .isIndexMaintenanceSynchronous());
+    assertEquals(regionAttributes.getConcurrencyLevel(), regionAttributesData.getConcurrencyLevel());
 
-    boolean statisticsEnabled = regAttrs.getStatisticsEnabled();
+    assertEquals(regionAttributes.getIndexMaintenanceSynchronous(), regionAttributesData.isIndexMaintenanceSynchronous());
 
-    assertEquals(statisticsEnabled, data.isStatisticsEnabled());
+    assertEquals(regionAttributes.getStatisticsEnabled(), regionAttributesData.isStatisticsEnabled());
 
-    boolean subsciptionConflationEnabled = regAttrs
-        .getEnableSubscriptionConflation();
-    assertEquals(subsciptionConflationEnabled, data
-        .isSubscriptionConflationEnabled());
+    assertEquals(regionAttributes.getEnableSubscriptionConflation(), regionAttributesData.isSubscriptionConflationEnabled());
 
-    boolean asyncConflationEnabled = regAttrs.getEnableAsyncConflation();
-    assertEquals(asyncConflationEnabled, data.isAsyncConflationEnabled());
+    assertEquals(regionAttributes.getEnableAsyncConflation(), regionAttributesData.isAsyncConflationEnabled());
 
-    String poolName = regAttrs.getPoolName();
-    assertEquals(poolName, data.getPoolName());
+    assertEquals(regionAttributes.getPoolName(), regionAttributesData.getPoolName());
 
-    boolean isCloningEnabled = regAttrs.getCloningEnabled();
-    assertEquals(isCloningEnabled, data.isCloningEnabled());
+    assertEquals(regionAttributes.getCloningEnabled(), regionAttributesData.isCloningEnabled());
 
-    String diskStoreName = regAttrs.getDiskStoreName();
-    assertEquals(diskStoreName, data.getDiskStoreName());
+    assertEquals(regionAttributes.getDiskStoreName(), regionAttributesData.getDiskStoreName());
 
     String interestPolicy = null;
-    if (regAttrs.getSubscriptionAttributes() != null) {
-      interestPolicy = regAttrs.getSubscriptionAttributes().getInterestPolicy()
-          .toString();
+    if (regionAttributes.getSubscriptionAttributes() != null) {
+      interestPolicy = regionAttributes.getSubscriptionAttributes().getInterestPolicy().toString();
     }
-    assertEquals(interestPolicy, data.getInterestPolicy());
-    boolean diskSynchronus = regAttrs.isDiskSynchronous();
-    assertEquals(diskSynchronus, data.isDiskSynchronous());
-  }
-
-  /**
-   * Verifies Region related Statistics
-   */
-  public void verifyStatistics() {
+    assertEquals(interestPolicy, regionAttributesData.getInterestPolicy());
 
+    assertEquals(regionAttributes.isDiskSynchronous(), regionAttributesData.isDiskSynchronous());
   }
 
-
   /**
+   * Registered in manager VM
+   *
    * User defined notification handler for Region creation handling
-   * 
-   * 
    */
-  private static class RegionNotif implements NotificationListener {
+  private static class MemberNotificationListener implements NotificationListener {
 
     @Override
-    public void handleNotification(Notification notification, Object handback) {
+    public void handleNotification(final Notification notification, final Object handback) {
       assertNotNull(notification);
-      Notification rn =  notification;
-      assertTrue(rn.getType().equals(JMXNotificationType.REGION_CREATED)
-          || rn.getType().equals(JMXNotificationType.REGION_CLOSED));
-      LogWriterUtils.getLogWriter().info(
-          "<ExpectedString> Member Level Notifications" + rn.toString()
-              + "</ExpectedString> ");
+      assertTrue(notification.getType().equals(JMXNotificationType.REGION_CREATED) ||
+                 notification.getType().equals(JMXNotificationType.REGION_CLOSED));
+      // TODO: add better validation
+      //LogWriterUtils.getLogWriter().info("<ExpectedString> Member Level Notifications" + notification + "</ExpectedString> ");
     }
-
   }
 
   /**
+   * Registered in manager VM
+   *
    * User defined notification handler for Region creation handling
-   * 
-   * 
    */
-  private static class DistrNotif implements NotificationListener {
+  private static class DistributedSystemNotificationListener implements NotificationListener {
 
     @Override
-    public void handleNotification(Notification notification, Object handback) {
+    public void handleNotification(final Notification notification, final Object handback) {
       assertNotNull(notification);
-      Notification rn = notification;
-      LogWriterUtils.getLogWriter().info(
-          "<ExpectedString> Distributed System Notifications" + rn.toString()
-              + "</ExpectedString> ");
+      // TODO: add something that will be validated
+      //LogWriterUtils.getLogWriter().info("<ExpectedString> Distributed System Notifications" + notification + "</ExpectedString> ");
     }
-
   }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/864c92c9/geode-core/src/test/java/org/apache/geode/management/bean/stats/DistributedSystemStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/bean/stats/DistributedSystemStatsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/bean/stats/DistributedSystemStatsDUnitTest.java
index 2330031..446ea2e 100644
--- a/geode-core/src/test/java/org/apache/geode/management/bean/stats/DistributedSystemStatsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/bean/stats/DistributedSystemStatsDUnitTest.java
@@ -16,98 +16,66 @@
  */
 package org.apache.geode.management.bean.stats;
 
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
+import static com.jayway.awaitility.Awaitility.*;
 import static org.junit.Assert.*;
 
-import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.junit.categories.DistributedTest;
-
+import java.lang.management.ManagementFactory;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
 
 import javax.management.ObjectName;
 
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.internal.cache.DiskStoreStats;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.management.DistributedSystemMXBean;
-import org.apache.geode.management.ManagementTestBase;
+import org.apache.geode.management.ManagementService;
+import org.apache.geode.management.ManagementTestRule;
+import org.apache.geode.management.Manager;
+import org.apache.geode.management.Member;
 import org.apache.geode.management.MemberMXBean;
 import org.apache.geode.management.internal.SystemManagementService;
-import org.apache.geode.management.internal.beans.MemberMBean;
-import org.apache.geode.management.internal.beans.MemberMBeanBridge;
-import org.apache.geode.test.dunit.Assert;
-import org.apache.geode.test.dunit.SerializableRunnable;
 import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.junit.categories.DistributedTest;
 
-/**
- */
 @Category(DistributedTest.class)
-public class DistributedSystemStatsDUnitTest extends ManagementTestBase{
-  
-  private static final long serialVersionUID = 1L;
+@SuppressWarnings("serial")
+public class DistributedSystemStatsDUnitTest {
 
-  public DistributedSystemStatsDUnitTest() {
-    super();
-  }
+  @Manager
+  private VM manager;
+
+  @Member
+  private VM[] members;
+
+  @Rule
+  public ManagementTestRule managementTestRule = ManagementTestRule.builder().build();
 
   @Test
   public void testDistributedSystemStats() throws Exception {
-    initManagement(true);
+    this.manager.invoke("verifyMBeans", () -> {
+      GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+      assertNotNull(cache);
 
-    for(VM vm : managedNodeList){
-      setDiskStats(vm);
-    }
-    verifyDiskStats(managingNode);
-  }
-  
-  @SuppressWarnings("serial")
-  public void setDiskStats(VM vm1) throws Exception {
-    vm1.invoke(new SerializableRunnable("Set Member Stats") {
-      public void run() {
-        MemberMBean bean = (MemberMBean) managementService.getMemberMXBean();
-        MemberMBeanBridge bridge = bean.getBridge();
-        DiskStoreStats diskStoreStats = new DiskStoreStats(basicGetSystem(), "test");
-        bridge.addDiskStoreStats(diskStoreStats);
-        diskStoreStats.startRead();
-        diskStoreStats.startWrite();
-        diskStoreStats.startBackup();
-        diskStoreStats.startRecovery();
-        diskStoreStats.incWrittenBytes(20, true);
-        diskStoreStats.startFlush();
-        diskStoreStats.setQueueSize(10);
-      }
-    });
-  }
+      SystemManagementService service = (SystemManagementService) ManagementService.getManagementService(cache);
+      DistributedSystemMXBean distributedSystemMXBean = service.getDistributedSystemMXBean();
+      assertNotNull(distributedSystemMXBean);
+
+      Set<DistributedMember> otherMemberSet = cache.getDistributionManager().getOtherNormalDistributionManagerIds();
+      assertEquals(3, otherMemberSet.size());
+
+      for (DistributedMember member : otherMemberSet) {
+        ObjectName memberMXBeanName = service.getMemberMBeanName(member);
+        await().atMost(2, TimeUnit.MINUTES).until(() -> assertTrue(ManagementFactory.getPlatformMBeanServer().isRegistered(memberMXBeanName)));
 
-  @SuppressWarnings("serial")
-  public void verifyDiskStats(VM vm1) throws Exception {
-    vm1.invoke(new SerializableRunnable("Set Member Stats") {
-      public void run() {
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-        
-        SystemManagementService service = (SystemManagementService) getManagementService();
-        DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
-        assertNotNull(bean);
-        Set<DistributedMember> otherMemberSet = cache.getDistributionManager()
-            .getOtherNormalDistributionManagerIds();
-         
-        for (DistributedMember member : otherMemberSet) {
-          ObjectName memberMBeanName;
-          try {
-            memberMBeanName = service.getMemberMBeanName(member);
-            waitForProxy(memberMBeanName, MemberMXBean.class);
-            MemberMXBean memberBean = service.getMBeanProxy(memberMBeanName, MemberMXBean.class);
-            waitForRefresh(2, memberMBeanName);
-          } catch (NullPointerException e) {
-            Assert.fail("FAILED WITH EXCEPION", e);
-          } catch (Exception e) {
-            Assert.fail("FAILED WITH EXCEPION", e);
-          }
-        }
+        MemberMXBean memberMXBean = service.getMBeanProxy(memberMXBeanName, MemberMXBean.class);
+        assertNotNull(memberMXBean);
 
+        final long lastRefreshTime = service.getLastUpdateTime(memberMXBeanName);
+        await().atMost(1, TimeUnit.MINUTES).until(() -> assertTrue(service.getLastUpdateTime(memberMXBeanName) > lastRefreshTime));
       }
     });
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/864c92c9/geode-core/src/test/java/org/apache/geode/management/internal/beans/QueryDataFunctionApplyLimitClauseTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/beans/QueryDataFunctionApplyLimitClauseTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/beans/QueryDataFunctionApplyLimitClauseTest.java
index 7270a2b..1554cd6 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/beans/QueryDataFunctionApplyLimitClauseTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/beans/QueryDataFunctionApplyLimitClauseTest.java
@@ -26,7 +26,6 @@ import org.junit.experimental.categories.Category;
 
 import org.apache.geode.test.junit.categories.UnitTest;
 
-
 @Category(UnitTest.class)
 public class QueryDataFunctionApplyLimitClauseTest {
 
@@ -47,8 +46,7 @@ public class QueryDataFunctionApplyLimitClauseTest {
   public void applyLimitClauseDoesNothingIfLimitClauseSpecified() {
     String limitClause = " LIMIT 50";
     String selectQueryWithLimit = selectQuery + limitClause;
-    assertThat(QueryDataFunction.applyLimitClause(selectQueryWithLimit, limit_10, queryResultSetLimit_100))
-      .isEqualTo(selectQueryWithLimit);
+    assertThat(QueryDataFunction.applyLimitClause(selectQueryWithLimit, limit_10, queryResultSetLimit_100)).isEqualTo(selectQueryWithLimit);
   }
 
   @Test
@@ -64,15 +62,13 @@ public class QueryDataFunctionApplyLimitClauseTest {
   @Test // GEODE-1907
   public void applyLimitClauseAddsQueryResultSetLimitIfMissingSpaceAfterFrom() {
     String selectQueryMissingSpaceAfterFrom = "SELECT * FROM/MyRegion";
-    assertThat(QueryDataFunction.applyLimitClause(selectQueryMissingSpaceAfterFrom, limit_0, queryResultSetLimit_100))
-      .isEqualTo(selectQueryMissingSpaceAfterFrom + " LIMIT " + queryResultSetLimit_100);
+    assertThat(QueryDataFunction.applyLimitClause(selectQueryMissingSpaceAfterFrom, limit_0, queryResultSetLimit_100)).isEqualTo(selectQueryMissingSpaceAfterFrom + " LIMIT " + queryResultSetLimit_100);
   }
 
   @Test
   public void applyLimitClauseDoesNotAddQueryResultSetLimitIfMissingSpaceAfterFromButLimitIsPresent() {
     String selectQueryMissingSpaceAfterFromWithLimit = "SELECT * FROM/MyRegion LIMIT " + limit_10;
-    assertThat(QueryDataFunction.applyLimitClause(selectQueryMissingSpaceAfterFromWithLimit, limit_0, queryResultSetLimit_100))
-      .isEqualTo(selectQueryMissingSpaceAfterFromWithLimit);
+    assertThat(QueryDataFunction.applyLimitClause(selectQueryMissingSpaceAfterFromWithLimit, limit_0, queryResultSetLimit_100)).isEqualTo(selectQueryMissingSpaceAfterFromWithLimit);
   }
 
 }
\ No newline at end of file