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 TypeFieldDescriptionprotected static int
static final int
static final int
static final int
-
Constructor Summary
ConstructorsConstructorDescriptionLarvaTool
(org.springframework.context.ApplicationContext applicationContext, LarvaConfig larvaConfig, LarvaWriter writer, TestExecutionObserver testExecutionObserver) -
Method Summary
Modifier and TypeMethodDescriptioncanonicaliseFilePathContentBetweenKeys
(String string, String key1, String key2) int
compareResult
(Scenario scenario, String step, String stepDisplayName, String fileName, String stepSaveFileName, Message expectedResultMessage, Message actualResultMessage, Properties properties) static LarvaTool
createInstance
(jakarta.servlet.ServletContext servletContext, jakarta.servlet.http.HttpServletRequest request, Writer out) static LarvaTool
createInstance
(org.springframework.context.ApplicationContext applicationContext, OutputStream out) static LarvaTool
createInstance
(org.springframework.context.ApplicationContext ibisContext, Writer out) 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.void
debugMessage
(String message) decodeUnzipContentBetweenKeys
(String string, String key1, String key2, boolean replaceNewlines) doActionBetweenKeys
(String key, String value, Properties properties, Map<String, Map<String, Map<String, String>>> ignoreMap, LarvaTool.BetweenKeysAction action) 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().formatDecimalContentBetweenKeys
(String string, String key1, String key2) formatString
(String string) Replace all linefeed-characters with the platform-specific linefeed-character for the current platform.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) 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 application, jakarta.servlet.http.HttpServletRequest request, Writer out) runScenarios
(String execute) static TestRunStatus
runScenarios
(org.springframework.context.ApplicationContext applicationContext, LarvaConfig config, LarvaWriter out, TestExecutionObserver testExecutionObserver, String execute) static void
setTimeout
(int newTimeout) 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:
-
globalTimeoutMillis
protected static int globalTimeoutMillis
-
-
Constructor Details
-
LarvaTool
public LarvaTool(org.springframework.context.ApplicationContext applicationContext, LarvaConfig larvaConfig, LarvaWriter writer, TestExecutionObserver testExecutionObserver)
-
-
Method Details
-
createInstance
public static LarvaTool createInstance(org.springframework.context.ApplicationContext applicationContext, OutputStream out) -
createInstance
-
createInstance
-
setTimeout
public static void setTimeout(int newTimeout) -
runScenarios
public static TestRunStatus runScenarios(jakarta.servlet.ServletContext application, jakarta.servlet.http.HttpServletRequest request, Writer out) -
runScenarios
public static TestRunStatus runScenarios(org.springframework.context.ApplicationContext applicationContext, LarvaConfig config, LarvaWriter out, TestExecutionObserver testExecutionObserver, String execute) -
runScenarios
- Returns:
- negative: error condition 0: all scenarios passed positive: number of scenarios that failed
-
createScenarioRunner
-
debugMessage
-
errorMessage
-
warningMessage
-
errorMessage
-
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
-
createParametersMapFromParamProperties
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- Returns:
- A map with parameters
-
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'
-