@Override
  @Test
  public void testResourceManagerThresholds() throws Exception {
    CacheCreation cache = new CacheCreation();
    final float low = 90.0f;
    final float high = 95.0f;

    System.setProperty(GeodeGlossary.GEMFIRE_PREFIX + OFF_HEAP_MEMORY_SIZE, "1m");

    Cache c;
    ResourceManagerCreation rmc = new ResourceManagerCreation();
    rmc.setEvictionOffHeapPercentage(low);
    rmc.setCriticalOffHeapPercentage(high);
    cache.setResourceManagerCreation(rmc);
    testXml(cache);
    {
      c = getCache();
      assertEquals(low, c.getResourceManager().getEvictionOffHeapPercentage(), 0);
      assertEquals(high, c.getResourceManager().getCriticalOffHeapPercentage(), 0);
    }
    closeCache();

    rmc = new ResourceManagerCreation();
    // Set them to similar values
    rmc.setEvictionOffHeapPercentage(low);
    rmc.setCriticalOffHeapPercentage(low + 1);
    cache.setResourceManagerCreation(rmc);
    testXml(cache);
    {
      c = getCache();
      assertEquals(low, c.getResourceManager().getEvictionOffHeapPercentage(), 0);
      assertEquals(low + 1, c.getResourceManager().getCriticalOffHeapPercentage(), 0);
    }
    closeCache();

    rmc = new ResourceManagerCreation();
    rmc.setEvictionOffHeapPercentage(high);
    rmc.setCriticalOffHeapPercentage(low);
    cache.setResourceManagerCreation(rmc);
    IgnoredException expectedException = IgnoredException.addIgnoredException(
        "Eviction percentage must be less than the critical percentage.");
    try {
      testXml(cache);
      fail("Expected IllegalArgumentException to be thrown");
    } catch (IllegalArgumentException ignored) {
    } finally {
      expectedException.remove();
      closeCache();
    }

    // Disable eviction
    rmc = new ResourceManagerCreation();
    rmc.setEvictionOffHeapPercentage(0);
    rmc.setCriticalOffHeapPercentage(low);
    cache.setResourceManagerCreation(rmc);
    testXml(cache);
    {
      c = getCache();
      assertEquals(0f, c.getResourceManager().getEvictionOffHeapPercentage(), 0);
      assertEquals(low, c.getResourceManager().getCriticalOffHeapPercentage(), 0);
    }
    closeCache();

    // Disable refusing ops in "red zone"
    rmc = new ResourceManagerCreation();
    rmc.setEvictionOffHeapPercentage(low);
    rmc.setCriticalOffHeapPercentage(0);
    cache.setResourceManagerCreation(rmc);
    testXml(cache);
    {
      c = getCache();
      assertEquals(low, c.getResourceManager().getEvictionOffHeapPercentage(), 0);
      assertEquals(0f, c.getResourceManager().getCriticalOffHeapPercentage(), 0);
    }
    closeCache();

    // Disable both
    rmc = new ResourceManagerCreation();
    rmc.setEvictionOffHeapPercentage(0);
    rmc.setCriticalOffHeapPercentage(0);
    cache.setResourceManagerCreation(rmc);
    testXml(cache);
    c = getCache();
    assertEquals(0f, c.getResourceManager().getEvictionOffHeapPercentage(), 0);
    assertEquals(0f, c.getResourceManager().getCriticalOffHeapPercentage(), 0);
  }
Test the ResourceManager element's critical-off-heap-percentage and
eviction-off-heap-percentage attributes
geode-core/src/distributedTest/java/org/apache/geode/cache30/CacheXmlGeode10DUnitTest.java