Skip to content

Commit

Permalink
Merge origin/master
Browse files Browse the repository at this point in the history
  • Loading branch information
vertigo17 committed Jan 17, 2024
2 parents 549726d + 6f1c323 commit 5d75b00
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.jayway.jsonpath.InvalidPathException;

import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.cerberus.core.crud.entity.AppService;
Expand Down Expand Up @@ -1693,7 +1695,14 @@ private TestCaseExecutionData property_getFromDataLib(TestCaseExecutionData test
// Value of testCaseExecutionData object takes the master subdata entry "".
String value = result.get(0).get("");
if (value == null) {
testCaseExecutionData.setValue(VALUE_NULL);
final boolean ignoreNonMatchedSubdata = parameterService.getParameterBooleanByKey("cerberus_testdatalib_ignoreNonMatchedSubdata", StringUtils.EMPTY, false);
if (ignoreNonMatchedSubdata) {
final String defaultSubdataValue = ignoreNonMatchedSubdata ? parameterService.getParameterStringByKey("cerberus_testdatalib_subdataDefaultValue", StringUtils.EMPTY, StringUtils.EMPTY) : StringUtils.EMPTY;
LOG.debug("Unmatched columns parsing enabled: Null answer received from service call of datalib '{}' with default value", () -> testDataLib.getName());
testCaseExecutionData.setValue(defaultSubdataValue);
} else {
testCaseExecutionData.setValue(VALUE_NULL);
}
} else {
testCaseExecutionData.setValue(value);
// Converting HashMap to json.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,12 @@ public AnswerList<HashMap<String, String>> queryDatabaseNColumns(String connecti
try {
String valueSQL = resultSet.getString(column);
if (valueSQL == null) { // If data is null from the database, we convert it to the static string <NULL>.
valueSQL = PropertyService.VALUE_NULL;
if (ignoreNoMatchColumns) {
LOG.debug("Unmatched columns parsing enabled: Fill null value for column '{}' with default value", () -> name);
valueSQL = defaultNoMatchColumnValue;
} else {
valueSQL = PropertyService.VALUE_NULL;
}
}
if (columnsToHide.contains(name)) {
execution.appendSecret(valueSQL);
Expand Down

0 comments on commit 5d75b00

Please sign in to comment.