Package org.frankframework.larva
Class LarvaTool
java.lang.Object
org.frankframework.larva.LarvaTool
- Author:
- Jaco de Groot
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
-
Constructor Summary
ConstructorsConstructorDescriptionLarvaTool
(org.springframework.context.ApplicationContext applicationContext, LarvaConfig larvaConfig) -
Method Summary
Modifier and TypeMethodDescriptioncanonicaliseFilePathContentBetweenKeys
(String string, String key1, String key2) int
compareResult
(TestExecutionObserver testExecutionObserver, Scenario scenario, Step step, String fileName, Message expectedResultMessage, Message actualResultMessage) static LarvaTool
createInstance
(jakarta.servlet.ServletContext servletContext) static LarvaTool
createInstance
(org.springframework.context.ApplicationContext applicationContext) createScenarioRunner
(TestExecutionObserver testExecutionObserver, TestRunStatus testRunStatus) void
debugMessage
(String message) decodeUnzipContentBetweenKeys
(String string, String key1, String key2, boolean replaceNewlines) static String
doActionBetweenKeys
(String key, String value, Properties properties, Map<String, Map<String, Map<String, String>>> ignoreMap, LarvaTool.BetweenKeysAction action) static String
doActionWithSingleKey
(String keyName, String value, Properties properties, Map<String, Map<String, Map<String, String>>> ignoreMap, LarvaTool.SingleKeyAction action) void
errorMessage
(String message) void
errorMessage
(String message, Exception exception) findAttributesForIgnore
(String propertyName) This method is used to de-couple the need of providing a set of attributes when calling mapPropertiesByIdentifier().void
formatDecimalContentBetweenKeys
(String string, String key1, String key2) formatString
(String string) Replace all linefeed-characters with the platform-specific linefeed-character for the current platform.Get the scenario directory selected as default Active with the currentLarvaConfig
getMessagesAtLevel
(LarvaLogLevel level) Larva API calls that do not provide an output-writer can collect relevant log messages for the user to be returned via the API from the message list.static String
ignoreContentAfterKey
(String string, String key) static String
ignoreContentBeforeKey
(String string, String key) static String
ignoreContentBetweenKeys
(String string, String key1, String key2) ignoreCurrentTimeBetweenKeys
(String string, String key1, String key2, String pattern, String margin, boolean errorMessageOnRemainingString, boolean isControlString) static String
static String
ignoreKeysAndContentBetweenKeys
(String string, String key1, String key2) static String
ignoreRegularExpression
(String string, String regex) void
infoMessage
(String message) mapPropertiesToIgnores
(Properties properties) This method is used to provide a way to implement ignores based on an identifier.messageToString
(Message message) Read the message into a string.prepareResultForCompare
(String input, Properties properties, Map<String, Map<String, Map<String, String>>> ignoreMap) static String
static String
removeKeysAndContentBetweenKeys
(String string, String key1, String key2) static String
removeRegularExpression
(String string, String regex) static String
replaceKey
(String string, String from, String to) static String
replaceRegularExpression
(String string, String from, String to) static TestRunStatus
runScenarios
(jakarta.servlet.ServletContext servletContext, jakarta.servlet.http.HttpServletRequest request, Writer out) runScenarios
(String execute, TestExecutionObserver testExecutionObserver, LarvaWriter writer) static TestRunStatus
runScenarios
(org.springframework.context.ApplicationContext applicationContext, Writer writer, String execute) void
warningMessage
(String message) void
static void
-
Field Details
-
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:
-
-
Constructor Details
-
LarvaTool
public LarvaTool(org.springframework.context.ApplicationContext applicationContext, LarvaConfig larvaConfig)
-
-
Method Details
-
createInstance
-
createInstance
public static LarvaTool createInstance(org.springframework.context.ApplicationContext applicationContext) -
runScenarios
public static TestRunStatus runScenarios(jakarta.servlet.ServletContext servletContext, jakarta.servlet.http.HttpServletRequest request, Writer out) -
runScenarios
public static TestRunStatus runScenarios(org.springframework.context.ApplicationContext applicationContext, Writer writer, String execute) -
runScenarios
public TestRunStatus runScenarios(String execute, TestExecutionObserver testExecutionObserver, LarvaWriter writer) - Returns:
TestRunStatus
with result of test
-
createTestRunStatus
-
createScenarioRunner
@Nonnull public ScenarioRunner createScenarioRunner(TestExecutionObserver testExecutionObserver, TestRunStatus testRunStatus) -
debugMessage
-
infoMessage
-
warningMessage
-
errorMessage
-
errorMessage
-
getMessagesAtLevel
Larva API calls that do not provide an output-writer can collect relevant log messages for the user to be returned via the API from the message list.- Parameters:
level
- Minimum level to be returned- Returns:
- List of LarvaMessages
-
getActiveScenariosDirectory
Get the scenario directory selected as default Active with the currentLarvaConfig
- Returns:
- Active Scenario Directory
-
flushOutput
public void flushOutput() -
windiff
public void windiff(String expectedFileName, String result, String expected) throws IOException, SenderException - Throws:
IOException
SenderException
-
writeFile
- Throws:
IOException
-
messageToString
Read the message into a string. If the message had no data, return an empty string. If there was an error reading the message, return null and show an error message in the Larva output. If the message was read as part of a step, the caller should returnRESULT_ERROR
.- Parameters:
message
- Message to read- Returns:
- Message data, or "" if the message was empty. Returns NULL if there was an error reading the message.
-
compareResult
-
prepareResultForCompare
-
doActionBetweenKeys
-
doActionWithSingleKey
-
ignoreContentBetweenKeys
-
ignoreKeysAndContentBetweenKeys
-
removeKeysAndContentBetweenKeys
-
ignoreKey
-
removeKey
-
replaceKey
-
decodeUnzipContentBetweenKeys
-
canonicaliseFilePathContentBetweenKeys
-
ignoreCurrentTimeBetweenKeys
-
formatDecimalContentBetweenKeys
-
ignoreContentBeforeKey
-
ignoreContentAfterKey
-
ignoreRegularExpression
-
removeRegularExpression
-
replaceRegularExpression
-
formatString
Replace all linefeed-characters with the platform-specific linefeed-character for the current platform. -
mapPropertiesToIgnores
public static Map<String,Map<String, mapPropertiesToIgnoresMap<String, String>>> (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:
- Mapinvalid input: '<'String, Mapinvalid input: '<'String, Mapinvalid input: '<'String, String>>> as Mapinvalid input: '<''ignoreContentBetweenKeys', Mapinvalid input: '<''fieldA', Mapinvalid input: '<''key1', '
'>
-
findAttributesForIgnore
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'
-