blob: 00d0431084184d9d0992a661c206481bec618f51 [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2000-2019 Ericsson Telecom AB //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v2.0 //
// which accompanies this distribution, and is available at //
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// Module: EPTF_DataSource_Test_Functions
//
// Purpose:
// This module provides functions for testing GUIDataSource
//
// Module depends on:
// -
//
// Current Owner:
// TitanSim Group
//
// Last Review Date:
// -
//
// Detailed Comments:
// Provide functions to test GUIDataSource
//
//
///////////////////////////////////////////////////////////////
module EPTF_DataSource_Test_Functions
{
import from EPTF_CLL_Common_Definitions all;
import from EPTF_CLL_Base_Functions all;
import from EPTF_CLL_Variable_Definitions all;
import from EPTF_CLL_Variable_Functions all;
import from EPTF_DataSource_Test_Definitions all;
import from EPTF_CLL_UIHandler_WidgetFunctions all;
import from EPTF_CLL_UIHandler_Definitions all;
import from EPTF_CLL_DataSource_Definitions all;
import from EPTF_CLL_DataSource_Functions all;
import from EPTF_CLL_DataSourceClient_Functions all;
import from EPTF_CLL_Logging_Functions all;
import from EPTF_CLL_DataSource_Definitions all;
group EPTF_DataSource_TestFunctions {
///////////////////////////////////////////////////////////
// Testcase: f_EPTF_GUIDataSource_Test_ServerBehavior
//
// Purpose:
//
// Parameters:
//
///////////////////////////////////////////////////////////
public function f_EPTF_CLL_DataSource_Test_serverBehavior()
runs on EPTF_DataSource_CT
{
f_EPTF_DataSource_init_CT("GUIDataSourceServer");
timer t;
t.start(26.0);
alt {
[] t.timeout {}
}
f_EPTF_Base_wait4Shutdown();
//f_EPTF_Base_cleanup_CT();
}
///////////////////////////////////////////////////////////
// Testcase: f_EPTF_GUIDataSource_Test_ClientBehavior
//
// Purpose:
//
// Parameters:
//
///////////////////////////////////////////////////////////
public function f_EPTF_CLL_DataSource_Test_clientBehavior( in charstring pl_dataProviderName,
in EPTF_DataSource_CT pl_server,
in charstring pl_selfName := "GUIDataSource Client")
runs on EPTF_CLL_DataSource_Client_CT
{
f_EPTF_Var_init_CT(pl_selfName);
f_EPTF_DataSourceClient_init_CT(pl_selfName, pl_server);
//f_EPTF_DataSourceClient_registerIterator(pl_dataProviderName, "", refers(f_EPTF_CLL_DataSource_preProcessor));
f_EPTF_DataSourceClient_registerData(pl_dataProviderName, "", refers(f_EPTF_CLL_DataSource_preProcessorData));
var integer vl_idx;
var EPTF_CharstringList vl_cList := {};
f_EPTF_Var_newCharstring(c_EPTF_CLL_DataSource_Test_var_prefix & "ch1","Initvalue for charstring variable",vl_idx);
vl_cList[sizeof(vl_cList)] := "ch1";
f_EPTF_Var_newCharstring(c_EPTF_CLL_DataSource_Test_var_prefix & "ch2","Initvalue for charstring variable second",vl_idx);
vl_cList[sizeof(vl_cList)] := "ch2";
f_EPTF_Var_newFloat(c_EPTF_CLL_DataSource_Test_var_prefix & "fl1",3.14,vl_idx);
vl_cList[sizeof(vl_cList)] := "fl1";
f_EPTF_Var_newBool(c_EPTF_CLL_DataSource_Test_var_prefix & "bool1",true,vl_idx);
vl_cList[sizeof(vl_cList)] := "bool1";
f_EPTF_Var_newInt(c_EPTF_CLL_DataSource_Test_var_prefix & "int1",7890,vl_idx);
vl_cList[sizeof(vl_cList)] := "int1";
f_EPTF_Var_newCharstringlistRef(c_EPTF_CLL_DataSource_Test_var_prefix & "allVar", vl_cList ,vl_idx);
vl_cList := {"LGen1", "LGen2", "LGen3"}
f_EPTF_Var_newCharstringlistRef(c_EPTF_CLL_DataSource_Test_var_prefix & "LGens", vl_cList ,vl_idx);
vl_cList := {"Scens1", "Scens2", "Scens3"}
f_EPTF_Var_newCharstringlistRef(c_EPTF_CLL_DataSource_Test_var_prefix & "Scens", vl_cList ,vl_idx);
vl_cList := {"TC1", "TC2", "TC3"}
f_EPTF_Var_newCharstringlistRef(c_EPTF_CLL_DataSource_Test_var_prefix & "TCs", vl_cList ,vl_idx);
f_EPTF_DataSourceClient_registerData("LGenBase", "LGen1", refers(f_EPTF_CLL_DataSource_preProcessorData));
f_EPTF_DataSourceClient_registerData("LGenBase", "LGen2", refers(f_EPTF_CLL_DataSource_preProcessorData));
f_EPTF_DataSourceClient_registerData("LGenBase", "LGen3", refers(f_EPTF_CLL_DataSource_preProcessorData));
timer t;
t.start(26.0);
alt {
[] t.timeout {}
}
f_EPTF_Base_cleanup_CT();
}
public function f_EPTF_CLL_DataSource_preProcessorData( out charstring pl_dataVarName,
in charstring pl_source,
in charstring pl_ptcName,
in charstring pl_element,
in EPTF_DataSource_Params pl_params
) runs on EPTF_CLL_DataSource_Client_CT return integer{
//TODO pl_dataProviderName-nak kene lennie, le ken menteni, hogy mi kik vagyunk...
action(" f_EPTF_CLL_DataSource_preProcessorData ");
action("1: " & pl_source & " 2: " & pl_ptcName & " 3: " & pl_element);
if(pl_source != "ExecCtrl" and pl_source != "LGenBase"){
setverdict(fail , "Wrong datasource: " & pl_source);
return -1;
}
select( true ){
case(pl_element == "allVar"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "allVar"
return 0;
}
case(pl_element == "allVarand other"){
//Iterator is valid, but result is empty
pl_dataVarName := "";
return 0;
}
case(pl_element == "LGens"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "allVar"
return 0;
}
case(pl_element == "EntityGroups"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "allVar"
return 0;
}
case(pl_element == "LGenList"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "LGens"
return 0;
}
case(pl_element == "EntityCount"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "int1"
return 0;
}
case(pl_element == "LGens"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "allVar"
return 0;
}
case(pl_element == "Scenarios"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "Scens"
return 0;
}
case(pl_element == "TrafficCases"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "TCs"
return 0;
}
case(pl_element == "TCName"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "ch2"
return 0;
}
case(pl_element == "TCEnabled"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "bool1"
return 0;
}
case(pl_element == "TCStateName"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "ch2"
return 0;
}
case(pl_element == "ch1"){
if(pl_params[0].paramValue == "x"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "ch1"
} else {
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "ch2"
}
return 0;
}
case(pl_element == "fl1"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "fl1"
return 0;
}
case(pl_element == "bool1"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "bool1"
return 0;
}
case(pl_element == "int1"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "int1"
return 0;
}
case(pl_element == "bool2"){
pl_dataVarName := "";
return 0;
}
case else { //error, no rule for that
pl_dataVarName := "";
action("Unhandled request type in f_EPTF_UIHandler_validateElementId!");
return -1;
}
}
}
group GetDataFromClient {
// behaviour of main DS component
function f_EPTF_CLL_DataSourceClient_Test_mainDSBehaviour(in charstring pl_selfName) runs on EPTF_DataSource_CT {
f_EPTF_DataSource_init_CT(pl_selfName);
f_EPTF_Base_wait4Shutdown();
}
const charstring c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName := "DSOwner";
const charstring c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName := "DataElement";
const charstring c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName2 := "DataElement2";
const charstring c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_List := "DataElement_List";
const charstring c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_ListString := "DataElement_ListString";
const charstring c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_ListFloat := "DataElement_ListFloat";
const charstring c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_Value := "DataElement_Value";
const charstring c_EPTF_CLL_DataSourceClient_Test_DSOwnerDataVarName := "DataVarName";
const charstring c_EPTF_CLL_DataSourceClient_Test_DSOwnerMethodName := "Method1";
const charstring c_EPTF_CLL_DataSourceClient_Test_DSOwnerMethod2Name := "Method2";
const integer c_EPTF_CLL_DataSourceClient_Test_BuiltInDataValue := 11;
const EPTF_IntegerList c_EPTF_CLL_DataSourceClient_Test_DSOwnerListInit := {0,1,2,3,4,5,6,7,8,9};
const EPTF_CharstringList c_EPTF_CLL_DataSourceClient_Test_DSOwnerListStringInit := {"alma", "korte", "szilva", "szolo", "dinnye"};
const EPTF_FloatList c_EPTF_CLL_DataSourceClient_Test_DSOwnerListFloatInit := {0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0};
const EPTF_IntegerList c_EPTF_CLL_DataSourceClient_Test_BuiltInDataValueList := {9, 8, 7, 6};
const charstring c_EPTF_CLL_DataSourceClient_Test_DSOwnerValueHandlerParam := "ValueHandlerParam";
const charstring c_EPTF_CLL_DataSourceClient_Test_DSOwnerValueHandlerParam2 := "ValueHandlerParam2";
function f_EPTF_CLL_DataSourceClient_Test_dsOwnerBehaviour(in charstring pl_selfName, in EPTF_DataSource_CT pl_sourceCompRef, in charstring pl_errMessage := "", in charstring pl_warningMessage := "") runs on EPTF_CLL_DataSource_Client_CT {
f_EPTF_DataSourceClient_init_CT(pl_selfName,pl_sourceCompRef);
var integer vl_varIdx;
f_EPTF_Var_newInt(c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName&"."&c_EPTF_CLL_DataSourceClient_Test_DSOwnerDataVarName,0,vl_varIdx);
f_EPTF_Var_newInt(c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName2&"."&c_EPTF_CLL_DataSourceClient_Test_DSOwnerDataVarName,2,vl_varIdx);
f_EPTF_Var_newIntegerlist(c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_List&"."&c_EPTF_CLL_DataSourceClient_Test_DSOwnerDataVarName, c_EPTF_CLL_DataSourceClient_Test_DSOwnerListInit, vl_varIdx);
f_EPTF_Var_newCharstringlist(c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_ListString&"."&c_EPTF_CLL_DataSourceClient_Test_DSOwnerDataVarName, c_EPTF_CLL_DataSourceClient_Test_DSOwnerListStringInit, vl_varIdx);
f_EPTF_Var_newFloatlist(c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_ListFloat&"."&c_EPTF_CLL_DataSourceClient_Test_DSOwnerDataVarName, c_EPTF_CLL_DataSourceClient_Test_DSOwnerListFloatInit, vl_varIdx);
f_EPTF_DataSourceClient_registerCondition(c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName, f_EPTF_Base_selfName(), refers(f_EPTF_CLL_DataSourceClient_conditionHandler), c_EPTF_CLL_DataSourceClient_Test_DSOwnerMethodName);
f_EPTF_DataSourceClient_registerCondition(c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName, f_EPTF_Base_selfName(), refers(f_EPTF_CLL_DataSourceClient_conditionHandler), c_EPTF_CLL_DataSourceClient_Test_DSOwnerMethod2Name);
f_EPTF_DataSourceClient_registerData(c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName, f_EPTF_Base_selfName(), refers(f_EPTF_CLL_DataSourceClient_mainDSServer));
f_EPTF_DataSourceClient_registerDataValue(c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName, f_EPTF_Base_selfName(), refers(f_EPTF_CLL_DataSourceClient_getValueHandler));
f_EPTF_DataSourceClient_registerSetDataValue(c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName, f_EPTF_Base_selfName(), refers(f_EPTF_CLL_DataSourceClient_setValueHandler));
if (pl_errMessage != "") {
f_EPTF_Base_setNegativeTestMode();
f_EPTF_Base_setExpectedErrorMsg(pl_errMessage);
}
if (pl_warningMessage != "") {
f_EPTF_Logging_setExpectedWarningMsg(pl_warningMessage);
}
f_EPTF_Base_wait4Shutdown();
}
public function f_EPTF_CLL_DataSourceClient_mainDSServer(
out charstring pl_dataVarName,
in charstring pl_source,
in charstring pl_ptcName,
in charstring pl_element,
in EPTF_DataSource_Params pl_params
) runs on EPTF_CLL_DataSource_Client_CT return integer {
if (pl_source!=c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName
or (pl_element != c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName
and pl_element != c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName2
and pl_element != c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_List
and pl_element != c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_ListString
and pl_element != c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_ListFloat)
) {
return 1; // incorrect params
}
//check for built in error
var EPTF_CharstringList pl_result := {}
f_EPTF_DataSource_extractParams(pl_params,
{c_TestNonBlocking_BuiltIn_Error_paramName},
pl_result
);
if (pl_result[0] != "") {
pl_dataVarName := "error on demand";
return 2; // error on demand
}
pl_dataVarName := pl_element&"."&c_EPTF_CLL_DataSourceClient_Test_DSOwnerDataVarName;
return 0;
}
public function f_EPTF_CLL_DataSourceClient_getValueHandler(
out EPTF_Var_DirectContent pl_dataValue,
in charstring pl_dataSource,
in charstring pl_ptcName,
in charstring pl_element,
in EPTF_DataSource_Params pl_params
) runs on EPTF_DataSourceClient_CT return integer {
if (pl_dataSource != c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName or
(pl_element != c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_Value
and pl_element != c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName
and pl_element != c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_List)) {
return 1; //incorrect param
}
//set new value
var integer vl_toSet := c_EPTF_CLL_DataSourceClient_Test_BuiltInDataValue;
var EPTF_CharstringList vl_result := {}
f_EPTF_DataSource_extractParams(pl_params,
{c_EPTF_CLL_DataSourceClient_Test_DSOwnerValueHandlerParam, c_EPTF_CLL_DataSourceClient_Test_DSOwnerValueHandlerParam2},
vl_result
);
var integer vl_results := sizeof(vl_result);
for(var integer i := 0; i < vl_results; i := i + 1)
{
if (vl_result[i] != "") {
vl_toSet := vl_toSet + str2int(vl_result[i]);
}
}
if (pl_element == c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName or pl_element == c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_List) {
if (vl_result[0] == "") {
return 1; //incorrect param
}
}
if (pl_element == c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_List) {
pl_dataValue := {integerlistVal := c_EPTF_CLL_DataSourceClient_Test_BuiltInDataValueList};
} else {
pl_dataValue := {intVal := vl_toSet};
}
return 0;
}
function f_EPTF_CLL_DataSourceClient_setValueHandler(
inout EPTF_Var_DirectContent pl_dataValue,
in charstring pl_dataSource,
in charstring pl_ptcName,
in charstring pl_dataElement,
in EPTF_DataSource_Params pl_params,
in EPTF_IntegerList pl_indexList
) runs on EPTF_DataSourceClient_CT return integer {
if (pl_dataSource != c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName or
( 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
}
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
}
}
if (pl_dataElement == c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_List) {
if (not ischosen(pl_dataValue.integerlistVal)) {
return -2; //incorrect value
}
}
var EPTF_CharstringList pl_result := {};
f_EPTF_DataSource_extractParams(pl_params,
{c_EPTF_CLL_DataSourceClient_Test_DSOwnerValueHandlerParam},
pl_result
);
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
}
}
if (pl_dataElement == c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName_List) {
pl_dataValue := {integerlistVal := pl_indexList};
} else {
//set new value
var integer vl_toSet := pl_dataValue.intVal;
if (pl_result[0] != "") {
vl_toSet := vl_toSet + str2int(pl_result[0]);
}
pl_dataValue := {intVal := vl_toSet};
}
return 0;
}
function f_EPTF_CLL_DataSourceClient_conditionHandler(
out boolean pl_conditionValue,
in charstring pl_source,
in charstring pl_ptcName,
in charstring pl_method,
in EPTF_DataSource_Params pl_params
) runs on EPTF_CLL_DataSource_Client_CT return integer {
if (pl_source!=c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName
or (pl_method != c_EPTF_CLL_DataSourceClient_Test_DSOwnerMethodName and pl_method != c_EPTF_CLL_DataSourceClient_Test_DSOwnerMethod2Name)) {
return 1; // incorrect params
}
if (pl_method == c_EPTF_CLL_DataSourceClient_Test_DSOwnerMethodName) {
pl_conditionValue := true;
} else if (pl_method == c_EPTF_CLL_DataSourceClient_Test_DSOwnerMethod2Name) {
pl_conditionValue := false;
}
return 0;
}
function f_EPTF_CLL_DataSourceClient_Test_dsRequesterBehaviour(in charstring pl_selfName, in EPTF_DataSource_CT pl_sourceCompRef) runs on EPTF_CLL_DataSource_Client_CT {
f_EPTF_DataSourceClient_init_CT(pl_selfName,pl_sourceCompRef);
var charstring vl_dataVarName;
f_EPTF_DataSourceClient_getData(
pl_dataVarName := vl_dataVarName,
pl_source := c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName,
pl_ptcName := "",
pl_element := c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName,
pl_params := {{"paramX", "valueX"}, {"paramA", "valueA"}} // they are not in lexical order!
);
if (f_EPTF_Var_getId(vl_dataVarName)==-1) {
setverdict(fail, "Returned data variable name is incorrect.")
f_EPTF_Base_stopAll(none);
}
// check the value:
if (0!=f_EPTF_Var_getIntValue(f_EPTF_Var_getId(vl_dataVarName))) {
setverdict(fail, "Inital value of the variable is incorrect. Expecting 0, got: ",f_EPTF_Var_getIntValue(f_EPTF_Var_getId(vl_dataVarName)))
f_EPTF_Base_stopAll(none);
}
// check the checkData function:
var charstring vl_dataVarName_check;
var integer vl_errorCode := f_EPTF_DataSourceClient_checkData(
pl_dataVarName := vl_dataVarName_check,
pl_source := c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName,
pl_ptcName := "",
pl_element := c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName,
pl_params := {{"paramX", "valueX"}, {"paramA", "valueA"}}
);
if (vl_errorCode!=0) {
setverdict(fail, "CheckData returned an error: ",vl_errorCode)
f_EPTF_Base_stopAll(none);
}
if (vl_dataVarName != vl_dataVarName_check) {
setverdict(fail, "CheckData returned an invalid variable name: ",vl_dataVarName_check,". Should be: ",vl_dataVarName)
f_EPTF_Base_stopAll(none);
}
// check data for datalement2"
var charstring vl_dataVarName2_check;
vl_errorCode := f_EPTF_DataSourceClient_checkData(
pl_dataVarName := vl_dataVarName2_check,
pl_source := c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName,
pl_ptcName := "",
pl_element := c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName2,
pl_params := {}
);
if (vl_errorCode!=0) {
setverdict(fail, "CheckData returned an error: ",vl_errorCode)
f_EPTF_Base_stopAll(none);
}
// if (f_EPTF_Var_getId(vl_dataVarName2_check)!=-1) {
// setverdict(fail, "The local variable exists on local component while subscription was not performed by DataSource.")
// f_EPTF_Base_stopAll(none);
// }
var charstring vl_dataVarName2;
f_EPTF_DataSourceClient_getData(
pl_dataVarName := vl_dataVarName2,
pl_source := c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName,
pl_ptcName := "",
pl_element := c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName2,
pl_params := {}
);
if (f_EPTF_Var_getId(vl_dataVarName2)==-1) {
setverdict(fail, "Returned data variable name is incorrect.")
f_EPTF_Base_stopAll(none);
}
// check the value:
if (2!=f_EPTF_Var_getIntValue(f_EPTF_Var_getId(vl_dataVarName2))) {
setverdict(fail, "Inital value of the variable is incorrect. Expecting 2, got: ",f_EPTF_Var_getIntValue(f_EPTF_Var_getId(vl_dataVarName2)))
f_EPTF_Base_stopAll(none);
}
if (vl_dataVarName2 != vl_dataVarName2_check) {
setverdict(fail, "CheckData returned an invalid variable name: ",vl_dataVarName2_check,". Should be: ",vl_dataVarName2)
f_EPTF_Base_stopAll(none);
}
setverdict(pass);
f_EPTF_Base_stopAll(none);
}
function f_EPTF_CLL_DataSourceClient_Test_dsRequesterBehaviour_getDataValue(in charstring pl_selfName, in EPTF_DataSource_CT pl_sourceCompRef) runs on EPTF_CLL_DataSource_Client_CT {
f_EPTF_DataSourceClient_init_CT(pl_selfName,pl_sourceCompRef);
var EPTF_Var_DirectContent vl_dataValue;
f_EPTF_DataSourceClient_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName,
pl_ptcName := "",
pl_element := c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName,
pl_params := {{"paramX", "valueX"}, {"paramA", "valueA"}} // they are not in lexical order!
);
// check the value:
if (vl_dataValue != {intVal := 0}) {
setverdict(fail, "Inital value of the variable is incorrect. Expecting 0, got: ",vl_dataValue)
f_EPTF_Base_stopAll(none);
}
var EPTF_Var_DirectContent vl_dataValue2;
f_EPTF_DataSourceClient_getDataValue(
pl_dataValue := vl_dataValue2,
pl_source := c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName,
pl_ptcName := "",
pl_element := c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName2,
pl_params := {}
);
// check the value:
if (vl_dataValue2 != {intVal := 2}) {
setverdict(fail, "Inital value of the variable is incorrect. Expecting 2, got: ",vl_dataValue2)
f_EPTF_Base_stopAll(none);
}
setverdict(pass);
f_EPTF_Base_stopAll(none);
}
function f_EPTF_CLL_DataSourceClient_Test_dsRequesterBehaviour_setDataValue(in charstring pl_selfName, in EPTF_DataSource_CT pl_sourceCompRef) runs on EPTF_CLL_DataSource_Client_CT {
f_EPTF_DataSourceClient_init_CT(pl_selfName,pl_sourceCompRef);
var EPTF_Var_DirectContent vl_dataValue;
f_EPTF_DataSourceClient_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName,
pl_ptcName := "",
pl_element := c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName,
pl_params := {{"paramX", "valueX"}, {"paramA", "valueA"}} // they are not in lexical order!
);
// check the value:
if (vl_dataValue != {intVal := 0}) {
setverdict(fail, "Inital value of the variable is incorrect. Expecting 0, got: ",vl_dataValue)
f_EPTF_Base_stopAll(none);
}
vl_dataValue := {intVal := 1}
f_EPTF_DataSourceClient_setDataValue(
pl_dataValue := vl_dataValue,
pl_source := c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName,
pl_ptcName := "",
pl_element := c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName,
pl_params := {{"paramX", "valueX"}, {"paramA", "valueA"}} // they are not in lexical order!
);
// check the value:
if (vl_dataValue != {intVal := 1}) {
setverdict(fail, "Updated value of the variable is incorrect. Expecting 1, got: ",vl_dataValue)
f_EPTF_Base_stopAll(none);
}
f_EPTF_DataSourceClient_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName,
pl_ptcName := "",
pl_element := c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName,
pl_params := {{"paramX", "valueX"}, {"paramA", "valueA"}} // they are not in lexical order!
);
// check the value:
if (vl_dataValue != {intVal := 1}) {
setverdict(fail, "Value after getDataValue of the variable is incorrect. Expecting 1, got: ",vl_dataValue)
f_EPTF_Base_stopAll(none);
}
var EPTF_Var_DirectContent vl_dataValue2;
f_EPTF_DataSourceClient_getDataValue(
pl_dataValue := vl_dataValue2,
pl_source := c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName,
pl_ptcName := "",
pl_element := c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName2,
pl_params := {}
);
// check the value:
if (vl_dataValue2 != {intVal := 2}) {
setverdict(fail, "Inital value of the variable is incorrect. Expecting 2, got: ",vl_dataValue2)
f_EPTF_Base_stopAll(none);
}
vl_dataValue2 := {intVal := 3}
f_EPTF_DataSourceClient_setDataValue(
pl_dataValue := vl_dataValue2,
pl_source := c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName,
pl_ptcName := "",
pl_element := c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName2,
pl_params := {}
);
// check the value:
if (vl_dataValue2 != {intVal := 3}) {
setverdict(fail, "New value of the variable is incorrect. Expecting 3, got: ",vl_dataValue2)
f_EPTF_Base_stopAll(none);
}
f_EPTF_DataSourceClient_getDataValue(
pl_dataValue := vl_dataValue2,
pl_source := c_EPTF_CLL_DataSourceClient_Test_DSOwnerSourceName,
pl_ptcName := "",
pl_element := c_EPTF_CLL_DataSourceClient_Test_DSOwnerElementName2,
pl_params := {}
);
// check the value:
if (vl_dataValue2 != {intVal := 3}) {
setverdict(fail, "Value after getDataValue of the variable is incorrect. Expecting 3, got: ",vl_dataValue2)
f_EPTF_Base_stopAll(none);
}
setverdict(pass);
f_EPTF_Base_stopAll(none);
}
} // group GetDataFromClient
group GUITest{
public function f_EPTF_CLL_DataSourceGUI_Test_clientBehavior( in EPTF_DataSource_CT pl_server)
runs on EPTF_CLL_DataSource_Client_CT
{
var integer vl_idx;
f_EPTF_Var_init_CT("GUIDataSource Client");
f_EPTF_DataSourceClient_init_CT("GUIDataSourceClient", pl_server);
var EPTF_CharstringList vl_cList := {"LGen1", "LGen2", "LGen3"}
f_EPTF_Var_newCharstringlist(c_EPTF_CLL_DataSource_Test_var_prefix & "LGens", vl_cList ,vl_idx);
vl_cList := {"EG1", "EG2", "EG3"}
f_EPTF_Var_newCharstringlist(c_EPTF_CLL_DataSource_Test_var_prefix & "EntityGroups", vl_cList ,vl_idx);
vl_cList := {"SC1", "SC2", "SC3"}
f_EPTF_Var_newCharstringlist(c_EPTF_CLL_DataSource_Test_var_prefix & "Scenarios", vl_cList ,vl_idx);
f_EPTF_Var_newInt(c_EPTF_CLL_DataSource_Test_var_prefix & "ECount1", 101, vl_idx)
f_EPTF_Var_newInt(c_EPTF_CLL_DataSource_Test_var_prefix & "ECount2", 102, vl_idx)
f_EPTF_Var_newInt(c_EPTF_CLL_DataSource_Test_var_prefix & "ECount3", 103, vl_idx)
f_EPTF_DataSourceClient_registerData("LGenBase", "LGen1", refers(f_EPTF_CLL_DataSourceGUI_preProcessorData));
f_EPTF_DataSourceClient_registerData("LGenBase", "LGen2", refers(f_EPTF_CLL_DataSourceGUI_preProcessorData));
f_EPTF_DataSourceClient_registerData("LGenBase", "LGen3", refers(f_EPTF_CLL_DataSourceGUI_preProcessorData));
f_EPTF_DataSourceClient_registerData("ExecCtrl", "LGen1", refers(f_EPTF_CLL_DataSourceGUI_preProcessorData));
f_EPTF_DataSourceClient_registerData("ExecCtrl", "" , refers(f_EPTF_CLL_DataSourceGUI_preProcessorData));
f_EPTF_Base_wait4Shutdown();
f_EPTF_Base_stopAll();
}
public function f_EPTF_CLL_DataSourceGUI_preProcessorData( out charstring pl_dataVarName,
in charstring pl_source,
in charstring pl_ptcName,
in charstring pl_element,
in EPTF_DataSource_Params pl_params
) runs on EPTF_CLL_DataSource_Client_CT return integer{
action(%definitionId&": ",pl_source, ",",pl_element)
select( true ){
case(pl_element == "LGenList"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "LGens"
return 0;
}
case(pl_element == "EntityGroups"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "EntityGroups"
return 0;
}
case(pl_element == "Scenarios"){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "Scenarios"
return 0;
}
case(pl_element == "EntityCount"){
select( true ){
case ( pl_params[0].paramValue == "EG1" ){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "ECount1"
return 0;
}
case ( pl_params[0].paramValue == "EG2" ){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "ECount2"
return 0;
}
case ( pl_params[0].paramValue == "EG3" ){
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "ECount3"
return 0;
}
}
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "Scenarios"
return 0;
}
}
return -1;
}
}
function f_EPTF_DataSourceClient_behaviour(
in charstring pl_dataProviderName,
in EPTF_DataSource_CT pl_dataSourceCompRef,
in charstring pl_selfName := "EPTF_CLL_DataSourceClient_Test"
) runs on EPTF_CLL_DataSource_Client_CT {
f_EPTF_DataSourceClient_init_CT(pl_selfName,pl_dataSourceCompRef);
f_EPTF_DataSourceClient_registerData(
pl_source := pl_dataProviderName,
pl_ptcName := f_EPTF_Base_selfName(),
pl_dataHandler := refers(f_EPTF_DataSourceClient_testIteratorHandler)
);
f_EPTF_Base_wait4Shutdown();
}
function f_EPTF_DataSourceClient_testIteratorHandler(
out charstring pl_dataVarName,
in charstring pl_dataSource,
in charstring pl_ptcName,
in charstring pl_dataElement,
in EPTF_DataSource_Params pl_params
) runs on EPTF_DataSourceClient_CT return integer {
pl_dataVarName := "IteratorVarName"&pl_dataElement&log2str(pl_params);
var integer vl_varIdx;
//create iterator var if not exist for test
if (f_EPTF_Var_getId(pl_dataVarName)==-1) {
f_EPTF_Var_newCharstringlist(pl_dataVarName,{"3","4"},vl_varIdx);
}
return 0;
}
function f_EPTF_DataSourceClient_CheckParamOrder_IteratorHandler(
out charstring pl_dataVarName,
in charstring pl_dataSource,
in charstring pl_ptcName,
in charstring pl_dataElement,
in EPTF_DataSource_Params pl_params
) runs on EPTF_DataSourceClient_CT return integer {
if (sizeof(pl_params)!=2) {
pl_dataVarName := log2str(%definitionId&": Custom warning: Wrong number of params for Element "&pl_dataElement);
return 1; // invalid number of params
}
pl_dataVarName := "IteratorVarName"&pl_dataElement&log2str(pl_params);
var integer vl_varIdx;
//create iterator var if not exist for test
var EPTF_CharstringList vl_dataValue := {};
for(var integer i:=0; i<sizeof(pl_params);i:=i+1) {
vl_dataValue := vl_dataValue&{pl_params[i].paramValue};
}
if (f_EPTF_Var_getId(pl_dataVarName)==-1) {
f_EPTF_Var_newCharstringlist(pl_dataVarName,vl_dataValue,vl_varIdx);
if (pl_params[0].paramName == "read-only") {
// set it to read-only:
var EPTF_Var_ProviderLocal vl_localProvider := {
{null,{0},{}}
}
f_EPTF_Var_subscribeLocal(vl_varIdx,vl_localProvider);
}
}
return 0;
}
function f_EPTF_DataSourceClient_getDataTest_dataHandler(
out charstring pl_dataVarName,
in charstring pl_dataSource,
in charstring pl_ptcName,
in charstring pl_dataElement,
in EPTF_DataSource_Params pl_params
) runs on EPTF_DataSourceClient_CT return integer {
if (not match(pl_dataElement,pattern "data*")) {
pl_dataVarName := log2str(%definitionId&": Custom warning: Wrong element name for DataSource "&pl_dataSource&": ",pl_dataElement);
return 2; // invalid element name
}
if (sizeof(pl_params)!=2) {
pl_dataVarName := log2str(%definitionId&": Custom warning: Wrong number of params for Element "&pl_dataElement);
return 1; // invalid number of params
}
pl_dataVarName := "IteratorVarName"&pl_dataElement&log2str(pl_params);
var integer vl_varIdx;
//create iterator var if not exist for test
var EPTF_CharstringList vl_dataValue := {};
for(var integer i:=0; i<sizeof(pl_params);i:=i+1) {
vl_dataValue := vl_dataValue&{pl_params[i].paramValue};
}
if (f_EPTF_Var_getId(pl_dataVarName)==-1) {
f_EPTF_Var_newCharstringlist(pl_dataVarName,vl_dataValue,vl_varIdx);
if (pl_params[0].paramName == "read-only") {
// set it to read-only:
var EPTF_Var_ProviderLocal vl_localProvider := {
{null,{0},{}}
}
f_EPTF_Var_subscribeLocal(vl_varIdx,vl_localProvider);
}
}
return 0;
}
function f_EPTF_DataSourceClient_CheckParamOrder_IteratorValueHandler(
out EPTF_Var_DirectContent pl_dataValue,
in charstring pl_dataSource,
in charstring pl_ptcName,
in charstring pl_dataElement,
in EPTF_DataSource_Params pl_params
) 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
}
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
}
pl_dataValue := {charstringlistVal :={}};
for(var integer i:=0; i<sizeof(pl_params);i:=i+1) {
pl_dataValue := {charstringlistVal := pl_dataValue.charstringlistVal&{pl_params[i].paramValue}};
}
return 0;
}
// the help database for DummySource
const EPTF_DataSource_Help_DataElementChildren c_EPTF_DataSource_helpTest := {
{
dataElement := {
name := c_EPTF_DataSource_dataElement_Help,
valueType := charstringType,
description := "This data element returns the help information about all dataElements supported in DummySource",
parameters := {
{
name := c_EPTF_DataSource_paramNameHelpFormat,
typeDescriptor := {
valueType := charstringType
},
description := "The format of the output. Valid values: "
&c_EPTF_DataSource_helpFormatJSON&" , "&c_EPTF_DataSource_helpFormatTEXT
&". Default: "&c_EPTF_DataSource_helpFormatJSON,
exampleValue := c_EPTF_DataSource_helpFormatTEXT
}
}
},
children := {}
},
{
dataElement := {
name := "ElementWithUnspecifiedTypeDescr",
valueType := charstringType,
description := "Help dataelement test with unspecified typeDescriptor",
parameters := {
}
},
children := {}
},
{
dataElement := {
name := "ElementWith_TypeDescr==omit",
valueType := charstringType,
typeDescriptor := omit,
description := "Help dataelement test with typeDescriptor==omit",
parameters := {
}
},
children := {}
},
{
dataElement := {
name := "ElementListOfItem",
valueType := charstringType,
typeDescriptor := {
isListOf := true,
typeName := "Item"
},
description := "Help dataelement test with isListOf==true",
parameters := {
}
},
children := {}
},
{
dataElement := {
name := "SingleItem",
valueType := charstringType,
typeDescriptor := {
isListOf := false,
typeName := "Item"
},
description := "Help dataelement test with isListOf==false",
parameters := {
}
},
children := {}
},
{
dataElement := {
name := "SingleItemWithOmit",
valueType := charstringType,
typeDescriptor := {
isListOf := omit,
typeName := "Item"
},
description := "Help dataelement test with isListOf==omit",
parameters := {
}
},
children := {}
},
{
dataElement := {
name := "SingleItemListNotSpecified",
valueType := charstringType,
typeDescriptor := {
typeName := "Item"
},
description := "Help dataelement test with unspecified isListOf",
parameters := {
}
},
children := {}
},
{
dataElement := {
name := "ParamTypeDescr==valueType",
valueType := charstringType,
description := "Help dataelement parameter test",
parameters := {
{
name := c_EPTF_DataSource_paramNameHelpFormat,
typeDescriptor := {
valueType := charstringType
},
description := "Parameter with ParamTypeDescr==valueType",
exampleValue := c_EPTF_DataSource_helpFormatTEXT
}
}
},
children := {}
},
{
dataElement := {
name := "ParamTypeDescr==reference_isListOf_unspecified",
valueType := charstringType,
description := "Help dataelement parameter test",
parameters := {
{
name := c_EPTF_DataSource_paramNameHelpFormat,
typeDescriptor := {
reference := {
typeName := "ParamType"
}
},
description := "Parameter with ParamTypeDescr==reference isIndexInListOf unspecified",
exampleValue := c_EPTF_DataSource_helpFormatTEXT
}
}
},
children := {}
},
{
dataElement := {
name := "ParamTypeDescr==reference_isIndexInListOf==omit",
valueType := charstringType,
description := "Help dataelement parameter test",
parameters := {
{
name := c_EPTF_DataSource_paramNameHelpFormat,
typeDescriptor := {
reference := {
isIndexInListOf := omit,
typeName := "ParamType"
}
},
description := "Parameter with ParamTypeDescr==reference isIndexInListOf==omit",
exampleValue := c_EPTF_DataSource_helpFormatTEXT
}
}
},
children := {}
},
{
dataElement := {
name := "ParamTypeDescr==reference_isIndexInListOf==false",
valueType := charstringType,
description := "Help dataelement parameter test",
parameters := {
{
name := c_EPTF_DataSource_paramNameHelpFormat,
typeDescriptor := {
reference := {
isIndexInListOf := false,
typeName := "ParamType"
}
},
description := "Parameter with ParamTypeDescr==reference isIndexInListOf==false",
exampleValue := c_EPTF_DataSource_helpFormatTEXT
}
}
},
children := {}
},
{
dataElement := {
name := "ParamTypeDescr==reference_isIndexInListOf==true",
valueType := charstringType,
description := "Help dataelement parameter test",
parameters := {
{
name := c_EPTF_DataSource_paramNameHelpFormat,
typeDescriptor := {
reference := {
isIndexInListOf := true,
typeName := "ParamType"
}
},
description := "Parameter with ParamTypeDescr==reference isIndexInListOf==true",
exampleValue := c_EPTF_DataSource_helpFormatTEXT
}
}
},
children := {}
}
}
function f_EPTF_DataSourceClient_getHelpDataValueTest(in charstring pl_source, in charstring pl_element, in charstring pl_expectedPattern := "") runs on EPTF_CLL_DataSource_Source_CT {
var EPTF_Var_DirectContent vl_helpFromGetDataValueTEXT;
var EPTF_Var_DirectContent vl_helpFromGetDataValueJSON;
f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_helpFromGetDataValueTEXT,
pl_source := c_EPTF_DataSource_sourceId,
pl_ptcName := "",
pl_element := c_EPTF_DataSource_dataElement_Help,
pl_params := {
{
paramName := c_EPTF_DataSource_paramNameHelpFormat,
paramValue := c_EPTF_DataSource_helpFormatTEXT
},
{
paramName := c_EPTF_DataSource_paramNameSource,
paramValue := pl_source
},
{
paramName := c_EPTF_DataSource_paramNameElement,
paramValue := pl_element
}
}
);
f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_helpFromGetDataValueJSON,
pl_source := c_EPTF_DataSource_sourceId,
pl_ptcName := "",
pl_element := c_EPTF_DataSource_dataElement_Help,
pl_params := {
{
paramName := c_EPTF_DataSource_paramNameHelpFormat,
paramValue := c_EPTF_DataSource_helpFormatJSON
},
{
paramName := c_EPTF_DataSource_paramNameSource,
paramValue := pl_source
},
{
paramName := c_EPTF_DataSource_paramNameElement,
paramValue := pl_element
}
}
);
action("Help string in TEXT format from getDataValue: ", vl_helpFromGetDataValueTEXT);
action("Help string in JSON format from getDataValue: ", vl_helpFromGetDataValueJSON);
var charstring vl_filtered;
var octetstring vl_filteredJSON;
vl_filtered := f_EPTF_DataSource_getHelpTEXT(pl_source,pl_element);
action("Help for all DS: ", vl_filtered);
vl_filteredJSON := f_EPTF_DataSource_getHelpJSON(pl_source,pl_element);
action("HelpJSON for all DS: ", vl_filteredJSON);
if (not ischosen(vl_helpFromGetDataValueTEXT.charstringVal) or vl_helpFromGetDataValueTEXT.charstringVal!=vl_filtered or vl_filtered == "" ) {
setverdict(fail, "TEXT help is incorrect");
}
if (not ischosen(vl_helpFromGetDataValueJSON.octetstringVal) or vl_helpFromGetDataValueJSON.octetstringVal!=vl_filteredJSON) {
setverdict(fail, "JSON help is incorrect");
}
if (pl_expectedPattern!="") {
// check if the TEXT help contains the pattern:
if(not match(vl_filtered,pattern pl_expectedPattern)) {
setverdict(fail,"The TEXT help does not match the expected pattern: ", match(vl_filtered,pattern pl_expectedPattern));
}
}
}
function f_EPTF_DataSource_getHelpApidocTest(in charstring pl_source, in charstring pl_element, in charstring pl_expectedPattern := "") runs on EPTF_CLL_DataSource_Source_CT {
var charstring vl_apidocHelp := f_EPTF_DataSource_getHelpApidoc(
pl_source := pl_source,
pl_element := pl_element
);
action("APIDoc Help string: ", vl_apidocHelp);
if (pl_expectedPattern!="") {
// check if the TEXT help contains the pattern:
if(not match(vl_apidocHelp,pattern pl_expectedPattern)) {
setverdict(fail,"The APIDoc help text does not match the expected pattern: ", match(vl_apidocHelp,pattern pl_expectedPattern));
}
}
}
function f_EPTF_DataSourceClient_helpHandlerTest(
out EPTF_Var_DirectContent pl_dataValue,
in charstring pl_dataSource,
in charstring pl_ptcName,
in charstring pl_dataElement,
in EPTF_DataSource_Params pl_params
) runs on EPTF_DataSourceClient_CT return integer {
if (pl_dataElement!=c_EPTF_DataSource_dataElement_Help) {
pl_dataValue := {charstringVal := log2str(%definitionId&": Custom warning: Wrong element name for DataSource "&pl_dataSource&": ",pl_dataElement)};
return 2; // invalid element name
}
return f_EPTF_DataSource_handleHelp(pl_dataValue,pl_dataSource,pl_params,c_EPTF_DataSource_helpTest);
}
function f_EPTF_DataSourceClient_CheckParamOrder_IteratorSetValueHandler(
inout EPTF_Var_DirectContent pl_dataValue,
in charstring pl_dataSource,
in charstring pl_ptcName,
in charstring pl_dataElement,
in EPTF_DataSource_Params pl_params,
in EPTF_IntegerList pl_indexList
) 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
}
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
}
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
}
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)
return 0;
}
function f_EPTF_DataSourceClient_getCondition_handler_isEqual(
out boolean pl_conditionValue,
in charstring pl_dataSource,
in charstring pl_ptcName,
in charstring pl_method,
in EPTF_DataSource_Params pl_params
) runs on EPTF_DataSourceClient_CT return integer {
if (sizeof(pl_params)!=2) {
return 1; // invalid number of params
}
pl_conditionValue := (pl_params[0].paramValue == pl_params[1].paramValue);
return 0;
}
function f_EPTF_DataSourceClient_getCondition_handler_isNotEqual(
out boolean pl_conditionValue,
in charstring pl_dataSource,
in charstring pl_ptcName,
in charstring pl_method,
in EPTF_DataSource_Params pl_params
) runs on EPTF_DataSourceClient_CT return integer {
if (sizeof(pl_params)!=2) {
return 1; // invalid number of params
}
pl_conditionValue := (pl_params[0].paramValue != pl_params[1].paramValue);
return 0;
}
function f_EPTF_DataSourceClient_getCondition_behaviour(in charstring pl_dataProviderName, in EPTF_DataSource_CT pl_dataSourceCompRef) runs on EPTF_CLL_DataSource_Client_CT {
f_EPTF_DataSourceClient_init_CT("EPTF_CLL_DataSourceClient_Test",pl_dataSourceCompRef);
// register with specified name:
f_EPTF_DataSourceClient_registerCondition(
pl_source := pl_dataProviderName,
pl_ptcName := f_EPTF_Base_selfName(),
pl_conditionHandler := refers(f_EPTF_DataSourceClient_getCondition_handler_isEqual),
pl_method := "isEqual"
);
// register with default name:
f_EPTF_DataSourceClient_registerCondition(
pl_source := pl_dataProviderName,
pl_ptcName := f_EPTF_Base_selfName(),
pl_conditionHandler := refers(f_EPTF_DataSourceClient_getCondition_handler_isNotEqual)
);
f_EPTF_Base_wait4Shutdown();
}
///////////////////////////////////////////////////////////
// Testcase: f_EPTF_GUIDataSource_Test_ClientBehavior
//
// Purpose:
//
// Parameters:
//
///////////////////////////////////////////////////////////
public function f_EPTF_CLL_DataSource_Test_CheckGUIVariable_Manual_clientBehavior( in charstring pl_clientName,
in EPTF_DataSource_CT pl_server)
runs on EPTF_CLL_DataSource_Test_Client_CT
{
f_EPTF_Var_init_CT(pl_clientName);
f_EPTF_DataSourceClient_init_CT(pl_clientName, pl_server);
//f_EPTF_DataSourceClient_registerIterator(pl_dataProviderName, "", refers(f_EPTF_CLL_DataSource_preProcessor));
var integer vl_idx;
var EPTF_CharstringList vl_cList := {};
f_EPTF_Var_newCharstring(c_EPTF_CLL_DataSource_Test_var_prefix & "ch1","Initvalue for charstring variable",vl_idx);
vl_cList[sizeof(vl_cList)] := "ch1";
f_EPTF_Var_newCharstring(c_EPTF_CLL_DataSource_Test_var_prefix & "ch2","Initvalue for charstring variable second",vl_idx);
vl_cList[sizeof(vl_cList)] := "ch2";
f_EPTF_Var_newFloat(c_EPTF_CLL_DataSource_Test_var_prefix & "fl1",3.14,vl_idx);
vl_cList[sizeof(vl_cList)] := "fl1";
f_EPTF_Var_newBool(c_EPTF_CLL_DataSource_Test_var_prefix & "bool1",true,vl_idx);
vl_cList[sizeof(vl_cList)] := "bool1";
f_EPTF_Var_newInt(c_EPTF_CLL_DataSource_Test_var_prefix & "int1",7890,vl_idx);
vl_cList[sizeof(vl_cList)] := "int1";
f_EPTF_Var_newCharstringlistRef(c_EPTF_CLL_DataSource_Test_var_prefix & "allVar", vl_cList ,vl_idx);
vl_cList[sizeof(vl_cList)] := "allVar";
f_EPTF_DataSourceClient_registerData("VarProvider", pl_clientName, refers(f_EPTF_CLL_DataSource_CheckGUIVariable_Manual_preProcessorData));
t_periodicUpdate.start;
activate(as_EPTF_CLL_DataSource_CheckGUIVariable_Manual_handleVarUpdates());
f_EPTF_Base_wait4Shutdown();
}
private altstep as_EPTF_CLL_DataSource_CheckGUIVariable_Manual_handleVarUpdates() runs on EPTF_CLL_DataSource_Test_Client_CT {
var integer vl_varIdx;
var float vl_currentTime := f_EPTF_Base_getRelTimeInSecs();
[] t_periodicUpdate.timeout {
vl_varIdx := f_EPTF_Var_getId(c_EPTF_CLL_DataSource_Test_var_prefix & "ch1");
f_EPTF_Var_adjustContent(vl_varIdx, {charstringVal := float2str(vl_currentTime)});
vl_varIdx := f_EPTF_Var_getId(c_EPTF_CLL_DataSource_Test_var_prefix & "ch2");
f_EPTF_Var_adjustContent(vl_varIdx, {charstringVal := int2str(float2int(vl_currentTime))});
vl_varIdx := f_EPTF_Var_getId(c_EPTF_CLL_DataSource_Test_var_prefix & "fl1");
f_EPTF_Var_adjustContent(vl_varIdx, {floatVal := vl_currentTime});
vl_varIdx := f_EPTF_Var_getId(c_EPTF_CLL_DataSource_Test_var_prefix & "bool1");
f_EPTF_Var_adjustContent(vl_varIdx, {boolVal := (float2int(vl_currentTime*1000.0) rem 2)==0});
vl_varIdx := f_EPTF_Var_getId(c_EPTF_CLL_DataSource_Test_var_prefix & "int1");
f_EPTF_Var_adjustContent(vl_varIdx, {intVal := float2int(vl_currentTime)});
t_periodicUpdate.start;
repeat;
}
}
private function f_EPTF_CLL_DataSource_CheckGUIVariable_Manual_preProcessorData(
out charstring pl_dataVarName,
in charstring pl_source,
in charstring pl_ptcName,
in charstring pl_element,
in EPTF_DataSource_Params pl_params
) runs on EPTF_CLL_DataSource_Test_Client_CT return integer {
if (pl_source!="VarProvider") {
return 1;
}
if (pl_element=="VarList") {
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "allVar";
return 0;
}
if (pl_element=="VarValue") {
if (sizeof(pl_params)!=1) {
return 21;
}
if (-1 == f_EPTF_Var_getId(c_EPTF_CLL_DataSource_Test_var_prefix & pl_params[0].paramValue)) {
return 22;
}
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & pl_params[0].paramValue;
return 0;
}
return 2;
}
public function f_EPTF_CLL_DataSource_dummy_DataSourceHandler(
out charstring pl_dataVarName,
in charstring pl_source,
in charstring pl_ptcName,
in charstring pl_element,
in EPTF_DataSource_Params pl_params
) runs on EPTF_DataSourceClient_CT return integer {
if (pl_source!="VarProvider") {
return 1;
}
if (pl_element=="VarExists") {
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "yesVar";
return 0;
}
if (pl_element=="VarDoesNotExist") {
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "NoVar";
return 0;
}
if (pl_element=="VarValue") {
var EPTF_CharstringList vl_needed := {"Param1", "Param2"};
var EPTF_CharstringList vl_result;
if (0 == f_EPTF_DataSource_getParams(pl_params,vl_needed,vl_result)) {
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "VarValue" &"."& vl_result[0] &"."& vl_result[1];
return 0;
}
}
return 2;
}
} //end of group
group CheckDistributionChart {
///////////////////////////////////////////////////////////
// Function: f_EPTF_CLL_DataSource_Test_CheckDistributionChart_Manual_clientBehavior
//
// Purpose:
//
// Parameters:
//
///////////////////////////////////////////////////////////
public function f_EPTF_CLL_DataSource_Test_CheckDistributionChart_Manual_clientBehavior( in charstring pl_clientName,
in EPTF_DataSource_CT pl_server)
runs on EPTF_CLL_DataSource_Test_Client_CT
{
f_EPTF_Var_init_CT(pl_clientName);
f_EPTF_DataSourceClient_init_CT(pl_clientName, pl_server);
//f_EPTF_DataSourceClient_registerIterator(pl_dataProviderName, "", refers(f_EPTF_CLL_DataSource_preProcessor));
var integer vl_idx;
f_EPTF_Var_newIntegerlist(c_EPTF_CLL_DataSource_Test_var_prefix & "iList1",{0,1,5,10,15,19,20,19,15,10,5,1,0,1,5,10,15,19,20,19,15,10,5,1,0},vl_idx);
f_EPTF_DataSourceClient_registerData("CheckDistributionChart_Provider", "", refers(f_EPTF_CLL_DataSource_CheckDistributionChart_Manual_preProcessorData));
t_periodicUpdate.start;
activate(as_EPTF_CLL_DataSource_CheckDistributionChart_Manual_handleVarUpdates());
f_EPTF_Base_wait4Shutdown();
}
private altstep as_EPTF_CLL_DataSource_CheckDistributionChart_Manual_handleVarUpdates() runs on EPTF_CLL_DataSource_Test_Client_CT {
var integer vl_varIdx;
var float vl_currentTime := f_EPTF_Base_getRelTimeInSecs();
[] t_periodicUpdate.timeout {
vl_varIdx := f_EPTF_Var_getId(c_EPTF_CLL_DataSource_Test_var_prefix & "iList1");
var EPTF_IntegerList vl_currentValue;
vl_currentValue := f_EPTF_Var_getIntegerlistValue(vl_varIdx);
var EPTF_IntegerList vl_newValue;
vl_newValue[0] := vl_currentValue[sizeof(vl_currentValue)-1];
for(var integer i := 1; i < sizeof(vl_currentValue); i := i + 1) {
vl_newValue[i] := vl_currentValue[ i - 1 ];
}
f_EPTF_Var_adjustContent(vl_varIdx, {integerlistVal := vl_newValue});
t_periodicUpdate.start;
repeat;
}
}
private function f_EPTF_CLL_DataSource_CheckDistributionChart_Manual_preProcessorData(
out charstring pl_dataVarName,
in charstring pl_source,
in charstring pl_ptcName,
in charstring pl_element,
in EPTF_DataSource_Params pl_params
) runs on EPTF_CLL_DataSource_Test_Client_CT return integer {
if (pl_source!="CheckDistributionChart_Provider") {
return 1;
}
if (pl_element != "Wave" and pl_params != {}) {
return 2;
}
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "iList1";
return 0;
}
} // group CheckDistributionChart
group CheckChart {
///////////////////////////////////////////////////////////
// Function: f_EPTF_CLL_DataSource_Test_CheckChart_Manual_clientBehavior
//
// Purpose:
//
// Parameters:
//
///////////////////////////////////////////////////////////
public function f_EPTF_CLL_DataSource_Test_CheckChart_Manual_clientBehavior( in charstring pl_clientName,
in EPTF_DataSource_CT pl_server)
runs on EPTF_CLL_DataSource_Test_Client_CT
{
f_EPTF_Var_init_CT(pl_clientName);
f_EPTF_DataSourceClient_init_CT(pl_clientName, pl_server);
//f_EPTF_DataSourceClient_registerIterator(pl_dataProviderName, "", refers(f_EPTF_CLL_DataSource_preProcessor));
var integer vl_idx;
f_EPTF_Var_newFloat(c_EPTF_CLL_DataSource_Test_var_prefix & "trace1",0.1,vl_idx);
f_EPTF_Var_newFloat(c_EPTF_CLL_DataSource_Test_var_prefix & "trace2",0.2,vl_idx);
f_EPTF_DataSourceClient_registerData("CheckChart_Provider", "", refers(f_EPTF_CLL_DataSource_CheckChart_Manual_preProcessorData));
timer t_wait:=2.0;
t_wait.start; t_wait.timeout;
t_periodicUpdate.start;
activate(as_EPTF_CLL_DataSource_CheckChart_Manual_handleVarUpdates());
f_EPTF_Base_wait4Shutdown();
}
private altstep as_EPTF_CLL_DataSource_CheckChart_Manual_handleVarUpdates() runs on EPTF_CLL_DataSource_Test_Client_CT {
var integer vl_varIdx;
var float vl_currentTime := f_EPTF_Base_getRelTimeInSecs();
var float vl_currentValue;
var float vl_newValue;
[] t_periodicUpdate.timeout {
vl_varIdx := f_EPTF_Var_getId(c_EPTF_CLL_DataSource_Test_var_prefix & "trace1");
vl_currentValue := f_EPTF_Var_getFloatValue(vl_varIdx);
vl_newValue := 4.0*vl_currentValue*(1.0-vl_currentValue);
f_EPTF_Var_adjustContent(vl_varIdx, {floatVal := vl_newValue});
// do not update second var => GUI should update even now
// vl_varIdx := f_EPTF_Var_getId(c_EPTF_CLL_DataSource_Test_var_prefix & "trace2");
// vl_currentValue := f_EPTF_Var_getFloatValue(vl_varIdx);
// vl_newValue := 3.8*vl_currentValue*(1.0-vl_currentValue);
// f_EPTF_Var_adjustContent(vl_varIdx, {floatVal := vl_newValue});
t_periodicUpdate.start;
repeat;
}
}
private function f_EPTF_CLL_DataSource_CheckChart_Manual_preProcessorData(
out charstring pl_dataVarName,
in charstring pl_source,
in charstring pl_ptcName,
in charstring pl_element,
in EPTF_DataSource_Params pl_params
) runs on EPTF_CLL_DataSource_Test_Client_CT return integer {
if (pl_source!="CheckChart_Provider") {
return 1;
}
if (pl_element != "ChartData" or sizeof(pl_params) != 1) {
return 2;
}
if (pl_params[0].paramValue == "trace1") {
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "trace1";
} else if (pl_params[0].paramValue == "trace2") {
pl_dataVarName := c_EPTF_CLL_DataSource_Test_var_prefix & "trace2";
} else {
return 3;
}
return 0;
}
} // group CheckChart
group EPTF_CLL_DataSource_Test {
function f_EPTF_CLL_DataSource_test_DummySource(in charstring pl_ptcName := "") runs on EPTF_DataSource_CT {
// Source: DummySource
var charstring vl_dataVarName;
var integer vl_errorCode := f_EPTF_DataSource_getData(
pl_dataVarName := vl_dataVarName,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "element1",
pl_params := {
{
paramName := "P1",
paramValue := "v1"
},
{
paramName := "P1",
paramValue := "v2"
}
}
);
// data should exist, and its value should be {"v1","v2"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(f_EPTF_Var_getId(vl_dataVarName) == -1) {
setverdict(fail,"DataSource variable ",vl_dataVarName," is not found, but it should be there");
f_EPTF_Base_stopAll(none);
}
if(f_EPTF_Var_getCharstringlistValue(f_EPTF_Var_getId(vl_dataVarName)) != {"v1","v2"}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
// checkData is called before getData:
vl_errorCode := f_EPTF_DataSource_checkData(
pl_dataVarName := vl_dataVarName,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "element2",
pl_params := {
{
paramName := "P21",
paramValue := "v21"
},
{
paramName := "P21",
paramValue := "v22"
}
}
);
// data should exist, and its value should be {"v21","v22"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
// // the variable should not exist:
// if(f_EPTF_Var_getId(vl_dataVarName) != -1) {
// setverdict(fail,"DataSource variable ",vl_dataVarName," is found, but it should not be there");
// f_EPTF_Base_stopAll(none);
// }
vl_errorCode := f_EPTF_DataSource_getData(
pl_dataVarName := vl_dataVarName,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "element2",
pl_params := {
{
paramName := "P21",
paramValue := "v21"
},
{
paramName := "P21",
paramValue := "v22"
}
}
);
// data should exist, and its value should be {"v21","v22"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(f_EPTF_Var_getId(vl_dataVarName) == -1) {
setverdict(fail,"DataSource variable ",vl_dataVarName," is not found, but it should be there");
f_EPTF_Base_stopAll(none);
}
if(f_EPTF_Var_getCharstringlistValue(f_EPTF_Var_getId(vl_dataVarName)) != {"v21","v22"}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
}
function f_EPTF_CLL_DataSource_test_DataSource(
in charstring pl_ptcName := "",
in EPTF_CharstringList vl_expectedSources := {},
in charstring pl_checkPTCsForSource := "",
in EPTF_CharstringList vl_expectedPTCs := {}
) runs on EPTF_DataSource_CT {
var charstring vl_dataVarName;
var integer vl_errorCode;
// Source: DataSource
vl_errorCode := f_EPTF_DataSource_getData(
pl_dataVarName := vl_dataVarName,
pl_source := "DataSource",
pl_ptcName := pl_ptcName,
pl_element := "Sources",
pl_params := {}
);
// data should exist, and its value should be {"DataSource","DummySource"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(f_EPTF_Var_getId(vl_dataVarName) == -1) {
setverdict(fail,"DataSource variable ",vl_dataVarName," is not found, but it should be there");
f_EPTF_Base_stopAll(none);
}
if(f_EPTF_Var_getCharstringlistValue(f_EPTF_Var_getId(vl_dataVarName)) != vl_expectedSources) {
setverdict(fail,"The value of the DataSource variable is wrong: ", f_EPTF_Var_getCharstringlistValue(f_EPTF_Var_getId(vl_dataVarName)),
"Expected: ", vl_expectedSources);
f_EPTF_Base_stopAll(none);
}
// checkData is called before getData:
vl_errorCode := f_EPTF_DataSource_checkData(
pl_dataVarName := vl_dataVarName,
pl_source := "DataSource",
pl_ptcName := pl_ptcName,
pl_element := "PTCs",
pl_params := {
{
paramName := "Source",
paramValue := pl_checkPTCsForSource
}
}
);
// data should exist, and its value should be {"DataSourceClient_getData_Test"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
// the variable should exist:
if(f_EPTF_Var_getId(vl_dataVarName) == -1) {
setverdict(fail,"DataSource variable ",vl_dataVarName," is not found, but it should be there");
f_EPTF_Base_stopAll(none);
}
vl_errorCode := f_EPTF_DataSource_getData(
pl_dataVarName := vl_dataVarName,
pl_source := "DataSource",
pl_ptcName := pl_ptcName,
pl_element := "PTCs",
pl_params := {
{
paramName := "Source",
paramValue := pl_checkPTCsForSource
}
}
);
// data should exist, and its value should be {"DataSourceClient_getData_Test"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(f_EPTF_Var_getId(vl_dataVarName) == -1) {
setverdict(fail,"DataSource variable ",vl_dataVarName," is not found, but it should be there");
f_EPTF_Base_stopAll(none);
}
if(f_EPTF_Var_getCharstringlistValue(f_EPTF_Var_getId(vl_dataVarName)) != vl_expectedPTCs) {
setverdict(fail,"The value of the DataSource variable is wrong: ",f_EPTF_Var_getCharstringlistValue(f_EPTF_Var_getId(vl_dataVarName))," Expected: ", vl_expectedPTCs);
f_EPTF_Base_stopAll(none);
}
}
function f_EPTF_CLL_DataSource_test_checkData_DummySource(in charstring pl_ptcName) runs on EPTF_DataSource_CT {
// Source: DummySource
if (pl_ptcName=="") {
setverdict(inconc,%definitionId&": PTC Name has to be specified");
f_EPTF_Base_stopAll(none);
}
var charstring vl_dataVarName;
// checkData is called before getData
// PTCName: "", "":
var integer vl_errorCode := f_EPTF_DataSource_checkData(
pl_dataVarName := vl_dataVarName,
pl_source := "DummySource",
pl_ptcName := "",
pl_element := "element2",
pl_params := {
{
paramName := "P21",
paramValue := "v21"
},
{
paramName := "P21",
paramValue := "v22"
}
}
);
// data should exist, and its value should be {"v21","v22"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
// // the variable should not exist:
// if(f_EPTF_Var_getId(vl_dataVarName) != -1) {
// setverdict(fail,"DataSource variable ",vl_dataVarName," is found, but it should not be there");
// f_EPTF_Base_stopAll(none);
// }
vl_errorCode := f_EPTF_DataSource_getData(
pl_dataVarName := vl_dataVarName,
pl_source := "DummySource",
pl_ptcName := "",
pl_element := "element2",
pl_params := {
{
paramName := "P21",
paramValue := "v21"
},
{
paramName := "P21",
paramValue := "v22"
}
}
);
// data should exist, and its value should be {"v21","v22"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(f_EPTF_Var_getId(vl_dataVarName) == -1) {
setverdict(fail,"DataSource variable ",vl_dataVarName," is not found, but it should be there");
f_EPTF_Base_stopAll(none);
}
if(f_EPTF_Var_getCharstringlistValue(f_EPTF_Var_getId(vl_dataVarName)) != {"v21","v22"}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
// checkData is called before getData
// PTCName: pl_ptcName, "":
vl_errorCode := f_EPTF_DataSource_checkData(
pl_dataVarName := vl_dataVarName,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "element3",
pl_params := {
{
paramName := "P31",
paramValue := "v31"
},
{
paramName := "P31",
paramValue := "v32"
}
}
);
// data should exist, and its value should be {"v31","v32"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
// // the variable should not exist:
// if(f_EPTF_Var_getId(vl_dataVarName) != -1) {
// setverdict(fail,"DataSource variable ",vl_dataVarName," is found, but it should not be there");
// f_EPTF_Base_stopAll(none);
// }
vl_errorCode := f_EPTF_DataSource_getData(
pl_dataVarName := vl_dataVarName,
pl_source := "DummySource",
pl_ptcName := "",
pl_element := "element3",
pl_params := {
{
paramName := "P31",
paramValue := "v31"
},
{
paramName := "P31",
paramValue := "v32"
}
}
);
// data should exist, and its value should be {"v31","v32"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(f_EPTF_Var_getId(vl_dataVarName) == -1) {
setverdict(fail,"DataSource variable ",vl_dataVarName," is not found, but it should be there");
f_EPTF_Base_stopAll(none);
}
if(f_EPTF_Var_getCharstringlistValue(f_EPTF_Var_getId(vl_dataVarName)) != {"v31","v32"}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
// checkData is called before getData
// PTCName: "", pl_ptcName:
vl_errorCode := f_EPTF_DataSource_checkData(
pl_dataVarName := vl_dataVarName,
pl_source := "DummySource",
pl_ptcName := "",
pl_element := "element4",
pl_params := {
{
paramName := "P41",
paramValue := "v41"
},
{
paramName := "P41",
paramValue := "v42"
}
}
);
// data should exist, and its value should be {"v41","v42"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
// // the variable should not exist:
// if(f_EPTF_Var_getId(vl_dataVarName) != -1) {
// setverdict(fail,"DataSource variable ",vl_dataVarName," is found, but it should not be there");
// f_EPTF_Base_stopAll(none);
// }
vl_errorCode := f_EPTF_DataSource_getData(
pl_dataVarName := vl_dataVarName,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "element4",
pl_params := {
{
paramName := "P41",
paramValue := "v41"
},
{
paramName := "P41",
paramValue := "v42"
}
}
);
// data should exist, and its value should be {"v41","v42"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(f_EPTF_Var_getId(vl_dataVarName) == -1) {
setverdict(fail,"DataSource variable ",vl_dataVarName," is not found, but it should be there");
f_EPTF_Base_stopAll(none);
}
if(f_EPTF_Var_getCharstringlistValue(f_EPTF_Var_getId(vl_dataVarName)) != {"v41","v42"}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
// checkData is called before getData
// PTCName: pl_ptcName, pl_ptcName:
vl_errorCode := f_EPTF_DataSource_checkData(
pl_dataVarName := vl_dataVarName,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "element5",
pl_params := {
{
paramName := "P51",
paramValue := "v51"
},
{
paramName := "P51",
paramValue := "v52"
}
}
);
// data should exist, and its value should be {"v51","v52"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
// // the variable should not exist:
// if(f_EPTF_Var_getId(vl_dataVarName) != -1) {
// setverdict(fail,"DataSource variable ",vl_dataVarName," is found, but it should not be there");
// f_EPTF_Base_stopAll(none);
// }
vl_errorCode := f_EPTF_DataSource_getData(
pl_dataVarName := vl_dataVarName,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "element5",
pl_params := {
{
paramName := "P51",
paramValue := "v51"
},
{
paramName := "P51",
paramValue := "v52"
}
}
);
// data should exist, and its value should be {"v51","v52"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(f_EPTF_Var_getId(vl_dataVarName) == -1) {
setverdict(fail,"DataSource variable ",vl_dataVarName," is not found, but it should be there");
f_EPTF_Base_stopAll(none);
}
if(f_EPTF_Var_getCharstringlistValue(f_EPTF_Var_getId(vl_dataVarName)) != {"v51","v52"}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
}
function f_EPTF_CLL_DataSource_test_DummySource_getDataValue(in charstring pl_ptcName := "") runs on EPTF_DataSource_CT {
// Source: DummySource
var EPTF_Var_DirectContent vl_dataValue;
var integer vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "dataelement1",
pl_params := {
{
paramName := "P1",
paramValue := "v1"
},
{
paramName := "P1",
paramValue := "v2"
}
}
);
// data should exist, and its value should be {"v1","v2"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {charstringlistVal := {"v1","v2"}}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "dataelement2",
pl_params := {
{
paramName := "P21",
paramValue := "v21"
},
{
paramName := "P21",
paramValue := "v22"
}
}
);
// data should exist, and its value should be {"v21","v22"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {charstringlistVal := {"v21","v22"}}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
//check invalid param:
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "dataelement1",
pl_params := {
{
paramName := "P1",
paramValue := "v1"
},
{
paramName := "P2",
paramValue := "v2"
},
{
paramName := "P3",
paramValue := "v3"
}
}
);
// data should not exist
if (vl_errorCode==0) {
setverdict(fail,"DataSource is found, but it should not be there. DataValue from DS: ", vl_dataValue);
f_EPTF_Base_stopAll(none);
}
//check nonexistent source:
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "NonExistentSource",
pl_ptcName := pl_ptcName,
pl_element := "dataelement1",
pl_params := {
{
paramName := "P1",
paramValue := "v1"
}
}
);
// data should not exist
if (vl_errorCode==0) {
setverdict(fail,"DataSource is found, but it should not be there. DataValue from DS: ", vl_dataValue);
f_EPTF_Base_stopAll(none);
}
// check getValue for condition:
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "isEqual",
pl_params := {
{
paramName := "P21",
paramValue := "v21"
},
{
paramName := "P21",
paramValue := "v21"
}
}
);
// data should exist, and its value should be true
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {boolVal := true}) {
setverdict(fail,"The value of the condition is wrong");
f_EPTF_Base_stopAll(none);
}
// check getValue for condition:
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "isEqual",
pl_params := {
{
paramName := "P21",
paramValue := "v21"
},
{
paramName := "P21",
paramValue := "v22"
}
}
);
// data should exist, and its value should be false
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {boolVal := false}) {
setverdict(fail,"The value of the condition is wrong");
f_EPTF_Base_stopAll(none);
}
// check getValue for condition with invalid par:
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "isEqual",
pl_params := {
{
paramName := "P21",
paramValue := "v21"
},
{
paramName := "P22",
paramValue := "v22"
},
{
paramName := "P23",
paramValue := "v23"
}
}
);
// data should not exist
if (vl_errorCode==0) {
setverdict(fail,"DataSource is found, but it should not be there. DataValue from DS: ", vl_dataValue);
f_EPTF_Base_stopAll(none);
}
}
function f_EPTF_CLL_DataSource_test_DummySource_getDataValue_withValueHandler(in charstring pl_ptcName := "") runs on EPTF_DataSource_CT {
// Source: DummySource
var EPTF_Var_DirectContent vl_dataValue;
var integer vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "value_element1",
pl_params := {
{
paramName := "P1",
paramValue := "v1"
},
{
paramName := "P1",
paramValue := "v2"
},
{
paramName := "P1",
paramValue := "v3"
}
}
);
// data should exist, and its value should be {"v1","v2", "v3"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {charstringlistVal := {"v1","v2","v3"}}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "value_element2",
pl_params := {
{
paramName := "P21",
paramValue := "v21"
},
{
paramName := "P21",
paramValue := "v22"
},
{
paramName := "P21",
paramValue := "v23"
}
}
);
// data should exist, and its value should be {"v21","v22","v23"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {charstringlistVal := {"v21","v22","v23"}}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "datavalue_element3",
pl_params := {
{
paramName := "P21",
paramValue := "v21"
},
{
paramName := "P21",
paramValue := "v22"
}
}
);
// data should exist (returned by getData handler, getValueHandler returns error:invalid element), and its value should be {"v21","v22"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {charstringlistVal := {"v21","v22"}}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "dataelement3b",
pl_params := {
{
paramName := "P21b",
paramValue := "v21b"
},
{
paramName := "P21b",
paramValue := "v22b"
}
}
);
// data should exist (returned by getData handler, getValueHandler returns error:invalid element), and its value should be {"v21b","v22b"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {charstringlistVal := {"v21b","v22b"}}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
//check invalid param:
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "value_element4",
pl_params := {
{
paramName := "P1",
paramValue := "v1"
}
}
);
// data should not exist
if (vl_errorCode==0) {
setverdict(fail,"DataSource is found, but it should not be there. DataValue from DS: ", vl_dataValue);
f_EPTF_Base_stopAll(none);
}
//check invalid param:
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "dataelement5",
pl_params := {
{
paramName := "P21",
paramValue := "v1"
},
{
paramName := "P21",
paramValue := "v22"
},
{
paramName := "P21",
paramValue := "v23"
}
}
);
// data should not exist
if (vl_errorCode==0) {
setverdict(fail,"DataSource is found, but it should not be there. DataValue from DS: ", vl_dataValue);
f_EPTF_Base_stopAll(none);
}
//check invalid param:
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "dataelement5",
pl_params := {
{
paramName := "P21",
paramValue := "v1"
}
}
);
// data should not exist
if (vl_errorCode==0) {
setverdict(fail,"DataSource is found, but it should not be there. DataValue from DS: ", vl_dataValue);
f_EPTF_Base_stopAll(none);
}
//check nonexistent source:
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "NonExistentSource",
pl_ptcName := pl_ptcName,
pl_element := "value_element1",
pl_params := {
{
paramName := "P1",
paramValue := "v1"
}
}
);
// data should not exist
if (vl_errorCode==0) {
setverdict(fail,"DataSource is found, but it should not be there. DataValue from DS: ", vl_dataValue);
f_EPTF_Base_stopAll(none);
}
}
function f_EPTF_CLL_DataSource_test_DataSource_getDataValue(
in charstring pl_ptcName := "",
in EPTF_CharstringList vl_expectedSources := {},
in charstring pl_checkPTCsForSource := "",
in EPTF_CharstringList vl_expectedPTCs := {}
) runs on EPTF_DataSource_CT {
var EPTF_Var_DirectContent vl_dataValue;
var integer vl_errorCode;
// Source: DataSource
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DataSource",
pl_ptcName := pl_ptcName,
pl_element := "Sources",
pl_params := {}
);
// data should exist, and its value should be {"DataSource","DummySource"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {charstringlistVal := vl_expectedSources}) {
setverdict(fail,"The value of the DataSource variable is wrong: ", vl_dataValue,
"Expected: ", vl_expectedSources);
f_EPTF_Base_stopAll(none);
}
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DataSource",
pl_ptcName := pl_ptcName,
pl_element := "PTCs",
pl_params := {
{
paramName := "Source",
paramValue := pl_checkPTCsForSource
}
}
);
// data should exist, and its value should be {"DataSourceClient_getData_Test"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {charstringlistVal := vl_expectedPTCs}) {
setverdict(fail,"The value of the DataSource variable is wrong: ",vl_dataValue," Expected: ", vl_expectedPTCs);
f_EPTF_Base_stopAll(none);
}
//check nonexistent:
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DataSource",
pl_ptcName := pl_ptcName,
pl_element := "noSuchElement",
pl_params := {
{
paramName := "P1",
paramValue := "v1"
}
}
);
// data should not exist
if (vl_errorCode==0) {
setverdict(fail,"DataSource is found, but it should not be there. DataValue from DS: ", vl_dataValue);
f_EPTF_Base_stopAll(none);
}
// check for conditions:
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DataSource",
pl_ptcName := pl_ptcName,
pl_element := "==",
pl_params := {
{
paramName := "P1",
paramValue := "v1"
},
{
paramName := "P2",
paramValue := "v1"
}
}
);
// data should exist, and its value should be true
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {boolVal := true}) {
setverdict(fail,"The value of the DataSource variable is wrong: ",vl_dataValue," Expected: ", vl_expectedPTCs);
f_EPTF_Base_stopAll(none);
}
// check for conditions for false:
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DataSource",
pl_ptcName := pl_ptcName,
pl_element := "==",
pl_params := {
{
paramName := "P1",
paramValue := "v1"
},
{
paramName := "P2",
paramValue := "v2"
}
}
);
// data should exist, and its value should be false
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {boolVal := false}) {
setverdict(fail,"The value of the DataSource variable is wrong: ",vl_dataValue," Expected: ", vl_expectedPTCs);
f_EPTF_Base_stopAll(none);
}
// check for conditions for invalid params:
vl_errorCode := f_EPTF_DataSource_getDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DataSource",
pl_ptcName := pl_ptcName,
pl_element := "==",
pl_params := {
{
paramName := "P1",
paramValue := "v1"
},
{
paramName := "P2",
paramValue := "v2"
},
{
paramName := "P3",
paramValue := "v3"
}
}
);
// data should exist, and its value should be false
if (vl_errorCode==0) {
setverdict(fail,"DataSource is found, but it should not be there. DataValue from DS: ", vl_dataValue);
f_EPTF_Base_stopAll(none);
}
}
// set ------
function f_EPTF_CLL_DataSource_test_DummySource_setDataValue(in charstring pl_ptcName := "") runs on EPTF_DataSource_CT {
// Source: DummySource
var EPTF_Var_DirectContent vl_dataValue := {charstringlistVal := {"a","b"}};
var integer vl_errorCode := f_EPTF_DataSource_setDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "element1",
pl_params := {
{
paramName := "P1",
paramValue := "v1"
},
{
paramName := "P1",
paramValue := "v2"
}
}
);
// data should exist, and its value should be {"a","b"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {charstringlistVal := {"a","b"}}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
vl_dataValue := {charstringlistVal :={"a","b"}};
vl_errorCode := f_EPTF_DataSource_setDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "element2",
pl_params := {
{
paramName := "P21",
paramValue := "v21"
},
{
paramName := "P21",
paramValue := "v22"
}
}
);
// data should exist, and its value should be {"a","b"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {charstringlistVal := {"a","b"}}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
//check invalid param:
vl_dataValue := {charstringlistVal :={"a","b"}};
vl_errorCode := f_EPTF_DataSource_setDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "element1",
pl_params := {
{
paramName := "P1",
paramValue := "v1"
},
{
paramName := "P2",
paramValue := "v2"
},
{
paramName := "P3",
paramValue := "v3"
}
}
);
// data should not exist
if (vl_errorCode==0) {
setverdict(fail,"DataSource is found, but it should not be there. DataValue from DS: ", vl_dataValue);
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 := "element1",
pl_params := {
{
paramName := "read-only",
paramValue := "v1"
},
{
paramName := "P21",
paramValue := "v22"
}
}
);
// data should be read-only
if (vl_errorCode==0) {
setverdict(fail,"DataSource is found, but it should be read-only: 'element1'");
f_EPTF_Base_stopAll(none);
}
//check nonexistent source:
vl_dataValue := {charstringlistVal :={"a","b"}};
vl_errorCode := f_EPTF_DataSource_setDataValue(
pl_dataValue := vl_dataValue,
pl_source := "NonExistentSource",
pl_ptcName := pl_ptcName,
pl_element := "element1",
pl_params := {
{
paramName := "P1",
paramValue := "v1"
}
}
);
// data should not exist
if (vl_errorCode==0) {
setverdict(fail,"DataSource is found, but it should not be there. DataValue from DS: ", vl_dataValue);
f_EPTF_Base_stopAll(none);
}
}
function f_EPTF_CLL_DataSource_test_DummySource_setDataValue_withValueHandler(in charstring pl_ptcName := "") runs on EPTF_DataSource_CT {
// Source: DummySource
var EPTF_Var_DirectContent vl_dataValue := {charstringlistVal :={"a","b"}};
var integer vl_errorCode := f_EPTF_DataSource_setDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "value_element1",
pl_params := {
{
paramName := "P1",
paramValue := "v1"
},
{
paramName := "P1",
paramValue := "v2"
},
{
paramName := "P1",
paramValue := "v3"
}
}
);
// data should exist, and its value should be {"a","b"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {charstringlistVal := {"a","b"}}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
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_element2",
pl_params := {
{
paramName := "P21",
paramValue := "v21"
},
{
paramName := "P21",
paramValue := "v22"
},
{
paramName := "P21",
paramValue := "v23"
}
}
);
// data should exist, and its value should be {"a","b"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {charstringlistVal := {"a","b"}}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
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_element3",
pl_params := {
{
paramName := "P21",
paramValue := "v21"
},
{
paramName := "P21",
paramValue := "v22"
}
}
);
// data should exist (returned by getData handler, getValueHandler returns error:invalid param), and its value should be {"a","b"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {charstringlistVal := {"a","b"}}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
vl_dataValue := {charstringlistVal :={"a","b"}};
vl_errorCode := f_EPTF_DataSource_setDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "element3b",
pl_params := {
{
paramName := "P21b",
paramValue := "v21b"
},
{
paramName := "P21b",
paramValue := "v22b"
}
}
);
// data should exist (returned by getData handler, getValueHandler returns error:invalid element), and its value should be {"a","b"}
if (vl_errorCode!=0) {
setverdict(fail,"DataSource is not found, but it should be there. Error code from DS: ", vl_errorCode);
f_EPTF_Base_stopAll(none);
}
if(vl_dataValue != {charstringlistVal := {"a","b"}}) {
setverdict(fail,"The value of the DataSource variable is wrong");
f_EPTF_Base_stopAll(none);
}
//check invalid param:
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_element4",
pl_params := {
{
paramName := "P1",
paramValue := "v1"
}
}
);
// data should not exist
if (vl_errorCode==0) {
setverdict(fail,"DataSource is found, but it should not be there. DataValue from DS: ", vl_dataValue);
f_EPTF_Base_stopAll(none);
}
//check invalid param:
vl_dataValue := {charstringlistVal :={"a","b"}};
vl_errorCode := f_EPTF_DataSource_setDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "element5",
pl_params := {
{
paramName := "P21",
paramValue := "v1"
},
{
paramName := "P21",
paramValue := "v22"
},
{
paramName := "P21",
paramValue := "v23"
}
}
);
// data should not exist
if (vl_errorCode==0) {
setverdict(fail,"DataSource is found, but it should not be there. DataValue from DS: ", vl_dataValue);
f_EPTF_Base_stopAll(none);
}
//check invalid param:
vl_dataValue := {charstringlistVal :={"a","b"}};
vl_errorCode := f_EPTF_DataSource_setDataValue(
pl_dataValue := vl_dataValue,
pl_source := "DummySource",
pl_ptcName := pl_ptcName,
pl_element := "element5",
pl_params := {
{
paramName := "P21",
paramValue := "v1"
}
}
);
// data should not exist
if (vl_errorCode==0) {
setverdict(fail,"DataSource is found, but it should not be there. DataValue from DS: ", vl_dataValue);
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 := "element1",
pl_params := {
{
paramName := "read-only",
paramValue := "v1"
},
{
paramName := "P21",
paramValue := "v22"
}
}
);
// data should be read-only
if (vl_errorCode==0) {
setverdict(fail,"DataSource is found, but it should be read-only: 'element1'");
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_element2",
pl_params := {
{
paramName := "read-only",
paramValue := "v21"
},
{
paramName := "P21",
paramValue := "v22"
},
{
paramName := "P21",
paramValue := "v23"
}
}
);
// data should be read-only
if (vl_errorCode==0) {
setverdict(fail,"DataSource is not found, but it should be read-only: 'value_element2'");
f_EPTF_Base_stopAll(none);