Package mondrian.xmla
Class XmlaBaseTestCase
- java.lang.Object
-
- TestCase
-
- mondrian.test.FoodMartTestCase
-
- mondrian.xmla.XmlaBaseTestCase
-
- Direct Known Subclasses:
XmlaBasicTest,XmlaCognosTest,XmlaDimensionPropertiesTest,XmlaErrorTest,XmlaExcel2000Test,XmlaExcel2007Test,XmlaExcelXPTest,XmlaMetaDataConstraintsTest,XmlaTabularTest
public abstract class XmlaBaseTestCase extends FoodMartTestCase
Extends FoodMartTestCase, adding support for testing XMLA specific functionality, for example LAST_SCHEMA_UPDATE- Author:
- mkambol
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classXmlaBaseTestCase.Action(package private) static classXmlaBaseTestCase.CallBackprotected static classXmlaBaseTestCase.XmlaRequestCallbackImpl
-
Field Summary
Fields Modifier and Type Field Description static StringCATALOGstatic StringCATALOG_NAME_PROPstatic StringCATALOG_PROPprotected SortedMap<String,String>catalogNameUrlsstatic StringCUBE_NAME_PROPstatic StringDATA_SOURCE_INFOstatic StringDATA_SOURCE_INFO_PROPprotected static booleanDEBUGstatic StringFORMAT_MULTI_DIMENSIONALstatic StringFORMAT_PROPprotected static StringLAST_SCHEMA_UPDATE_DATEstatic StringLOCALE_PROPstatic StringREQUEST_TYPE_PROPstatic StringROLE_PROPstatic StringSALES_CUBEstatic StringSESSION_ID_PROP-
Fields inherited from class mondrian.test.FoodMartTestCase
propSaver
-
-
Constructor Summary
Constructors Constructor Description XmlaBaseTestCase()XmlaBaseTestCase(String name)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddDatasourceInfoResponseKey(Properties props)voiddoTest(String requestType, Properties props, TestContext testContext)Executes an XMLA request, reading the text of the request and the response from attributes ingetDiffRepos().voiddoTest(String requestType, Properties props, TestContext testContext, Role role)voiddoTest(Properties props)protected voiddoTest(MockHttpServletRequest req, Properties props)voiddoTestInline(String requestType, String requestText, String respFileName, Properties props, TestContext testContext)voiddoTestInline(String requestType, String requestText, String respFileName, Properties props, TestContext testContext, Role role)protected voiddoTests(String soapRequestText, Properties props, TestContext testContext, String connectString, Map<String,String> catalogNameUrls, Document expectedDoc, XmlaConstants.Content content, Role role, boolean replace)Executes a SOAP request.protected voiddoTestsJson(String soapRequestText, Properties props, TestContext testContext, String connectString, Map<String,String> catalogNameUrls, String expectedStr, XmlaConstants.Content content, Role role)protected DocumentfileToDocument(String filename, Properties props)protected StringfileToString(String filename)protected Stringfilter(String testCaseName, String filename, String content)Filters the content of a test resource.protected StringfilterConnectString(String original)protected StringgenerateExpectedString(Properties props)protected StringgenerateRequestString(Properties props)protected Map<String,String>getCatalogNameUrls(TestContext testContext)protected PropertiesgetDefaultRequestProperties(String requestType)protected abstract DiffRepositorygetDiffRepos()protected ServletgetServlet(TestContext testContext)protected abstract Class<? extends XmlaRequestCallback>getServletCallbackClass()protected static StringgetSessionId(String name, XmlaBaseTestCase.Action action)protected abstract StringgetSessionId(XmlaBaseTestCase.Action action)Creates, retrieves or clears the session id for this test.protected voidhelperTest(boolean doSessionId)protected voidhelperTestExpect(boolean doSessionId)static StringmaskVersion(String str)Masks Mondrian's version number from a string.protected DocumentreplaceLastSchemaUpdateDate(Document doc)protected voidtearDown()protected voidvalidate(byte[] bytes, Document expectedDoc, TestContext testContext, boolean replace, boolean validate)-
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, verifySameNativeAndNot, warehouseMembersCanadaMexicoUsa
-
-
-
-
Field Detail
-
LAST_SCHEMA_UPDATE_DATE
protected static final String LAST_SCHEMA_UPDATE_DATE
- See Also:
- Constant Field Values
-
SESSION_ID_PROP
public static final String SESSION_ID_PROP
- See Also:
- Constant Field Values
-
REQUEST_TYPE_PROP
public static final String REQUEST_TYPE_PROP
- See Also:
- Constant Field Values
-
DATA_SOURCE_INFO_PROP
public static final String DATA_SOURCE_INFO_PROP
- See Also:
- Constant Field Values
-
DATA_SOURCE_INFO
public static final String DATA_SOURCE_INFO
- See Also:
- Constant Field Values
-
CATALOG_PROP
public static final String CATALOG_PROP
- See Also:
- Constant Field Values
-
CATALOG_NAME_PROP
public static final String CATALOG_NAME_PROP
- See Also:
- Constant Field Values
-
CATALOG
public static final String CATALOG
- See Also:
- Constant Field Values
-
CUBE_NAME_PROP
public static final String CUBE_NAME_PROP
- See Also:
- Constant Field Values
-
SALES_CUBE
public static final String SALES_CUBE
- See Also:
- Constant Field Values
-
FORMAT_PROP
public static final String FORMAT_PROP
- See Also:
- Constant Field Values
-
FORMAT_MULTI_DIMENSIONAL
public static final String FORMAT_MULTI_DIMENSIONAL
- See Also:
- Constant Field Values
-
ROLE_PROP
public static final String ROLE_PROP
- See Also:
- Constant Field Values
-
LOCALE_PROP
public static final String LOCALE_PROP
- See Also:
- Constant Field Values
-
DEBUG
protected static final boolean DEBUG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
XmlaBaseTestCase
public XmlaBaseTestCase()
-
XmlaBaseTestCase
public XmlaBaseTestCase(String name)
-
-
Method Detail
-
tearDown
protected void tearDown() throws Exception- Overrides:
tearDownin classFoodMartTestCase- Throws:
Exception
-
generateExpectedString
protected String generateExpectedString(Properties props) throws Exception
- Throws:
Exception
-
generateRequestString
protected String generateRequestString(Properties props) throws Exception
- Throws:
Exception
-
validate
protected void validate(byte[] bytes, Document expectedDoc, TestContext testContext, boolean replace, boolean validate) throws Exception- Throws:
Exception
-
doTest
public void doTest(Properties props) throws Exception
- Throws:
Exception
-
doTest
protected void doTest(MockHttpServletRequest req, Properties props) throws Exception
- Throws:
Exception
-
helperTestExpect
protected void helperTestExpect(boolean doSessionId)
-
helperTest
protected void helperTest(boolean doSessionId)
-
addDatasourceInfoResponseKey
protected void addDatasourceInfoResponseKey(Properties props)
-
getDiffRepos
protected abstract DiffRepository getDiffRepos()
-
getCatalogNameUrls
protected Map<String,String> getCatalogNameUrls(TestContext testContext)
-
getServlet
protected Servlet getServlet(TestContext testContext) throws IOException, ServletException, SAXException
- Throws:
IOExceptionServletExceptionSAXException
-
getServletCallbackClass
protected abstract Class<? extends XmlaRequestCallback> getServletCallbackClass()
-
getDefaultRequestProperties
protected Properties getDefaultRequestProperties(String requestType)
-
fileToDocument
protected Document fileToDocument(String filename, Properties props) throws IOException, SAXException
- Throws:
IOExceptionSAXException
-
filter
protected String filter(String testCaseName, String filename, String content)
Filters the content of a test resource. The default implementation returns the content unchanged, but a derived class might override this method to change the content.- Parameters:
testCaseName- Name of current test case, e.g. "testFoo"filename- Name of requested content, e.g. "${request}"content- Content- Returns:
- Modified content
-
doTest
public void doTest(String requestType, Properties props, TestContext testContext) throws Exception
Executes an XMLA request, reading the text of the request and the response from attributes ingetDiffRepos().- Parameters:
requestType- Request type: "DISCOVER_DATASOURCES", "EXECUTE", etc.props- Properties for requesttestContext- Test context- Throws:
Exception- on error
-
doTest
public void doTest(String requestType, Properties props, TestContext testContext, Role role) throws Exception
- Throws:
Exception
-
doTestInline
public void doTestInline(String requestType, String requestText, String respFileName, Properties props, TestContext testContext) throws Exception
- Throws:
Exception
-
doTestInline
public void doTestInline(String requestType, String requestText, String respFileName, Properties props, TestContext testContext, Role role) throws Exception
- Throws:
Exception
-
doTests
protected void doTests(String soapRequestText, Properties props, TestContext testContext, String connectString, Map<String,String> catalogNameUrls, Document expectedDoc, XmlaConstants.Content content, Role role, boolean replace) throws Exception
Executes a SOAP request.- Parameters:
soapRequestText- SOAP requestprops- Name/value pairs to substitute in the requesttestContext- Test contextconnectString- Connect stringcatalogNameUrls- Map from catalog names to URLexpectedDoc- Expected SOAP outputcontent- Content typerole- Role in which to execute query, or nullreplace- Whether to generate a replacement reference log into TestName.log.xml if there is an exception. If you are running the same request with different content types and the same reference log, you should passtruefor the content type that has the most information (generallyXmlaConstants.Content.SchemaData)- Throws:
Exception- on error
-
doTestsJson
protected void doTestsJson(String soapRequestText, Properties props, TestContext testContext, String connectString, Map<String,String> catalogNameUrls, String expectedStr, XmlaConstants.Content content, Role role) throws Exception
- Throws:
Exception
-
getSessionId
protected abstract String getSessionId(XmlaBaseTestCase.Action action)
Creates, retrieves or clears the session id for this test.- Parameters:
action- Action to perform- Returns:
- Session id for create, query; null for clear
-
getSessionId
protected static String getSessionId(String name, XmlaBaseTestCase.Action action)
-
maskVersion
public static String maskVersion(String str)
Masks Mondrian's version number from a string. Note that this method does a mostly blind replacement of the version string and may replace strings that just happen to have the same sequence.- Parameters:
str- String- Returns:
- String with each occurrence of mondrian's version number (e.g. "2.3.0.0") replaced with "${mondrianVersion}"
-
-