Package de.gebit.integrity.runner

## Class DefaultTestRunner

- java.lang.Object
- - de.gebit.integrity.runner.DefaultTestRunner

- All Implemented Interfaces:
    `TestRunner`

      public class DefaultTestRunner
      extends Object
      implements TestRunner

  The test runner executes tests. This class is the core of the Integrity runtime system.
  Author:
    Rene Schneider - initial API and implementation

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `protected static class` | `DefaultTestRunner.Phase` | Test execution is splitted in phases.
    `protected class` | `DefaultTestRunner.RemotingListener` | The listener used to respond on actions triggered by remoting clients.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected ExceptionWrapper` | `abortExecutionCause` | In case of an `AbortExecutionException` aborting the test execution, this exception is stored here (actually, only the message and stack trace string are stored - this is because the data could just as well come from a fork, in which case an exception can not be transported over the remoting connection).
    `protected Set<Integer>` | `breakpoints` | All enabled breakpoints.
    `protected TestRunnerCallback` | `callback` | The callback provided by the creator of the `TestRunner`.
    `protected static int` | `CHILD_PROCESS_KILL_TIMEOUT_DEFAULT` | The default time to wait for child processes to be killed.
    `protected static String` | `CHILD_PROCESS_KILL_TIMEOUT_PROPERTY` | The system property that allows to override the single connect timeout used when connecting to forks.
    `protected IntegrityClassLoader` | `classLoader` | The classloader.
    `protected String[]` | `commandLineArguments` | The original command line arguments, as given to the test runner by the test runner creator.
    `protected Queue<org.eclipse.xtext.util.Pair<String,​Runnable>>` | `constantAndVariableDefinitionDelayedCallbackInvocations` | This list is used to collect invocations to callbacks during a parallel constant/variable definition phase.
    `protected com.google.inject.Provider<ConversionContext>` | `conversionContextProvider` | The conversion context provider.
    `protected TestRunnerCallback` | `currentCallback` | The currently used callback, that is, the callback that gets directly called during execution.
    `protected DefaultTestRunner.Phase` | `currentPhase` | The current execution phase.
    `protected Set<ForkDefinition>` | `diedForks` | Collects all forks that have died.
    `protected Semaphore` | `executionWaiter` | A semaphore used for single-stepping tests.
    `protected static int` | `FORK_CONNECT_DELAY` | The delay until connection attempts are made to a newly started fork.
    `protected static int` | `FORK_CONNECTION_TIMEOUT_DEFAULT` | The default fork connection timeout, in seconds.
    `protected static String` | `FORK_CONNECTION_TIMEOUT_PROPERTY` | The system property that allows to override the timeout used when connecting to forks.
    `protected static int` | `FORK_PAUSE_WAIT_INTERVAL` | The interval in which the forks' execution state is checked on first connect.
    `protected static int` | `FORK_SINGLE_CONNECT_TIMEOUT_DEFAULT` | The timeout in milliseconds used for a single connection attempt to a fork.
    `protected static String` | `FORK_SINGLE_CONNECT_TIMEOUT_PROPERTY` | The system property that allows to override the single connect timeout used when connecting to forks.
    `protected static int` | `FORK_STARTUP_RETRYCOUNT_DEFAULT` | The default number of retries when starting forks.
    `protected static String` | `FORK_STARTUP_RETRYCOUNT_PROPERTY` | The system property that allows to override the number of retries to attempt when starting forked processes.
    `protected static int` | `FORK_WAIT_UNTIL_READY_TIMEOUT_DEFAULT` | The default time to wait for a fork to become ready for execution.
    `protected static String` | `FORK_WAIT_UNTIL_READY_TIMEOUT_PROPERTY` | The system property that allows to override the time to wait for a fork to become ready for execution.
    `protected ForkDefinition` | `forkInExecution` | The fork that is currently being executed.
    `protected Map<ForkDefinition,​Fork>` | `forkMap` | Maps fork definitions to actual fork instances.
    `protected Map<ForkDefinition,​TimeSyncState>` | `forkTimeSyncStates` | Maps forks to their (intended) timesync states.
    `protected com.google.inject.Injector` | `injector` | The Guice injector.
    `protected boolean` | `isTimesetTracingEnabled` | Whether timeset tracing is enabled.
    `protected ClassLoader` | `javaClassLoader` | The classloader used to load model-related classes.
    `protected Map<ForkDefinition,​Integer>` | `lastSuiteForFork` | Maps each `ForkDefinition` to the suite call and a number that counts any suite invocations.
    `protected TestModel` | `model` | The test model being executed.
    `protected ModelChecker` | `modelChecker` | The model checker is used to validate the test model prior to execution.
    `protected ModelSourceExplorer` | `modelSourceExplorer` | The model source explorer.
    `protected static String` | `MY_FORK_NAME` | If this JVM instance is executing a fork, the name is stored here.
    `protected int` | `numberOfSuiteInvocationsLeftOnThisFork` | This counts the number of suite invocations ttill to be done on this fork.
    `protected Map<String,​String>` | `parameterizedConstantValues` | This maps fully qualified constant names to parameter values.
    `protected ParameterResolver` | `parameterResolver` | The parameter resolver.
    `protected TestRunnerPerformanceLogger` | `performanceLogger` | The performance logger.
    `protected ProcessTerminator` | `processTerminator` | The process watchdog, used to govern other processes started by the test runner.
    `protected DefaultTestRunner.RemotingListener` | `remotingListener` | The remoting listener, which allows the remoting server to influence test execution.
    `protected IntegrityRemotingServer` | `remotingServer` | The remoting server.
    `protected ResultComparator` | `resultComparator` | The result comparator to use.
    `protected SetList` | `setList` | The current setlist.
    `protected SetListCallback` | `setListCallback` | The setlist callback (used to create/update the setlist).
    `protected Object` | `setListWaiter` | A waiter object used by remoting while waiting for the setlist to be created.
    `protected Map<ForkDefinition,​Set<SuiteDefinition>>` | `setupSuitesExecuted` | The setup suites that have been executed.
    `protected boolean` | `shallWaitBeforeNextStep` | Whether the test runner shall pause before executing the next step.
    `protected Set<SuiteDefinition>` | `singleRunSuitesExecuted` | The single-run suites that have already been executed.
    `protected TestFormatter` | `testFormatter` | The test formatter.
    `protected TestTimeAdapter` | `testTimeAdapter` | The test time adapter.
    `protected static String` | `TIMESET_TRACE_OUTPUT` | System property to enable writing timeset trace output.
    `protected TimeSyncResultMessage` | `timeSyncResult` | The result of a time sync request from this fork sent to a master is stored here.
    `protected Object` | `timeSyncResultSyncObject` | A sync object used to synchronize accesses to `timeSyncResult`.
    `protected Set<ForkDefinition>` | `touchedForks` | Collects forks that are being used in the current test run.
    `protected ValueConverter` | `valueConverter` | The value converter.
    `protected VariableManager` | `variableManager` | The variable manager, which keeps track of the variable values (local and global).
    `protected VariantDefinition` | `variantInExecution` | The currently executed test variant.
    `protected WrapperFactory` | `wrapperFactory` | The wrapper factory.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultTestRunner()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected int` | `calculateMasterTimeSyncTimeout​(int aNumberOfForks)` | Returns the timeout in seconds for timesync requests originating from this fork, sent to the master and distributed to a variable number of forks for execution.
    `protected List<SuiteSummaryResult>` | `callSuite​(Suite aSuiteCall)` | Performs a specified suite call.
    `protected SuiteSummaryResult` | `callSuiteSingle​(Suite aSuiteCall)` | Performs a specified suite call (doesn't honor the multiplier!).
    `protected boolean` | `checkForAbortion()` | Checks whether a situation demanding for a quick test run abortion has occurred.
    `protected void` | `checkForValidationError​(org.eclipse.emf.ecore.EObject anObject)` | Checks and ensures that the specified object has no validation errors.
    `protected void` | `createBreakpoint​(int anEntryReference)` | Creates a new breapoint.
    `protected Fork` | `createFork​(Suite aSuiteCall)` | Creates a new fork instance.
    `protected void` | `defineConstant​(ConstantDefinition aDefinition, SuiteDefinition aSuite)` | Defines a constant.
    `protected void` | `defineConstant​(ConstantDefinition aDefinition, Object aValue, SuiteDefinition aSuite)` | Defines a constant.
    `protected void` | `defineVariable​(VariableDefinition aDefinition, SuiteDefinition aSuite)` | Defines a variable.
    `protected void` | `defineVariable​(VariableOrConstantEntity anEntity, Object anInitialValue, SuiteDefinition aSuite)` | Defines a variable.
    `protected TimeSyncResultMessage` | `distributeTimeSyncRequest​(Date aStartTime, List<org.eclipse.xtext.util.Pair<Long,​TemporalUnit>> aDiffTime, BigDecimal aProgressionFactor, String[] someTargetedForks)` | This will be called when a master process either receives a time sync message from one of its forks and has to redistribute it to all the forks that this time sync is intended for, or when a master process encounters a time sync command by itself.
    `protected void` | `distributeTimeSyncRequestAsync​(Date aStartTime, List<org.eclipse.xtext.util.Pair<Long,​TemporalUnit>> aDiffTime, BigDecimal aProgressionFactor, String[] someTargetedForks, Fork aResultTarget)` | Like `#distributeTimeSyncRequest(Date, BigDecimal, String[])`, but performs the work in an asynchronous thread, so it returns instantly.
    `protected List<CallResult>` | `executeCall​(Call aCall)` | Executes a call.
    `protected CallResult` | `executeCallSingle​(Call aCall)` | Executes a call (a single time, doesn't honor the multiplier).
    `protected List<SuiteDefinition>` | `executeSetupSuites​(SuiteDefinition aSuite, Map<SuiteDefinition,​Result> aSetupResultMap)` | Executes the provided suite as a setup suite.
    `protected Map<SuiteStatementWithResult,​List<? extends Result>>` | `executeSuite​(SuiteDefinition aSuite)` | Executes a suite.
    `protected TestResult` | `executeTableTest​(TableTest aTest)` | Executes a table test.
    `protected void` | `executeTearDownSuites​(List<SuiteDefinition> aSetupSuitesList, Map<SuiteDefinition,​Result> aTearDownResultMap)` | Executes the teardown suites required by the provided setup suites.
    `protected TestResult` | `executeTest​(Test aTest)` | Executes a test (doesn't pay attention to the multiplier).
    `protected Result` | `executeTimeSet​(TimeSet aTimeSet)` | Executes a time setting operation.
    `protected void` | `executeVariableAssignment​(VariableAssignment anAssignment, SuiteDefinition aSuite)` | Executes variable assignments.
    `protected int` | `getChildProcessKillTimeout()` |
    `protected int` | `getChildProcessKillTimeoutDefault()` |
    `protected Class<?>` | `getClassForJvmType​(org.eclipse.xtext.common.types.JvmType aType)` | Loads a class by resolving a given `JvmType`.
    `protected int` | `getForkConnectDelay()` | The delay until connection attempts are made to a newly started fork.
    `protected int` | `getForkConnectionTimeout()` | The fork connection timeout, in seconds.
    `protected int` | `getForkConnectionTimeoutDefault()` | The default fork connection timeout, in seconds.
    `protected int` | `getForkPauseWaitInterval()` | The interval in which the forks' execution state is checked on first connect.
    `protected int` | `getForkSingleConnectTimeout()` | The timeout in milliseconds used for a single connection attempt to a fork.
    `protected int` | `getForkSingleConnectTimeoutDefault()` | Default for the timeout in milliseconds used for a single connection attempt to a fork.
    `protected int` | `getForkStartupRetryCount()` | The number of retries when starting forks.
    `protected int` | `getForkStartupRetryCountDefault()` | The default number of retries when starting forks.
    `protected int` | `getForkWaitUntilReadyTimeout()` | Returns the time to wait for a fork to become ready for execution.
    `protected int` | `getForkWaitUntilReadyTimeoutDefault()` | Returns the default time to wait for a fork to become ready for execution.
    `protected void` | `handlePossibleAbortException​(Throwable anException)` | If the exception provided is an `AbortExecutionException`, this method performs the necessary steps to enter "abort" mode locally.
    `void` | `initialize​(TestModel aModel, Map<String,​String> someParameterizedConstants, TestRunnerCallback aCallback, String aResultLocale, Integer aRemotingPort, String aRemotingBindHost, Long aRandomSeed, String[] someCommandLineArguments)` | Initializes a fresh test runner instance.
    `protected void` | `initializeParameterizedConstants()` | Initializes the parameterized constants from the `parameterizedConstantValues` map.
    `static boolean` | `isFork()` | Determines whether this JVM is a forked JVM from a master Integrity process.
    `protected void` | `pauseIfRequiredByRemoteClient​(boolean aForkSyncFlag)` | Pauses execution (blocks the method call) if the remoting client requested to do so via execution control or breakpoints.
    `protected void` | `performRemotingBinding​(Integer aRemotingPort, String aRemotingBindHost)` | Performs the remoting port binding.
    `protected void` | `removeBreakpoint​(int anEntryReference)` | Removes a specific breakpoint.
    `protected void` | `reset()` | Resets the internal variable state.
    `protected void` | `resetWaitBeforeNextStep()` | Resets a scheduled interruption (see `scheduleWaitBeforeNextStep()`).
    `protected Object` | `resolveConstantValue​(ConstantValue aConstantValue)` | Resolves a constant value (either it's a static value anyway, or it's a constant which needs to be resolved).
    `SuiteSummaryResult` | `run​(SuiteDefinition aRootSuite, VariantDefinition aVariant, boolean aBlockForRemotingFlag)` | Executes a specified suite.
    `protected SuiteSummaryResult` | `run​(Suite aRootSuiteCall, VariantDefinition aVariant, boolean aBlockForRemotingFlag)` | Executes a specific suite call.
    `protected SuiteSummaryResult` | `runInternal​(Suite aRootSuiteCall)` | Actually executes a root suite call.
    `protected void` | `scheduleWaitBeforeNextStep()` | Schedules a "wait for the master" before the next execution step.
    `protected TimeSyncResultMessage` | `setTestTimeGuarded​(long aRealtimeOffset, long aRealtimeDecouplingTime, double aProgressionFactor)` | Performs a guarded call to the `TestTimeAdapter`.
    `protected void` | `setVariableValue​(VariableOrConstantEntity anEntity, Object aValue, boolean aDoSendUpdateFlag)` | Sets the value of a variable.
    `protected void` | `setVariableValue​(String aQualifiedVariableName, Object aValue, boolean aDoSendUpdateFlag)` | Updates a variables' value.
    `protected void` | `setVariableValueConverted​(VariableOrConstantEntity anEntity, ValueOrEnumValueOrOperationCollection aValue, boolean aDoSendUpdateFlag)` | Sets the value of a variable.
    `protected boolean` | `shouldExecuteFixtures()` | Determines whether we should actually execute fixture method calls at the moment.
    `void` | `shutdown​(boolean anEmptyRemotingOutputQueueFlag)` | Shuts down this test runner instance.
    `protected void` | `timesetTraceLog​(String anAction, String aLogMessage)` | Outputs a timeset trace log.
    `protected void` | `timesetTraceLog​(String anAction, String aLogMessage, Date aStartDate, List<org.eclipse.xtext.util.Pair<Long,​TemporalUnit>> aDiffTime, BigDecimal aProgressionFactor, String[] someTargetedForks)` | Outputs a timeset trace log.
    `protected void` | `undefineVariable​(VariableOrConstantEntity anEntity)` | Undefines a variable (= clears its value, which is NOT exactly the same as setting it to null).
    `protected void` | `unsetVariableValue​(VariableOrConstantEntity anEntity, boolean aDoSendUpdateFlag)` | Unsets the value of a variable.
    `protected void` | `unsetVariableValue​(String aQualifiedVariableName, boolean aDoSendUpdateFlag)` | Unsets a variables' value.
    `protected void` | `waitForContinue​(boolean aForkSyncFlag)` | Pause execution (blocks method call) until continuation is triggered by remoting.
    `protected void` | `waitForSetListInjection()` | If this is a fork, we now need to wait for the setlist and test scripts to be injected by the master! Otherwise this method returns immediately.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### model

          protected TestModel model

      The test model being executed.

    - #### setList

          protected SetList setList

      The current setlist.

    - #### setListWaiter

          protected Object setListWaiter

      A waiter object used by remoting while waiting for the setlist to be created.

    - #### executionWaiter

          protected Semaphore executionWaiter

      A semaphore used for single-stepping tests.

    - #### shallWaitBeforeNextStep

          protected boolean shallWaitBeforeNextStep

      Whether the test runner shall pause before executing the next step.

    - #### breakpoints

          protected Set<Integer> breakpoints

      All enabled breakpoints.

    - #### callback

          protected TestRunnerCallback callback

      The callback provided by the creator of the `TestRunner`.

    - #### setListCallback

          protected SetListCallback setListCallback

      The setlist callback (used to create/update the setlist).

    - #### currentCallback

          protected TestRunnerCallback currentCallback

      The currently used callback, that is, the callback that gets directly called during execution.

    - #### currentPhase

          protected DefaultTestRunner.Phase currentPhase

      The current execution phase.

    - #### variableManager

          @Inject
          protected VariableManager variableManager

      The variable manager, which keeps track of the variable values (local and global).

    - #### valueConverter

          @Inject
          protected ValueConverter valueConverter

      The value converter.

    - #### parameterResolver

          @Inject
          protected ParameterResolver parameterResolver

      The parameter resolver.

    - #### wrapperFactory

          @Inject
          protected WrapperFactory wrapperFactory

      The wrapper factory.

    - #### resultComparator

          @Inject
          protected ResultComparator resultComparator

      The result comparator to use.

    - #### processTerminator

          @Inject
          protected ProcessTerminator processTerminator

      The process watchdog, used to govern other processes started by the test runner.

    - #### injector

          @Inject
          protected com.google.inject.Injector injector

      The Guice injector.

    - #### modelSourceExplorer

          @Inject
          protected ModelSourceExplorer modelSourceExplorer

      The model source explorer.

    - #### conversionContextProvider

          @Inject
          protected com.google.inject.Provider<ConversionContext> conversionContextProvider

      The conversion context provider.

    - #### testFormatter

          @Inject
          protected TestFormatter testFormatter

      The test formatter.

    - #### performanceLogger

          @Inject
          protected TestRunnerPerformanceLogger performanceLogger

      The performance logger.

    - #### testTimeAdapter

          @Inject
          protected TestTimeAdapter testTimeAdapter

      The test time adapter.

    - #### remotingServer

          protected IntegrityRemotingServer remotingServer

      The remoting server.

    - #### remotingListener

          protected DefaultTestRunner.RemotingListener remotingListener

      The remoting listener, which allows the remoting server to influence test execution.

    - #### forkMap

          protected Map<ForkDefinition,​Fork> forkMap

      Maps fork definitions to actual fork instances.

    - #### diedForks

          protected Set<ForkDefinition> diedForks

      Collects all forks that have died. If forks die after they have executed their last statement, this is perfectly fine, but if forks die earlier, this set is used to detect that erroneous situation.

    - #### touchedForks

          protected Set<ForkDefinition> touchedForks

      Collects forks that are being used in the current test run. This is filled during dry run execution and is ONLY USABLE ON MASTER.

    - #### forkTimeSyncStates

          protected Map<ForkDefinition,​TimeSyncState> forkTimeSyncStates

      Maps forks to their (intended) timesync states.

    - #### commandLineArguments

          protected String[] commandLineArguments

      The original command line arguments, as given to the test runner by the test runner creator.

    - #### parameterizedConstantValues

          protected Map<String,​String> parameterizedConstantValues

      This maps fully qualified constant names to parameter values. Defined during initialization. This allows to define the values for "parameterized" constants.

    - #### modelChecker

          @Inject
          protected ModelChecker modelChecker

      The model checker is used to validate the test model prior to execution.

    - #### classLoader

          @Inject
          protected IntegrityClassLoader classLoader

      The classloader.

    - #### javaClassLoader

          @Inject
          protected ClassLoader javaClassLoader

      The classloader used to load model-related classes.

    - #### constantAndVariableDefinitionDelayedCallbackInvocations

          protected Queue<org.eclipse.xtext.util.Pair<String,​Runnable>> constantAndVariableDefinitionDelayedCallbackInvocations

      This list is used to collect invocations to callbacks during a parallel constant/variable definition phase. Callbacks are not expected to be thread-safe, so we need to synchronize those calls anyway, and we want to have them in deterministic order, so we have to sort them by the variable/constant name.
      The existence of this queue defines that all callback invocations should be delayed. If it does not exist, immediate invocation is necessary.

    - #### MY_FORK_NAME

          protected static final String MY_FORK_NAME

      If this JVM instance is executing a fork, the name is stored here.

    - #### FORK_STARTUP_RETRYCOUNT_PROPERTY

          protected static final String FORK_STARTUP_RETRYCOUNT_PROPERTY

      The system property that allows to override the number of retries to attempt when starting forked processes.
      See Also:
        Constant Field Values

    - #### FORK_STARTUP_RETRYCOUNT_DEFAULT

          protected static final int FORK_STARTUP_RETRYCOUNT_DEFAULT

      The default number of retries when starting forks. By default, use "fail fast" and abort test runs immediately.
      See Also:
        Constant Field Values

    - #### FORK_CONNECTION_TIMEOUT_PROPERTY

          protected static final String FORK_CONNECTION_TIMEOUT_PROPERTY

      The system property that allows to override the timeout used when connecting to forks.
      See Also:
        Constant Field Values

    - #### FORK_CONNECTION_TIMEOUT_DEFAULT

          protected static final int FORK_CONNECTION_TIMEOUT_DEFAULT

      The default fork connection timeout, in seconds.
      See Also:
        Constant Field Values

    - #### FORK_SINGLE_CONNECT_TIMEOUT_PROPERTY

          protected static final String FORK_SINGLE_CONNECT_TIMEOUT_PROPERTY

      The system property that allows to override the single connect timeout used when connecting to forks.
      See Also:
        Constant Field Values

    - #### FORK_SINGLE_CONNECT_TIMEOUT_DEFAULT

          protected static final int FORK_SINGLE_CONNECT_TIMEOUT_DEFAULT

      The timeout in milliseconds used for a single connection attempt to a fork. If this timeout is hit, but the total timeout for connecting is not yet over, another attempt is being started.
      See Also:
        Constant Field Values

    - #### FORK_CONNECT_DELAY

          protected static final int FORK_CONNECT_DELAY

      The delay until connection attempts are made to a newly started fork.
      See Also:
        Constant Field Values

    - #### FORK_PAUSE_WAIT_INTERVAL

          protected static final int FORK_PAUSE_WAIT_INTERVAL

      The interval in which the forks' execution state is checked on first connect.
      See Also:
        Constant Field Values

    - #### FORK_WAIT_UNTIL_READY_TIMEOUT_PROPERTY

          protected static final String FORK_WAIT_UNTIL_READY_TIMEOUT_PROPERTY

      The system property that allows to override the time to wait for a fork to become ready for execution.
      See Also:
        Constant Field Values

    - #### FORK_WAIT_UNTIL_READY_TIMEOUT_DEFAULT

          protected static final int FORK_WAIT_UNTIL_READY_TIMEOUT_DEFAULT

      The default time to wait for a fork to become ready for execution.

    - #### CHILD_PROCESS_KILL_TIMEOUT_PROPERTY

          protected static final String CHILD_PROCESS_KILL_TIMEOUT_PROPERTY

      The system property that allows to override the single connect timeout used when connecting to forks.
      See Also:
        Constant Field Values

    - #### CHILD_PROCESS_KILL_TIMEOUT_DEFAULT

          protected static final int CHILD_PROCESS_KILL_TIMEOUT_DEFAULT

      The default time to wait for child processes to be killed.
      See Also:
        Constant Field Values

    - #### forkInExecution

          protected ForkDefinition forkInExecution

      The fork that is currently being executed. This is set regardless of whether we are a fork ourselves and are currently executing our own stuff, or whether we are a master or different fork and skipping over a bunch of invocations due to them being executed by another fork.

    - #### variantInExecution

          protected VariantDefinition variantInExecution

      The currently executed test variant.

    - #### setupSuitesExecuted

          protected Map<ForkDefinition,​Set<SuiteDefinition>> setupSuitesExecuted

      The setup suites that have been executed.

    - #### singleRunSuitesExecuted

          protected Set<SuiteDefinition> singleRunSuitesExecuted

      The single-run suites that have already been executed.

    - #### abortExecutionCause

          protected ExceptionWrapper abortExecutionCause

      In case of an `AbortExecutionException` aborting the test execution, this exception is stored here (actually, only the message and stack trace string are stored - this is because the data could just as well come from a fork, in which case an exception can not be transported over the remoting connection).

    - #### lastSuiteForFork

          protected Map<ForkDefinition,​Integer> lastSuiteForFork

      Maps each `ForkDefinition` to the suite call and a number that counts any suite invocations. The fork should die after this number of suites has executed. Since suite invocation numbers are predeterminable in the dry run and deterministic, this can be used to find out whether a suite during the test run has been the last one to run on a particular fork. During this real test run, the counter is decremented on each suite invocation on a fork, so in the end, we know when the fork has finished execution (= counter reaches zero).
      This map is only used by the master to keep track of when the forks should die. It will then wait until they do. The forks still carry the responsibility to terminate their execution in a clean way!

    - #### numberOfSuiteInvocationsLeftOnThisFork

          protected int numberOfSuiteInvocationsLeftOnThisFork

      This counts the number of suite invocations ttill to be done on this fork. Is only used if this test runner is indeed a fork (otherwise this value has no meaning). Is somewhat related to `lastSuiteForFork` in that this is the individual number of invocations on a fork that is left; it is initially seeded with the corresponding `lastSuiteForFork` value from the master process and then counted down to know when a fork can take the quick path to termination. Basically this is an optimization to allow for quicker termination on forks that would otherwise have a huge bunch of test scripts to run through in dry mode when they're finished.

    - #### timeSyncResult

          protected TimeSyncResultMessage timeSyncResult

      The result of a time sync request from this fork sent to a master is stored here.

    - #### timeSyncResultSyncObject

          protected final Object timeSyncResultSyncObject

      A sync object used to synchronize accesses to `timeSyncResult`.

    - #### TIMESET_TRACE_OUTPUT

          protected static final String TIMESET_TRACE_OUTPUT

      System property to enable writing timeset trace output.
      See Also:
        Constant Field Values

    - #### isTimesetTracingEnabled

          protected boolean isTimesetTracingEnabled

      Whether timeset tracing is enabled.

  - ### Constructor Detail

    - #### DefaultTestRunner

          public DefaultTestRunner()

  - ### Method Detail

    - #### getForkStartupRetryCount

          protected int getForkStartupRetryCount()

      The number of retries when starting forks.

    - #### getForkStartupRetryCountDefault

          protected int getForkStartupRetryCountDefault()

      The default number of retries when starting forks.

    - #### getForkConnectionTimeout

          protected int getForkConnectionTimeout()

      The fork connection timeout, in seconds.

    - #### getForkConnectionTimeoutDefault

          protected int getForkConnectionTimeoutDefault()

      The default fork connection timeout, in seconds.

    - #### getForkSingleConnectTimeout

          protected int getForkSingleConnectTimeout()

      The timeout in milliseconds used for a single connection attempt to a fork. If this timeout is hit, but the total timeout for connecting is not yet over, another attempt is being started.

    - #### getForkSingleConnectTimeoutDefault

          protected int getForkSingleConnectTimeoutDefault()

      Default for the timeout in milliseconds used for a single connection attempt to a fork. If this timeout is hit, but the total timeout for connecting is not yet over, another attempt is being started.

    - #### getForkConnectDelay

          protected int getForkConnectDelay()

      The delay until connection attempts are made to a newly started fork.

    - #### getForkPauseWaitInterval

          protected int getForkPauseWaitInterval()

      The interval in which the forks' execution state is checked on first connect.

    - #### getForkWaitUntilReadyTimeout

          protected int getForkWaitUntilReadyTimeout()

      Returns the time to wait for a fork to become ready for execution.

    - #### getForkWaitUntilReadyTimeoutDefault

          protected int getForkWaitUntilReadyTimeoutDefault()

      Returns the default time to wait for a fork to become ready for execution.

    - #### getChildProcessKillTimeout

          protected int getChildProcessKillTimeout()

    - #### getChildProcessKillTimeoutDefault

          protected int getChildProcessKillTimeoutDefault()

    - #### calculateMasterTimeSyncTimeout

          protected int calculateMasterTimeSyncTimeout​(int aNumberOfForks)

      Returns the timeout in seconds for timesync requests originating from this fork, sent to the master and distributed to a variable number of forks for execution.
      Parameters:
        `aNumberOfForks` - the number of forks involved in this timesync
      Returns:
        a timeout in seconds

    - #### initialize

          public void initialize​(TestModel aModel,
                                 Map<String,​String> someParameterizedConstants,
                                 TestRunnerCallback aCallback,
                                 String aResultLocale,
                                 Integer aRemotingPort,
                                 String aRemotingBindHost,
                                 Long aRandomSeed,
                                 String[] someCommandLineArguments)
                          throws IOException

      Description copied from interface: `TestRunner`
      Initializes a fresh test runner instance. In case of forks, this method guarantees that when it exits without an exception, the master has successfully connected and injected the test scripts and a setlist into it.
      Specified by:
        `initialize` in interface `TestRunner`
      Parameters:
        `aModel` - the model to execute (may not contain any test script data yet in case of forks!)
        `someParameterizedConstants` - Maps fully qualified constant names (must be those with the "parameterized" keyword) to their desired value. This way, test execution can be parameterized from outside.
        `aCallback` - the callback to use to report test results
        `aResultLocale` - the locale to be used for the test result generation (if not provided, use the non-localized default strings, which usually are in English)
        `aRemotingPort` - the port on which the remoting server should listen, or null if remoting should be disabled
        `aRemotingBindHost` - the host name (or IP) to which the remoting server should bind
        `aRandomSeed` - the seed for the `RandomNumberOperation` (optional; randomly determined if not given).
        `someCommandLineArguments` - all command line arguments as given to the original Java programs' main routine (required for forking!)
      Throws:
        `IOException` - if the remoting server startup fails, or if the connection from the master process does not complete in time (for forks only)

    - #### performRemotingBinding

          protected void performRemotingBinding​(Integer aRemotingPort,
                                                String aRemotingBindHost)
                                         throws IOException

      Performs the remoting port binding.
      Parameters:
        `aRemotingPort` - the port to bind to, or null if no remoting is desired
        `aRemotingBindHost` - the host/IP to bind to
      Throws:
        `IOException`

    - #### waitForSetListInjection

          protected void waitForSetListInjection()
                                          throws IOException

      If this is a fork, we now need to wait for the setlist and test scripts to be injected by the master! Otherwise this method returns immediately.
      Throws:
        `IOException`

    - #### shutdown

          public void shutdown​(boolean anEmptyRemotingOutputQueueFlag)

      Shuts down this test runner instance.
      Specified by:
        `shutdown` in interface `TestRunner`
      Parameters:
        `anEmptyRemotingOutputQueueFlag` - true if the remoting server shall be given time to send all remaining messages to clients while closing connections

    - #### run

          public SuiteSummaryResult run​(SuiteDefinition aRootSuite,
                                        VariantDefinition aVariant,
                                        boolean aBlockForRemotingFlag)

      Description copied from interface: `TestRunner`
      Executes a specified suite. Designated starting point for test execution.
      Specified by:
        `run` in interface `TestRunner`
      Parameters:
        `aRootSuite` - the suite to execute
        `aBlockForRemotingFlag` - whether execution should pause before actually starting until execution is resumed via remoting
      Returns:
        the suite execution result (this may also be null in case there is no tangible "result", like when the test runner is actually just running the part of a single fork within a bigger test suite - the partial result in this case is not relevant, but is automatically integrated in the result of the master process)

    - #### run

          protected SuiteSummaryResult run​(Suite aRootSuiteCall,
                                           VariantDefinition aVariant,
                                           boolean aBlockForRemotingFlag)

      Executes a specific suite call. Internal starting point for test execution.
      Parameters:
        `aRootSuiteCall` - the suite call to execute
        `aBlockForRemotingFlag` - whether execution should pause before actually starting until execution is resumed via remoting
      Returns:
        the suite execution result

    - #### handlePossibleAbortException

          protected void handlePossibleAbortException​(Throwable anException)

      If the exception provided is an `AbortExecutionException`, this method performs the necessary steps to enter "abort" mode locally.
      Parameters:
        `anException` -

    - #### checkForAbortion

          protected boolean checkForAbortion()

      Checks whether a situation demanding for a quick test run abortion has occurred. This is true if either an `AbortExecutionException` has been thrown (locally or by a fork) or if we are a fork and our last suite has executed. This method does NOT only check something, but also ensures that the `setListCallback` is also removed from the current callback hierarchy - a very important step, since after this method has returned true for the first time, a different execution path than normally is expected, which would cause the set list callback to throw an inconsistency exception.
      Returns:
        true if the test execution shall take the quick path to an end

    - #### initializeParameterizedConstants

          protected void initializeParameterizedConstants()

      Initializes the parameterized constants from the `parameterizedConstantValues` map.

    - #### reset

          protected void reset()

      Resets the internal variable state.

    - #### runInternal

          protected SuiteSummaryResult runInternal​(Suite aRootSuiteCall)

      Actually executes a root suite call.
      Parameters:
        `aRootSuiteCall` - the suite call to execute
      Returns:
        the result

    - #### callSuite

          protected List<SuiteSummaryResult> callSuite​(Suite aSuiteCall)

      Performs a specified suite call.
      Parameters:
        `aSuiteCall` - the suite call to execute
      Returns:
        the suite results (multiple if the suite has an execution multiplier)

    - #### callSuiteSingle

          protected SuiteSummaryResult callSuiteSingle​(Suite aSuiteCall)

      Performs a specified suite call (doesn't honor the multiplier!).
      Parameters:
        `aSuiteCall` - the suite call to execute
      Returns:
        the suite result

    - #### executeSetupSuites

          protected List<SuiteDefinition> executeSetupSuites​(SuiteDefinition aSuite,
                                                             Map<SuiteDefinition,​Result> aSetupResultMap)

      Executes the provided suite as a setup suite. This includes executing further nested setup suites (but not teardown suites, as those will intentionally be executed when the original suite which caused this setup suite to be executed has finished).
      Parameters:
        `aSuite` - the suite to be executed as setup suite
        `aSetupResultMap` - the map of setup results to add the result to
      Returns:
        a list of executed setup suites

    - #### executeTearDownSuites

          protected void executeTearDownSuites​(List<SuiteDefinition> aSetupSuitesList,
                                               Map<SuiteDefinition,​Result> aTearDownResultMap)

      Executes the teardown suites required by the provided setup suites.
      Parameters:
        `aSetupSuitesList` - the list of setup suites
        `aTearDownResultMap` - a map into which teardown suite execution results will be stored

    - #### executeSuite

          protected Map<SuiteStatementWithResult,​List<? extends Result>> executeSuite​(SuiteDefinition aSuite)

      Executes a suite.
      Parameters:
        `aSuite` - the suite to execute
      Returns:
        a map that maps statements to results

    - #### defineVariable

          protected void defineVariable​(VariableDefinition aDefinition,
                                        SuiteDefinition aSuite)

      Defines a variable.
      Parameters:
        `aDefinition` - the variable definition
        `aSuite` - the suite in which the variable is defined

    - #### defineConstant

          protected void defineConstant​(ConstantDefinition aDefinition,
                                        SuiteDefinition aSuite)
                                 throws ClassNotFoundException,
                                        InstantiationException,
                                        UnexecutableException

      Defines a constant.
      Parameters:
        `aDefinition` - the constant definition
        `aSuite` - the suite in which the constant is defined
      Throws:
        `InstantiationException`
        `ClassNotFoundException`
        `UnexecutableException`

    - #### defineConstant

          protected void defineConstant​(ConstantDefinition aDefinition,
                                        Object aValue,
                                        SuiteDefinition aSuite)
                                 throws ClassNotFoundException,
                                        InstantiationException,
                                        UnexecutableException

      Defines a constant.
      Parameters:
        `aDefinition` - the constant definition
        `aValue` - the value to define (if null, the value in the constant definition is used; this should only be set in case of parameterizable constants!)
        `aSuite` - the suite in which the constant is defined
      Throws:
        `InstantiationException`
        `ClassNotFoundException`
        `UnexecutableException`

    - #### defineVariable

          protected void defineVariable​(VariableOrConstantEntity anEntity,
                                        Object anInitialValue,
                                        SuiteDefinition aSuite)

      Defines a variable.
      Parameters:
        `anEntity` - the variable entity
        `anInitialValue` - the initial variable value, or null if the variable is not initialized
        `aSuite` - the suite in which the variable is defined

    - #### undefineVariable

          protected void undefineVariable​(VariableOrConstantEntity anEntity)

      Undefines a variable (= clears its value, which is NOT exactly the same as setting it to null).
      Parameters:
        `anEntity` - the variable entity

    - #### setVariableValueConverted

          protected void setVariableValueConverted​(VariableOrConstantEntity anEntity,
                                                   ValueOrEnumValueOrOperationCollection aValue,
                                                   boolean aDoSendUpdateFlag)
                                            throws InstantiationException,
                                                   ClassNotFoundException,
                                                   UnexecutableException

      Sets the value of a variable.
      Parameters:
        `anEntity` - the variable entity to update
        `aValue` - the new value (which will be converted to its default type before assigning it!)
        `aDoSendUpdateFlag` - whether this update should be sent to connected master/slaves
      Throws:
        `InstantiationException`
        `ClassNotFoundException`
        `UnexecutableException`

    - #### setVariableValue

          protected void setVariableValue​(VariableOrConstantEntity anEntity,
                                          Object aValue,
                                          boolean aDoSendUpdateFlag)

      Sets the value of a variable.
      Parameters:
        `anEntity` - the variable entity to update
        `aValue` - the new value
        `aDoSendUpdateFlag` - whether this update should be sent to connected master/slaves

    - #### setVariableValue

          protected void setVariableValue​(String aQualifiedVariableName,
                                          Object aValue,
                                          boolean aDoSendUpdateFlag)

      Updates a variables' value.
      Parameters:
        `aQualifiedVariableName` - the name of the variable to update
        `aValue` - the new value
        `aDoSendUpdateFlag` - whether this update should be sent to connected master/slaves

    - #### unsetVariableValue

          protected void unsetVariableValue​(VariableOrConstantEntity anEntity,
                                            boolean aDoSendUpdateFlag)

      Unsets the value of a variable.
      Parameters:
        `anEntity` - the variable entity to unset
        `aDoSendUpdateFlag` - whether this update should be sent to connected master/slaves

    - #### unsetVariableValue

          protected void unsetVariableValue​(String aQualifiedVariableName,
                                            boolean aDoSendUpdateFlag)

      Unsets a variables' value.
      Parameters:
        `aQualifiedVariableName` - the name of the variable to unset
        `aDoSendUpdateFlag` - whether this update should be sent to connected master/slaves

    - #### resolveConstantValue

          protected Object resolveConstantValue​(ConstantValue aConstantValue)

      Resolves a constant value (either it's a static value anyway, or it's a constant which needs to be resolved).
      Parameters:
        `aConstantValue` - the constant value
      Returns:
        the value

    - #### executeVariableAssignment

          protected void executeVariableAssignment​(VariableAssignment anAssignment,
                                                   SuiteDefinition aSuite)

      Executes variable assignments.
      Parameters:
        `anAssignment` - the assignment to execute
        `aSuite` - the suite that the assignment is in

    - #### executeTest

          protected TestResult executeTest​(Test aTest)

      Executes a test (doesn't pay attention to the multiplier).
      Parameters:
        `aTest` - the test to execute
      Returns:
        the result

    - #### executeTableTest

          protected TestResult executeTableTest​(TableTest aTest)

      Executes a table test.
      Parameters:
        `aTest` - the test to execute
      Returns:
        the result

    - #### getClassForJvmType

          protected Class<?> getClassForJvmType​(org.eclipse.xtext.common.types.JvmType aType)
                                         throws ClassNotFoundException

      Loads a class by resolving a given `JvmType`.
      Parameters:
        `aType` - the type to load
      Returns:
        the class
      Throws:
        `ClassNotFoundException`

    - #### executeCall

          protected List<CallResult> executeCall​(Call aCall)

      Executes a call.
      Parameters:
        `aCall` - the call to execute
      Returns:
        the results (multiple if the call has an execution multiplier)

    - #### executeCallSingle

          protected CallResult executeCallSingle​(Call aCall)

      Executes a call (a single time, doesn't honor the multiplier).
      Parameters:
        `aCall` - the call to execute
      Returns:
        the result

    - #### executeTimeSet

          protected Result executeTimeSet​(TimeSet aTimeSet)

      Executes a time setting operation.
      Parameters:
        `aTimeSet` - the timeset command

    - #### shouldExecuteFixtures

          protected boolean shouldExecuteFixtures()

      Determines whether we should actually execute fixture method calls at the moment.
      Returns:
        true if calls should be executed, false otherwise

    - #### pauseIfRequiredByRemoteClient

          protected void pauseIfRequiredByRemoteClient​(boolean aForkSyncFlag)

      Pauses execution (blocks the method call) if the remoting client requested to do so via execution control or breakpoints.
      Parameters:
        `aForkSyncFlag` - true if we are pausing for fork synchronization reasons

    - #### waitForContinue

          protected void waitForContinue​(boolean aForkSyncFlag)
                                  throws InterruptedException

      Pause execution (blocks method call) until continuation is triggered by remoting.
      Parameters:
        `aForkSyncFlag` - true if we are pausing for fork synchronization reasons
      Throws:
        `InterruptedException`

    - #### removeBreakpoint

          protected void removeBreakpoint​(int anEntryReference)

      Removes a specific breakpoint.
      Parameters:
        `anEntryReference` - the setlist entry reference at which the breakpoint is set

    - #### createBreakpoint

          protected void createBreakpoint​(int anEntryReference)

      Creates a new breapoint.
      Parameters:
        `anEntryReference` - the setlist entry reference at which the breakpoint will be created

    - #### distributeTimeSyncRequest

          protected TimeSyncResultMessage distributeTimeSyncRequest​(Date aStartTime,
                                                                    List<org.eclipse.xtext.util.Pair<Long,​TemporalUnit>> aDiffTime,
                                                                    BigDecimal aProgressionFactor,
                                                                    String[] someTargetedForks)

      This will be called when a master process either receives a time sync message from one of its forks and has to redistribute it to all the forks that this time sync is intended for, or when a master process encounters a time sync command by itself. In both cases it may have to execute it for itself. This method ONLY runs on the master! It calculates the actual internal state variables necessary for the test time proxies running in the individual fork processes and forwards those to the forks (and to the master itself), where these state variable values are then being used to call the `TestTimeAdapter`.
      The method is also responsible for collecting the responses about successful or failed timesyncs and for aggregating them into a result object. It blocks until this has finished (or a timeout has hit).
      Parameters:
        `aStartTime` - the time to set to (if null, use current system time)
        `aDiffTime` - the time difference in case of relative timesetting (if used, start time is ignored, because relative time setting always works with the previously-set fake test time as basis)
        `aProgressionFactor` -
        `someTargetedForks` -
      Returns:
        null if nothing went wrong, an exception wrapper containing all messages and all exceptions (textually merged) in case of (non-critical) errors

    - #### distributeTimeSyncRequestAsync

          protected void distributeTimeSyncRequestAsync​(Date aStartTime,
                                                        List<org.eclipse.xtext.util.Pair<Long,​TemporalUnit>> aDiffTime,
                                                        BigDecimal aProgressionFactor,
                                                        String[] someTargetedForks,
                                                        Fork aResultTarget)

      Like `#distributeTimeSyncRequest(Date, BigDecimal, String[])`, but performs the work in an asynchronous thread, so it returns instantly. The result of the operation is sent to the provided fork that shall receive it.
      Parameters:
        `aStartTime` -
        `aDiffTime` -
        `aProgressionFactor` -
        `someTargetedForks` -

    - #### setTestTimeGuarded

          protected TimeSyncResultMessage setTestTimeGuarded​(long aRealtimeOffset,
                                                             long aRealtimeDecouplingTime,
                                                             double aProgressionFactor)

      Performs a guarded call to the `TestTimeAdapter`. If the call runs into any exception, it will be caught and returned.
      Parameters:
        `aStartTime` -
        `aProgressionFactor` -
      Returns:
        null in case of success or an exception wrapper with errors in case of errors

    - #### isFork

          public static boolean isFork()

      Determines whether this JVM is a forked JVM from a master Integrity process.
      Returns:

    - #### createFork

          protected Fork createFork​(Suite aSuiteCall)
                             throws ForkException

      Creates a new fork instance. This starts up the forked JVM and connects to it for remote control.
      Parameters:
        `aSuiteCall` - the suite call that shall be run on the fork
      Returns:
        the new fork
      Throws:
        `ForkException` - if any problem arises during forking

    - #### scheduleWaitBeforeNextStep

          protected void scheduleWaitBeforeNextStep()

      Schedules a "wait for the master" before the next execution step.

    - #### resetWaitBeforeNextStep

          protected void resetWaitBeforeNextStep()

      Resets a scheduled interruption (see `scheduleWaitBeforeNextStep()`).

    - #### checkForValidationError

          protected void checkForValidationError​(org.eclipse.emf.ecore.EObject anObject)

      Checks and ensures that the specified object has no validation errors.
      Parameters:
        `anObject` - Object to be validated.

    - #### timesetTraceLog

          protected void timesetTraceLog​(String anAction,
                                         String aLogMessage,
                                         Date aStartDate,
                                         List<org.eclipse.xtext.util.Pair<Long,​TemporalUnit>> aDiffTime,
                                         BigDecimal aProgressionFactor,
                                         String[] someTargetedForks)

      Outputs a timeset trace log. Although this checks for `isTimesetTracingEnabled`, the caller may also check to save some cycles when generating expensive parameters.
      Parameters:
        `anAction` - the action
        `aLogMessage` - the message to log

    - #### timesetTraceLog

          protected void timesetTraceLog​(String anAction,
                                         String aLogMessage)

      Outputs a timeset trace log. Although this checks for `isTimesetTracingEnabled`, the caller may also check to save some cycles when generating expensive parameters.
      Parameters:
        `anAction` - the action
        `aLogMessage` - the message to log