java.lang.Object
net.ssehub.easy.instantiation.core.model.defaultInstantiators.AbstractFileInstantiator
net.ssehub.easy.producer.scenario_tests.mocks.MavenMock
All Implemented Interfaces:
net.ssehub.easy.instantiation.core.model.vilTypes.IVilType

public class MavenMock extends net.ssehub.easy.instantiation.core.model.defaultInstantiators.AbstractFileInstantiator
Simple manual mocking of the Maven instantiator, currently with .
Author:
Holger Eichelberger
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static interface 
    Function interfaces for original Maven function to be mocked.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static boolean
     
    private static boolean
     
    private static List<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact>
    maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root)
    Executes a specific MAVEN build specification with "clean" and "install" targets.
    static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact>
    maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, boolean updateSnapshots)
    Executes a specific MAVEN build specification with "clean" and "install" targets.
    static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact>
    maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, boolean updateSnapshots, net.ssehub.easy.instantiation.core.model.vilTypes.Sequence<String> buildtargets)
    Executes a specific MAVEN build specification.
    static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact>
    maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, String buildFilePath)
    Executes a specific MAVEN build specification with "clean" and "install" targets.
    static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact>
    maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, String buildFilePath, boolean updateSnapshots)
    Executes a specific MAVEN build specification with "clean" and "install" targets.
    static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact>
    maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, String buildFilePath, boolean updateSnapshots, net.ssehub.easy.instantiation.core.model.vilTypes.Sequence<String> buildtargets)
    Executes a specific MAVEN build specification.
    static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact>
    maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, String buildFilePath, net.ssehub.easy.instantiation.core.model.vilTypes.Sequence<String> buildtargets)
    Executes a specific MAVEN build specification.
    static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact>
    maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, String buildFilePath, net.ssehub.easy.instantiation.core.model.vilTypes.Sequence<String> mvnArgs, boolean updateSnapshots)
    Executes a specific MAVEN build specification with "clean" and "install" targets.
    static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact>
    maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, net.ssehub.easy.instantiation.core.model.vilTypes.Sequence<String> buildtargets)
    Executes a specific MAVEN build specification.
    static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact>
    maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, net.ssehub.easy.instantiation.core.model.vilTypes.Sequence<String> mvnArgs, boolean updateSnapshots)
    Executes a specific MAVEN build specification with "clean" and "install" targets.
    static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact>
    maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, net.ssehub.easy.instantiation.core.model.vilTypes.Sequence<String> mvnArgs, boolean updateSnapshots, net.ssehub.easy.instantiation.core.model.vilTypes.Sequence<String> buildtargets)
    Executes a specific MAVEN build specification.
    private static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact>
    Mocks an original function returning a set of file artifacts.
    static final void
    Registers the Java artifacts and instantiators.
    static boolean
    setPassThrough(boolean pass)
    Changes the pass-through state.
    static List<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact>
    setResult(List<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact> res)
    Changes the mocked result for the following calls.

    Methods inherited from class net.ssehub.easy.instantiation.core.model.defaultInstantiators.AbstractFileInstantiator

    determineTargetPath, toString

    Methods inherited from class java.lang.Object

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

    • registered

      private static boolean registered
    • passThrough

      private static boolean passThrough
    • result

      private static List<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact> result
  • Constructor Details

    • MavenMock

      public MavenMock()
  • Method Details

    • register

      public static final void register()
      Registers the Java artifacts and instantiators.
    • mock

      private static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact> mock(MavenMock.MavenFunction original) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Mocks an original function returning a set of file artifacts.
      Parameters:
      original - the original function to be called if not passThrough
      Returns:
      the result, may be result
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - if the execution fails
    • maven

      public static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact> maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Executes a specific MAVEN build specification with "clean" and "install" targets.
      Parameters:
      root - the root-path
      Returns:
      the created artifacts
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case of artifact / parameter problems
    • maven

      public static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact> maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, boolean updateSnapshots) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Executes a specific MAVEN build specification with "clean" and "install" targets.
      Parameters:
      root - the root-path
      updateSnapshots - whether snapshots shall be updated
      Returns:
      the created artifacts
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case of artifact / parameter problems
    • maven

      public static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact> maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, net.ssehub.easy.instantiation.core.model.vilTypes.Sequence<String> mvnArgs, boolean updateSnapshots) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Executes a specific MAVEN build specification with "clean" and "install" targets.
      Parameters:
      root - the root-path
      mvnArgs - optional maven arguments
      updateSnapshots - whether snapshots shall be updated
      Returns:
      the created artifacts
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case of artifact / parameter problems
    • maven

      public static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact> maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, String buildFilePath) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Executes a specific MAVEN build specification with "clean" and "install" targets.
      Parameters:
      root - the root-path
      buildFilePath - the path where the MAVEN file is located
      Returns:
      the created artifacts
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case of artifact / parameter problems
    • maven

      public static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact> maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, String buildFilePath, boolean updateSnapshots) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Executes a specific MAVEN build specification with "clean" and "install" targets.
      Parameters:
      root - the root-path
      buildFilePath - the path where the MAVEN file is located
      updateSnapshots - whether snapshots shall be updated
      Returns:
      the created artifacts
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case of artifact / parameter problems
    • maven

      public static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact> maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, String buildFilePath, net.ssehub.easy.instantiation.core.model.vilTypes.Sequence<String> mvnArgs, boolean updateSnapshots) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Executes a specific MAVEN build specification with "clean" and "install" targets.
      Parameters:
      root - the root-path
      buildFilePath - the path where the MAVEN file is located
      mvnArgs - additional maven arguments
      updateSnapshots - whether snapshots shall be updated
      Returns:
      the created artifacts
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case of artifact / parameter problems
    • maven

      public static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact> maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, net.ssehub.easy.instantiation.core.model.vilTypes.Sequence<String> buildtargets) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Executes a specific MAVEN build specification.
      Parameters:
      root - the root-path
      buildtargets - the targets to be executed
      Returns:
      the created artifacts
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case of artifact / parameter problems
    • maven

      public static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact> maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, boolean updateSnapshots, net.ssehub.easy.instantiation.core.model.vilTypes.Sequence<String> buildtargets) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Executes a specific MAVEN build specification.
      Parameters:
      root - the root-path
      updateSnapshots - whether snapshots shall be updated
      buildtargets - the targets to be executed
      Returns:
      the created artifacts
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case of artifact / parameter problems
    • maven

      public static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact> maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, net.ssehub.easy.instantiation.core.model.vilTypes.Sequence<String> mvnArgs, boolean updateSnapshots, net.ssehub.easy.instantiation.core.model.vilTypes.Sequence<String> buildtargets) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Executes a specific MAVEN build specification.
      Parameters:
      root - the root-path
      mvnArgs - additional maven arguments, may be null for none
      updateSnapshots - whether snapshots shall be updated
      buildtargets - the targets to be executed
      Returns:
      the created artifacts
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case of artifact / parameter problems
    • maven

      public static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact> maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, String buildFilePath, net.ssehub.easy.instantiation.core.model.vilTypes.Sequence<String> buildtargets) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Executes a specific MAVEN build specification.
      Parameters:
      root - the root-path
      buildFilePath - the path where the MAVEN file is located
      buildtargets - the targets to be executed
      Returns:
      the created artifacts
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case of artifact / parameter problems
    • maven

      public static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact> maven(net.ssehub.easy.instantiation.core.model.artifactModel.Path root, String buildFilePath, boolean updateSnapshots, net.ssehub.easy.instantiation.core.model.vilTypes.Sequence<String> buildtargets) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Executes a specific MAVEN build specification.
      Parameters:
      root - the root-path
      buildFilePath - the path where the MAVEN file is located
      updateSnapshots - whether snapshots shall be updated
      buildtargets - the targets to be executed
      Returns:
      the created artifacts
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case of artifact / parameter problems
    • setPassThrough

      public static boolean setPassThrough(boolean pass)
      Changes the pass-through state.
      Parameters:
      pass - shall calls be passed-through to the original implementation or mocked here
      Returns:
      the original value of the flag before calling this method
    • setResult

      public static List<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact> setResult(List<net.ssehub.easy.instantiation.core.model.artifactModel.FileArtifact> res)
      Changes the mocked result for the following calls.
      Parameters:
      res - the result values
      Returns:
      the original value before calling this method