Class AbstractScenarioTest
java.lang.Object
net.ssehub.easy.dslCore.test.AbstractTest<net.ssehub.easy.instantiation.core.model.buildlangModel.Script>
test.de.uni_hildesheim.sse.vil.buildlang.AbstractTest<net.ssehub.easy.instantiation.core.model.buildlangModel.Script>
net.ssehub.easy.producer.scenario_tests.AbstractScenarioTest
- Direct Known Subclasses:
AbstractEasyScenarioTest
public abstract class AbstractScenarioTest
extends test.de.uni_hildesheim.sse.vil.buildlang.AbstractTest<net.ssehub.easy.instantiation.core.model.buildlangModel.Script>
Abstract functionality for scenario tests.
- Author:
- Holger Eichelberger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceAn instance that may modify certain behavior of a real-world test case on-the-fly.static classA Test modifier that makes given files executable.protected static enumTest execution modes.private static classA simple tracer factory for understanding the build process.Nested classes/interfaces inherited from class test.de.uni_hildesheim.sse.vil.buildlang.AbstractTest
test.de.uni_hildesheim.sse.vil.buildlang.AbstractTest.CleanerNested classes/interfaces inherited from class net.ssehub.easy.dslCore.test.AbstractTest
net.ssehub.easy.dslCore.test.AbstractTest.EqualitySetup<R extends net.ssehub.easy.basics.modelManagement.IModel> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static booleanprotected static final String[]Defines the default model paths (IVML, VIL, VTL).protected static booleanprotected static final net.ssehub.easy.reasoning.core.reasoner.IMeasurementKey[]protected static String[]Defines the current model paths.Fields inherited from class net.ssehub.easy.dslCore.test.AbstractTest
OBSERVER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidActivates operating system specific build properties if they exist.protected net.ssehub.easy.instantiation.core.model.vilTypes.configuration.ConfigurationassertConfiguration(net.ssehub.easy.varModel.model.Project prj, AbstractScenarioTest.Mode mode) Creates and asserts a VIL configuration and checks the reasoning/propagation result for no conflicts.protected voidconfigureExecution(String projectName, Map<String, Object> args) Configures the execution of VIL forprojectName.private static net.ssehub.easy.instantiation.core.model.vilTypes.ProjectcreateProjectInstance(File folder) Creates a project instance forfolder.protected net.ssehub.easy.reasoning.core.reasoner.IReasonerReturns a reasoner instance.protected test.de.uni_hildesheim.sse.vil.buildlang.ITestConfigurer<net.ssehub.easy.instantiation.core.model.buildlangModel.Script> private voiddoLocations(File ivmlFolder, File vilFolder, File vtlFolder, File[] cfgFolder, boolean add) Operate on the locations.private voidexecute(net.ssehub.easy.instantiation.core.model.execution.Executor executor, AbstractScenarioTest.ITestModifier modifier, net.ssehub.easy.instantiation.core.model.execution.TracerFactory tFactory) Executes the configured executor.protected FileexecuteCase(String[] names, String[] versions, String caseFolder, String sourceProjectName, AbstractScenarioTest.Mode mode) Executes a "real-world" case.protected FileexecuteCase(String[] names, String[] versions, String caseFolder, String sourceProjectName, AbstractScenarioTest.Mode mode, AbstractScenarioTest.ITestModifier modifier) Executes a "real-world" case.protected FileexecuteCase(String projectName, String[] versions, String caseFolder, String sourceProjectName, AbstractScenarioTest.Mode mode) Executes a "real-world" case.protected FileexecuteCase(String projectName, String[] versions, String caseFolder, String sourceProjectName, AbstractScenarioTest.Mode mode, AbstractScenarioTest.ITestModifier modifier) Executes a "real-world" case.protected voidprotected static FilegetIvmlFolderIn(File base) Returns the folder inbasecontaining the IVML files.protected abstract StringReturns the name of the measurement file.protected net.ssehub.easy.reasoning.core.reasoner.IMeasurementKey[]Returns the measurements to be collected for the measurement collector.protected net.ssehub.easy.instantiation.core.model.execution.TracerFactoryCreates the tracer factory.protected static FilegetVilFolderIn(File base) Returns the folder inbasecontaining the VIL files.protected static FilegetVtlFolderIn(File base) Returns the folder inbasecontaining the VTL files.(package private) static voidInitializes the reasoner.protected static net.ssehub.easy.varModel.model.ProjectobtainIvmlModel(String projectName, String ivmlVersion, File ivmlFolder) Obtains the specified IVML model.private static net.ssehub.easy.instantiation.core.model.buildlangModel.ScriptobtainVilModel(String projectName, String vilVersion, File vilFolder) Obtains the specified VIL model.private static voidConditional println.private static StringProjects the specified version fromversions.Methods inherited from class test.de.uni_hildesheim.sse.vil.buildlang.AbstractTest
addTestDataLocations, assertEqual, assertEqual, assertExecutor, assertFailure, assertFailure, assertOutdated, cleanTemp, copyFile, createFile, createTempDir, deleteQuietly, getSystemPropertyName, getTempDir, getTestConfigurer, getTestDataDir, getTestFolder, registerTypeAnyway, testExecutorMethods inherited from class net.ssehub.easy.dslCore.test.AbstractTest
assertNamingAndVersion, checkEqualsAndPrepareMessage, checkEqualsAndPrepareMessage, checkEqualsAndPrint, checkEqualsAndPrint, checkErrorCodes, checkErrorCodes, checkWarnings, determineTestDataDir, file2String, isEqual, resourceInitialization, toString
-
Field Details
-
debug
protected static boolean debug -
instantiate
protected static boolean instantiate -
DEFAULT_MODEL_PATHS
Defines the default model paths (IVML, VIL, VTL). -
modelPaths
Defines the current model paths. -
MEASUREMENTS
protected static final net.ssehub.easy.reasoning.core.reasoner.IMeasurementKey[] MEASUREMENTS
-
-
Constructor Details
-
AbstractScenarioTest
public AbstractScenarioTest()
-
-
Method Details
-
initializeReasoner
static void initializeReasoner()Initializes the reasoner. -
createReasoner
protected net.ssehub.easy.reasoning.core.reasoner.IReasoner createReasoner()Returns a reasoner instance.- Returns:
- the instance
-
furtherInitialization
protected void furtherInitialization()- Overrides:
furtherInitializationin classtest.de.uni_hildesheim.sse.vil.buildlang.AbstractTest<net.ssehub.easy.instantiation.core.model.buildlangModel.Script>
-
createTestConfigurer
protected test.de.uni_hildesheim.sse.vil.buildlang.ITestConfigurer<net.ssehub.easy.instantiation.core.model.buildlangModel.Script> createTestConfigurer()- Specified by:
createTestConfigurerin classtest.de.uni_hildesheim.sse.vil.buildlang.AbstractTest<net.ssehub.easy.instantiation.core.model.buildlangModel.Script>
-
configureExecution
Configures the execution of VIL forprojectName.- Parameters:
projectName- the project nameargs- the arguments (may be modified as a side effect
-
project
Projects the specified version fromversions.- Parameters:
versions- the versions (may be null)index- the index within version (ignored ifversionsis null)- Returns:
- the version or null
-
executeCase
protected File executeCase(String projectName, String[] versions, String caseFolder, String sourceProjectName, AbstractScenarioTest.Mode mode) throws IOException Executes a "real-world" case.- Parameters:
projectName- the name of the projectversions- the version of the models, index 0 IVML, index 1 VIL build file (may be null)caseFolder- an optional set of intermediary folders where the actual case study (innermost folder corresponds to name) is located insourceProjectName- the optional name of the source project (null if same asprojectName)mode- the testing mode- Returns:
- the base directory of the instantiated project
- Throws:
IOException- in case of I/O problems
-
executeCase
protected File executeCase(String projectName, String[] versions, String caseFolder, String sourceProjectName, AbstractScenarioTest.Mode mode, AbstractScenarioTest.ITestModifier modifier) throws IOException Executes a "real-world" case.- Parameters:
projectName- the name of the projectversions- the version of the models, index 0 IVML, index 1 VIL build file (may be null)caseFolder- an optional set of intermediary folders where the actual case study (innermost folder corresponds to name) is located insourceProjectName- the optional name of the source project (null if same asprojectName)mode- the testing modemodifier- test modifier instance (may be null)- Returns:
- the base directory of the instantiated project
- Throws:
IOException- in case of I/O problems
-
executeCase
protected File executeCase(String[] names, String[] versions, String caseFolder, String sourceProjectName, AbstractScenarioTest.Mode mode) throws IOException Executes a "real-world" case.- Parameters:
names- the name of the project, if only one entry the project folder / model name, else project folder name, (optional) IVML/VIL model name, (optional) VIL model nameversions- the version of the models, index 0 IVML, index 1 VIL build file (may be null)caseFolder- an optional set of intermediary folders where the actual case study (innermost folder corresponds to name) is located insourceProjectName- the optional name of the source project (null if same asprojectName)mode- the testing mode- Returns:
- the base directory of the instantiated project (null for no instantiation, i.e., do not assert)
- Throws:
IOException- in case of I/O problems
-
executeCase
protected File executeCase(String[] names, String[] versions, String caseFolder, String sourceProjectName, AbstractScenarioTest.Mode mode, AbstractScenarioTest.ITestModifier modifier) throws IOException Executes a "real-world" case.- Parameters:
names- the name of the project, if only one entry the project folder / model name, else project folder name, (optional) IVML/VIL model name, (optional) VIL model nameversions- the version of the models, index 0 IVML, index 1 VIL build file (may be null)caseFolder- an optional set of intermediary folders where the actual case study (innermost folder corresponds to name) is located insourceProjectName- the optional name of the source project (null if same asprojectName)mode- the testing modemodifier- test modifier instance (may be null)- Returns:
- the base directory of the instantiated project (null for no instantiation, i.e., do not assert)
- Throws:
IOException- in case of I/O problems
-
execute
private void execute(net.ssehub.easy.instantiation.core.model.execution.Executor executor, AbstractScenarioTest.ITestModifier modifier, net.ssehub.easy.instantiation.core.model.execution.TracerFactory tFactory) Executes the configured executor.- Parameters:
executor- the executormodifier- optional modifier for start rule nametFactory- the tracer factory to use
-
doLocations
private void doLocations(File ivmlFolder, File vilFolder, File vtlFolder, File[] cfgFolder, boolean add) Operate on the locations.- Parameters:
ivmlFolder- the IVML foldervilFolder- the VIL foldervtlFolder- the VTL foldercfgFolder- optional IVML folder (usually containing the configuration, may be null for none)add-truefor adding as locations,falsefor removing
-
assertConfiguration
protected net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration assertConfiguration(net.ssehub.easy.varModel.model.Project prj, AbstractScenarioTest.Mode mode) Creates and asserts a VIL configuration and checks the reasoning/propagation result for no conflicts.- Parameters:
prj- the project to create the configuration formode- the testing mode- Returns:
- the VIL configuration
-
getMeasurementFileName
Returns the name of the measurement file.- Returns:
- the name of the measurement file
-
getMeasurements
protected net.ssehub.easy.reasoning.core.reasoner.IMeasurementKey[] getMeasurements()Returns the measurements to be collected for the measurement collector. Requires registration of measurement keys!- Returns:
- the measurements
-
println
Conditional println.- Parameters:
object- the object to be printedprint- to print or not to print
-
getTracerFactory
protected net.ssehub.easy.instantiation.core.model.execution.TracerFactory getTracerFactory()Creates the tracer factory.- Returns:
- the tracer factory
-
obtainVilModel
private static net.ssehub.easy.instantiation.core.model.buildlangModel.Script obtainVilModel(String projectName, String vilVersion, File vilFolder) Obtains the specified VIL model.- Parameters:
projectName- the name of the projectvilVersion- the version of the VIL filevilFolder- the base folder for VIL files- Returns:
- the VIL model
-
obtainIvmlModel
protected static net.ssehub.easy.varModel.model.Project obtainIvmlModel(String projectName, String ivmlVersion, File ivmlFolder) Obtains the specified IVML model.- Parameters:
projectName- the name of the projectivmlVersion- the version of the IVML fileivmlFolder- the base folder for IVML files- Returns:
- the IVML model
-
getIvmlFolderIn
Returns the folder inbasecontaining the IVML files.- Parameters:
base- the base directory for the project- Returns:
- the IVML files folder
-
getVilFolderIn
Returns the folder inbasecontaining the VIL files.- Parameters:
base- the base directory for the project- Returns:
- the VIL files folder
-
getVtlFolderIn
Returns the folder inbasecontaining the VTL files.- Parameters:
base- the base directory for the project- Returns:
- the VTL files folder
-
activateBuildProperties
Activates operating system specific build properties if they exist.- Parameters:
dir- the directory to look into
-
createProjectInstance
private static net.ssehub.easy.instantiation.core.model.vilTypes.Project createProjectInstance(File folder) Creates a project instance forfolder.- Parameters:
folder- the folder to create the project on- Returns:
- the created project instance
-