Class SetListCallback


  • public class SetListCallback
    extends AbstractTestRunnerCallback
    Callback for creation and update of the SetList - a crucial part of Integritys' remoting system.
    Author:
    Rene Schneider - initial API and implementation
    • Field Detail

      • ENABLE_SETLIST_TRACE_OUTPUT

        protected static final java.lang.String ENABLE_SETLIST_TRACE_OUTPUT
        System property to enable writing setlist trace output.
        See Also:
        Constant Field Values
      • isTracingEnabled

        protected boolean isTracingEnabled
        Whether setlist tracing is enabled.
      • conversionContextProvider

        @Inject
        protected com.google.inject.Provider<ConversionContext> conversionContextProvider
        The conversion context provider.
    • Constructor Detail

      • SetListCallback

        public SetListCallback​(SetList aSetList,
                               IntegrityRemotingServer aRemotingServer)
        Creates a new instance.
        Parameters:
        aSetList - the setlist to update
        aRemotingServer - the remoting server to use
    • Method Detail

      • onExecutionStart

        public void onExecutionStart​(TestModel aModel,
                                     VariantDefinition aVariant)
        Description copied from class: TestRunnerCallback
        Called when the execution starts, that is, before the first (root) suite is entered. This is always the first call of an execution phase.
        Specified by:
        onExecutionStart in class TestRunnerCallback
        Parameters:
        aModel - the test model that will be executed
      • onSuiteStart

        public void onSuiteStart​(Suite aSuite)
        Description copied from class: TestRunnerCallback
        Called when a suite call is being followed.
        Specified by:
        onSuiteStart in class TestRunnerCallback
        Parameters:
        aSuite - the suite call that will be entered
      • onTableTestFinish

        public void onTableTestFinish​(TableTest aTableTest,
                                      TestResult aResult)
        Description copied from class: TestRunnerCallback
        Called after a tabletest was fully executed (all rows have been executed).
        Specified by:
        onTableTestFinish in class TestRunnerCallback
        Parameters:
        aTableTest - the table test
        aResult - the result of the test execution
      • onAnyKindOfSubTestFinish

        protected java.util.List<SetListEntry> onAnyKindOfSubTestFinish​(MethodReference aMethod,
                                                                        SuiteStatementWithResult aStatement,
                                                                        SetListEntry aTestEntry,
                                                                        TestSubResult aSubResult,
                                                                        java.util.Map<java.lang.String,​java.lang.Object> aParameterMap)
        This method is used to perform the actual sub-test result parsing, both for normal tests and tabletests (with the latter having more than one subtest).
        Parameters:
        aMethod - the fixture method
        aStatement - the statement currently being executed
        aTestEntry - the setlist entry for the test
        aSubResult - the sub-result to analyze
        aParameterMap - the parameters given to the test method
        Returns:
        a list of newly generated setlist entries (with the first being the result entry itself)
      • onSuiteFinish

        public void onSuiteFinish​(Suite aSuite,
                                  SuiteSummaryResult aResult)
        Description copied from class: TestRunnerCallback
        Called after a suite has finished execution. This might return a SuiteResult instance if the suite was executed locally, or a SuiteSummaryResult with just the summary count information if the suite ran on a fork, in which case the detailed information is not available.
        Specified by:
        onSuiteFinish in class TestRunnerCallback
        Parameters:
        aSuite - the suite that was executed
        aResult - the result of the execution
      • onVisibleComment

        public void onVisibleComment​(java.lang.String aCommentText,
                                     boolean anIsTitle,
                                     VisibleComment aCommentElement)
        Description copied from class: TestRunnerCallback
        Called when a visible comment is encountered during execution.
        Specified by:
        onVisibleComment in class TestRunnerCallback
        Parameters:
        aCommentText - the text inside the comment
        aCommentElement - the raw comment element
      • onVisibleDivider

        public void onVisibleDivider​(java.lang.String aDividerText,
                                     VisibleDivider aDividerElement)
        Description copied from class: TestRunnerCallback
        Called when a visible divider is encountered during execution.
        Specified by:
        onVisibleDivider in class TestRunnerCallback
        Parameters:
        aDividerText - the divider text (basically a String of '-' chars with minimum length of 3 chars)
        aDividerElement - the raw divider element
      • onVariableDefinition

        public void onVariableDefinition​(VariableEntity aDefinition,
                                         SuiteDefinition aSuite,
                                         java.lang.Object anInitialValue)
        Description copied from class: TestRunnerCallback
        Called when a variable is being defined.
        Specified by:
        onVariableDefinition in class TestRunnerCallback
        Parameters:
        aDefinition - the variable
        aSuite - the suite in which the variable is scoped (may be null if the variable is global)
        anInitialValue - the initial value (may be null if no initial value is given)
      • onConstantDefinition

        public void onConstantDefinition​(ConstantEntity aDefinition,
                                         SuiteDefinition aSuite,
                                         java.lang.Object aValue,
                                         boolean aParameterizedFlag)
        Description copied from class: TestRunnerCallback
        Called when a constant is being defined.
        Specified by:
        onConstantDefinition in class TestRunnerCallback
        Parameters:
        aDefinition - the constant
        aSuite - the suite in which the constant is scoped (may be null if the constant is global)
        aValue - the value (may be null if no value was given)
        aParameterizedFlag - true if the constant was parameterized (value defined not in script, but from outside the test runner via parameter)
      • onVariableAssignment

        public void onVariableAssignment​(VariableAssignment anAssignment,
                                         VariableEntity aVariableEntity,
                                         SuiteDefinition aSuite,
                                         java.lang.Object aValue)
        Description copied from class: TestRunnerCallback
        Called when a variable is being assigned.
        Specified by:
        onVariableAssignment in class TestRunnerCallback
        Parameters:
        anAssignment - the assignment
        aVariableEntity - the variable that the value is to be assigned
        aSuite - the suite in which the variable is scoped (may be null if the variable is global)
        aValue - the value
      • onAbortExecution

        public void onAbortExecution​(java.lang.String anAbortExecutionMessage,
                                     java.lang.String anAbortExecutionStackTrace)
        Description copied from class: TestRunnerCallback
        Called when test execution is aborted prematurely due to an AbortExecutionException - either thrown locally or by a fork. The original exception can't be provided since it cannot be received from a fork by remoting. Instead, the data from the exception is provided in both cases.
        Specified by:
        onAbortExecution in class TestRunnerCallback
        Parameters:
        anAbortExecutionMessage - the message from the exception
        anAbortExecutionStackTrace - the stack trace of the exception
      • onReturnVariableAssignment

        public void onReturnVariableAssignment​(SuiteReturn aReturn,
                                               VariableEntity aSource,
                                               VariableEntity aTarget,
                                               Suite aSuite,
                                               java.lang.Object aValue)
        Description copied from class: TestRunnerCallback
        Called when a return variable value from a suite is assigned to the respective local variable in the calling suite.
        Specified by:
        onReturnVariableAssignment in class TestRunnerCallback
        Parameters:
        aReturn - the return variable object
        aSource - the source variable entity
        aTarget - the target variable entity
        aSuite - the suite invocation for which the assignment is done
        aValue - the value to be assigned
      • onTimeSetStart

        public void onTimeSetStart​(TimeSet aTimeSet,
                                   SuiteDefinition aSuite,
                                   java.util.List<ForkDefinition> someForks)
        Description copied from class: TestRunnerCallback
        Called when the test time will be set.
        Specified by:
        onTimeSetStart in class TestRunnerCallback
        Parameters:
        aTimeSet - the time to be set
        aSuite - the suite in which the time was set
        someForks - the forks on which the time was set (the null element in the list means the master process)
      • createConversionContext

        protected ConversionContext createConversionContext()
        Determines the way unresolvable variables are to be handled.
        Returns:
      • addMethodAndParamsToTestOrCall

        protected SetListEntry[] addMethodAndParamsToTestOrCall​(MethodReference aMethod,
                                                                org.eclipse.emf.common.util.EList<Parameter> aParamList,
                                                                SetListEntry anEntry,
                                                                SuiteStatementWithResult aStatement)
        Adds information about the fixture method being called and the parameters given to it to a test or call entry.
        Parameters:
        aMethod - the fixture method
        aParamList - the parameters
        anEntry - the entry to add the information to
        aStatement - the statement currently in execution
        Returns:
        the setlist entries created for the parameters
      • sendUpdateToClients

        protected void sendUpdateToClients​(java.lang.Integer anEntryInExecution,
                                           SetListEntry... someUpdatedEntries)
        Sends a setlist entry update to all clients of the remoting server.
        Parameters:
        anEntryInExecution - the entry that is currently in execution (may be null if that information shouldn't be included)
        someUpdatedEntries - the actual updated entries
      • sendUpdateToClients

        protected void sendUpdateToClients​(java.lang.Integer anEntryInExecution,
                                           SetListEntry aSingleEntry,
                                           SetListEntry[] someMoreEntries)
        Sends a setlist entry update to all clients of the remoting server. This is a convenience method and behaves much like sendUpdateToClients(Integer, SetListEntry...).
        Parameters:
        anEntryInExecution - the entry that is currently in execution (may be null if that information shouldn't be included)
        aSingleEntry - one single updated entry
        someMoreEntries - more updated entries
      • sendUpdateToClients

        protected void sendUpdateToClients​(java.lang.Integer anEntryInExecution,
                                           SetListEntry[] someEntries,
                                           SetListEntry... someSingleEntries)
        Sends a setlist entry update to all clients of the remoting server. This is a convenience method and behaves much like sendUpdateToClients(Integer, SetListEntry...).
        Parameters:
        anEntryInExecution - the entry that is currently in execution (may be null if that information shouldn't be included)
        someEntries - some updated entries as an array
        someSingleEntries - more updated entries
      • stackTraceToString

        protected static java.lang.String stackTraceToString​(java.lang.Throwable anException)
        Utility method to convert a stack trace to a string to be included in a setlist entry.
        Parameters:
        anException - the exception from which to take the stack trace
        Returns:
        the formatted trace string
      • nanoTimeToString

        protected static java.lang.String nanoTimeToString​(long aNanosecondValue)
        Converts a nanosecond time value into a string according to the EXECUTION_TIME_FORMAT.
        Parameters:
        aNanosecondValue - the time value
        Returns:
        the formatted string
      • onMessageFromFork

        public void onMessageFromFork​(TestRunnerCallbackMethods aMethod,
                                      java.io.Serializable... someObjects)
        Description copied from class: TestRunnerCallback
        Called when a fork has sent a message to the masters' callback. In order to merge results determined by forks seamlessly into the masters' results, callbacks do automatically have a simple messaging system at their disposal. When a fork callback uses TestRunnerCallback.sendToMaster(TestRunnerCallbackMethods, Serializable...), this method is called on the masters' respective callback in order to deliver the objects given.
        Specified by:
        onMessageFromFork in class TestRunnerCallback
        Parameters:
        aMethod - the method that was called on the forks' callback (doesn't have to be used, evaluating this parameter is the job of the masters' callback and can thus be omitted if it ain't necessary)
        someObjects - the objects sent by the forks' callback
      • addLinkToEntry

        protected void addLinkToEntry​(SetListEntry anEntry,
                                      org.eclipse.emf.ecore.EObject anObject)
        Adds a link (to suite and line number) to the given SetListEntry.
        Parameters:
        anEntry - the entry to add the link to
        anObject - the object to link to
      • addExtendedResultDataToEntry

        protected void addExtendedResultDataToEntry​(SetListEntry anEntry,
                                                    FixtureExecutionResult aResult)
        Adds the extended result data in the FixtureExecutionResult object to the provided SetListEntry. If there's no extended results, this method does nothing.
        Parameters:
        anEntry - the entry to attach results to
        aResult - the result to explore
      • addFixtureLogDataToEntry

        protected void addFixtureLogDataToEntry​(SetListEntry anEntry)
        Adds the fixture log data in the FixtureExecutionResult object to the provided SetListEntry. If there's no fixture log output, this method does nothing.
        Parameters:
        anEntry - the entry to attach log data to
      • getInvocationCountCalls

        public int getInvocationCountCalls()
      • getInvocationCountSuites

        public int getInvocationCountSuites()
      • getInvocationCountTableTestRows

        public int getInvocationCountTableTestRows()
      • getInvocationCountTableTests

        public int getInvocationCountTableTests()
      • getInvocationCountTests

        public int getInvocationCountTests()