Package org.frankframework.larva
Class LarvaTool
java.lang.Object
org.frankframework.larva.LarvaTool
- Author:
- Jaco de Groot
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionLarvaTool(org.springframework.context.ApplicationContext applicationContext, LarvaConfig larvaConfig) -
Method Summary
Modifier and TypeMethodDescriptioncanonicaliseFilePathContentBetweenKeys(String string, String key1, String key2) intcompareResult(TestExecutionObserver testExecutionObserver, Scenario scenario, Step step, String fileName, Message expectedResultMessage, Message actualResultMessage) static LarvaToolcreateInstance(jakarta.servlet.ServletContext servletContext) static LarvaToolcreateInstance(org.springframework.context.ApplicationContext applicationContext) createScenarioRunner(TestExecutionObserver testExecutionObserver, TestRunStatus testRunStatus) voiddebugMessage(String message) decodeUnzipContentBetweenKeys(String string, String key1, String key2, boolean replaceNewlines) static StringdoActionBetweenKeys(String key, String value, Properties properties, Map<String, Map<String, Map<String, String>>> ignoreMap, LarvaTool.BetweenKeysAction action) static StringdoActionWithSingleKey(String keyName, String value, Properties properties, Map<String, Map<String, Map<String, String>>> ignoreMap, LarvaTool.SingleKeyAction action) voiderrorMessage(String message) voiderrorMessage(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().voidformatDecimalContentBetweenKeys(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 currentLarvaConfiggetMessagesAtLevel(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 StringignoreContentAfterKey(String string, String key) static StringignoreContentBeforeKey(String string, String key) static StringignoreContentBetweenKeys(String string, String key1, String key2) ignoreCurrentTimeBetweenKeys(String string, String key1, String key2, String pattern, String margin, boolean errorMessageOnRemainingString, boolean isControlString) static Stringstatic StringignoreKeysAndContentBetweenKeys(String string, String key1, String key2) static StringignoreRegularExpression(String string, String regex) voidinfoMessage(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 Stringstatic StringremoveKeysAndContentBetweenKeys(String string, String key1, String key2) static StringremoveRegularExpression(String string, String regex) static StringreplaceKey(String string, String from, String to) static StringreplaceRegularExpression(String string, String from, String to) static TestRunStatusrunScenarios(jakarta.servlet.ServletContext servletContext, jakarta.servlet.http.HttpServletRequest request, Writer out) runScenarios(String execute, TestExecutionObserver testExecutionObserver, LarvaWriter writer) static TestRunStatusrunScenarios(org.springframework.context.ApplicationContext applicationContext, Writer writer, String execute) voidwarningMessage(String message) voidstatic 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:
TestRunStatuswith 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:
IOExceptionSenderException
-
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'
-