Class LarvaTool

java.lang.Object
org.frankframework.larva.LarvaTool

public class LarvaTool extends Object
Author:
Jaco de Groot
  • Field Details

    • ERROR_NO_SCENARIO_DIRECTORIES_FOUND

      public static final int ERROR_NO_SCENARIO_DIRECTORIES_FOUND
      See Also:
    • TESTTOOL_CLEAN_UP_REPLY

      protected static final Message TESTTOOL_CLEAN_UP_REPLY
    • RESULT_ERROR

      public static final int RESULT_ERROR
      See Also:
    • RESULT_OK

      public static final int RESULT_OK
      See Also:
    • RESULT_AUTOSAVED

      public static final int RESULT_AUTOSAVED
      See Also:
    • allowReadlineSteps

      protected final boolean allowReadlineSteps
      See Also:
    • globalTimeoutMillis

      protected static int globalTimeoutMillis
  • Constructor Details

    • LarvaTool

      public LarvaTool()
  • Method Details

    • setTimeout

      public static void setTimeout(int newTimeout)
    • runScenarios

      public static int runScenarios(jakarta.servlet.ServletContext application, jakarta.servlet.http.HttpServletRequest request, Writer out)
    • runScenarios

      public static int runScenarios(IbisContext ibisContext, jakarta.servlet.http.HttpServletRequest request, Writer out, boolean silent)
    • runScenarios

      public int runScenarios(IbisContext ibisContext, String paramLogLevel, String paramAutoScroll, String paramMultithreaded, String paramExecute, String paramWaitBeforeCleanUp, int timeout, String paramScenariosRootDirectory, Writer out, boolean silent)
      Returns:
      negative: error condition 0: all scenarios passed positive: number of scenarios that failed
    • printHtmlForm

      public void printHtmlForm(List<String> scenariosRootDirectories, List<String> scenariosRootDescriptions, String scenariosRootDirectory, AppConstants appConstants, List<File> scenarioFiles, int waitBeforeCleanUp, int timeout, String paramExecute)
    • write

      public void write(String html, boolean isHtmlType, LarvaLogLevel logLevel, boolean scroll)
    • writeHtml

      public void writeHtml(String html, boolean scroll)
    • writeLog

      public void writeLog(String html, LarvaLogLevel logLevel, boolean scroll)
    • debugMessage

      public void debugMessage(String message)
    • debugPipelineMessage

      public void debugPipelineMessage(String stepDisplayName, String message, Message pipelineMessage)
    • debugPipelineMessage

      public void debugPipelineMessage(String stepDisplayName, String message, String pipelineMessage)
    • debugPipelineMessagePreparedForDiff

      public void debugPipelineMessagePreparedForDiff(String stepDisplayName, String message, String pipelineMessage)
    • wrongPipelineMessage

      public void wrongPipelineMessage(String message, Message pipelineMessage)
    • wrongPipelineMessage

      public void wrongPipelineMessage(String stepDisplayName, String message, String pipelineMessage, String pipelineMessageExpected)
    • wrongPipelineMessagePreparedForDiff

      public void wrongPipelineMessagePreparedForDiff(String stepDisplayName, String pipelineMessagePreparedForDiff, String pipelineMessageExpectedPreparedForDiff)
    • scenariosTotalMessage

      public void scenariosTotalMessage(String message)
    • scenariosPassedTotalMessage

      public void scenariosPassedTotalMessage(String message)
    • scenariosAutosavedTotalMessage

      public void scenariosAutosavedTotalMessage(String message)
    • scenariosFailedTotalMessage

      public void scenariosFailedTotalMessage(String message)
    • errorMessage

      public void errorMessage(String message)
    • warningMessage

      public void warningMessage(String message)
    • errorMessage

      public void errorMessage(String message, Exception exception)
    • initScenariosRootDirectories

      public String initScenariosRootDirectories(String paramScenariosRootDirectory, List<String> scenariosRootDirectories, List<String> scenariosRootDescriptions)
    • readScenarioFiles

      public List<File> readScenarioFiles(AppConstants appConstants, String scenariosDirectory)
    • readProperties

      @Nullable public Properties readProperties(AppConstants appConstants, File propertiesFile)
    • readProperties

      @Nullable public Properties readProperties(AppConstants appConstants, File propertiesFile, boolean root)
    • getAbsolutePath

      public static String getAbsolutePath(String parent, String child)
    • getAbsolutePath

      public static String getAbsolutePath(String parent, String child, boolean addFileSeparator)
      Returns the absolute pathname for the child pathname. The parent pathname is used as a prefix when the child pathname is an not absolute.
      Parameters:
      parent - the parent pathname to use
      child - the child pathname to convert to a absolute pathname
    • addAbsolutePathProperties

      public static void addAbsolutePathProperties(String propertiesDirectory, Properties properties)
    • executeStep

      protected int executeStep(String step, Properties properties, String stepDisplayName, Map<String,LarvaScenarioAction> actions, String correlationId)
    • windiff

      public void windiff(String expectedFileName, String result, String expected) throws IOException, SenderException
      Throws:
      IOException
      SenderException
    • writeFile

      public static void writeFile(String fileName, String content) throws IOException
      Throws:
      IOException
    • compareResult

      public int compareResult(String step, String stepDisplayName, String fileName, Message expectedResultMessage, Message actualResultMessage, Properties properties)
    • prepareResultForCompare

      public String prepareResultForCompare(String input, Properties properties, Map<String,HashMap<String,HashMap<String,String>>> ignoreMap)
    • doActionBetweenKeys

      public String doActionBetweenKeys(String key, String value, Properties properties, Map<String,HashMap<String,HashMap<String,String>>> ignoreMap, LarvaTool.BetweenKeysAction action)
    • doActionWithSingleKey

      public String doActionWithSingleKey(String keyName, String value, Properties properties, Map<String,HashMap<String,HashMap<String,String>>> ignoreMap, LarvaTool.SingleKeyAction action)
    • ignoreContentBetweenKeys

      public static String ignoreContentBetweenKeys(String string, String key1, String key2)
    • ignoreKeysAndContentBetweenKeys

      public static String ignoreKeysAndContentBetweenKeys(String string, String key1, String key2)
    • removeKeysAndContentBetweenKeys

      public static String removeKeysAndContentBetweenKeys(String string, String key1, String key2)
    • ignoreKey

      public static String ignoreKey(String string, String key)
    • removeKey

      public static String removeKey(String string, String key)
    • replaceKey

      public static String replaceKey(String string, String from, String to)
    • decodeUnzipContentBetweenKeys

      public String decodeUnzipContentBetweenKeys(String string, String key1, String key2, boolean replaceNewlines)
    • canonicaliseFilePathContentBetweenKeys

      public String canonicaliseFilePathContentBetweenKeys(String string, String key1, String key2)
    • ignoreCurrentTimeBetweenKeys

      public String ignoreCurrentTimeBetweenKeys(String string, String key1, String key2, String pattern, String margin, boolean errorMessageOnRemainingString, boolean isControlString)
    • formatDecimalContentBetweenKeys

      public String formatDecimalContentBetweenKeys(String string, String key1, String key2)
    • ignoreContentBeforeKey

      public static String ignoreContentBeforeKey(String string, String key)
    • ignoreContentAfterKey

      public static String ignoreContentAfterKey(String string, String key)
    • ignoreRegularExpression

      public static String ignoreRegularExpression(String string, String regex)
    • removeRegularExpression

      public static String removeRegularExpression(String string, String regex)
    • replaceRegularExpression

      public static String replaceRegularExpression(String string, String from, String to)
    • createParametersMapFromParamProperties

      public Map<String,Object> createParametersMapFromParamProperties(Properties properties)
      Create a Map for a specific property based on other properties that are the same except for a .param1.name, .param1.value or .param1.valuefile suffix. The property with the .name suffix specifies the key for the Map, the property with the value suffix specifies the value for the Map. A property with a the .valuefile suffix can be used as an alternative for a property with a .value suffix to specify the file to read the value for the Map from. More than one param can be specified by using param2, param3 etc.
      Parameters:
      properties - Properties object from which to create the map
      property - Property name to use as base name
      Returns:
      A map with parameters
    • formatString

      public String formatString(String string)
    • mapPropertiesToIgnores

      public static HashMap<String,HashMap<String,HashMap<String,String>>> mapPropertiesToIgnores(Properties properties)
      This method is used to provide a way to implement ignores based on an identifier. For example: ignoreContentBetweenKeys.fieldA.key1= ignoreContentBetweenKeys.fieldA.key2=
      Parameters:
      properties - Properties to be checked
      Returns:
      HashMapinvalid input: '<'String, HashMapinvalid input: '<'String, HashMapinvalid input: '<'String, String>>> as HashMapinvalid input: '<''ignoreContentBetweenKeys', Hashmapinvalid input: '<''fieldA', HashMapinvalid input: '<''key1', ''>
    • findAttributesForIgnore

      public static List<String> findAttributesForIgnore(String propertyName)
      This method is used to de-couple the need of providing a set of attributes when calling mapPropertiesByIdentifier(). Caller of mapPropertiesByIdentifier() should not necessarily know about all attributes related to an ignore.
      Parameters:
      propertyName - The name of the ignore we are checking, in the example 'ignoreContentBetweenKeys'