public class OffHeapManagementDUnitTest extends CacheTestCase
DistributedTestCase.ExpectedException, DistributedTestCase.WaitCriterion, DistributedTestCase.WaitCriterion2cachelogPerTest, reconnect, system, testName| Constructor and Description |
|---|
OffHeapManagementDUnitTest(String name)
Creates a new OffHeapManagementDUnitTest.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addOffHeapNotificationListener()
Adds an off-heap notification listener to the MemberMXBean.
|
protected void |
addOffHeapNotificationListenerOnVm(VM vm)
Adds an off-heap notification listener to the MemberMXBean for a vm.
|
protected void |
assertCompactionTimeStat(long compactionTime,
com.gemstone.gemfire.management.OffHeapManagementDUnitTest.ASSERT_OP op)
Asserts that the compactionTime stat is available and satisfies an assert operation.
|
protected void |
assertCompactionTimeStatOnVm(VM vm,
long compactionTime,
com.gemstone.gemfire.management.OffHeapManagementDUnitTest.ASSERT_OP op)
Asserts that the compactionTime stat is available and satisfies an assert operation.
|
protected void |
assertFragmentationStat(int fragmentation,
com.gemstone.gemfire.management.OffHeapManagementDUnitTest.ASSERT_OP op)
Asserts that the fragmentation stat is available and satisfies an assert operation.
|
protected void |
assertFragmentationStatOnVm(VM vm,
int fragmentation,
com.gemstone.gemfire.management.OffHeapManagementDUnitTest.ASSERT_OP op)
Asserts that the fragmentation stat is available and satisfies an assert operation.
|
protected void |
assertOffHeapMetrics(long freeMemory,
long allocatedMemory,
long objects,
int fragmentation)
Asserts that OffHeapMetrics match input parameters.
|
protected void |
assertOffHeapMetricsOnVm(VM vm,
long freeMemory,
long allocatedMemory,
long objects,
int fragmentation)
Asserts that OffHeapMetrics match input parameters for a VM.
|
protected void |
assertOffHeapRegionAttributes()
Asserts that the off heap region data is available and enabled.
|
protected void |
assertOffHeapRegionAttributesOnVm(VM vm)
Asserts that the off heap region data is available and enabled for a VM.
|
protected void |
cleanup()
Removes off-heap region and disconnects.
|
protected void |
clearNotificationListenerOnVm(VM vm)
Clears received notifications.
|
protected com.gemstone.gemfire.cache.Region |
createOffHeapRegion(String name,
com.gemstone.gemfire.cache.DataPolicy dataPolicy)
Creates an off-heap region.
|
protected boolean |
createOffHeapRegionOnVm(VM vm,
String name,
com.gemstone.gemfire.cache.DataPolicy dataPolicy)
Creates an off-heap region on a vm.
|
protected void |
doCleanupOnVm(VM vm)
Removes off heap region on vm and disconnects.
|
protected int |
doConsumeOffHeapMemory(int allocationSize)
Consumes off off-heap memory until the allocation size cannot be satisfied.
|
protected int |
doConsumeOffHeapMemoryOnVm(VM vm,
int allocationSize)
Consumes off off-heap memory until the allocation size cannot be satisfied.
|
protected void |
doDestroy(Object key,
String regionName)
Performs a destroy operation.
|
protected void |
doDestroyOnVm(VM vm,
Object key,
String regionName)
Performs a destroy operation on a vm.
|
protected void |
doFreeOffHeapMemory(int numAllocations,
int numDestroys)
Performs some destroys to free off-heap allocations.
|
protected void |
doFreeOffHeapMemoryOnVm(VM vm,
int numAllocations,
int numDestroys)
Destroys a number of entries previously allocated.
|
protected void |
doPut(Object key,
Object value,
String regionName,
boolean expectException)
Performs a put operation.
|
protected void |
doPutOnVm(VM vm,
Object key,
Object value,
String regionName,
boolean expectException)
Performs a put operation on a vm.
|
protected Properties |
getSystemProperties()
Returns off-heap system properties for enabling off-heap and the JMX system.
|
protected void |
setSystemProperties(boolean management,
Properties props)
Sets the distributed system properties.
|
protected void |
setSystemPropertiesOnVm(VM vm,
boolean management,
Properties props)
Sets the distributed system properties for a vm.
|
void |
setUp()
Sets up the test (noop).
|
protected void |
setupOffHeapMonitor(String attribute,
long highThreshold,
long lowThreshold,
boolean aggregate)
Creates and adds a generic GaugeMonitor for an attribute of the MemberMXBean.
|
protected void |
setupOffHeapMonitorOnVm(VM vm,
String attribute,
long highThreshold,
long lowThreshold,
boolean aggregate)
Creates and adds a generic GaugeMonitor for an attribute of the MemberMXBean on a VM.
|
void |
tearDown2()
Tears down the test.
|
void |
testCompactionTimeStat()
Tests the compation time statistic for off-heap memory.
|
void |
testFragmentationStat()
Tests the fragmentation statistic for off-heap memory.
|
void |
testOffHeapAllocatedSizeMonitoring()
Asserts that a monitor assigned to the OffHeapAllocatedSize attribute is triggered.
|
void |
testOffHeapFreeSizeAggregateMonitoring()
Asserts that a monitor assigned to the OffHeapUsedSize attribute is triggered.
|
void |
testOffHeapFreeSizeMonitoring()
Asserts that a monitor assigned to the OffHeapFreeSize attribute is triggered.
|
void |
testOffHeapMBeanAttributesAndStats()
Tests off-heap additions to the RegionMXBean and MemberMXBean interfaces.
|
void |
testOffHeapObjectsMonitoring()
Asserts that a monitor assigned to the OffHeapObjects attribute is triggered.
|
void |
testOffHeapUsedSizeAggregateMonitoring()
Asserts that a monitor assigned to the OffHeapUsedSize attribute is triggered.
|
protected void |
waitForNotificationListenerOnVm(VM vm,
long wait,
long interval,
boolean throwOnTimeout)
Waits to receive MBean notifications.
|
addExceptionTag1, basicGetCache, beginCacheXml, cleanDiskDirs, closeAllCache, closeCache, createLonerCache, createMcastCache, createMcastCache, createRegion, createRegion, createRootRegion, createRootRegion, disconnectFromDS, finishCacheXml, finishCacheXml, getCache, getCache, getCache, getCache, getClientCache, getDiskDirs, getGemfireCache, getInternalRegionArguments, getRootRegion, getRootRegion, hasCache, remoteTearDown, removeExceptionTag1, sendSerialMessageToAll, sendUnorderedMessageToAlladdExpectedException, addExpectedException, addHydraProperties, attachDebugger, checkBBFlag, cleanupAllVms, clearBBFlag, crashDistributedSystem, crashDistributedSystem, createLogWriter, disconnectAllFromDS, dumpAllStacks, dumpMyThreads, dumpStack, dumpStack, dumpStack, dumpStackTrace, fail, getAllDistributedSystemProperties, getDistributedSystemProperties, getDUnitLocatorAddress, getDUnitLocatorPort, getDUnitLocatorString, getDUnitLogLevel, getIPLiteral, getLogWriter, getLonerSystem, getMcastSystem, getMcastSystem, getRepeatTimeoutMs, getServerHostName, getSystem, getSystem, getTestClass, getTestName, getUniqueName, getVMCount, incBBFlag, invokeInEveryVM, invokeInEveryVM, invokeInEveryVM, invokeInEveryVM, invokeInEveryVMRepeatingIfNecessary, invokeInLocator, invokeRepeatingIfNecessary, isConnectedToDS, join, noteTiming, pause, pause, perVMSetUp, realTearDown, setDiskStoreForGateway, setSystem, setTestName, staticPause, tearDown, unregisterAllDataSerializersFromAllVms, unregisterDataSerializerInThisVM, unregisterInstantiatorsInThisVM, waitForBBFlag, waitForCriterion, waitMutexassertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toStringpublic OffHeapManagementDUnitTest(String name)
name - the test name.public void setUp()
throws Exception
DistributedTestCasesetUp in class DistributedTestCaseExceptionpublic void tearDown2()
throws Exception
DistributedTestCaseDistributedTestCase.tearDown() method, and should be over ridden in its place.tearDown2 in class CacheTestCaseExceptionpublic void testOffHeapMBeanAttributesAndStats()
throws Exception
Exceptionpublic void testFragmentationStat()
throws Exception
Exceptionpublic void testCompactionTimeStat()
throws Exception
Exceptionpublic void testOffHeapObjectsMonitoring()
throws Exception
Exceptionpublic void testOffHeapFreeSizeMonitoring()
throws Exception
Exceptionpublic void testOffHeapAllocatedSizeMonitoring()
throws Exception
Exceptionpublic void testOffHeapUsedSizeAggregateMonitoring()
throws Exception
Exceptionpublic void testOffHeapFreeSizeAggregateMonitoring()
throws Exception
Exceptionprotected void doFreeOffHeapMemoryOnVm(VM vm, int numAllocations, int numDestroys)
vm - a virtual machinenumAllocations - the number of previous off-heap allocationsnumDestroys - the number of destroys to performprotected void doFreeOffHeapMemory(int numAllocations,
int numDestroys)
numAllocations - the number of previous off-heap allocationsnumDestroys - the number of destroys to performprotected int doConsumeOffHeapMemoryOnVm(VM vm, int allocationSize)
vm - a virtual machineallocationSize - the number of bytes for each allocationprotected int doConsumeOffHeapMemory(int allocationSize)
allocationSize - the number of bytes for each allocationprotected void assertCompactionTimeStatOnVm(VM vm, long compactionTime, com.gemstone.gemfire.management.OffHeapManagementDUnitTest.ASSERT_OP op)
vm - a virtual machine.compactionTime - total off heap compaction time.op - an assert operation.protected void assertCompactionTimeStat(long compactionTime,
com.gemstone.gemfire.management.OffHeapManagementDUnitTest.ASSERT_OP op)
compactionTime - total off heap compaction time.op - an assert operation.protected void assertFragmentationStatOnVm(VM vm, int fragmentation, com.gemstone.gemfire.management.OffHeapManagementDUnitTest.ASSERT_OP op)
vm - a virtual machinefragmentation - a fragmentation percentageop - an assertion operationprotected void assertFragmentationStat(int fragmentation,
com.gemstone.gemfire.management.OffHeapManagementDUnitTest.ASSERT_OP op)
fragmentation - a fragmentation percentageop - an assertion operationprotected Properties getSystemProperties()
protected void doCleanupOnVm(VM vm)
vm - a virutal machine.protected void cleanup()
protected void assertOffHeapRegionAttributesOnVm(VM vm)
protected void assertOffHeapRegionAttributes()
protected void assertOffHeapMetricsOnVm(VM vm, long freeMemory, long allocatedMemory, long objects, int fragmentation)
vm - a virtual machine.freeMemory - total off-heap free memory in bytes.allocatedMemory - allocated (or used) off-heap memory in bytes.objects - number of objects stored in off-heap memory.fragmentation - the fragmentation percentage.protected void assertOffHeapMetrics(long freeMemory,
long allocatedMemory,
long objects,
int fragmentation)
freeMemory - total off-heap free memory in bytes.allocatedMemory - allocated (or used) off-heap memory in bytes.objects - number of objects stored in off-heap memory.fragmentation - the fragmentation percentage.protected boolean createOffHeapRegionOnVm(VM vm, String name, com.gemstone.gemfire.cache.DataPolicy dataPolicy)
vm - a virtual machine.name - a region name.dataPolicy - a data policy.protected com.gemstone.gemfire.cache.Region createOffHeapRegion(String name, com.gemstone.gemfire.cache.DataPolicy dataPolicy)
name - a region name.dataPolicy - a data policy.protected void setSystemPropertiesOnVm(VM vm, boolean management, Properties props)
vm - a virtual machine.management - starts the ManagementService when true.props - distributed system properties.protected void setSystemProperties(boolean management,
Properties props)
management - starts the ManagementService when true.props - distributed system properties.protected void doDestroyOnVm(VM vm, Object key, String regionName)
vm - a virtual machine.key - the region entry to destroy.regionName - a region name.protected void doDestroy(Object key, String regionName)
key - the region entry to destroy.regionName - a region name.protected void doPutOnVm(VM vm, Object key, Object value, String regionName, boolean expectException)
vm - a virtual machine.key - region entry key.value - region entry value.regionName - a region name.protected void doPut(Object key, Object value, String regionName, boolean expectException)
key - region entry key.value - region entry value.regionName - a region name.protected void addOffHeapNotificationListenerOnVm(VM vm)
vm - a virtual machine.protected void addOffHeapNotificationListener()
protected void setupOffHeapMonitorOnVm(VM vm, String attribute, long highThreshold, long lowThreshold, boolean aggregate)
vm - a virtual machine.attribute - the attribute to monitor.highThreshold - the high threshold trigger.lowThreshold - the low threshold trigger.protected void setupOffHeapMonitor(String attribute, long highThreshold, long lowThreshold, boolean aggregate)
attribute - the attribute to monitor.highThreshold - the high threshold trigger.lowThreshold - the low threshold trigger.protected void waitForNotificationListenerOnVm(VM vm, long wait, long interval, boolean throwOnTimeout)
vm - a virtual machine.wait - how long to wait for in millis.interval - the polling interval to check for notifications.throwOnTimeout - throws an exception on timeout if true.protected void clearNotificationListenerOnVm(VM vm)
vm - a virtual machine.Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.