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 Classes
    Modifier and Type
    Class
    Description
    protected static interface 
    An instance that may modify certain behavior of a real-world test case on-the-fly.
    static class 
    A Test modifier that makes given files executable.
    protected static enum 
    Test execution modes.
    private static class 
    A 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.Cleaner

    Nested 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

    Fields
    Modifier and Type
    Field
    Description
    protected static boolean
     
    protected static final String[]
    Defines the default model paths (IVML, VIL, VTL).
    protected static boolean
     
    protected 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static void
    Activates operating system specific build properties if they exist.
    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.
    protected void
    configureExecution(String projectName, Map<String,Object> args)
    Configures the execution of VIL for projectName.
    private static net.ssehub.easy.instantiation.core.model.vilTypes.Project
    Creates a project instance for folder.
    protected net.ssehub.easy.reasoning.core.reasoner.IReasoner
    Returns a reasoner instance.
    protected test.de.uni_hildesheim.sse.vil.buildlang.ITestConfigurer<net.ssehub.easy.instantiation.core.model.buildlangModel.Script>
     
    private void
    doLocations(File ivmlFolder, File vilFolder, File vtlFolder, File[] cfgFolder, boolean add)
    Operate on the locations.
    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.
    protected File
    executeCase(String[] names, String[] versions, String caseFolder, String sourceProjectName, AbstractScenarioTest.Mode mode)
    Executes a "real-world" case.
    protected File
    executeCase(String[] names, String[] versions, String caseFolder, String sourceProjectName, AbstractScenarioTest.Mode mode, AbstractScenarioTest.ITestModifier modifier)
    Executes a "real-world" case.
    protected File
    executeCase(String projectName, String[] versions, String caseFolder, String sourceProjectName, AbstractScenarioTest.Mode mode)
    Executes a "real-world" case.
    protected File
    executeCase(String projectName, String[] versions, String caseFolder, String sourceProjectName, AbstractScenarioTest.Mode mode, AbstractScenarioTest.ITestModifier modifier)
    Executes a "real-world" case.
    protected void
     
    protected static File
    Returns the folder in base containing the IVML files.
    protected abstract String
    Returns 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.TracerFactory
    Creates the tracer factory.
    protected static File
    Returns the folder in base containing the VIL files.
    protected static File
    Returns the folder in base containing the VTL files.
    (package private) static void
    Initializes the reasoner.
    protected static net.ssehub.easy.varModel.model.Project
    obtainIvmlModel(String projectName, String ivmlVersion, File ivmlFolder)
    Obtains the specified IVML model.
    private static net.ssehub.easy.instantiation.core.model.buildlangModel.Script
    obtainVilModel(String projectName, String vilVersion, File vilFolder)
    Obtains the specified VIL model.
    private static void
    println(Object object, boolean print)
    Conditional println.
    private static String
    project(String[] versions, int index)
    Projects the specified version from versions.

    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, testExecutor

    Methods inherited from class net.ssehub.easy.dslCore.test.AbstractTest

    assertNamingAndVersion, checkEqualsAndPrepareMessage, checkEqualsAndPrepareMessage, checkEqualsAndPrint, checkEqualsAndPrint, checkErrorCodes, checkErrorCodes, checkWarnings, determineTestDataDir, file2String, isEqual, resourceInitialization, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • debug

      protected static boolean debug
    • instantiate

      protected static boolean instantiate
    • DEFAULT_MODEL_PATHS

      protected static final String[] DEFAULT_MODEL_PATHS
      Defines the default model paths (IVML, VIL, VTL).
    • modelPaths

      protected static String[] 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:
      furtherInitialization in class test.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:
      createTestConfigurer in class test.de.uni_hildesheim.sse.vil.buildlang.AbstractTest<net.ssehub.easy.instantiation.core.model.buildlangModel.Script>
    • configureExecution

      protected void configureExecution(String projectName, Map<String,Object> args)
      Configures the execution of VIL for projectName.
      Parameters:
      projectName - the project name
      args - the arguments (may be modified as a side effect
    • project

      private static String project(String[] versions, int index)
      Projects the specified version from versions.
      Parameters:
      versions - the versions (may be null)
      index - the index within version (ignored if versions is 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 project
      versions - 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 in
      sourceProjectName - the optional name of the source project (null if same as projectName)
      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 project
      versions - 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 in
      sourceProjectName - the optional name of the source project (null if same as projectName)
      mode - the testing mode
      modifier - 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 name
      versions - 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 in
      sourceProjectName - the optional name of the source project (null if same as projectName)
      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 name
      versions - 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 in
      sourceProjectName - the optional name of the source project (null if same as projectName)
      mode - the testing mode
      modifier - 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 executor
      modifier - optional modifier for start rule name
      tFactory - 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 folder
      vilFolder - the VIL folder
      vtlFolder - the VTL folder
      cfgFolder - optional IVML folder (usually containing the configuration, may be null for none)
      add - true for adding as locations, false for 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 for
      mode - the testing mode
      Returns:
      the VIL configuration
    • getMeasurementFileName

      protected abstract String 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

      private static void println(Object object, boolean print)
      Conditional println.
      Parameters:
      object - the object to be printed
      print - 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 project
      vilVersion - the version of the VIL file
      vilFolder - 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 project
      ivmlVersion - the version of the IVML file
      ivmlFolder - the base folder for IVML files
      Returns:
      the IVML model
    • getIvmlFolderIn

      protected static File getIvmlFolderIn(File base)
      Returns the folder in base containing the IVML files.
      Parameters:
      base - the base directory for the project
      Returns:
      the IVML files folder
    • getVilFolderIn

      protected static File getVilFolderIn(File base)
      Returns the folder in base containing the VIL files.
      Parameters:
      base - the base directory for the project
      Returns:
      the VIL files folder
    • getVtlFolderIn

      protected static File getVtlFolderIn(File base)
      Returns the folder in base containing the VTL files.
      Parameters:
      base - the base directory for the project
      Returns:
      the VTL files folder
    • activateBuildProperties

      private static void activateBuildProperties(File dir)
      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 for folder.
      Parameters:
      folder - the folder to create the project on
      Returns:
      the created project instance