Package mondrian.xmla

Class XmlaBaseTestCase

    • Constructor Detail

      • XmlaBaseTestCase

        public XmlaBaseTestCase()
      • XmlaBaseTestCase

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

      • tearDown

        protected void tearDown()
                         throws java.lang.Exception
        Overrides:
        tearDown in class FoodMartTestCase
        Throws:
        java.lang.Exception
      • generateExpectedString

        protected java.lang.String generateExpectedString​(java.util.Properties props)
                                                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • generateRequestString

        protected java.lang.String generateRequestString​(java.util.Properties props)
                                                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • validate

        protected void validate​(byte[] bytes,
                                org.w3c.dom.Document expectedDoc,
                                TestContext testContext,
                                boolean replace,
                                boolean validate)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • doTest

        public void doTest​(java.util.Properties props)
                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • doTest

        protected void doTest​(MockHttpServletRequest req,
                              java.util.Properties props)
                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • helperTestExpect

        protected void helperTestExpect​(boolean doSessionId)
      • helperTest

        protected void helperTest​(boolean doSessionId)
      • addDatasourceInfoResponseKey

        protected void addDatasourceInfoResponseKey​(java.util.Properties props)
      • 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)
      • filterConnectString

        protected java.lang.String filterConnectString​(java.lang.String original)
      • 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,
                                                      java.util.Properties props)
                                               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 - on error
      • 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 connectString,
                               java.util.Map<java.lang.String,​java.lang.String> catalogNameUrls,
                               org.w3c.dom.Document expectedDoc,
                               XmlaConstants.Content content,
                               Role role,
                               boolean replace)
                        throws java.lang.Exception
        Executes a SOAP request.
        Parameters:
        soapRequestText - SOAP request
        props - Name/value pairs to substitute in the request
        testContext - Test context
        connectString - Connect string
        catalogNameUrls - Map from catalog names to URL
        expectedDoc - Expected SOAP output
        content - Content type
        role - Role in which to execute query, or null
        replace - 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 pass true for the content type that has the most information (generally XmlaConstants.Content.SchemaData)
        Throws:
        java.lang.Exception - on error
      • doTestsJson

        protected void doTestsJson​(java.lang.String soapRequestText,
                                   java.util.Properties props,
                                   TestContext testContext,
                                   java.lang.String connectString,
                                   java.util.Map<java.lang.String,​java.lang.String> catalogNameUrls,
                                   java.lang.String expectedStr,
                                   XmlaConstants.Content 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)
      • maskVersion

        public static java.lang.String maskVersion​(java.lang.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}"