You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by sb...@apache.org on 2015/10/28 00:39:31 UTC

incubator-geode git commit: Fixes GEODE-495: fix for OffHeapManagementDUnitTest

Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-409 9d8e568b4 -> fa3a47bc0


Fixes GEODE-495: fix for OffHeapManagementDUnitTest

- use a random port for the JMX manager
- fixed cleanup not to create cache if not created already

This closes #25


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

Branch: refs/heads/feature/GEODE-409
Commit: fa3a47bc0460ef329bd64e55da22c5d8454e8d69
Parents: 9d8e568
Author: Sai Boorlagadda <sb...@pivotal.io>
Authored: Tue Oct 27 16:17:07 2015 -0700
Committer: Swapnil Bawaskar <sb...@pivotal.io>
Committed: Tue Oct 27 16:33:19 2015 -0700

----------------------------------------------------------------------
 .../management/OffHeapManagementDUnitTest.java      | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/fa3a47bc/gemfire-core/src/test/java/com/gemstone/gemfire/management/OffHeapManagementDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/management/OffHeapManagementDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/management/OffHeapManagementDUnitTest.java
index aca8ae0..16a12ff 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/management/OffHeapManagementDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/management/OffHeapManagementDUnitTest.java
@@ -29,6 +29,7 @@ import javax.management.NotificationListener;
 import javax.management.ObjectName;
 
 import com.gemstone.gemfire.OutOfOffHeapMemoryException;
+import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.DataPolicy;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache30.CacheTestCase;
@@ -614,7 +615,8 @@ public class OffHeapManagementDUnitTest extends CacheTestCase {
     props.setProperty(DistributionConfig.OFF_HEAP_MEMORY_SIZE_NAME, "1m");    
     props.setProperty(DistributionConfig.JMX_MANAGER_NAME, "true");
     props.setProperty(DistributionConfig.JMX_MANAGER_START_NAME, "true");
-    
+    props.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, "0");
+
     return props;
   }
 
@@ -635,10 +637,14 @@ public class OffHeapManagementDUnitTest extends CacheTestCase {
    * Removes off-heap region and disconnects.
    */
   protected void cleanup() {
-    Region region = getCache().getRegion(OFF_HEAP_REGION_NAME);
-    
-    if(null != region) {
-      region.destroyRegion();
+    Cache existingCache = basicGetCache();
+
+    if(null != existingCache && !existingCache.isClosed()) {
+      Region region = getCache().getRegion(OFF_HEAP_REGION_NAME);
+
+      if (null != region) {
+        region.destroyRegion();
+      }
     }
     
     disconnectFromDS();