diff --git a/source/src/main/java/org/cerberus/core/engine/gwt/impl/PropertyService.java b/source/src/main/java/org/cerberus/core/engine/gwt/impl/PropertyService.java index a568582e4..4b1546407 100644 --- a/source/src/main/java/org/cerberus/core/engine/gwt/impl/PropertyService.java +++ b/source/src/main/java/org/cerberus/core/engine/gwt/impl/PropertyService.java @@ -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; @@ -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. diff --git a/source/src/main/java/org/cerberus/core/service/sql/impl/SQLService.java b/source/src/main/java/org/cerberus/core/service/sql/impl/SQLService.java index aa198b7dc..b9ffcf69c 100644 --- a/source/src/main/java/org/cerberus/core/service/sql/impl/SQLService.java +++ b/source/src/main/java/org/cerberus/core/service/sql/impl/SQLService.java @@ -443,7 +443,12 @@ public AnswerList> 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 . - 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);