Package de.gebit.integrity.runner
Class DefaultTestRunner
java.lang.Object
de.gebit.integrity.runner.DefaultTestRunner
- All Implemented Interfaces:
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 ClassesModifier and TypeClassDescriptionprotected static enumTest execution is splitted in phases.protected classThe listener used to respond on actions triggered by remoting clients. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ExceptionWrapperIn case of anAbortExecutionExceptionaborting 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).All enabled breakpoints.protected TestRunnerCallbackThe callback provided by the creator of theTestRunner.protected static final intThe default time to wait for child processes to be killed.protected static final StringThe system property that allows to override the single connect timeout used when connecting to forks.protected IntegrityClassLoaderThe classloader.protected String[]The original command line arguments, as given to the test runner by the test runner creator.This list is used to collect invocations to callbacks during a parallel constant/variable definition phase.protected com.google.inject.Provider<ConversionContext> The conversion context provider.protected TestRunnerCallbackThe currently used callback, that is, the callback that gets directly called during execution.protected DefaultTestRunner.PhaseThe current execution phase.protected Set<ForkDefinition> Collects all forks that have died.protected SemaphoreA semaphore used for single-stepping tests.protected static final intThe delay until connection attempts are made to a newly started fork.protected static final intThe default fork connection timeout, in seconds.protected static final StringThe system property that allows to override the timeout used when connecting to forks.protected static final intThe interval in which the forks' execution state is checked on first connect.protected static final intThe timeout in milliseconds used for a single connection attempt to a fork.protected static final StringThe system property that allows to override the single connect timeout used when connecting to forks.protected static final intThe default number of retries when starting forks.protected static final StringThe system property that allows to override the number of retries to attempt when starting forked processes.protected static final intThe default time to wait for a fork to become ready for execution.protected static final StringThe system property that allows to override the time to wait for a fork to become ready for execution.protected ForkDefinitionThe fork that is currently being executed.protected Map<ForkDefinition, Fork> Maps fork definitions to actual fork instances.protected Map<ForkDefinition, TimeSyncState> Maps forks to their (intended) timesync states.protected com.google.inject.InjectorThe Guice injector.protected booleanWhether timeset tracing is enabled.protected ClassLoaderThe classloader used to load model-related classes.protected Map<ForkDefinition, Integer> Maps eachForkDefinitionto the suite call and a number that counts any suite invocations.protected TestModelThe test model being executed.protected ModelCheckerThe model checker is used to validate the test model prior to execution.protected ModelSourceExplorerThe model source explorer.protected static final StringIf this JVM instance is executing a fork, the name is stored here.protected intThis counts the number of suite invocations ttill to be done on this fork.This maps fully qualified constant names to parameter values.protected ParameterResolverThe parameter resolver.protected TestRunnerPerformanceLoggerThe performance logger.protected ProcessTerminatorThe process watchdog, used to govern other processes started by the test runner.protected DefaultTestRunner.RemotingListenerThe remoting listener, which allows the remoting server to influence test execution.protected IntegrityRemotingServerThe remoting server.protected ResultComparatorThe result comparator to use.protected SetListThe current setlist.protected SetListCallbackThe setlist callback (used to create/update the setlist).protected ObjectA waiter object used by remoting while waiting for the setlist to be created.protected Map<ForkDefinition, Set<SuiteDefinition>> The setup suites that have been executed.protected booleanWhether the test runner shall pause before executing the next step.protected Set<SuiteDefinition> The single-run suites that have already been executed.protected TestFormatterThe test formatter.protected TestTimeAdapterThe test time adapter.protected static final StringSystem property to enable writing timeset trace output.protected TimeSyncResultMessageThe result of a time sync request from this fork sent to a master is stored here.protected final ObjectA sync object used to synchronize accesses totimeSyncResult.protected Set<ForkDefinition> Collects forks that are being used in the current test run.protected ValueConverterThe value converter.protected VariableManagerThe variable manager, which keeps track of the variable values (local and global).protected VariantDefinitionThe currently executed test variant.protected WrapperFactoryThe wrapper factory. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intcalculateMasterTimeSyncTimeout(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> Performs a specified suite call.protected SuiteSummaryResultcallSuiteSingle(Suite aSuiteCall) Performs a specified suite call (doesn't honor the multiplier!).protected booleanChecks whether a situation demanding for a quick test run abortion has occurred.protected voidcheckForValidationError(org.eclipse.emf.ecore.EObject anObject) Checks and ensures that the specified object has no validation errors.protected voidcreateBreakpoint(int anEntryReference) Creates a new breapoint.protected ForkcreateFork(Suite aSuiteCall) Creates a new fork instance.protected voiddefineConstant(ConstantDefinition aDefinition, SuiteDefinition aSuite) Defines a constant.protected voiddefineConstant(ConstantDefinition aDefinition, Object aValue, SuiteDefinition aSuite) Defines a constant.protected voiddefineVariable(VariableDefinition aDefinition, SuiteDefinition aSuite) Defines a variable.protected voiddefineVariable(VariableOrConstantEntity anEntity, Object anInitialValue, SuiteDefinition aSuite) Defines a variable.protected TimeSyncResultMessagedistributeTimeSyncRequest(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 voiddistributeTimeSyncRequestAsync(Date aStartTime, List<org.eclipse.xtext.util.Pair<Long, TemporalUnit>> aDiffTime, BigDecimal aProgressionFactor, String[] someTargetedForks, Fork aResultTarget) Like, but performs the work in an asynchronous thread, so it returns instantly.invalid reference
#distributeTimeSyncRequest(Date, BigDecimal, String[])protected List<CallResult> executeCall(Call aCall) Executes a call.protected CallResultexecuteCallSingle(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 TestResultexecuteTableTest(TableTest aTest) Executes a table test.protected voidexecuteTearDownSuites(List<SuiteDefinition> aSetupSuitesList, Map<SuiteDefinition, Result> aTearDownResultMap) Executes the teardown suites required by the provided setup suites.protected TestResultexecuteTest(Test aTest) Executes a test (doesn't pay attention to the multiplier).protected ResultexecuteTimeSet(TimeSet aTimeSet) Executes a time setting operation.protected voidexecuteVariableAssignment(VariableAssignment anAssignment, SuiteDefinition aSuite) Executes variable assignments.protected intprotected intprotected Class<?> getClassForJvmType(org.eclipse.xtext.common.types.JvmType aType) Loads a class by resolving a givenJvmType.protected intThe delay until connection attempts are made to a newly started fork.protected intThe fork connection timeout, in seconds.protected intThe default fork connection timeout, in seconds.protected intThe interval in which the forks' execution state is checked on first connect.protected intThe timeout in milliseconds used for a single connection attempt to a fork.protected intDefault for the timeout in milliseconds used for a single connection attempt to a fork.protected intThe number of retries when starting forks.protected intThe default number of retries when starting forks.protected intReturns the time to wait for a fork to become ready for execution.protected intReturns the default time to wait for a fork to become ready for execution.protected voidhandlePossibleAbortException(Throwable anException) If the exception provided is anAbortExecutionException, this method performs the necessary steps to enter "abort" mode locally.voidinitialize(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 voidInitializes the parameterized constants from theparameterizedConstantValuesmap.static booleanisFork()Determines whether this JVM is a forked JVM from a master Integrity process.protected voidpauseIfRequiredByRemoteClient(boolean aForkSyncFlag) Pauses execution (blocks the method call) if the remoting client requested to do so via execution control or breakpoints.protected voidperformRemotingBinding(Integer aRemotingPort, String aRemotingBindHost) Performs the remoting port binding.protected voidremoveBreakpoint(int anEntryReference) Removes a specific breakpoint.protected voidreset()Resets the internal variable state.protected voidResets a scheduled interruption (seescheduleWaitBeforeNextStep()).protected ObjectresolveConstantValue(ConstantValue aConstantValue) Resolves a constant value (either it's a static value anyway, or it's a constant which needs to be resolved).run(SuiteDefinition aRootSuite, VariantDefinition aVariant, boolean aBlockForRemotingFlag) Executes a specified suite.protected SuiteSummaryResultrun(Suite aRootSuiteCall, VariantDefinition aVariant, boolean aBlockForRemotingFlag) Executes a specific suite call.protected SuiteSummaryResultrunInternal(Suite aRootSuiteCall) Actually executes a root suite call.protected voidSchedules a "wait for the master" before the next execution step.protected TimeSyncResultMessagesetTestTimeGuarded(long aRealtimeOffset, long aRealtimeDecouplingTime, double aProgressionFactor) Performs a guarded call to theTestTimeAdapter.protected voidsetVariableValue(VariableOrConstantEntity anEntity, Object aValue, boolean aDoSendUpdateFlag) Sets the value of a variable.protected voidsetVariableValue(String aQualifiedVariableName, Object aValue, boolean aDoSendUpdateFlag) Updates a variables' value.protected voidsetVariableValueConverted(VariableOrConstantEntity anEntity, ValueOrEnumValueOrOperationCollection aValue, boolean aDoSendUpdateFlag) Sets the value of a variable.protected booleanDetermines whether we should actually execute fixture method calls at the moment.voidshutdown(boolean anEmptyRemotingOutputQueueFlag) Shuts down this test runner instance.protected voidtimesetTraceLog(String anAction, String aLogMessage) Outputs a timeset trace log.protected voidtimesetTraceLog(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 voidundefineVariable(VariableOrConstantEntity anEntity) Undefines a variable (= clears its value, which is NOT exactly the same as setting it to null).protected voidunsetVariableValue(VariableOrConstantEntity anEntity, boolean aDoSendUpdateFlag) Unsets the value of a variable.protected voidunsetVariableValue(String aQualifiedVariableName, boolean aDoSendUpdateFlag) Unsets a variables' value.protected voidwaitForContinue(boolean aForkSyncFlag) Pause execution (blocks method call) until continuation is triggered by remoting.protected voidIf 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.
-
Field Details
-
model
The test model being executed. -
setList
The current setlist. -
setListWaiter
A waiter object used by remoting while waiting for the setlist to be created. -
executionWaiter
A semaphore used for single-stepping tests. -
shallWaitBeforeNextStep
protected boolean shallWaitBeforeNextStepWhether the test runner shall pause before executing the next step. -
breakpoints
All enabled breakpoints. -
callback
The callback provided by the creator of theTestRunner. -
setListCallback
The setlist callback (used to create/update the setlist). -
currentCallback
The currently used callback, that is, the callback that gets directly called during execution. -
currentPhase
The current execution phase. -
variableManager
The variable manager, which keeps track of the variable values (local and global). -
valueConverter
The value converter. -
parameterResolver
The parameter resolver. -
wrapperFactory
The wrapper factory. -
resultComparator
The result comparator to use. -
processTerminator
The process watchdog, used to govern other processes started by the test runner. -
injector
@Inject protected com.google.inject.Injector injectorThe Guice injector. -
modelSourceExplorer
The model source explorer. -
conversionContextProvider
The conversion context provider. -
testFormatter
The test formatter. -
performanceLogger
The performance logger. -
testTimeAdapter
The test time adapter. -
remotingServer
The remoting server. -
remotingListener
The remoting listener, which allows the remoting server to influence test execution. -
forkMap
Maps fork definitions to actual fork instances. -
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
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
Maps forks to their (intended) timesync states. -
commandLineArguments
The original command line arguments, as given to the test runner by the test runner creator. -
parameterizedConstantValues
This maps fully qualified constant names to parameter values. Defined during initialization. This allows to define the values for "parameterized" constants. -
modelChecker
The model checker is used to validate the test model prior to execution. -
classLoader
The classloader. -
javaClassLoader
The classloader used to load model-related classes. -
constantAndVariableDefinitionDelayedCallbackInvocations
protected Queue<org.eclipse.xtext.util.Pair<String,Runnable>> constantAndVariableDefinitionDelayedCallbackInvocationsThis 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
If this JVM instance is executing a fork, the name is stored here. -
FORK_STARTUP_RETRYCOUNT_PROPERTY
The system property that allows to override the number of retries to attempt when starting forked processes.- See Also:
-
FORK_STARTUP_RETRYCOUNT_DEFAULT
protected static final int FORK_STARTUP_RETRYCOUNT_DEFAULTThe default number of retries when starting forks. By default, use "fail fast" and abort test runs immediately.- See Also:
-
FORK_CONNECTION_TIMEOUT_PROPERTY
The system property that allows to override the timeout used when connecting to forks.- See Also:
-
FORK_CONNECTION_TIMEOUT_DEFAULT
protected static final int FORK_CONNECTION_TIMEOUT_DEFAULTThe default fork connection timeout, in seconds.- See Also:
-
FORK_SINGLE_CONNECT_TIMEOUT_PROPERTY
The system property that allows to override the single connect timeout used when connecting to forks.- See Also:
-
FORK_SINGLE_CONNECT_TIMEOUT_DEFAULT
protected static final int FORK_SINGLE_CONNECT_TIMEOUT_DEFAULTThe 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:
-
FORK_CONNECT_DELAY
protected static final int FORK_CONNECT_DELAYThe delay until connection attempts are made to a newly started fork.- See Also:
-
FORK_PAUSE_WAIT_INTERVAL
protected static final int FORK_PAUSE_WAIT_INTERVALThe interval in which the forks' execution state is checked on first connect.- See Also:
-
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:
-
FORK_WAIT_UNTIL_READY_TIMEOUT_DEFAULT
protected static final int FORK_WAIT_UNTIL_READY_TIMEOUT_DEFAULTThe default time to wait for a fork to become ready for execution. -
CHILD_PROCESS_KILL_TIMEOUT_PROPERTY
The system property that allows to override the single connect timeout used when connecting to forks.- See Also:
-
CHILD_PROCESS_KILL_TIMEOUT_DEFAULT
protected static final int CHILD_PROCESS_KILL_TIMEOUT_DEFAULTThe default time to wait for child processes to be killed.- See Also:
-
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
The currently executed test variant. -
setupSuitesExecuted
The setup suites that have been executed. -
singleRunSuitesExecuted
The single-run suites that have already been executed. -
abortExecutionCause
In case of anAbortExecutionExceptionaborting 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
Maps eachForkDefinitionto 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 numberOfSuiteInvocationsLeftOnThisForkThis 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 tolastSuiteForForkin that this is the individual number of invocations on a fork that is left; it is initially seeded with the correspondinglastSuiteForForkvalue 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
The result of a time sync request from this fork sent to a master is stored here. -
timeSyncResultSyncObject
A sync object used to synchronize accesses totimeSyncResult. -
TIMESET_TRACE_OUTPUT
System property to enable writing timeset trace output.- See Also:
-
isTimesetTracingEnabled
protected boolean isTimesetTracingEnabledWhether timeset tracing is enabled.
-
-
Constructor Details
-
DefaultTestRunner
public DefaultTestRunner()
-
-
Method Details
-
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 IOExceptionDescription copied from interface:TestRunnerInitializes 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:
initializein interfaceTestRunner- 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 resultsaResultLocale- 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 disabledaRemotingBindHost- the host name (or IP) to which the remoting server should bindaRandomSeed- the seed for theRandomNumberOperation(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 desiredaRemotingBindHost- the host/IP to bind to- Throws:
IOException
-
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.- Throws:
IOException
-
shutdown
public void shutdown(boolean anEmptyRemotingOutputQueueFlag) Shuts down this test runner instance.- Specified by:
shutdownin interfaceTestRunner- 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:TestRunnerExecutes a specified suite. Designated starting point for test execution.- Specified by:
runin interfaceTestRunner- Parameters:
aRootSuite- the suite to executeaBlockForRemotingFlag- 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 executeaBlockForRemotingFlag- whether execution should pause before actually starting until execution is resumed via remoting- Returns:
- the suite execution result
-
handlePossibleAbortException
If the exception provided is anAbortExecutionException, 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 anAbortExecutionExceptionhas 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 thesetListCallbackis 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 theparameterizedConstantValuesmap. -
reset
protected void reset()Resets the internal variable state. -
runInternal
Actually executes a root suite call.- Parameters:
aRootSuiteCall- the suite call to execute- Returns:
- the result
-
callSuite
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
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 suiteaSetupResultMap- 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 suitesaTearDownResultMap- a map into which teardown suite execution results will be stored
-
executeSuite
Executes a suite.- Parameters:
aSuite- the suite to execute- Returns:
- a map that maps statements to results
-
defineVariable
Defines a variable.- Parameters:
aDefinition- the variable definitionaSuite- 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 definitionaSuite- the suite in which the constant is defined- Throws:
InstantiationExceptionClassNotFoundExceptionUnexecutableException
-
defineConstant
protected void defineConstant(ConstantDefinition aDefinition, Object aValue, SuiteDefinition aSuite) throws ClassNotFoundException, InstantiationException, UnexecutableException Defines a constant.- Parameters:
aDefinition- the constant definitionaValue- 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:
InstantiationExceptionClassNotFoundExceptionUnexecutableException
-
defineVariable
protected void defineVariable(VariableOrConstantEntity anEntity, Object anInitialValue, SuiteDefinition aSuite) Defines a variable.- Parameters:
anEntity- the variable entityanInitialValue- the initial variable value, or null if the variable is not initializedaSuite- the suite in which the variable is defined
-
undefineVariable
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 updateaValue- 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:
InstantiationExceptionClassNotFoundExceptionUnexecutableException
-
setVariableValue
protected void setVariableValue(VariableOrConstantEntity anEntity, Object aValue, boolean aDoSendUpdateFlag) Sets the value of a variable.- Parameters:
anEntity- the variable entity to updateaValue- the new valueaDoSendUpdateFlag- 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 updateaValue- the new valueaDoSendUpdateFlag- whether this update should be sent to connected master/slaves
-
unsetVariableValue
Unsets the value of a variable.- Parameters:
anEntity- the variable entity to unsetaDoSendUpdateFlag- whether this update should be sent to connected master/slaves
-
unsetVariableValue
Unsets a variables' value.- Parameters:
aQualifiedVariableName- the name of the variable to unsetaDoSendUpdateFlag- whether this update should be sent to connected master/slaves
-
resolveConstantValue
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
Executes variable assignments.- Parameters:
anAssignment- the assignment to executeaSuite- the suite that the assignment is in
-
executeTest
Executes a test (doesn't pay attention to the multiplier).- Parameters:
aTest- the test to execute- Returns:
- the result
-
executeTableTest
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 givenJvmType.- Parameters:
aType- the type to load- Returns:
- the class
- Throws:
ClassNotFoundException
-
executeCall
Executes a call.- Parameters:
aCall- the call to execute- Returns:
- the results (multiple if the call has an execution multiplier)
-
executeCallSingle
Executes a call (a single time, doesn't honor the multiplier).- Parameters:
aCall- the call to execute- Returns:
- the result
-
executeTimeSet
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
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 theTestTimeAdapter.
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, 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.invalid reference
#distributeTimeSyncRequest(Date, BigDecimal, String[])- Parameters:
aStartTime-aDiffTime-aProgressionFactor-someTargetedForks-
-
setTestTimeGuarded
protected TimeSyncResultMessage setTestTimeGuarded(long aRealtimeOffset, long aRealtimeDecouplingTime, double aProgressionFactor) Performs a guarded call to theTestTimeAdapter. If the call runs into any exception, it will be caught and returned.- Parameters:
aProgressionFactor-aStartTime-- 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
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 (seescheduleWaitBeforeNextStep()). -
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 forisTimesetTracingEnabled, the caller may also check to save some cycles when generating expensive parameters.- Parameters:
anAction- the actionaLogMessage- the message to log
-
timesetTraceLog
Outputs a timeset trace log. Although this checks forisTimesetTracingEnabled, the caller may also check to save some cycles when generating expensive parameters.- Parameters:
anAction- the actionaLogMessage- the message to log
-