Class OpenMetadataTestCase

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addDiscoveredProperty​(java.lang.String propertyName, java.lang.Object propertyValue, java.lang.Integer profileId, java.lang.Integer requirementId)
      Add the name and value of a discovered property that is relevant to a specific requirement within a profile.
      protected void addNotSupportedAssertion​(java.lang.String assertionId, java.lang.String assertionMessage, java.lang.Integer profileId, java.lang.Integer requirementId)
      Log the correct response to an unsupported function.
      protected void assertCondition​(boolean condition, java.lang.String assertionId, java.lang.String assertionMessage, java.lang.Integer profileId, java.lang.Integer requirementId)
      Throw an exception if the condition is not true; else return
      protected void assertCondition​(boolean condition, java.lang.String assertionId, java.lang.String assertionMessage, java.lang.Integer profileId, java.lang.Integer requirementId, java.lang.String methodName, java.lang.Long elapsedTime)
      Throw an exception if the condition is not true; else return
      void cleanTest()  
      protected void cleanup()
      Default implementation - over-ridden by some test cases.
      void endAsynchronousTest()
      Request from the workbench to log the start of an asynchronous test.
      void executeTest()
      Request from the workbench to execute this test and generate a result object.
      void executeTest​(OpenMetadataTestCase.TestPhase phase)
      Request from the workbench to execute this test and generate a result object.
      OpenMetadataTestCaseResult getResult()
      Return the result object for this test case.
      OpenMetadataTestCaseSummary getSummary()
      Return a summary bean for this test case.
      java.lang.String getTestCaseDescriptionURL()
      Return the URL of the description of the test case.
      java.lang.String getTestCaseId()
      Return the unique identifier of the test case.
      java.lang.String getTestCaseName()
      Return the display name of the test case.
      boolean isTestPassed()
      Has the test case passed? If it has not run then false is returned.
      boolean isTestRan()
      Has the test case been ran yet?
      protected abstract void logTestEnd​(java.lang.String methodName)
      Log that the test case is ending.
      protected abstract void logTestStart​(java.lang.String methodName)
      Log that the test case is starting.
      protected abstract void run()
      Method implemented by the actual test case.
      protected void run​(OpenMetadataTestCase.TestPhase phase)
      Method implemented by the actual test case.
      protected void setSuccessMessage​(java.lang.String message)
      Set up the success message.
      void startAsynchronousTest()
      Request from the workbench to log the start of an asynchronous test.
      java.lang.String toString()
      toString() JSON-style
      protected void updateTestId​(java.lang.String testCaseRootId, java.lang.String testCaseId, java.lang.String testCaseName)
      Update the test case Id, name and documentation URL if not already supplied in the constructor.
      protected void verifyCondition​(boolean condition, java.lang.String assertionId, java.lang.String assertionMessage, java.lang.Integer profileId, java.lang.Integer requirementId)
      Log if the condition is not true; else return
      protected void verifyCondition​(boolean condition, java.lang.String assertionId, java.lang.String assertionMessage, java.lang.Integer profileId, java.lang.Integer requirementId, java.lang.String methodName, java.lang.Long elapsedTime)
      Log if the condition is not true; else return
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • testCaseId

        protected java.lang.String testCaseId
      • testCaseName

        protected java.lang.String testCaseName
      • testCaseDescriptionURL

        protected java.lang.String testCaseDescriptionURL
      • defaultProfileId

        protected java.lang.Integer defaultProfileId
      • defaultRequirementId

        protected java.lang.Integer defaultRequirementId
      • successfulAssertions

        protected java.util.List<java.lang.String> successfulAssertions
      • unsuccessfulAssertions

        protected java.util.List<java.lang.String> unsuccessfulAssertions
      • notSupportedAssertions

        protected java.util.List<java.lang.String> notSupportedAssertions
      • discoveredProperties

        protected java.util.Map<java.lang.String,​java.lang.Object> discoveredProperties
      • successMessage

        protected java.lang.String successMessage
    • Constructor Detail

      • OpenMetadataTestCase

        public OpenMetadataTestCase()
        Default constructor
      • OpenMetadataTestCase

        public OpenMetadataTestCase​(OpenMetadataConformanceWorkbenchWorkPad workPad,
                                    java.lang.String testCaseId,
                                    java.lang.String testCaseName,
                                    java.lang.Integer defaultProfileId,
                                    java.lang.Integer defaultRequirementId)
        Typical constructor used when the test case Id is fixed.
        Parameters:
        workPad - location for workbench results
        testCaseId - identifier of test case
        testCaseName - name of test case
        defaultProfileId - identifier of default profile (for unexpected exceptions)
        defaultRequirementId - identifier of default required (for unexpected exceptions)
      • OpenMetadataTestCase

        public OpenMetadataTestCase​(OpenMetadataConformanceWorkbenchWorkPad workPad,
                                    java.lang.Integer defaultProfileId,
                                    java.lang.Integer defaultRequirementId)
        Typical constructor used when the test case Id needs to be constructed by the test case code.
        Parameters:
        workPad - location for workbench results
        defaultProfileId - identifier of default profile (for unexpected exceptions)
        defaultRequirementId - identifier of default required (for unexpected exceptions)
    • Method Detail

      • updateTestId

        protected void updateTestId​(java.lang.String testCaseRootId,
                                    java.lang.String testCaseId,
                                    java.lang.String testCaseName)
        Update the test case Id, name and documentation URL if not already supplied in the constructor.
        Parameters:
        testCaseRootId - common identifier of test case
        testCaseId - unique identifier of test case
        testCaseName - name of test case
      • logTestStart

        protected abstract void logTestStart​(java.lang.String methodName)
        Log that the test case is starting.
        Parameters:
        methodName - calling method name
      • logTestEnd

        protected abstract void logTestEnd​(java.lang.String methodName)
        Log that the test case is ending.
        Parameters:
        methodName - calling method name
      • getTestCaseId

        public java.lang.String getTestCaseId()
        Return the unique identifier of the test case.
        Returns:
        string id
      • getTestCaseName

        public java.lang.String getTestCaseName()
        Return the display name of the test case.
        Returns:
        string name
      • getTestCaseDescriptionURL

        public java.lang.String getTestCaseDescriptionURL()
        Return the URL of the description of the test case.
        Returns:
        string url
      • isTestRan

        public boolean isTestRan()
        Has the test case been ran yet?
        Returns:
        boolean flag
      • isTestPassed

        public boolean isTestPassed()
        Has the test case passed? If it has not run then false is returned.
        Returns:
        boolean flag
      • getResult

        public OpenMetadataTestCaseResult getResult()
        Return the result object for this test case. It will be null if the test case has not run.
        Returns:
        result bean (or null if the test has not yet been run).
      • assertCondition

        protected void assertCondition​(boolean condition,
                                       java.lang.String assertionId,
                                       java.lang.String assertionMessage,
                                       java.lang.Integer profileId,
                                       java.lang.Integer requirementId)
                                throws AssertionFailureException
        Throw an exception if the condition is not true; else return
        Parameters:
        condition - condition to test
        assertionId - identifier for the assertion
        assertionMessage - descriptive message of the assertion
        profileId - identifier of profile for this assertion
        requirementId - identifier of requirement for this assertion
        Throws:
        AssertionFailureException - condition was false
      • assertCondition

        protected void assertCondition​(boolean condition,
                                       java.lang.String assertionId,
                                       java.lang.String assertionMessage,
                                       java.lang.Integer profileId,
                                       java.lang.Integer requirementId,
                                       java.lang.String methodName,
                                       java.lang.Long elapsedTime)
                                throws AssertionFailureException
        Throw an exception if the condition is not true; else return
        Parameters:
        condition - condition to test
        assertionId - identifier for the assertion
        assertionMessage - descriptive message of the assertion
        profileId - identifier of profile for this assertion
        requirementId - identifier of requirement for this assertion
        methodName - method that this condition tests
        elapsedTime - of the test executing (in milliseconds)
        Throws:
        AssertionFailureException - condition was false
      • verifyCondition

        protected void verifyCondition​(boolean condition,
                                       java.lang.String assertionId,
                                       java.lang.String assertionMessage,
                                       java.lang.Integer profileId,
                                       java.lang.Integer requirementId)
        Log if the condition is not true; else return
        Parameters:
        condition - condition to test
        assertionId - identifier for the assertion
        assertionMessage - descriptive message of the assertion
        profileId - identifier of profile for this assertion
        requirementId - identifier of requirement for this assertion
      • verifyCondition

        protected void verifyCondition​(boolean condition,
                                       java.lang.String assertionId,
                                       java.lang.String assertionMessage,
                                       java.lang.Integer profileId,
                                       java.lang.Integer requirementId,
                                       java.lang.String methodName,
                                       java.lang.Long elapsedTime)
        Log if the condition is not true; else return
        Parameters:
        condition - condition to test
        assertionId - identifier for the assertion
        assertionMessage - descriptive message of the assertion
        profileId - identifier of profile for this assertion
        requirementId - identifier of requirement for this assertion
        methodName - method that this condition tests
        elapsedTime - of the test executing (in milliseconds)
      • addNotSupportedAssertion

        protected void addNotSupportedAssertion​(java.lang.String assertionId,
                                                java.lang.String assertionMessage,
                                                java.lang.Integer profileId,
                                                java.lang.Integer requirementId)
        Log the correct response to an unsupported function.
        Parameters:
        assertionId - identifier for the assertion
        assertionMessage - descriptive message of the assertion
        profileId - identifier of profile for this assertion
        requirementId - identifier of requirement for this assertion
      • addDiscoveredProperty

        protected void addDiscoveredProperty​(java.lang.String propertyName,
                                             java.lang.Object propertyValue,
                                             java.lang.Integer profileId,
                                             java.lang.Integer requirementId)
        Add the name and value of a discovered property that is relevant to a specific requirement within a profile.
        Parameters:
        propertyName - name of the property
        propertyValue - value of the property as object
        profileId - identifier of profile
        requirementId - identifier of requirement within the profile
      • setSuccessMessage

        protected void setSuccessMessage​(java.lang.String message)
        Set up the success message.
        Parameters:
        message - text of message
      • startAsynchronousTest

        public void startAsynchronousTest()
        Request from the workbench to log the start of an asynchronous test.
      • endAsynchronousTest

        public void endAsynchronousTest()
        Request from the workbench to log the start of an asynchronous test.
      • executeTest

        public void executeTest()
        Request from the workbench to execute this test and generate a result object. This method is used for synchronous test cases. This variant of the method calls the parameter-less run method of the testcase.
      • executeTest

        public void executeTest​(OpenMetadataTestCase.TestPhase phase)
        Request from the workbench to execute this test and generate a result object. This method is used for synchronous test cases. This variant of the method accepts a test phase parameter to allow explicit execution of create, execute and clean phases.
        Parameters:
        phase - test phase
      • cleanTest

        public void cleanTest()
      • cleanup

        protected void cleanup()
                        throws java.lang.Exception
        Default implementation - over-ridden by some test cases.
        Throws:
        java.lang.Exception - something went wrong with the test.
      • run

        protected abstract void run()
                             throws java.lang.Exception
        Method implemented by the actual test case.
        Throws:
        java.lang.Exception - something went wrong with the test.
      • run

        protected void run​(OpenMetadataTestCase.TestPhase phase)
                    throws java.lang.Exception
        Method implemented by the actual test case.
        Parameters:
        phase - test phase
        Throws:
        java.lang.Exception - something went wrong with the test.
      • toString

        public java.lang.String toString()
        toString() JSON-style
        Overrides:
        toString in class java.lang.Object
        Returns:
        string description