public class BatchTestCase extends FoodMartTestCase
Batch
related tests.Modifier and Type | Class and Description |
---|---|
(package private) static class |
BatchTestCase.Bomb
Fake exception to interrupt the test when we see the desired query.
|
(package private) static class |
BatchTestCase.CellRequestConstraint |
protected class |
BatchTestCase.TestCase
Runs an MDX query with a predefined resultLimit and checks the number of
positions of the row axis.
|
(package private) static class |
BatchTestCase.TestListener
Gets notified on various test events:
when a matching native evaluator was found
when SQL is executed
when result is found in the cache
|
Modifier and Type | Field and Description |
---|---|
protected String |
cubeNameSales |
protected String |
fieldGender |
protected String |
fieldProductDepartment |
protected String |
fieldProductFamily |
protected String[] |
fieldValueProductDepartment |
protected String[] |
fieldValuesGender |
protected String[] |
fieldValuesProductFamily |
protected String[] |
fieldValuesYear |
protected String |
fieldYear |
protected String |
measureUnitSales |
protected String |
tableCustomer |
protected String |
tableProductClass |
protected String |
tableTime |
propSaver
Constructor and Description |
---|
BatchTestCase() |
BatchTestCase(String name) |
Modifier and Type | Method and Description |
---|---|
void |
assertNative(String mdx)
Convenience method for debugging; please do not delete.
|
protected void |
assertNoQuerySql(String mdxQuery,
SqlPattern[] patterns)
Checks that a given MDX query does not result in a particular SQL
statement being generated.
|
void |
assertNotNative(String mdx)
Convenience method for debugging; please do not delete.
|
protected void |
assertQuerySql(String mdxQuery,
SqlPattern[] patterns)
Checks that a given MDX query results in a particular SQL statement
being generated.
|
protected void |
assertQuerySql(String mdxQuery,
SqlPattern[] patterns,
boolean clearCache)
Checks that a given MDX query results in a particular SQL statement
being generated.
|
protected void |
assertQuerySql(TestContext testContext,
String mdxQuery,
SqlPattern[] patterns)
Checks that a given MDX query results in a particular SQL statement
being generated.
|
protected void |
assertQuerySqlOrNot(TestContext testContext,
String mdxQuery,
SqlPattern[] patterns,
boolean negative,
boolean bypassSchemaCache,
boolean clearCache)
During MDX query parse and execution, checks that the query results
(or does not result) in a particular SQL statement being generated.
|
protected void |
assertRequestSql(CellRequest[] requests,
SqlPattern[] patterns)
Checks that a given sequence of cell requests results in a
particular SQL statement being generated.
|
protected void |
assertRequestSql(CellRequest[] requests,
SqlPattern[] patterns,
boolean negative)
Checks that a given sequence of cell requests results in a
particular SQL statement being generated.
|
protected void |
checkNative(int resultLimit,
int rowCount,
String mdx)
Runs a query twice, with native crossjoin optimization enabled and
disabled.
|
protected void |
checkNative(int resultLimit,
int rowCount,
String mdx,
String expectedResult,
boolean freshConnection)
Runs a query twice, with native crossjoin optimization enabled and
disabled.
|
static void |
checkNative(String mdx,
Result expectedResult) |
protected void |
checkNotNative(int rowCount,
String mdx)
Make sure the mdx runs correctly and not in native mode.
|
protected void |
checkNotNative(int rowCount,
String mdx,
String expectedResult)
Makes sure the MDX runs correctly and not in native mode.
|
static void |
checkNotNative(String mdx,
Result expectedResult) |
protected BatchLoader.Batch |
createBatch(BatchLoader fbcr,
String[] tableNames,
String[] fieldNames,
String[][] fieldValues,
String cubeName,
String measure) |
protected BatchLoader.Batch |
createBatch(BatchLoader fbcr,
String[] tableNames,
String[] fieldNames,
String[][] fieldValues,
String cubeName,
String measure,
BatchTestCase.CellRequestConstraint constraint) |
protected CellRequest |
createRequest(String cube,
String measureName,
String[] tables,
String[] columns,
String[] values) |
protected CellRequest |
createRequest(String cube,
String measureName,
String[] tables,
String[] columns,
String[] values,
BatchTestCase.CellRequestConstraint aggConstraint) |
protected CellRequest |
createRequest(String cube,
String measure,
String table,
String column,
String value) |
protected CellRequest |
createRequest(String cube,
String measure,
String table,
String column,
String value,
BatchTestCase.CellRequestConstraint aggConstraint) |
protected String |
dialectize(Dialect.DatabaseProduct d,
String sql) |
protected Result |
executeQuery(String mdx,
Connection connection) |
protected RolapCube |
getCube(String cube) |
protected Connection |
getFoodMartConnection() |
protected GroupingSet |
getGroupingSet(String[] tableNames,
String[] fieldNames,
String[][] fieldValues,
String cubeName,
String measure) |
protected RolapStar.Measure |
getMeasure(String cube,
String measureName) |
(package private) RolapNativeRegistry |
getRegistry(Connection connection) |
(package private) static BatchTestCase.CellRequestConstraint |
makeConstraintCountryState(List<String[]> values) |
(package private) static BatchTestCase.CellRequestConstraint |
makeConstraintProductFamilyDepartment(List<String[]> values) |
(package private) static BatchTestCase.CellRequestConstraint |
makeConstraintYearQuarterMonth(List<String[]> values) |
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, tearDown, warehouseMembersCanadaMexicoUsa
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, toString
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
protected final String tableTime
protected final String tableProductClass
protected final String tableCustomer
protected final String fieldYear
protected final String fieldProductFamily
protected final String fieldProductDepartment
protected final String[] fieldValuesYear
protected final String[] fieldValuesProductFamily
protected final String[] fieldValueProductDepartment
protected final String[] fieldValuesGender
protected final String cubeNameSales
protected final String measureUnitSales
protected String fieldGender
public BatchTestCase(String name)
public BatchTestCase()
protected BatchLoader.Batch createBatch(BatchLoader fbcr, String[] tableNames, String[] fieldNames, String[][] fieldValues, String cubeName, String measure)
protected BatchLoader.Batch createBatch(BatchLoader fbcr, String[] tableNames, String[] fieldNames, String[][] fieldValues, String cubeName, String measure, BatchTestCase.CellRequestConstraint constraint)
protected GroupingSet getGroupingSet(String[] tableNames, String[] fieldNames, String[][] fieldValues, String cubeName, String measure)
protected void assertRequestSql(CellRequest[] requests, SqlPattern[] patterns)
Always clears the cache before running the requests.
Runs the requests once for each SQL pattern in the current dialect. If there are multiple patterns, runs the MDX query multiple times, and expects to see each SQL statement appear. If there are no patterns in this dialect, the test trivially succeeds.
requests
- Sequence of cell requestspatterns
- Set of patternsprotected void assertRequestSql(CellRequest[] requests, SqlPattern[] patterns, boolean negative)
Always clears the cache before running the requests.
Runs the requests once for each SQL pattern in the current dialect. If there are multiple patterns, runs the MDX query multiple times, and expects to see each SQL statement appear. If there are no patterns in this dialect, the test trivially succeeds.
requests
- Sequence of cell requestspatterns
- Set of patternsnegative
- Set to false in order to 'expect' a query or
true to 'forbid' a query.protected void assertQuerySql(String mdxQuery, SqlPattern[] patterns)
mdxQuery
- MDX querypatterns
- Set of patterns for expected SQL statementsprotected void assertQuerySql(TestContext testContext, String mdxQuery, SqlPattern[] patterns)
testContext
- non-default test context if requiredmdxQuery
- MDX querypatterns
- Set of patterns for expected SQL statementsprotected void assertNoQuerySql(String mdxQuery, SqlPattern[] patterns)
mdxQuery
- MDX querypatterns
- Set of patterns for expected SQL statementsprotected void assertQuerySql(String mdxQuery, SqlPattern[] patterns, boolean clearCache)
mdxQuery
- MDX querypatterns
- Set of patterns, one for each dialect.clearCache
- whether to clear cache before running the queryprotected void assertQuerySqlOrNot(TestContext testContext, String mdxQuery, SqlPattern[] patterns, boolean negative, boolean bypassSchemaCache, boolean clearCache)
Parses and executes the MDX query once for each SQL pattern in the current dialect. If there are multiple patterns, runs the MDX query multiple times, and expects to see each SQL statement appear. If there are no patterns in this dialect, the test trivially succeeds.
testContext
- non-default test context if requiredmdxQuery
- MDX querypatterns
- Set of patternsnegative
- false to assert if SQL is generated;
true to assert if SQL is NOT generatedbypassSchemaCache
- whether to grab a new connection and bypass the
schema cache before parsing the MDX queryclearCache
- whether to clear cache before executing the MDX queryprotected String dialectize(Dialect.DatabaseProduct d, String sql)
protected CellRequest createRequest(String cube, String measure, String table, String column, String value)
protected CellRequest createRequest(String cube, String measureName, String[] tables, String[] columns, String[] values)
protected CellRequest createRequest(String cube, String measure, String table, String column, String value, BatchTestCase.CellRequestConstraint aggConstraint)
protected CellRequest createRequest(String cube, String measureName, String[] tables, String[] columns, String[] values, BatchTestCase.CellRequestConstraint aggConstraint)
static BatchTestCase.CellRequestConstraint makeConstraintYearQuarterMonth(List<String[]> values)
static BatchTestCase.CellRequestConstraint makeConstraintCountryState(List<String[]> values)
static BatchTestCase.CellRequestConstraint makeConstraintProductFamilyDepartment(List<String[]> values)
protected RolapStar.Measure getMeasure(String cube, String measureName)
protected Connection getFoodMartConnection()
protected void checkNotNative(int rowCount, String mdx)
rowCount
- number of rows returnedmdx
- queryprotected void checkNotNative(int rowCount, String mdx, String expectedResult)
rowCount
- Number of rows returnedmdx
- QueryexpectedResult
- Expected result stringRolapNativeRegistry getRegistry(Connection connection)
protected void checkNative(int resultLimit, int rowCount, String mdx)
resultLimit
- Maximum result size of all the MDX operations in this
query. This might be hard to estimate as it is usually
larger than the rowCount of the final result. Setting
it to 0 will cause this limit to be ignored.rowCount
- Number of rows returnedmdx
- Queryprotected void checkNative(int resultLimit, int rowCount, String mdx, String expectedResult, boolean freshConnection)
Optionally the query can be run with fresh connection. This is useful if the test case sets its certain mondrian properties, e.g. native properties like: mondrian.native.filter.enable
resultLimit
- Maximum result size of all the MDX operations in
this query. This might be hard to estimate as it
is usually larger than the rowCount of the final
result. Setting it to 0 will cause this limit to
be ignored.rowCount
- Number of rows returned. (That is, the number
of positions on the last axis of the query.)mdx
- QueryexpectedResult
- Expected result stringfreshConnection
- Whether fresh connection is requiredprotected Result executeQuery(String mdx, Connection connection)
public void assertNotNative(String mdx)
public void assertNative(String mdx)