Class DefaultTestRunner

  • All Implemented Interfaces:
    TestRunner

    public class DefaultTestRunner
    extends java.lang.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
    • Field Detail

      • model

        protected TestModel model
        The test model being executed.
      • setList

        protected SetList setList
        The current setlist.
      • setListWaiter

        protected java.lang.Object setListWaiter
        A waiter object used by remoting while waiting for the setlist to be created.
      • executionWaiter

        protected java.util.concurrent.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 java.util.Set<java.lang.Integer> breakpoints
        All enabled breakpoints.
      • 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.
      • 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.
      • testTimeAdapter

        @Inject
        protected TestTimeAdapter testTimeAdapter
        The test time adapter.
      • forkMap

        protected java.util.Map<ForkDefinition,​Fork> forkMap
        Maps fork definitions to actual fork instances.
      • diedForks

        protected java.util.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 java.util.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 java.util.Map<ForkDefinition,​TimeSyncState> forkTimeSyncStates
        Maps forks to their (intended) timesync states.
      • commandLineArguments

        protected java.lang.String[] commandLineArguments
        The original command line arguments, as given to the test runner by the test runner creator.
      • parameterizedConstantValues

        protected java.util.Map<java.lang.String,​java.lang.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.
      • javaClassLoader

        @Inject
        protected java.lang.ClassLoader javaClassLoader
        The classloader used to load model-related classes.
      • constantAndVariableDefinitionDelayedCallbackInvocations

        protected java.util.Queue<org.eclipse.xtext.util.Pair<java.lang.String,​java.lang.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 java.lang.String MY_FORK_NAME
        If this JVM instance is executing a fork, the name is stored here.
      • FORK_STARTUP_RETRYCOUNT_PROPERTY

        protected static final java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.util.Map<ForkDefinition,​java.util.Set<SuiteDefinition>> setupSuitesExecuted
        The setup suites that have been executed.
      • singleRunSuitesExecuted

        protected java.util.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 java.util.Map<ForkDefinition,​java.lang.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 java.lang.Object timeSyncResultSyncObject
        A sync object used to synchronize accesses to timeSyncResult.
      • TIMESET_TRACE_OUTPUT

        protected static final java.lang.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,
                               java.util.Map<java.lang.String,​java.lang.String> someParameterizedConstants,
                               TestRunnerCallback aCallback,
                               java.lang.String aResultLocale,
                               java.lang.Integer aRemotingPort,
                               java.lang.String aRemotingBindHost,
                               java.lang.Long aRandomSeed,
                               java.lang.String[] someCommandLineArguments)
                        throws java.io.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:
        java.io.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​(java.lang.Integer aRemotingPort,
                                              java.lang.String aRemotingBindHost)
                                       throws java.io.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:
        java.io.IOException
      • waitForSetListInjection

        protected void waitForSetListInjection()
                                        throws java.io.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:
        java.io.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​(java.lang.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 java.util.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 java.util.List<SuiteDefinition> executeSetupSuites​(SuiteDefinition aSuite,
                                                                     java.util.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​(java.util.List<SuiteDefinition> aSetupSuitesList,
                                             java.util.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 java.util.Map<SuiteStatementWithResult,​java.util.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 java.lang.ClassNotFoundException,
                                      java.lang.InstantiationException,
                                      UnexecutableException
        Defines a constant.
        Parameters:
        aDefinition - the constant definition
        aSuite - the suite in which the constant is defined
        Throws:
        java.lang.InstantiationException
        java.lang.ClassNotFoundException
        UnexecutableException
      • defineConstant

        protected void defineConstant​(ConstantDefinition aDefinition,
                                      java.lang.Object aValue,
                                      SuiteDefinition aSuite)
                               throws java.lang.ClassNotFoundException,
                                      java.lang.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:
        java.lang.InstantiationException
        java.lang.ClassNotFoundException
        UnexecutableException
      • defineVariable

        protected void defineVariable​(VariableOrConstantEntity anEntity,
                                      java.lang.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 java.lang.InstantiationException,
                                                 java.lang.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:
        java.lang.InstantiationException
        java.lang.ClassNotFoundException
        UnexecutableException
      • setVariableValue

        protected void setVariableValue​(VariableOrConstantEntity anEntity,
                                        java.lang.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​(java.lang.String aQualifiedVariableName,
                                        java.lang.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​(java.lang.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 java.lang.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 java.lang.Class<?> getClassForJvmType​(org.eclipse.xtext.common.types.JvmType aType)
                                                 throws java.lang.ClassNotFoundException
        Loads a class by resolving a given JvmType.
        Parameters:
        aType - the type to load
        Returns:
        the class
        Throws:
        java.lang.ClassNotFoundException
      • executeCall

        protected java.util.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 java.lang.InterruptedException
        Pause execution (blocks method call) until continuation is triggered by remoting.
        Parameters:
        aForkSyncFlag - true if we are pausing for fork synchronization reasons
        Throws:
        java.lang.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​(java.util.Date aStartTime,
                                                                  java.util.List<org.eclipse.xtext.util.Pair<java.lang.Long,​java.time.temporal.TemporalUnit>> aDiffTime,
                                                                  java.math.BigDecimal aProgressionFactor,
                                                                  java.lang.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​(java.util.Date aStartTime,
                                                      java.util.List<org.eclipse.xtext.util.Pair<java.lang.Long,​java.time.temporal.TemporalUnit>> aDiffTime,
                                                      java.math.BigDecimal aProgressionFactor,
                                                      java.lang.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.
      • 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​(java.lang.String anAction,
                                       java.lang.String aLogMessage,
                                       java.util.Date aStartDate,
                                       java.util.List<org.eclipse.xtext.util.Pair<java.lang.Long,​java.time.temporal.TemporalUnit>> aDiffTime,
                                       java.math.BigDecimal aProgressionFactor,
                                       java.lang.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​(java.lang.String anAction,
                                       java.lang.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