mondrian.rolap.sql
Class SqlQueryTest

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

public class SqlQueryTest
extends BatchTestCase

Test for SqlQuery.

Since:
06-Jun-2007
Author:
Thiyagu

Nested Class Summary
 
Nested classes/interfaces inherited from class mondrian.rolap.BatchTestCase
BatchTestCase.TestCase
 
Field Summary
 
Fields inherited from class mondrian.rolap.BatchTestCase
cubeNameSales, fieldGender, fieldProductDepartment, fieldProductFamily, fieldValueProductDepartment, fieldValuesGender, fieldValuesProductFamily, fieldValuesYear, fieldYear, measureUnitSales, tableCustomer, tableProductClass, tableTime
 
Fields inherited from class mondrian.test.FoodMartTestCase
propSaver
 
Constructor Summary
SqlQueryTest()
           
 
Method Summary
protected  void setUp()
           
protected  void tearDown()
           
 void testApproxRowCountOverridesCount()
          This test makes sure that a level which specifies an approxRowCount property prevents Mondrian from executing a count() sql query.
 void testDoubleInList()
          Verifies that the correct SQL string is generated for literals of SQL type "double".
 void testInvalidSqlMemberLookup()
          Testcase for bug MONDRIAN-457, "Strange SQL condition appears when executing query".
 void testPredicatesAreNotOptimizedWhenPropertyIsFalse()
           
 void testPredicatesAreOptimizedWhenAllTheMembersAreIncluded()
           
 void testPredicatesAreOptimizedWhenPropertyIsTrue()
           
 void testTableNameIsIncludedWithParentChildQuery()
           
 void testToStringForForcedIndexHint()
           
 void testToStringForGroupingSetSqlWithEmptyGroup()
           
 void testToStringForMultipleGroupingSetsSql()
           
 void testToStringForSingleGroupingSetSql()
           
 
Methods inherited from class mondrian.rolap.BatchTestCase
assertNative, assertNoQuerySql, assertNotNative, assertQuerySql, assertQuerySql, assertQuerySql, assertQuerySqlOrNot, assertRequestSql, assertRequestSql, checkNative, checkNative, checkNative, checkNotNative, checkNotNative, checkNotNative, createBatch, createBatch, createRequest, createRequest, createRequest, createRequest, dialectize, executeQuery, getCube, getFoodMartConnection, getGroupingSet, getMeasure
 
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
 

Constructor Detail

SqlQueryTest

public SqlQueryTest()
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

testToStringForSingleGroupingSetSql

public void testToStringForSingleGroupingSetSql()

testToStringForForcedIndexHint

public void testToStringForForcedIndexHint()

testPredicatesAreOptimizedWhenPropertyIsTrue

public void testPredicatesAreOptimizedWhenPropertyIsTrue()

testTableNameIsIncludedWithParentChildQuery

public void testTableNameIsIncludedWithParentChildQuery()

testPredicatesAreNotOptimizedWhenPropertyIsFalse

public void testPredicatesAreNotOptimizedWhenPropertyIsFalse()

testPredicatesAreOptimizedWhenAllTheMembersAreIncluded

public void testPredicatesAreOptimizedWhenAllTheMembersAreIncluded()

testToStringForGroupingSetSqlWithEmptyGroup

public void testToStringForGroupingSetSqlWithEmptyGroup()

testToStringForMultipleGroupingSetsSql

public void testToStringForMultipleGroupingSetsSql()

testDoubleInList

public void testDoubleInList()
Verifies that the correct SQL string is generated for literals of SQL type "double".

Mondrian only generates SQL DOUBLE values in a special format for LucidDB; therefore, this test is a no-op on other databases.


testInvalidSqlMemberLookup

public void testInvalidSqlMemberLookup()
Testcase for bug MONDRIAN-457, "Strange SQL condition appears when executing query". The fix implemented MatchType.EXACT_SCHEMA, which only queries known schema objects. This prevents SQL such as "UPPER(`store`.`store_country`) = UPPER('Time.Weekly')" from being generated.


testApproxRowCountOverridesCount

public void testApproxRowCountOverridesCount()
This test makes sure that a level which specifies an approxRowCount property prevents Mondrian from executing a count() sql query. It was discovered in bug MONDRIAN-711 that the aggregate tables predicates optimization code was not considering the approxRowCount property. It is fixed and this test will ensure it won't happen again.


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