Commit db48f901 authored by József Gyürüsi's avatar József Gyürüsi
Browse files

[CR #1696842] CLL: Provide specific error code for dataSource SetDataValue...


[CR #1696842] CLL: Provide specific error code for dataSource SetDataValue handler when set request is faulty but handled

Change-Id: I61a65a0850268d89daf1200c08b4b93ff9875687
Signed-off-by: József Gyürüsi's avatarJózsef Gyürüsi <jozsef.gyurusi@ericsson.com>
parent c4e0505f
......@@ -1915,7 +1915,7 @@ private function f_EPTF_DataSourceClient_handleSetDataValue(
);
}
if (vl_dataValueResponse.errorCode != 0) {
if (vl_dataValueResponse.errorCode < 0) {
// try to find getData handler:
if (f_EPTF_str2int_HashMap_Find(v_EPTF_DataSourceClient_dataHandlerHash,vl_handlerIdStr,vl_handlerId)) {
// calling handler: v_fcb_EPTF_DataSourceClient_dataHandler_List[vl_handlerId]
......
......@@ -1641,9 +1641,13 @@ type function fcb_EPTF_DataSourceClient_dataValueHandler(
// For elementary type values this argument is not used
//
// Return Value:
// integer - error code (0 of OK, non zero if unsuccessful:
// integer - error code (0 if OK, non zero if unsuccessful:
// e.g. invalid parameters given in pl_params, or data is read-only.
// If error code is not zero pl_dataValue can be used to provide textual error message)
// For negative error codes the getDataHandlers registered by <f_EPTF_DataSourceClient_registerData>
// are also called to get the EPTF Variable name to process the request, since the value of any data source
// that have getDataHandler might also be set (if the corresponding variable can be adjusted with the value to be set)
// For positive error codes, the getDataHandlers are not called for the same request.
// If error code is positive pl_dataValue can be used to provide textual error message)
//
// Detailed Comments:
// This function is called when <f_EPTF_DataSource_setDataValue> is requested
......
......@@ -204,7 +204,7 @@ module EPTF_CLL_DsRestAPI_Timeline_Functions {
vl_errorCode := f_EPTF_DsRestAPI_Timeline_AppendFromFile(pl_dataValue.charstringVal, pl_dataValue);
} else {
pl_dataValue := {charstringVal := "Charstring value expected"};
vl_errorCode := -5;
vl_errorCode := 5;
}
}
case (c_DsRestAPI_Timeline_dataElementAppendFromJSON) {
......@@ -212,7 +212,7 @@ module EPTF_CLL_DsRestAPI_Timeline_Functions {
vl_errorCode := f_EPTF_DsRestAPI_Timeline_AppendFromJson(char2oct(pl_params[0].paramValue), pl_dataValue);
} else {
pl_dataValue := {charstringVal := "Charstring value expected"};
vl_errorCode := -5;
vl_errorCode := 5;
}
}
case (c_DsRestAPI_Timeline_dataElementClear) {
......@@ -235,7 +235,7 @@ module EPTF_CLL_DsRestAPI_Timeline_Functions {
vl_errorCode := 0;
} else {
pl_dataValue := {charstringVal := "Boolean value expected"};
vl_errorCode := -5;
vl_errorCode := 5;
}
}
case else {}
......@@ -695,4 +695,4 @@ module EPTF_CLL_DsRestAPI_Timeline_Functions {
return true;
}
}
\ No newline at end of file
}
......@@ -369,18 +369,18 @@ group EPTF_DataSource_TestFunctions {
( pl_dataElement != c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_Value
and pl_dataElement != c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName
and pl_dataElement != c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_List)) {
return 1; //incorrect param
return -1; //incorrect param
}
if (pl_dataElement == c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_Value or pl_dataElement == c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName) {
if (not ischosen(pl_dataValue.intVal)) {
return 2; //incorrect value
return -2; //incorrect value
}
}
if (pl_dataElement == c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_List) {
if (not ischosen(pl_dataValue.integerlistVal)) {
return 2; //incorrect value
return -2; //incorrect value
}
}
......@@ -392,7 +392,7 @@ group EPTF_DataSource_TestFunctions {
if (pl_dataElement == c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName or pl_dataElement == c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_List) {
if (pl_result[0] == "") {
return 1; //incorrect param
return -1; //incorrect param
}
}
......@@ -1166,15 +1166,19 @@ group EPTF_DataSource_TestFunctions {
) runs on EPTF_DataSourceClient_CT return integer {
if (not match(pl_dataElement,pattern "value*")) {
pl_dataValue := {charstringVal := log2str(%definitionId&": Custom warning: Wrong element name for DataSource "&pl_dataSource&": ",pl_dataElement)};
return 2; // invalid element name
return -2; // invalid element name
}
if (sizeof(pl_params)!=3) {
pl_dataValue := {charstringVal := log2str(%definitionId&": Custom warning: Wrong number of params for Element "&pl_dataElement)};
return 1; // invalid number of params
return -1; // invalid number of params
}
if (pl_params[0].paramName == "read-only") {
pl_dataValue := {charstringVal := log2str(%definitionId&": Custom warning: Data is read-only for ",pl_dataElement, " params: ", pl_params)};
return 2; // read-only value
return -2; // read-only value
}
if (pl_params[0].paramName == "read-only-2") {
pl_dataValue := {charstringVal := log2str(%definitionId&": Custom warning: Data is read-only for ",pl_dataElement, " params: ", pl_params)};
return 2; // read-only value, getData handler is not called
}
// store value in pl_dataValue:
//.... do nothing, (it is not stored)
......@@ -2895,6 +2899,35 @@ function f_EPTF_CLL_DataSource_test_DummySource_setDataValue_withValueHandler(in
f_EPTF_Base_stopAll(none);
}
// check read-only:
vl_dataValue := {charstringlistVal :={"a","b"}};
vl_errorCode := f_EPTF_DataSource_setDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "value_element-2",
pl_params := {
{
paramName := "read-only-2",
paramValue := "v21"
},
{
paramName := "P21",
paramValue := "v22"
},
{
paramName := "P21",
paramValue := "v23"
}
}
);
// data should be read-only
if (vl_errorCode!=2) {
setverdict(fail,"Wrong error code for DataSource, it should be read-only: 'value_element-2'");
f_EPTF_Base_stopAll(none);
}
//check nonexistent source:
vl_dataValue := {charstringlistVal :={"a","b"}};
vl_errorCode := f_EPTF_DataSource_setDataValue(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment