mondrian.rolap
Class MemberCacheControlTest

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

public class MemberCacheControlTest
extends FoodMartTestCase

Unit tests for flushing member cache and editing cached member properties.

The purpose of the cache control API is to clear the cache so that changes made to the DBMS can be seen. However, it is difficult to write tests that modify the database. So these tests just check that the relevant caches have been cleared. It is assumed that the updated values will be loaded next time mondrian goes to the database.

Since:
Jan 2008
Author:
mberkowitz

Field Summary
 
Fields inherited from class mondrian.test.FoodMartTestCase
propSaver
 
Constructor Summary
MemberCacheControlTest()
           
MemberCacheControlTest(String name)
           
 
Method Summary
protected static RolapMember findMember(TestContext tc, String cubeName, String... names)
          Finds a Member by its name and the name of its containing cube.
(package private)  DiffRepository getDiffRepos()
           
 TestContext getTestContext()
          Returns the test context.
protected  void setUp()
           
protected  void tearDown()
           
 void testAddCommand()
           
 void testAddCommandNegative()
          Tests a variety of negative cases including add/delete/move null members add/delete/move members in parent-child hierarchies.
 void testDeleteCommand()
           
 void testFilter()
          Tests operations on member sets, in particular the CacheControl.filter(mondrian.olap.Level, mondrian.olap.CacheControl.MemberSet) method.
 void testFlushHierarchy()
          Test case for bug MONDRIAN-1076, "Add CacheControl API to flush members from dimension cache".
 void testMemberOpsFailIfCacheEnabled()
          Tests that member operations fail if cache is enabled.
 void testMoveCommand()
           
 void testMoveFailBadLevel()
           
 void testSetPropertyCommandOnLeafMember()
          Test that edits the properties of a single leaf Member.
 void testSetPropertyCommandOnNonLeafMember()
          Test that edits properties of Members at various Levels (use Retail Dimension), but leaves grouping unchanged, so results not changed.
 
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, 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
 

Constructor Detail

MemberCacheControlTest

public MemberCacheControlTest()

MemberCacheControlTest

public MemberCacheControlTest(String name)
Method Detail

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

getDiffRepos

DiffRepository getDiffRepos()

getTestContext

public TestContext getTestContext()
Description copied from class: FoodMartTestCase
Returns the test context. Override this method if you wish to use a different source for your FoodMart connection.

Overrides:
getTestContext in class FoodMartTestCase

findMember

protected static RolapMember findMember(TestContext tc,
                                        String cubeName,
                                        String... names)
Finds a Member by its name and the name of its containing cube.

Parameters:
tc - Test context
cubeName - Cube name
names - the full-qualified Member name
Returns:
the Member
Throws:
MondrianException - when not found.

testFilter

public void testFilter()
Tests operations on member sets, in particular the CacheControl.filter(mondrian.olap.Level, mondrian.olap.CacheControl.MemberSet) method.


testMemberOpsFailIfCacheEnabled

public void testMemberOpsFailIfCacheEnabled()
Tests that member operations fail if cache is enabled.


testSetPropertyCommandOnLeafMember

public void testSetPropertyCommandOnLeafMember()
Test that edits the properties of a single leaf Member.


testSetPropertyCommandOnNonLeafMember

public void testSetPropertyCommandOnNonLeafMember()
Test that edits properties of Members at various Levels (use Retail Dimension), but leaves grouping unchanged, so results not changed.


testAddCommand

public void testAddCommand()

testDeleteCommand

public void testDeleteCommand()

testMoveCommand

public void testMoveCommand()

testMoveFailBadLevel

public void testMoveFailBadLevel()

testAddCommandNegative

public void testAddCommandNegative()
Tests a variety of negative cases including add/delete/move null members add/delete/move members in parent-child hierarchies.


testFlushHierarchy

public void testFlushHierarchy()
Test case for bug MONDRIAN-1076, "Add CacheControl API to flush members from dimension cache".


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