mondrian.util
Class MemoryMonitorTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by mondrian.test.FoodMartTestCase
              extended by mondrian.util.MemoryMonitorTest
All Implemented Interfaces:
junit.framework.Test

public class MemoryMonitorTest
extends FoodMartTestCase

Test case for ObjectPool.

Author:
Richard Emberson

Nested Class Summary
static class MemoryMonitorTest.TestMM
           
static class MemoryMonitorTest.TestMM2
           
 
Field Summary
protected  boolean enabled
           
(package private) static int PERCENT_100
           
 
Fields inherited from class mondrian.test.FoodMartTestCase
propSaver
 
Constructor Summary
MemoryMonitorTest()
           
MemoryMonitorTest(String name)
           
 
Method Summary
 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, warehouseMembersCanadaMexicoUsa
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, 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, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PERCENT_100

static final int PERCENT_100
See Also:
Constant Field Values

enabled

protected boolean enabled
Constructor Detail

MemoryMonitorTest

public MemoryMonitorTest()

MemoryMonitorTest

public MemoryMonitorTest(String name)
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 an OutOfMemoryError is created.


setUp

protected void setUp()
              throws Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception

tearDown

protected void tearDown()
                 throws Exception
Overrides:
tearDown in class FoodMartTestCase
Throws:
Exception

testDeltaUsage

public void testDeltaUsage()
                    throws Exception
Throws:
Exception

_testQuery

public void _testQuery()
                throws 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:
Exception

Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads