mondrian.xmla
Class XmlaBaseTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by mondrian.test.FoodMartTestCase
              extended by mondrian.xmla.XmlaBaseTestCase
All Implemented Interfaces:
Test
Direct Known Subclasses:
XmlaBasicTest, XmlaCognosTest, XmlaErrorTest, XmlaExcel2000Test, XmlaExcelXPTest, XmlaTabularTest

public abstract class XmlaBaseTestCase
extends FoodMartTestCase

Extends FoodMartTestCase, adding support for testing XMLA specific functionality, for example LAST_SCHEMA_UPDATE

Version:
$Id: //open/mondrian/testsrc/main/mondrian/xmla/XmlaBaseTestCase.java#19 $
Author:
mkambol

Nested Class Summary
(package private) static class XmlaBaseTestCase.Action
           
(package private) static class XmlaBaseTestCase.CallBack
           
 
Field Summary
static java.lang.String CATALOG
           
static java.lang.String CATALOG_NAME_PROP
           
static java.lang.String CATALOG_PROP
           
protected  java.util.SortedMap<java.lang.String,java.lang.String> catalogNameUrls
           
static java.lang.String CUBE_NAME_PROP
           
static java.lang.String DATA_SOURCE_INFO
           
static java.lang.String DATA_SOURCE_INFO_PROP
           
static java.lang.String FORMAT_MULTI_DIMENSIONAL
           
static java.lang.String FORMAT_PROP
           
static java.lang.String HR_CUBE
           
protected static java.lang.String LAST_SCHEMA_UPDATE_DATE
           
protected static java.lang.String LAST_SCHEMA_UPDATE_DATE_PROP
           
static java.lang.String REQUEST_TYPE_PROP
           
static java.lang.String SALES_CUBE
           
static java.lang.String SESSION_ID_PROP
           
 
Fields inherited from class mondrian.test.FoodMartTestCase
propSaver
 
Constructor Summary
XmlaBaseTestCase()
           
XmlaBaseTestCase(java.lang.String name)
           
 
Method Summary
protected  void clearServlet()
           
 void doTest(java.lang.String requestType, java.util.Properties props, TestContext testContext)
          Executes an XMLA request, reading the text of the request and the response from attributes in getDiffRepos().
 void doTest(java.lang.String requestType, java.util.Properties props, TestContext testContext, Role role)
           
 void doTestInline(java.lang.String requestType, java.lang.String requestText, java.lang.String respFileName, java.util.Properties props, TestContext testContext)
           
 void doTestInline(java.lang.String requestType, java.lang.String requestText, java.lang.String respFileName, java.util.Properties props, TestContext testContext, Role role)
           
protected  void doTests(java.lang.String soapRequestText, java.util.Properties props, TestContext testContext, java.lang.String soapResponseText, java.lang.String connectString, java.util.Map<java.lang.String,java.lang.String> catalogNameUrls, org.w3c.dom.Document expectedDoc, java.lang.String content, Role role)
           
protected  org.w3c.dom.Document fileToDocument(java.lang.String filename)
           
protected  java.lang.String fileToString(java.lang.String filename)
           
protected  java.lang.String filter(java.lang.String testCaseName, java.lang.String filename, java.lang.String content)
          Filters the content of a test resource.
protected  java.util.Map<java.lang.String,java.lang.String> getCatalogNameUrls(TestContext testContext)
           
protected  java.util.Properties getDefaultRequestProperties(java.lang.String requestType)
           
protected abstract  DiffRepository getDiffRepos()
           
protected  Servlet getServlet(TestContext testContext)
           
protected abstract  java.lang.Class<? extends XmlaRequestCallback> getServletCallbackClass()
           
protected static java.lang.String getSessionId(java.lang.String name, XmlaBaseTestCase.Action action)
           
protected abstract  java.lang.String getSessionId(XmlaBaseTestCase.Action action)
          Creates, retrieves or clears the session id for this test.
protected  org.w3c.dom.Document replaceLastSchemaUpdateDate(org.w3c.dom.Document doc)
           
 
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, getTestContext, isDefaultNullMemberRepresentation, isGroupingSetsSupported, member, productMembersPotScrubbersPotsAndPans, storeMembersCAAndOR, storeMembersUsaAndCanada, tearDown, warehouseMembersCanadaMexicoUsa
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, 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, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LAST_SCHEMA_UPDATE_DATE_PROP

protected static final java.lang.String LAST_SCHEMA_UPDATE_DATE_PROP
See Also:
Constant Field Values

LAST_SCHEMA_UPDATE_DATE

protected static final java.lang.String LAST_SCHEMA_UPDATE_DATE
See Also:
Constant Field Values

catalogNameUrls

protected java.util.SortedMap<java.lang.String,java.lang.String> catalogNameUrls

SESSION_ID_PROP

public static final java.lang.String SESSION_ID_PROP
See Also:
Constant Field Values

REQUEST_TYPE_PROP

public static final java.lang.String REQUEST_TYPE_PROP
See Also:
Constant Field Values

DATA_SOURCE_INFO_PROP

public static final java.lang.String DATA_SOURCE_INFO_PROP
See Also:
Constant Field Values

DATA_SOURCE_INFO

public static final java.lang.String DATA_SOURCE_INFO
See Also:
Constant Field Values

CATALOG_PROP

public static final java.lang.String CATALOG_PROP
See Also:
Constant Field Values

CATALOG_NAME_PROP

public static final java.lang.String CATALOG_NAME_PROP
See Also:
Constant Field Values

CATALOG

public static final java.lang.String CATALOG
See Also:
Constant Field Values

CUBE_NAME_PROP

public static final java.lang.String CUBE_NAME_PROP
See Also:
Constant Field Values

SALES_CUBE

public static final java.lang.String SALES_CUBE
See Also:
Constant Field Values

HR_CUBE

public static final java.lang.String HR_CUBE
See Also:
Constant Field Values

FORMAT_PROP

public static final java.lang.String FORMAT_PROP
See Also:
Constant Field Values

FORMAT_MULTI_DIMENSIONAL

public static final java.lang.String FORMAT_MULTI_DIMENSIONAL
See Also:
Constant Field Values
Constructor Detail

XmlaBaseTestCase

public XmlaBaseTestCase()

XmlaBaseTestCase

public XmlaBaseTestCase(java.lang.String name)
Method Detail

getDiffRepos

protected abstract DiffRepository getDiffRepos()

fileToString

protected java.lang.String fileToString(java.lang.String filename)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

replaceLastSchemaUpdateDate

protected org.w3c.dom.Document replaceLastSchemaUpdateDate(org.w3c.dom.Document doc)

getCatalogNameUrls

protected java.util.Map<java.lang.String,java.lang.String> getCatalogNameUrls(TestContext testContext)

getServlet

protected Servlet getServlet(TestContext testContext)
                      throws java.io.IOException,
                             ServletException,
                             org.xml.sax.SAXException
Throws:
java.io.IOException
ServletException
org.xml.sax.SAXException

clearServlet

protected void clearServlet()

getServletCallbackClass

protected abstract java.lang.Class<? extends XmlaRequestCallback> getServletCallbackClass()

getDefaultRequestProperties

protected java.util.Properties getDefaultRequestProperties(java.lang.String requestType)

fileToDocument

protected org.w3c.dom.Document fileToDocument(java.lang.String filename)
                                       throws java.io.IOException,
                                              org.xml.sax.SAXException
Throws:
java.io.IOException
org.xml.sax.SAXException

filter

protected java.lang.String filter(java.lang.String testCaseName,
                                  java.lang.String filename,
                                  java.lang.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(java.lang.String requestType,
                   java.util.Properties props,
                   TestContext testContext)
            throws java.lang.Exception
Executes an XMLA request, reading the text of the request and the response from attributes in getDiffRepos().

Parameters:
requestType - Request type: "DISCOVER_DATASOURCES", "EXECUTE", etc.
props - Properties for request
testContext - Test context
Throws:
java.lang.Exception

doTest

public void doTest(java.lang.String requestType,
                   java.util.Properties props,
                   TestContext testContext,
                   Role role)
            throws java.lang.Exception
Throws:
java.lang.Exception

doTestInline

public void doTestInline(java.lang.String requestType,
                         java.lang.String requestText,
                         java.lang.String respFileName,
                         java.util.Properties props,
                         TestContext testContext)
                  throws java.lang.Exception
Throws:
java.lang.Exception

doTestInline

public void doTestInline(java.lang.String requestType,
                         java.lang.String requestText,
                         java.lang.String respFileName,
                         java.util.Properties props,
                         TestContext testContext,
                         Role role)
                  throws java.lang.Exception
Throws:
java.lang.Exception

doTests

protected void doTests(java.lang.String soapRequestText,
                       java.util.Properties props,
                       TestContext testContext,
                       java.lang.String soapResponseText,
                       java.lang.String connectString,
                       java.util.Map<java.lang.String,java.lang.String> catalogNameUrls,
                       org.w3c.dom.Document expectedDoc,
                       java.lang.String content,
                       Role role)
                throws java.lang.Exception
Throws:
java.lang.Exception

getSessionId

protected abstract java.lang.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 java.lang.String getSessionId(java.lang.String name,
                                               XmlaBaseTestCase.Action action)

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