Package mondrian.test
Class FoodMartTestCase
- java.lang.Object
-
- TestCase
-
- mondrian.test.FoodMartTestCase
-
- Direct Known Subclasses:
AccessControlTest,AggGenTest,BasicQueryTest,BatchTestCase,CacheControlTest,CacheHitTest,CacheTest,CellKeyTest,CmdRunnerTest,CompatibilityTest,CompoundSlicerTest,ConcurrentMdxTest,CrossJoinArgFactoryTest,CrossJoinTest,CurrentDateMemberUdfTest,CustomizedParserTest,CVConcurrentMdxTest,DeadlockTest,DrillThroughTest,FilteredIterableTest,FunctionTest,HierarchyBugTest,HighDimensionsTest,I18nTest,IgnoreMeasureForNonJoiningDimensionInAggregationTest,IgnoreUnrelatedDimensionsTest,IndexedValuesTest,InlineTableTest,MemberCacheControlTest,MemoryMonitorTest,MonitorTest,NamedSetTest,NonEmptyPropertyForAllAxisTest,NullMemberRepresentationTest,NullValueTest,Olap4jTest,ParallelTest,ParameterTest,ParentChildHierarchyTest,ParserTest,PerformanceTest,PropertiesTest,QueryTest,RaggedHierarchyTest,ResultComparatorTest,RolapAxisTest,RolapCubeTest,RolapEvaluatorTest,RolapSchemaPoolTest,RolapSchemaReaderTest,RolapStarTest,ScenarioTest,SchemaTest,SchemaVersionTest,SetFunDefTest,SharedDimensionTest,SolveOrderScopeIsolationTest,SortTest,Ssas2005CompatibilityTest,TopCountNativeEvaluatorTest,TupleListTest,UdfTest,XmlaBaseTestCase,XmlaHandlerTypeTest,XmlaTests
public class FoodMartTestCase extends TestCaseFoodMartTestCaseis a unit test which runs against the FoodMart database.- Since:
- 29 March, 2002
- Author:
- jhyde
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classFoodMartTestCase.QueryAndResult
-
Field Summary
Fields Modifier and Type Field Description protected PropertySaverpropSaverAccess properties via this object and their values will be reset ontearDown().
-
Constructor Summary
Constructors Constructor Description FoodMartTestCase()FoodMartTestCase(String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MemberallMember(String dimensionName, Cube salesCube)voidassertAxisReturns(String expression, String expected)Runs a query on the "Sales" cube with a given expression on an axis, and asserts that it returns the expected string.voidassertAxisThrows(String expression, String pattern)Runs a query with a given expression on an axis, and asserts that it throws an error which matches a particular pattern.voidassertBooleanExprReturns(String expression, boolean expected)Executes an expression which yields a boolean result, and asserts that the result is the expected one.voidassertExprReturns(String expression, String expected)Runs an expression and asserts that it returns a given result.voidassertExprThrows(String expression, String pattern)Runs an expression, and asserts that it gives an error which contains a particular pattern.protected voidassertQueriesReturnSimilarResults(String query1, String query2, TestContext testContext)Executes query1 and query2 and Compares the obtained measure values.voidassertQueryReturns(String query, String desiredResult)Runs a query and checks that the result is a given string.voidassertQueryThrows(String queryString, String pattern)Runs a query, and asserts that it throws an exception which contains the given pattern.protected voidassertSize(String queryString, int columnCount, int rowCount)Runs a query, and asserts that the result has a given number of columns and rows.protected CubecubeByName(Connection connection, String cubeName)Resultexecute(Connection connection, String queryString)Executes a query in a given connection.StringexecuteExpr(String expression)Executes an expression against the Sales cube in the FoodMart database to form a single cell result set, then returns that cell's formatted value.ResultexecuteQuery(String queryString)Runs a query.MemberexecuteSingletonAxis(String expression)Executes a set expression which is expected to return 0 or 1 members.protected TupleListgenderMembersIncludingAll(boolean includeAllMember, SchemaReader salesCubeSchemaReader, Cube salesCube)protected ConnectiongetConnection()protected DimensiongetDimensionWithName(String name, Dimension[] dimensions)TestContextgetTestContext()Returns the test context.protected booleanisDefaultNullMemberRepresentation()protected booleanisGroupingSetsSupported()protected Membermember(List<Id.Segment> segmentList, SchemaReader salesCubeSchemaReader)protected TupleListproductMembersPotScrubbersPotsAndPans(SchemaReader salesCubeSchemaReader)protected TupleListstoreMembersCAAndOR(SchemaReader salesCubeSchemaReader)protected TupleListstoreMembersUsaAndCanada(boolean includeAllMember, SchemaReader salesCubeSchemaReader, Cube salesCube)protected voidtearDown()voidverifySameNativeAndNot(String query, String message, TestContext context)Checks whether query produces the same results with the native.* props enabled as it does with the props disabledprotected List<Member>warehouseMembersCanadaMexicoUsa(SchemaReader reader)
-
-
-
Field Detail
-
propSaver
protected final PropertySaver propSaver
Access properties via this object and their values will be reset ontearDown().
-
-
Constructor Detail
-
FoodMartTestCase
public FoodMartTestCase(String name)
-
FoodMartTestCase
public FoodMartTestCase()
-
-
Method Detail
-
getTestContext
public TestContext getTestContext()
Returns the test context. Override this method if you wish to use a different source for your FoodMart connection.
-
getConnection
protected Connection getConnection()
-
assertSize
protected void assertSize(String queryString, int columnCount, int rowCount)
Runs a query, and asserts that the result has a given number of columns and rows.
-
assertQueryThrows
public void assertQueryThrows(String queryString, String pattern)
Runs a query, and asserts that it throws an exception which contains the given pattern.
-
execute
public Result execute(Connection connection, String queryString)
Executes a query in a given connection.
-
executeSingletonAxis
public Member executeSingletonAxis(String expression)
Executes a set expression which is expected to return 0 or 1 members. It is an error if the expression returns tuples (as opposed to members), or if it returns two or more members.- Parameters:
expression- Expression- Returns:
- Null if axis returns the empty set, member if axis returns one member. Throws otherwise.
-
assertQueryReturns
public void assertQueryReturns(String query, String desiredResult)
Runs a query and checks that the result is a given string.
-
assertAxisThrows
public void assertAxisThrows(String expression, String pattern)
Runs a query with a given expression on an axis, and asserts that it throws an error which matches a particular pattern. The expression is evaulated against the Sales cube.
-
assertAxisReturns
public void assertAxisReturns(String expression, String expected)
Runs a query on the "Sales" cube with a given expression on an axis, and asserts that it returns the expected string.
-
executeExpr
public String executeExpr(String expression)
Executes an expression against the Sales cube in the FoodMart database to form a single cell result set, then returns that cell's formatted value.
-
assertBooleanExprReturns
public void assertBooleanExprReturns(String expression, boolean expected)
Executes an expression which yields a boolean result, and asserts that the result is the expected one.
-
assertExprThrows
public void assertExprThrows(String expression, String pattern)
Runs an expression, and asserts that it gives an error which contains a particular pattern. The error might occur during parsing, or might be contained within the cell value.
-
assertExprReturns
public void assertExprReturns(String expression, String expected)
Runs an expression and asserts that it returns a given result.
-
assertQueriesReturnSimilarResults
protected void assertQueriesReturnSimilarResults(String query1, String query2, TestContext testContext)
Executes query1 and query2 and Compares the obtained measure values.
-
isGroupingSetsSupported
protected boolean isGroupingSetsSupported()
-
isDefaultNullMemberRepresentation
protected boolean isDefaultNullMemberRepresentation()
-
member
protected Member member(List<Id.Segment> segmentList, SchemaReader salesCubeSchemaReader)
-
storeMembersCAAndOR
protected TupleList storeMembersCAAndOR(SchemaReader salesCubeSchemaReader)
-
productMembersPotScrubbersPotsAndPans
protected TupleList productMembersPotScrubbersPotsAndPans(SchemaReader salesCubeSchemaReader)
-
genderMembersIncludingAll
protected TupleList genderMembersIncludingAll(boolean includeAllMember, SchemaReader salesCubeSchemaReader, Cube salesCube)
-
warehouseMembersCanadaMexicoUsa
protected List<Member> warehouseMembersCanadaMexicoUsa(SchemaReader reader)
-
cubeByName
protected Cube cubeByName(Connection connection, String cubeName)
-
storeMembersUsaAndCanada
protected TupleList storeMembersUsaAndCanada(boolean includeAllMember, SchemaReader salesCubeSchemaReader, Cube salesCube)
-
verifySameNativeAndNot
public void verifySameNativeAndNot(String query, String message, TestContext context)
Checks whether query produces the same results with the native.* props enabled as it does with the props disabled- Parameters:
query- query to runmessage- Message to output on test failurecontext- test context to use
-
-