java.lang.Object
test.de.iip_ecosphere.platform.configuration.easyProducer.AbstractIvmlTests
Direct Known Subclasses:
AbstractIvmlSerializerConfigTests, IvmlApiTests, IvmlContainerLxcTests, IvmlContainerTests, IvmlKodexMeshTests, IvmlMetaModelTests, IvmlRoutingTestTests, IvmlSimpleMesh3Tests, IvmlSimpleMeshTests

public abstract class AbstractIvmlTests extends Object
Base class for IVML model tests.
Author:
Holger Eichelberger, SSE
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Reusable test configuration/setup.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final Set<String>
     
    private static final Set<String>
     
    private static Boolean
     
    static final File
     
    static final File
     
    private static File
     
    private static File
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static final void
    Generically asserts all files in folder and recursively in contained folders.
    private void
    assertDatatype(File typeFolder, File serFolder, String name, String extension)
    Tests for the existence of all files related to a Data Type.
    protected void
    Asserts the structure of a deployment Yaml file (from service.environment perspective).
    protected void
    Asserts file and contents of the ECS runtime component.
    private static File
    Asserts that the specified file exists and has contents.
    protected static File
    assertFile(File base, String name)
    Asserts that the specified file exists and has contents.
    protected static void
    assertFileContains(File base, String name, String... search)
    Asserts that the specified file exists, has contents and contains the specified search string(s).
    protected void
    Tests for the existence of all files related to a Java Data Type.
    protected void
    assertJavaInterface(File folder, String name, boolean old, boolean connector)
    Tests for the existence of all files related to a Java Service Mesh Node.
    protected void
    assertJavaNode(File folder, String name, boolean connector)
    Tests for the existence of all files related to a Java Service Mesh Node.
    protected static de.iip_ecosphere.platform.configuration.easyProducer.ConfigurationLifecycleDescriptor
    Asserts and returns an instance of the configuration lifecycle descriptor.
    protected void
    Asserts file and contents of the platform (server) component.
    protected void
    Tests for the existence of all files related to a Python Data Type.
    protected void
    Tests for the existence of all files related to a Python Data Type implementation.
    protected void
    Asserts file and contents of the service manager component.
    protected static File
    Asserts the eclipse template ZIP file, usually indicating the the template generation was executed successfully.
    protected void
    Extracts the python service environment implementation (via Maven and main project).
    static de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer
    genApi(de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer cfg)
    Helper method to configure for partial instantiation, i.e., generated platform APIs only.
    static de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer
    genApps(de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer cfg)
    Helper method to configure for partial instantiation, i.e., apps only and no platform components.
    static de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer
    genAppsNoDeps(de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer cfg)
    Helper method to configure for partial instantiation, i.e., apps without dependencies and no platform components.
    protected static boolean
    Returns whether a simplified build due to the first (CI) build shall be performed.
    protected void
    pythonSourceCodeCheck(File srcMainPython, String pyFile)
    Checks a python source code file (in packages with folders).
    protected static File
    Returns file relocated into testModelBase if not null.
    static void
    Sets the #metaModelFolder.
    static void
    Sets #testModelBase.
    static de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer
    setTracing(de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer cfg, String level)
    Helper method to set the tracing level.
    static String
    Strips EasySetup.getTestingEasyModelParent() from file's path.

    Methods inherited from class java.lang.Object

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

    • TEST_BASE_FOLDER

      public static final File TEST_BASE_FOLDER
    • MODEL_BASE_FOLDER

      public static final File MODEL_BASE_FOLDER
    • ASSERT_FILE_EXTENSIONS

      private static final Set<String> ASSERT_FILE_EXTENSIONS
    • ASSERT_FILE_NAME_EXCLUSIONS

      private static final Set<String> ASSERT_FILE_NAME_EXCLUSIONS
    • isIipBuildInitial

      private static Boolean isIipBuildInitial
    • testModelBase

      private static File testModelBase
    • testMetaModelFolder

      private static File testMetaModelFolder
  • Constructor Details

    • AbstractIvmlTests

      public AbstractIvmlTests()
  • Method Details

    • relocateTestModel

      protected static File relocateTestModel(File file)
      Returns file relocated into testModelBase if not null.
      Parameters:
      file - the file to relocate
      Returns:
      file or file relocated into testModelBase.
    • stripTestingEasyModelParent

      public static String stripTestingEasyModelParent(File file)
      Strips EasySetup.getTestingEasyModelParent() from file's path.
      Returns:
      file or file without EasySetup.getTestingEasyModelParent() as prefix
    • setTestModelBase

      public static void setTestModelBase(File base)
      Sets #testModelBase.
      Parameters:
      base - the base folder, may be null for none
      See Also:
    • setTestMetaModelFolder

      public static void setTestMetaModelFolder(File folder)
      Sets the #metaModelFolder.
      Parameters:
      folder - the meta model folder, may be null for "./src/main/easy"
    • isIipBuildInitial

      protected static boolean isIipBuildInitial()
      Returns whether a simplified build due to the first (CI) build shall be performed. Depends on JVM/system property iip.build.initial.
      Returns:
      true for initial build, false else
    • assertLifecycleDescriptor

      protected static de.iip_ecosphere.platform.configuration.easyProducer.ConfigurationLifecycleDescriptor assertLifecycleDescriptor()
      Asserts and returns an instance of the configuration lifecycle descriptor.
      Returns:
      the configuration lifecycle descriptor instance
    • extractPythonServiceEnv

      protected void extractPythonServiceEnv(File srcMainPython) throws IOException
      Extracts the python service environment implementation (via Maven and main project). Required for pythonSourceCodeCheck(File, String).
      Parameters:
      srcMainPython - the target folder where to extract the service environment to
      Throws:
      IOException - if the service environment archive cannot be extracted
    • pythonSourceCodeCheck

      protected void pythonSourceCodeCheck(File srcMainPython, String pyFile) throws IOException
      Checks a python source code file (in packages with folders).
      Parameters:
      srcMainPython - the main (parent) source folder for python files
      pyFile - the python file to check (packages as folders)
      Throws:
      IOException - in case that expected files cannot be found or inspected
    • assertDeploymentYaml

      protected void assertDeploymentYaml(File base, String name)
      Asserts the structure of a deployment Yaml file (from service.environment perspective). Disabled if isIipBuildInitial().
      Parameters:
      base - the base folder
      name - the name/path to the file
    • assertJavaInterface

      protected void assertJavaInterface(File folder, String name, boolean old, boolean connector)
      Tests for the existence of all files related to a Java Service Mesh Node.
      Parameters:
      folder - the basic source folder including base package
      name - the name of the service (as identifier)
      old - old (separated) or new shared interface style
      connector - whether the node is a connector
    • assertJavaNode

      protected void assertJavaNode(File folder, String name, boolean connector)
      Tests for the existence of all files related to a Java Service Mesh Node.
      Parameters:
      folder - the basic source folder including base package
      name - the name of the service (as identifier)
      connector - whether the node is a connector
    • assertJavaDatatype

      protected void assertJavaDatatype(File folder, String name)
      Tests for the existence of all files related to a Java Data Type.
      Parameters:
      folder - the basic source folder including base package
      name - the name of the datatype (as identifier)
    • assertPythonDatatypeImpl

      protected void assertPythonDatatypeImpl(File folder, String name)
      Tests for the existence of all files related to a Python Data Type implementation.
      Parameters:
      folder - the basic source folder
      name - the name of the datatype (as identifier)
    • assertPythonDatatype

      protected void assertPythonDatatype(File folder, String name)
      Tests for the existence of all files related to a Python Data Type.
      Parameters:
      folder - the basic source folder
      name - the name of the datatype (as identifier)
    • assertDatatype

      private void assertDatatype(File typeFolder, File serFolder, String name, String extension)
      Tests for the existence of all files related to a Data Type.
      Parameters:
      typeFolder - the folder containing the datatypes
      serFolder - the folder containing the datatypes serializers (may be typeFolder, ignored if null)
      name - the name of the datatype (as identifier)
      extension - the file name extension
    • assertEcsRuntime

      protected void assertEcsRuntime(File gen) throws IOException
      Asserts file and contents of the ECS runtime component.
      Parameters:
      gen - the generation base folder
      Throws:
      IOException - in case that expected files cannot be found or inspected
    • assertServiceManager

      protected void assertServiceManager(File gen) throws IOException
      Asserts file and contents of the service manager component.
      Parameters:
      gen - the generation base folder
      Throws:
      IOException - in case that expected files cannot be found or inspected
    • assertPlatform

      protected void assertPlatform(File gen) throws IOException
      Asserts file and contents of the platform (server) component.
      Parameters:
      gen - the generation base folder
      Throws:
      IOException - in case that expected files cannot be found or inspected
    • assertFile

      protected static File assertFile(File base, String name)
      Asserts that the specified file exists and has contents.
      Parameters:
      base - the base folder
      name - the name/path to the file
      Returns:
      the actual asserted file (base + name)
    • assertTemplateZip

      protected static File assertTemplateZip(File gen, String name)
      Asserts the eclipse template ZIP file, usually indicating the the template generation was executed successfully. This assert is disabled if isIipBuildInitial().
      Parameters:
      gen - the gen folder
      name - the name of the project
      Returns:
      the actual asserted file
    • assertFile

      private static File assertFile(File file)
      Asserts that the specified file exists and has contents. This assert is disabled if isIipBuildInitial().
      Parameters:
      file - the file
      Returns:
      file
    • assertAllFiles

      protected static final void assertAllFiles(File folder)
      Generically asserts all files in folder and recursively in contained folders.
      Parameters:
      folder - the folder to asserts the files within
    • assertFileContains

      protected static void assertFileContains(File base, String name, String... search) throws IOException
      Asserts that the specified file exists, has contents and contains the specified search string(s). Is disabled when isIipBuildInitial().
      Parameters:
      base - the base folder
      name - the name/path to the file
      search - the content/search strings to assert
      Throws:
      IOException - if the file cannot be read
    • genApi

      public static de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer genApi(de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer cfg)
      Helper method to configure for partial instantiation, i.e., generated platform APIs only.
      Parameters:
      cfg - the configurer instance
      Returns:
      cfg
    • genApps

      public static de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer genApps(de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer cfg)
      Helper method to configure for partial instantiation, i.e., apps only and no platform components.
      Parameters:
      cfg - the configurer instance
      Returns:
      cfg
    • genAppsNoDeps

      public static de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer genAppsNoDeps(de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer cfg)
      Helper method to configure for partial instantiation, i.e., apps without dependencies and no platform components.
      Parameters:
      cfg - the configurer instance
      Returns:
      cfg
    • setTracing

      public static de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer setTracing(de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer cfg, String level)
      Helper method to set the tracing level.
      Parameters:
      cfg - the configurer instance
      level - ALL|FUNC|TOP
      Returns:
      cfg