Package mondrian.util
Class MemoryMonitorTest
- java.lang.Object
-
- TestCase
-
- mondrian.test.FoodMartTestCase
-
- mondrian.util.MemoryMonitorTest
-
public class MemoryMonitorTest extends FoodMartTestCase
Test case forObjectPool
.- Author:
- Richard Emberson
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MemoryMonitorTest.TestMM
static class
MemoryMonitorTest.TestMM2
-
Field Summary
Fields Modifier and Type Field Description protected boolean
enabled
(package private) static int
PERCENT_100
-
Fields inherited from class mondrian.test.FoodMartTestCase
propSaver
-
-
Constructor Summary
Constructors Constructor Description MemoryMonitorTest()
MemoryMonitorTest(java.lang.String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
_testQuery()
Run this by itself and it works across 2 orders of magnitude.boolean
causeGC(MemoryMonitor mm)
Get the difference between the maximum memory and the used memory and divide that by 1000.protected static int
convertThresholdToPercentage(long threshold, long maxMemory)
protected void
setUp()
protected void
tearDown()
void
testDeltaUsage()
-
Methods inherited from class mondrian.test.FoodMartTestCase
allMember, assertAxisReturns, assertAxisThrows, assertBooleanExprReturns, assertExprReturns, assertExprThrows, assertQueriesReturnSimilarResults, assertQueryReturns, assertQueryThrows, assertSize, cubeByName, execute, executeExpr, executeQuery, executeSingletonAxis, genderMembersIncludingAll, getConnection, getDimensionWithName, getTestContext, isDefaultNullMemberRepresentation, isGroupingSetsSupported, member, productMembersPotScrubbersPotsAndPans, storeMembersCAAndOR, storeMembersUsaAndCanada, verifySameNativeAndNot, warehouseMembersCanadaMexicoUsa
-
-
-
-
Field Detail
-
PERCENT_100
static final int PERCENT_100
- See Also:
- Constant Field Values
-
enabled
protected boolean enabled
-
-
Method Detail
-
convertThresholdToPercentage
protected static int convertThresholdToPercentage(long threshold, long maxMemory)
-
causeGC
public boolean causeGC(MemoryMonitor mm)
Get the difference between the maximum memory and the used memory and divide that by 1000. This is the size of allocation chunks. Keep allocating chunks until anOutOfMemoryError
is created.
-
setUp
protected void setUp() throws java.lang.Exception
- Throws:
java.lang.Exception
-
tearDown
protected void tearDown() throws java.lang.Exception
- Overrides:
tearDown
in classFoodMartTestCase
- Throws:
java.lang.Exception
-
testDeltaUsage
public void testDeltaUsage() throws java.lang.Exception
- Throws:
java.lang.Exception
-
_testQuery
public void _testQuery() throws java.lang.Exception
Run this by itself and it works across 2 orders of magnitude. Run it with other tests and its hard to pick the right values for the percentage and how much to allocate for it to always work.- Throws:
java.lang.Exception
-
-