| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // Copyright (c) 2000-2017 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_UIHandler_Test_Functions |
| // |
| // Purpose: |
| // This module contains tests of EPTF_CLL_UIHandler_CT. |
| // |
| // Module depends on: |
| // TBD |
| // |
| // Current Owner: |
| // Janos Zoltan Svaner (EJNOSVN) |
| // |
| // Last Review Date: |
| // 2010-xx-xx |
| // |
| // Detailed Comments: |
| // |
| /////////////////////////////////////////////////////////////// |
| module EPTF_UIHandler_Test_Functions |
| { |
| import from EPTF_CLL_Variable_Definitions all; |
| |
| |
| //========================================================================= |
| // Import Part |
| //========================================================================= |
| import from EPTF_CLL_UIHandlerClient_Definitions all; |
| import from EPTF_CLL_UIHandlerClient_Functions all; |
| import from EPTF_CLL_UIHandler_Definitions all; |
| import from EPTF_CLL_UIHandlerVariableUI_Definitions all; |
| import from EPTF_CLL_UIHandlerVariableUI_Functions all; |
| import from EPTF_CLL_Base_Functions all; |
| import from EPTF_CLL_Logging_Functions all; |
| import from EPTF_CLL_Variable_Functions all; |
| |
| import from EPTF_CLL_UIHandler_WidgetFunctions all; |
| import from ttcn_ericsson_se_protocolModules_xtdp_xtdl all; |
| import from EPTF_CLL_UIHandlerCLI_Definitions all; |
| import from EPTF_CLL_UIHandlerCLI_Functions all; |
| import from EPTF_UIHandler_Test_Definitions all; |
| import from EPTF_UIHandler_Test_XSD_Definitions all; |
| import from TCCDateTime_Functions all; |
| import from TCCFileIO_Functions all; |
| |
| import from EPTF_CLL_Common_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 XTDP_EncDecFunctions all; |
| import from ttcn_ericsson_se_protocolModules_xtdp_xtdp all; |
| import from EPTF_CLL_UIHandler_XULFunctions all; |
| |
| import from EPTF_CLL_Transport_CommonDefinitions all; |
| import from Socket_API_Definitions all; |
| import from EPTF_CLL_TransportIPL4_Functions all; |
| import from HTTPmsg_Types all; |
| |
| import from EPTF_CLL_HostAdminServer_Definitions all; |
| import from EPTF_CLL_HostAdminServer_Functions all; |
| import from EPTF_CLL_UIHandler_BrowserFunctions all; |
| import from HTTPmsg_MessageLen all; |
| import from TCCConversion_Functions all; |
| |
| //========================================================================= |
| // Functions |
| //========================================================================= |
| group HelperFunctions { |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_UIHandler_Test_saveLayout |
| // |
| // Purpose: |
| // Saves the parameter charstring as a window layout. |
| // |
| // Detailed Comments: |
| // This is just a copy of f_EPTF_UIHandler_saveLayout supplemeented by comments/logs |
| // The layout of the window can be retreived with the function |
| // <f_EPTF_UIHandler_snapshot>. |
| /////////////////////////////////////////////////////////// |
| |
| //Temp: |
| function f_EPTF_UIHandler_Test_mySaveLayout(in charstring pl_layout) |
| runs on EPTF_UIHandler_CT{ |
| var charstring vl_currentConfig := "\n// saved by EPTF GUI\n\n[MODULE_PARAMETERS]\n\ntsp_EPTF_GUI_DefaultWindow := """ & f_EPTF_UIHandler_convertLayout(pl_layout) & """"; |
| var charstring vl_FileName := f_getTimeFormatted(f_time(),tsp_EPTF_savedGUIPrefix & "_%d%m%Y_%H_%M.cfg"); |
| var integer vl_file := f_FIO_open_trunc_wronly(vl_FileName); |
| if(-1 != vl_file){ |
| if(-1 == f_FIO_write_text(vl_file, vl_currentConfig)){ |
| f_EPTF_Logging_error(true, "Couldn't write file "&vl_FileName&"."); |
| var integer int := f_FIO_close(vl_file); |
| if (int == -1){ |
| f_EPTF_Logging_error(true, "Could not close the file!"); |
| } |
| // f_EPTF_Base_stop(); |
| }else{ |
| var integer int := f_FIO_close(vl_file); |
| if (int == -1){ |
| f_EPTF_Logging_error(true, "Could not close the file!"); |
| } |
| } |
| }else{ |
| f_EPTF_Logging_error(true, "Couldn't open file "&vl_FileName&" for writing."); |
| // f_EPTF_Base_stop(); |
| } |
| } |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_UIHandler_Test_readLayout |
| // |
| // Purpose: |
| // Saves the parameter charstring as a window layout. |
| // |
| // Detailed Comments: |
| // The layout of the window can be retreived with the function |
| // <f_EPTF_UIHandler_snapshot>. |
| /////////////////////////////////////////////////////////// |
| function f_EPTF_UIHandler_Test_readLayout(in charstring pl_fileName, inout charstring pl_layout) |
| runs on EPTF_UIHandler_CT |
| return integer { |
| var integer vl_file := f_FIO_open_rdonly(pl_fileName); |
| var integer vl_retval:=-1; |
| if(vl_file==-1){ |
| f_EPTF_Logging_error(true, "Couldn't open the file "&pl_fileName&"."); |
| return -1; |
| } |
| |
| var integer vl_from:=f_FIO_seek_home(vl_file); |
| var integer vl_to:=f_FIO_seek_end(vl_file); |
| log("DEBUG>>>from: ", vl_from, " To: ",vl_to); |
| log("Size: ", vl_to-vl_from); |
| //log("Length of Layout: ", lengthof(pl_layout)); |
| if( f_FIO_seek_home(vl_file)==-1) { |
| return -1; |
| } |
| |
| vl_retval:=f_FIO_read_text(vl_file, pl_layout, vl_to-vl_from) |
| if(-1 == vl_retval){ |
| f_EPTF_Logging_error(true, "Couldn't read the file "&pl_fileName&"."); |
| return -1; |
| } |
| |
| if( f_FIO_close(vl_file)==-1) { |
| f_EPTF_Logging_error(true, "Could not close the file!"); |
| return -1; |
| } |
| |
| return vl_retval; |
| }//f_ |
| |
| function f_EPTF_UIHandler_Test_createLayout4Save(in charstring pl_introstring, in charstring pl_layout) |
| runs on EPTF_UIHandler_CT |
| return charstring { |
| return "\n// saved by EPTF GUI\n\n[MODULE_PARAMETERS]\n\ntsp_EPTF_GUI_DefaultWindow := """ & f_EPTF_UIHandler_convertLayout(pl_layout) & """"; |
| } |
| |
| function f_EPTF_UIHandler_Test_createFileName() |
| runs on EPTF_UIHandler_CT |
| return charstring |
| { |
| return f_getTimeFormatted(f_time(),tsp_EPTF_savedGUIPrefix & "_%d%m%Y_%H_%M.cfg"); |
| } |
| |
| //decrements the minutes of the timestamp in the name |
| function f_EPTF_UIHandler_Test_modifyFilename(inout charstring pl_fileName) { |
| var integer vl_len:=lengthof(pl_fileName) |
| log("Day: ",substr(pl_fileName, vl_len-6,2)); |
| pl_fileName:= |
| substr(pl_fileName, 0,vl_len-6) & |
| (int2str(str2int(substr(pl_fileName, vl_len-6,2))-1)) & |
| ".cfg" |
| } |
| |
| }//group HelperFunctions |
| |
| group DemoFunctions { |
| |
| /////////////////////////////////////////////////////////// |
| // Function: f_EPTF_UIHandler_BaseBehaviour |
| // |
| // Purpose: |
| // Basic behaviour of the UIHandler. |
| // |
| // Parameters: |
| // pl_selfName - *in* *charstring* - The name of the component. |
| // pl_newWindow - *in* *boolean* - If it's true, clears the GUI and adds a window. |
| // |
| // Return Value: |
| // - |
| // |
| // Errors: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////// |
| function f_EPTF_UIHandler_BaseBehaviour( |
| charstring pl_selfName, |
| boolean pl_newWindow := false, |
| charstring pl_wndLayout := "") |
| runs on EPTF_UIHandler_Test_CT{ |
| log("----- basebehaviour START -------"); |
| f_EPTF_UIHandlerXUL_init_CT(pl_selfName, true, pl_wndLayout); |
| if(pl_newWindow){ |
| f_EPTF_UIHandler_clearGUI(); |
| log("----- clearGUI returned -------"); |
| var boolean bool := f_EPTF_UIHandler_addWindow(); |
| log("----- addWindow returned -------"); |
| } |
| // only take care of the exit button, stops execution |
| f_EPTF_UIHandler_exitButtonPressed(); |
| //EPTF_guiPortIf.send(ASP_XTDP_Bye:{client_id:=omit}); |
| f_EPTF_Base_cleanup_CT(); |
| } |
| |
| }//group DemoFunctions |
| |
| //****************************************************************** |
| |
| group FunctionTestFunctions { |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_LogVars |
| //========================================================== |
| function f_EPTF_UIHandler_Test_LogVars() runs on EPTF_UIHandler_CT |
| { |
| log("f_EPTF_Base_selfName(): ",f_EPTF_Base_selfName()); |
| // THESE ARE PRIVATE: |
| // log("v_EPTF_Var_initialized: ",v_EPTF_Var_initialized); |
| // log("v_EPTF_Base_initialized: ",v_EPTF_Base_initialized); |
| // log("v_EPTF_Logging_initialized: ",v_EPTF_Logging_initialized); |
| |
| // log("v_EPTF_Base_cleanupFunctions: ",v_EPTF_Base_cleanupFunctions); |
| // log("v_EPTF_Base_componentsToStop: ",v_EPTF_Base_componentsToStop); |
| // log("v_EPTF_Base_disableBye: ",v_EPTF_Base_disableBye); |
| // log("v_EPTF_Vars: ",v_EPTF_Vars); |
| // log("v_syncBuffer: ",v_syncBuffer); |
| // log("v_EPTF_Var_syncCallbackFns: ",v_EPTF_Var_syncCallbackFns); |
| // log("v_EPTF_Var_varsToSave: ",v_EPTF_Var_varsToSave); |
| } |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_VarsCleanedUp |
| //========================================================== |
| function f_EPTF_UIHandler_VarsCleanedUp() runs on EPTF_UIHandler_CT |
| return boolean |
| { |
| if( f_EPTF_Base_selfName()=="" |
| // THESE ARE PRIVATE: |
| // and v_EPTF_Var_initialized==false |
| // and v_EPTF_Base_initialized == false |
| // and v_EPTF_Base_cleanupFunctions == {} |
| // and v_EPTF_Base_componentsToStop == {} |
| // and v_EPTF_Base_disableBye == false |
| // and v_EPTF_Vars == {} |
| // and v_syncBuffer == {} //Var |
| // and v_EPTF_Var_syncCallbackFns == {} |
| // and v_EPTF_Var_varsToSave == {} |
| ) { |
| return true; |
| } else { |
| return false; |
| } |
| } |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_LogUIHandlerComponent |
| //========================================================== |
| function f_EPTF_UIHandler_Test_LogUIHandlerComponent() runs on EPTF_UIHandler_CT { |
| log("------Content of EPTF_UIHandler_CT: -------"); |
| //log("EPTF_guiPortIf: ",EPTF_guiPortIf); |
| //log("EPTF_pinger:", EPTF_pinger); // used for pinging the GUI. |
| f_EPTF_UIHandler_logAll(); |
| f_EPTF_UIHandler_Test_LogVars(); |
| log("------Finished Content of EPTF_UIHandler_CT -------"); |
| }//f_ |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_uiHandlerComponentCleanedUp |
| //========================================================== |
| function f_EPTF_UIHandler_Test_uiHandlerComponentCleanedUp() |
| runs on EPTF_UIHandler_CT |
| return boolean |
| { |
| //TODO (perhaps) to test saying bye to the gui components |
| |
| if( f_EPTF_UIHandler_initialized()==false |
| // THESE ARE PRIVATE: |
| // and v_EPTF_Var_initialized==false |
| // and v_EPTF_Base_initialized == false //other infos shall be checked at the anchestor's test |
| //and v_EPTF_Logging_initialized |
| ) { |
| return true; |
| } else { |
| return false |
| } |
| }//f_ |
| |
| //=== |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_LogUIHandlerClientComponent |
| //========================================================== |
| function f_EPTF_UIHandler_Test_LogUIHandlerClientComponent() runs on EPTF_UIHandlerClient_CT { |
| f_EPTF_UIHandlerClient_logAll(); |
| }//f_ |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_uiHandlerClientComponentInitialized |
| //========================================================== |
| function f_EPTF_UIHandler_Test_uiHandlerClientComponentInitialized(in charstring pl_selfName, in EPTF_UIHandler_CT pl_defUIHandler) |
| runs on EPTF_UIHandlerClient_CT |
| return boolean |
| { |
| if( v_UIHandlerClient_initialized==true |
| and v_UIHandlerClient_hangingConnections=={} |
| and v_UIHandlerClient_openUIConnections=={} |
| and v_UIHandlerClient_def!=null |
| and v_UIHandlerClient_DefaultUIHandler==pl_defUIHandler |
| and v_UIHandlerClient_lastRequest==0 |
| and f_EPTF_Base_selfName()==pl_selfName |
| // THESE ARE PRIVATE: |
| // and v_EPTF_Var_initialized |
| // and v_EPTF_Logging_initialized //the other infos shall be tested on earlier level |
| ) { |
| return true; |
| } else { |
| return false |
| } |
| }///f_ |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_uiHandlerClientComponentCleanedUp |
| //========================================================== |
| function f_EPTF_UIHandler_Test_uiHandlerClientComponentCleanedUp() |
| runs on EPTF_UIHandlerClient_CT |
| return boolean |
| { |
| if( v_UIHandlerClient_initialized==false |
| // THESE ARE PRIVATE: |
| // and v_EPTF_Var_initialized==false |
| // and v_EPTF_Base_initialized == false //other infos shall be checked at the anchestor's test |
| //and v_EPTF_Logging_initialized |
| ) { |
| return true; |
| } else { |
| return false |
| } |
| }//f_ |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_uiHandlerVariableComponentInitialized |
| //========================================================== |
| function f_EPTF_UIHandler_Test_uiHandlerVariableComponentInitialized(in charstring pl_selfName,in EPTF_UIHandler_CT pl_defUIHandler) |
| runs on EPTF_UIHandler_VariableUI_CT |
| return boolean |
| { |
| if( |
| f_EPTF_UIHandler_Test_uiHandlerClientComponentInitialized(pl_selfName,pl_defUIHandler) |
| and v_VariableUI_initialized==true |
| and v_VariableUI_UIHandler==pl_defUIHandler |
| and v_VariableUI_connections=={} |
| and v_VariableUI_holdingwidgets=={} |
| and v_VariableUI_initparent == false |
| and v_VariableUI_lastput == 0 |
| ){ |
| return true; |
| } else { |
| }return false; |
| }//f_ |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_uiHandlerVariableComponentCleanedUp |
| //========================================================== |
| function f_EPTF_UIHandler_Test_uiHandlerVariableComponentCleanedUp() |
| runs on EPTF_UIHandler_VariableUI_CT |
| return boolean |
| { |
| if( |
| f_EPTF_UIHandler_Test_uiHandlerClientComponentCleanedUp() |
| and v_VariableUI_initialized==false |
| ){ |
| return true; |
| } else { |
| }return false; |
| }//f_ |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_uiHandlerVariableComponentCleanedUp |
| //========================================================== |
| function f_EPTF_UIHandler_Test_LoguiHandlerVariableComponent() |
| runs on EPTF_UIHandler_VariableUI_CT |
| { |
| f_EPTF_UIHandler_Test_LogUIHandlerClientComponent(); |
| f_EPTF_UIHandler_VariableUI_logAll(); |
| }//f_ |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_LogUIHandlerCliComponent |
| //========================================================== |
| function f_EPTF_UIHandler_Test_LogUIHandlerCliComponent() runs on EPTF_UIHandler_CLI_CT { |
| log("------Content of EPTF_UIHandler_CLICT: -------"); |
| //log("v_UIHandler_CLI_initialized: ", v_UIHandler_CLI_initialized); |
| f_EPTF_UIHandler_logAll(); |
| f_EPTF_UIHandler_CLI_logAll(); |
| log("------Finished Content of EPTF_CLI_UIHandler_CT -------"); |
| }//f_ |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_uiHandlerComponentCliCleanedUp |
| //========================================================== |
| function f_EPTF_UIHandler_Test_uiHandlerComponentCliCleanedUp() |
| runs on EPTF_UIHandler_CLI_CT |
| return boolean |
| { |
| if( |
| //v_UIHandler_CLI_initialized==false TODO: TR: |
| //and |
| f_EPTF_UIHandler_initialized()==false //other infos shall be checked at the anchestor's test |
| // THESE ARE PRIVATE: |
| // and v_EPTF_Logging_initialized ==false |
| // and v_EPTF_Var_initialized ==false |
| ) { |
| return true; |
| } else { |
| return false |
| } |
| }//f_ |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_setVerdict |
| //========================================================== |
| function f_EPTF_UIHandler_Test_setVerdict(in boolean pl_bool, in charstring pl_errmsg := "") |
| { |
| if(pl_bool) { setverdict(pass) } else { setverdict(fail, pl_errmsg) } |
| }//f_ |
| |
| |
| function f_EPTF_UIHandlerClient_Test_waitForUIHandler(in EPTF_UIHandler_CT pl_uiHandlerCompRef, in float pl_maxWaitTime := 10.0) runs on EPTF_UIHandlerClient_CT { |
| // wait for UIHandler component to start up: |
| timer t_wait := 0.0; |
| t_wait.start; |
| timer t_waitPeriodic := 1.0; |
| t_waitPeriodic.start; |
| timer t_maxwait := pl_maxWaitTime; |
| t_maxwait.start; |
| alt { |
| [f_EPTF_Var_isPresentRemote(pl_uiHandlerCompRef,"UIHandlerReady")] t_wait.timeout { |
| } |
| [] t_waitPeriodic.timeout { |
| t_waitPeriodic.start; |
| repeat; |
| } |
| [] t_maxwait.timeout { |
| setverdict(fail,"UIHandler did not start up in time"); |
| f_EPTF_Base_stopAll(none); |
| } |
| } |
| } |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_BaseBehaviour |
| //========================================================== |
| function f_EPTF_UIHandler_Test_BaseBehaviour( |
| charstring pl_selfName, |
| boolean pl_connectGUI:=true, |
| boolean pl_newWindow := true, |
| charstring pl_wndLayout := "", |
| boolean pl_addMainTabbox:=false, |
| float pl_timeout:=15.0, |
| float pl_delay := 0.0) runs on EPTF_UIHandler_CT |
| { |
| timer t_delay := pl_delay; t_delay.start; t_delay.timeout; |
| f_EPTF_UIHandlerXUL_init_CT(pl_selfName,pl_connectGUI, pl_wndLayout); |
| if(pl_newWindow){ |
| f_EPTF_UIHandler_clearGUI(); |
| var boolean bool := f_EPTF_UIHandler_addWindow() |
| } |
| |
| if(pl_addMainTabbox==true) { |
| var boolean vl_dummy:=true; |
| f_EPTF_UIHandler_XSD_addElementToGui(valueof(t_MainTabBox),tsp_EPTF_GUI_Main_Window_WidgetId, vl_dummy); |
| //log(">>>DEBUG: v_UIHandler_guiItemList:",v_UIHandler_guiItemList) |
| } |
| |
| var integer vl_myVarId; |
| f_EPTF_Var_newBool("UIHandlerReady",true,vl_myVarId); |
| |
| f_EPTF_UIHandler_exitButtonPressed(pl_timeout); |
| //EPTF_guiPortIf.send(ASP_XTDP_Bye:{client_id:=omit}); |
| f_EPTF_Base_cleanup_CT(); |
| }//f_ |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_BaseBehaviour_warning |
| //========================================================== |
| function f_EPTF_UIHandler_Test_BaseBehaviour_warning( |
| charstring pl_selfName, |
| boolean pl_connectGUI:=true, |
| boolean pl_newWindow := true, |
| charstring pl_wndLayout := "", |
| boolean pl_addMainTabbox:=false, |
| float pl_timeout:=15.0, |
| float pl_delay := 0.0, |
| charstring pl_warning := "") runs on EPTF_UIHandler_Test_CT |
| { |
| timer t_delay := pl_delay; t_delay.start; t_delay.timeout; |
| f_EPTF_UIHandlerXUL_init_CT(pl_selfName,pl_connectGUI, pl_wndLayout); |
| if(pl_warning != "") { f_EPTF_UIHandler_Test_ExpectedWarning_setExpectedWarning(pl_warning) } |
| if(pl_newWindow){ |
| f_EPTF_UIHandler_clearGUI(); |
| var boolean bool := f_EPTF_UIHandler_addWindow() |
| } |
| //hack for tc_EPTF_UIHandler_Test_HostAdminUI_behavior: |
| if(pl_addMainTabbox==true) { |
| var boolean vl_dummy:=true; |
| f_EPTF_UIHandler_XSD_addElementToGui(valueof(t_MainTabBox),tsp_EPTF_GUI_Main_Window_WidgetId, vl_dummy); |
| //log(">>>DEBUG: v_UIHandler_guiItemList:",v_UIHandler_guiItemList) |
| } |
| var integer vl_myVarId; |
| f_EPTF_Var_newBool("UIHandlerReady",true,vl_myVarId); |
| |
| f_EPTF_UIHandler_exitButtonPressed(pl_timeout); |
| //EPTF_guiPortIf.send(ASP_XTDP_Bye:{client_id:=omit}); |
| f_EPTF_Base_cleanup_CT(); |
| }//f |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_init_CT |
| //========================================================== |
| function f_EPTF_UIHandler_Test_init_CT( |
| charstring pl_selfName, |
| boolean pl_connectGUI:=true, |
| charstring pl_wndLayout := "") |
| runs on EPTF_UIHandler_Test_CT { |
| f_EPTF_UIHandlerXUL_init_CT(pl_selfName,pl_connectGUI, pl_wndLayout); |
| f_EPTF_Base_registerCleanup(refers(f_EPTF_UIHandler_Test_cleanup_CT)); |
| } |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_cleanup_CT |
| //========================================================== |
| function f_EPTF_UIHandler_Test_cleanup_CT() |
| runs on EPTF_UIHandler_Test_CT { |
| //f_EPTF_UIHandler_cleanup_CT(); |
| } |
| |
| //========================================================== |
| //= f_EPTF_UIHandlerClient_Test_init_CT |
| //========================================================== |
| function f_EPTF_UIHandlerClient_Test_init_CT( |
| in charstring pl_selfName, |
| in EPTF_UIHandler_Test_CT pl_TestDefaultUIHandler) |
| runs on EPTF_UIHandlerClient_Test_CT |
| { |
| f_EPTF_UIHandlerClient_init_CT(pl_selfName,pl_TestDefaultUIHandler); |
| v_UIHandlerClient_Test_DefaultUIHandler:=pl_TestDefaultUIHandler; |
| f_EPTF_Base_registerCleanup(refers(f_EPTF_UIHandlerClient_Test_cleanup_CT)); |
| connect(self:TestPort_CP,pl_TestDefaultUIHandler:TestPort_CP); |
| } |
| //========================================================== |
| //= f_EPTF_UIHandlerClient_Test_cleanup_CT |
| //========================================================== |
| function f_EPTF_UIHandlerClient_Test_cleanup_CT() |
| runs on EPTF_UIHandlerClient_Test_CT |
| { |
| disconnect(self:TestPort_CP,v_UIHandlerClient_Test_DefaultUIHandler:TestPort_CP); |
| } |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_BaseBehaviourTest |
| //========================================================== |
| function f_EPTF_UIHandler_Test_BaseBehaviourTest( |
| charstring pl_selfName, |
| boolean pl_connectGUI:=true, |
| boolean pl_newWindow := true, |
| charstring pl_wndLayout := "") runs on EPTF_UIHandler_Test_CT |
| { |
| f_EPTF_UIHandler_Test_init_CT(pl_selfName,pl_connectGUI, pl_wndLayout); |
| if(pl_newWindow){ |
| f_EPTF_UIHandler_clearGUI(); |
| var boolean bool := f_EPTF_UIHandler_addWindow() |
| } |
| |
| timer Tl_base:= 3.0; |
| Tl_base.start; |
| var TestMsg vl_testMsg; |
| alt { |
| [] TestPort_CP.receive(TestMsg:{ getWidgetFromGuiMsg := { widgetId:= ? } } ) ->value vl_testMsg { log("Test mesg received");} |
| [] Tl_base.timeout {log("Tl_base timeout occured in test")} |
| } |
| // f_EPTF_UIHandler_exitButtonPressed(); |
| //EPTF_guiPortIf.send(ASP_XTDP_Bye:{client_id:=omit}); |
| f_EPTF_Base_cleanup_CT(); |
| }//f_ |
| |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_BaseBehaviourWithClearGui |
| //========================================================== |
| function f_EPTF_UIHandler_Test_BaseBehaviourWithClearGui( |
| charstring pl_selfName, |
| boolean pl_connectGUI:=true, |
| charstring pl_wndLayout := "") runs on EPTF_UIHandler_CT |
| { |
| f_EPTF_UIHandlerXUL_init_CT(pl_selfName,pl_connectGUI, pl_wndLayout); |
| f_EPTF_UIHandler_clearGUI(); |
| f_EPTF_UIHandler_requestLayout(); //TR:HJH6681 "TitanSim empty gui sends wrong layout response" - fixed in build 2008-10-22 |
| |
| timer Tl_base:= 2.0; |
| Tl_base.start; |
| alt { |
| [] Tl_base.timeout {log("Tl_base timeout occured in test")} |
| } |
| //EPTF_guiPortIf.send(ASP_XTDP_Bye:{client_id:=omit}); |
| f_EPTF_Base_cleanup_CT(); |
| }//f_ |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_BaseBehaviourWithClearGuiAddWindow |
| //========================================================== |
| function f_EPTF_UIHandler_Test_BaseBehaviourWithClearGuiAddWindow( |
| charstring pl_selfName, |
| boolean pl_connectGUI:=true, |
| boolean pl_newWindow := false, |
| charstring pl_wndLayout := "", |
| float pl_timeout:=2.0) runs on EPTF_UIHandler_CT |
| { |
| //log("----- basebehaviour start -------"); |
| //if pl_wndLayout=="" it logs an error, but setverdict remains untouched: |
| f_EPTF_UIHandlerXUL_init_CT(pl_selfName,pl_connectGUI, pl_wndLayout); |
| if(pl_newWindow){ |
| f_EPTF_UIHandler_clearGUI(); //if You don't apply it, the addWindow doesn't work |
| //f_EPTF_UIHandler_requestLayout(); // <== Don't call it, it causes dynamic test case error! |
| } |
| f_EPTF_UIHandler_Test_setVerdict( f_EPTF_UIHandler_addWindow()); |
| //log("----- addWindow returned -------"); |
| f_EPTF_UIHandler_Test_setVerdict(f_EPTF_UIHandler_requestLayout()); |
| //after addWindow the tsp values should be valid: |
| |
| var template Widgets vl_expectedXUL := { |
| window := { |
| about := *, |
| height := tsp_EPTF_GUI_Main_Window_Height, |
| help := *, |
| id := tsp_EPTF_GUI_Main_Window_WidgetId, |
| orientation := *, |
| title := tsp_EPTF_GUI_Main_Window_Title, |
| width := tsp_EPTF_GUI_Main_Window_Width, |
| image_list := ?, |
| embeddedwidgets := { |
| embeddedwidget_list := { |
| |
| } |
| } |
| } |
| } |
| |
| f_UIHandler_Test_compareXulWindowWithSnapshot(vl_expectedXUL) |
| //EPTF_guiPortIf.send(ASP_XTDP_Bye:{client_id:=omit}); |
| f_EPTF_Base_cleanup_CT(); |
| }//f_ |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_BaseBehaviour_addWindowTwice |
| //= Hasn't been cleared the window before "addWindow" |
| //========================================================== |
| function f_EPTF_UIHandler_Test_BaseBehaviour_addWindowTwice( |
| charstring pl_selfName, |
| boolean pl_connectGUI:=true, |
| charstring pl_wndLayout := "") runs on EPTF_UIHandler_CT |
| { |
| //log("----- basebehaviour start -------"); |
| //if pl_wndLayout=="" it logs an error, but setverdict remains untouched: |
| f_EPTF_UIHandlerXUL_init_CT(pl_selfName,pl_connectGUI, pl_wndLayout); //fist implicit addWindow() |
| |
| f_EPTF_UIHandler_Test_setVerdict( f_EPTF_UIHandler_addWindow()==false ); //second, explicit addWindow |
| f_EPTF_UIHandler_requestLayout(); |
| //log("Gui item list: ",v_UIHandler_guiItemList); |
| |
| //after addWindow the original window should return |
| var template Widgets vl_expectedXUL := { |
| window := { |
| about := *, |
| height := 380.000000, |
| help := *, |
| id := "My_EPTF_Main_Window", |
| orientation := *, |
| title := "My TTCN constructed window", |
| width := 800.000000, |
| image_list := ?, |
| embeddedwidgets := ? |
| } |
| } |
| |
| f_UIHandler_Test_compareXulWindowWithSnapshot(vl_expectedXUL) |
| |
| timer Tl_base:= 2.0; |
| Tl_base.start; |
| alt { |
| [] Tl_base.timeout {log("Tl_base timeout occured in test")} |
| } |
| //EPTF_guiPortIf.send(ASP_XTDP_Bye:{client_id:=omit}); |
| f_EPTF_Base_cleanup_CT(); |
| }//f_ |
| |
| //========================================================== |
| // f_UIHandler_Test_createWindowWithTwoTbarButtonsXUL |
| //========================================================== |
| function f_UIHandler_Test_createWindowWithTwoTbarButtonsXUL() |
| runs on EPTF_UIHandler_CT |
| return charstring |
| { |
| return "<Widgets xmlns='http://ttcn.ericsson.se/protocolModules/xtdp/xtdl'>\n\t<window height='300.000000' id='MyNewEPTFMainWindow' orientation='vertical' title='My TTCN constructed window' width='800.000000'>\n\t\t<toolbar id='MyEPTFMainToolbar' placement='north'>\n\t\t\t<toolbarbutton id='FirstTbarButtonId' tooltiptext='FirstTbarButton ToolTip'/>\n\t\t\t<separator/>\n\t\t\t<toolbarbutton id='SecondTbarButtonId' tooltiptext='SecondTbarButton ToolTip'/>\n\t\t</toolbar>\n\t</window>\n</Widgets>\n\n"; |
| } |
| |
| //========================================================== |
| // f_UIHandler_Test_compareXulWindowWithSnapshot |
| //========================================================== |
| function f_UIHandler_Test_compareXulWindowWithSnapshot(in template Widgets pl_xulWindow) |
| runs on EPTF_UIHandler_CT |
| { |
| var charstring vl_fetchedLayout := f_EPTF_UIHandler_snapshot(); |
| if(""==vl_fetchedLayout){ |
| setverdict(fail, "The snapshot is empty") |
| }else{ |
| var Widgets vl_fetchedLayoutXUL:= f_EPTF_UIHandler_XSD_decodeXUL(vl_fetchedLayout); |
| if(match(vl_fetchedLayoutXUL, pl_xulWindow)){ |
| setverdict(pass); |
| }else{ |
| log(match(vl_fetchedLayoutXUL, pl_xulWindow)) |
| setverdict(fail,match(vl_fetchedLayoutXUL, pl_xulWindow)); |
| } |
| } |
| } |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_BaseBehaviourWithAddElementsToGui_wrongToolbarId |
| //========================================================== |
| function f_EPTF_UIHandler_Test_BaseBehaviourWithAddElementsToGui_wrongToolbarId( |
| charstring pl_selfName |
| ) runs on EPTF_UIHandler_CT |
| { |
| f_EPTF_UIHandlerXUL_init_CT(pl_selfName,true, ""); |
| f_EPTF_UIHandler_clearGUI(); |
| var charstring vl_wrong_toolbarId:="EPTF Main_Toolbar"; //Wrong because space is forbidden |
| var boolean vl_dummy:=false; |
| |
| //This operation should be unsuccessful: |
| //f_EPTF_UIHandler_Test_setVerdict( f_EPTF_UIHandler_addElementToGui(vl_xul, "", vl_dummy) );//pass |
| |
| var template Widgets vl_expectedXUL := { |
| window := { |
| about := *, |
| height := tsp_EPTF_GUI_Main_Window_Height, |
| help := *, |
| id := tsp_EPTF_GUI_Main_Window_WidgetId, |
| orientation := *, |
| title := tsp_EPTF_GUI_Main_Window_Title, |
| width := tsp_EPTF_GUI_Main_Window_Width, |
| image_list := ?, |
| embeddedwidgets := { |
| embeddedwidget_list := { |
| { |
| toolbar := { |
| disabled := *, |
| id := vl_wrong_toolbarId, |
| placement := north, |
| choice_list := { |
| { |
| toolbarbutton := { |
| disabled := *, |
| id := "FirstTbarButtonId", |
| imageid := *, |
| tooltiptext := "FirstTbarButton ToolTip" |
| } |
| }, |
| { |
| separator := { |
| id := * |
| } |
| }, |
| { |
| toolbarbutton := { |
| disabled := *, |
| id := "SecondTbarButtonId", |
| imageid := *, |
| tooltiptext := "SecondTbarButton ToolTip" |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| }; |
| |
| f_UIHandler_Test_compareXulWindowWithSnapshot(vl_expectedXUL) |
| |
| |
| /* |
| TR: HJ83569 |
| Encoding error: |
| instead of <parentWidgetId>\"My EPTF_Main_Toolbar\"</parentWidgetId> this has been sent: |
| <parentWidgetId>My EPTF_Main_Toolbar</parentWidgetId>, therefore item not expected to accept |
| */ |
| |
| /* |
| TR: |
| TitanSim UIHandler puts also not accepted widgets into its database |
| */ |
| |
| //=== |
| |
| //==== 2nd addElementToGui: New, third toolbarbutton:==== |
| var Widgets vl_xul_thirdTbarButton:= { |
| toolbarbutton:= { |
| disabled:= omit, |
| disabledongui:= omit, |
| id:="ThirdTbarButtonId", |
| imageid:=omit, |
| tooltiptext:="ThirdTbarButton ToolTip", |
| externaldata:=omit |
| } |
| }//xul |
| |
| f_EPTF_UIHandler_Test_setVerdict( f_EPTF_UIHandler_XSD_addElementToGui(vl_xul_thirdTbarButton, vl_wrong_toolbarId, vl_dummy)); |
| |
| //check if it is ok or not: |
| |
| //Check it in the database: |
| //tr_expectedGuiItemRecList[1]:= tr_EPTF_UIHandler_guiItemToolbar( vl_wrong_toolbarId, {2,3,4,5},"north"); |
| //tr_expectedGuiItemRecList[sizeof(tr_expectedGuiItemRecList)] := t_EPTF_UIHandler_guiItemToolbarbutton("ThirdTbarButtonId","ThirdTbarButton ToolTip"); |
| |
| /* |
| if( not match(v_UIHandler_guiItemList,tr_expectedGuiItemRecList)) { |
| log( match(v_UIHandler_guiItemList,tr_expectedGuiItemRecList)); |
| setverdict(fail); |
| } |
| |
| //From the previous step it is not clear if the action was successful or not. Here is the real check: |
| */ |
| //Check on the gui: |
| //vl_xul.xtdp_window.widgets[0].toolbar.toolbarelements[sizeof(vl_xul.xtdp_window.widgets[0].toolbar.toolbarelements)]:= |
| // { toolbarbutton := vl_xul_thirdTbarButton.xtdp_toolbarbutton }; |
| |
| //f_UIHandler_Test_compareXulWindowWithSnapshot(vl_xul) |
| |
| //== |
| timer Tl_base:= 2.0; |
| Tl_base.start; |
| alt { |
| [] Tl_base.timeout {log("Tl_base timeout occured in test")} |
| } |
| //EPTF_guiPortIf.send(ASP_XTDP_Bye:{client_id:=omit}); |
| f_EPTF_Base_cleanup_CT(); |
| }//f_ |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_snapshot |
| //========================================================== |
| function f_EPTF_UIHandler_Test_snapshot( |
| charstring pl_selfName, |
| boolean pl_connectGUI:=true, |
| boolean pl_newWindow := false, |
| charstring pl_wndLayout := "") |
| runs on EPTF_UIHandler_CT |
| { |
| f_EPTF_UIHandlerXUL_init_CT(pl_selfName,pl_connectGUI, pl_wndLayout); |
| var charstring vl_fetchedLayout := f_EPTF_UIHandler_snapshot(); |
| log("Original layout: ",pl_wndLayout); |
| log("Fetched layout: ", vl_fetchedLayout); |
| |
| if(match(vl_fetchedLayout,pl_wndLayout)) { |
| setverdict(pass); |
| } else { |
| setverdict(fail, log2str("vl_fetchedLayout and pl_wndLayout are not matching", "vl_fetchedLayout = ", match(vl_fetchedLayout,pl_wndLayout))); |
| } |
| //EPTF_guiPortIf.send(ASP_XTDP_Bye:{client_id:=omit}); |
| f_EPTF_Base_cleanup_CT(); |
| }//f_ |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_saveLayout |
| //========================================================== |
| function f_EPTF_UIHandler_Test_saveLayout( |
| charstring pl_selfName, |
| charstring pl_wndLayout := "") |
| runs on EPTF_UIHandler_CT |
| { |
| f_EPTF_UIHandlerXUL_init_CT(pl_selfName,false, pl_wndLayout); |
| |
| var charstring vl_introString := "\n// saved by EPTF GUI\n\n[MODULE_PARAMETERS]\n\ntsp_EPTF_GUI_DefaultWindow := """; //WRONG!!! |
| var charstring vl_retreivedLayout:=""; |
| var charstring vl_expectedLayout:= f_EPTF_UIHandler_Test_createLayout4Save(vl_introString,pl_wndLayout) |
| var charstring vl_fileName:= f_EPTF_UIHandler_Test_createFileName(); |
| |
| f_EPTF_UIHandler_saveLayout(pl_wndLayout); |
| var integer vl_result:=f_EPTF_UIHandler_Test_readLayout(vl_fileName,vl_retreivedLayout); |
| |
| //Try again with decrementing the minutes of the timestamp: |
| if( vl_result==-1 ) { |
| log("Old filename: ",vl_fileName); |
| f_EPTF_UIHandler_Test_modifyFilename(vl_fileName); |
| log("New filename: ", vl_fileName); |
| vl_result:=f_EPTF_UIHandler_Test_readLayout(vl_fileName,vl_retreivedLayout);//try once more with smaller timestamp |
| }; |
| |
| if(vl_result==-1) { |
| setverdict(fail, "Can not read layout"); |
| return; |
| } |
| |
| log("Retreived layout:",vl_retreivedLayout); |
| log("Expected Layout: ",vl_expectedLayout); |
| |
| if(vl_retreivedLayout==vl_expectedLayout) { |
| setverdict(pass); |
| } |
| else { |
| setverdict(fail, log2str("vl_retreivedLayout != vl_expectedLayout ", "vl_retreivedLayout = ", vl_retreivedLayout, " vl_expectedLayout = ", vl_expectedLayout)); |
| } |
| f_EPTF_Base_cleanup_CT(); |
| return; |
| }//f_ |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_CliBaseBehaviour |
| //========================================================== |
| function f_EPTF_UIHandler_Test_CliBaseBehaviour( |
| charstring pl_selfName, |
| boolean pl_connectGUI:=false) |
| runs on EPTF_UIHandler_CLI_CT |
| { |
| log("----- basebehaviour START -------"); |
| f_EPTF_UIHandler_CLI_init_CT(pl_selfName,pl_connectGUI); |
| //f_EPTF_UIHandler_CLI_init_CT(pl_selfName,pl_connectGUI); //can it resist for the double init???? |
| |
| f_EPTF_UIHandler_Test_LogUIHandlerCliComponent(); |
| |
| timer Tl_base:= 1.0; |
| Tl_base.start; |
| alt { |
| [] Tl_base.timeout {log("Tl_base timeout occured in test")} |
| } |
| f_EPTF_Base_cleanup_CT(); |
| f_EPTF_UIHandler_Test_setVerdict(f_EPTF_UIHandler_Test_uiHandlerComponentCliCleanedUp()); |
| }//f_ |
| |
| //***************************************************************************************************** |
| // DUMMY GUI |
| //***************************************************************************************************** |
| /* group DummyGui { |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_DummyGuiInit |
| //========================================================== |
| function f_EPTF_UIHandler_Test_DummyGui_init(in charstring pl_selfName) runs on EPTF_UIHandler_Test_DummyGui_CT |
| { |
| var ASP_XTDP_Listen_result vl_listenResult; |
| var ASP_XTDP_Connected vl_connected; |
| if( v_DummyGui_initialized) { return; } |
| f_EPTF_Var_init_CT(pl_selfName); |
| f_EPTF_Logging_init_CT(pl_selfName); |
| map(self:EPTF_DummyGui_PCO,system:EPTF_DummyGui_PCO); |
| |
| v_DummyGui_initialized :=true; |
| //Connect as a server: |
| EPTF_DummyGui_PCO.send(ASP_XTDP_Listen:{tsp_xtdp_listen_port,"127.0.0.1"}); |
| timer t_waitConnect := 2.0; |
| t_waitConnect.start; |
| alt{ |
| [] t_waitConnect.timeout{ |
| f_EPTF_Base_stop(); |
| } |
| [] EPTF_DummyGui_PCO.receive(ASP_XTDP_Listen_result:{tsp_xtdp_listen_port}) -> value vl_listenResult { |
| log("The received listen result message is:", vl_listenResult); |
| t_waitConnect.stop; |
| } |
| } |
| |
| EPTF_DummyGui_PCO.receive(ASP_XTDP_Connected:?) -> value vl_connected { |
| log("Message connected received: ", vl_connected); |
| } |
| |
| v_DummyGui_def:= activate(as_EPTF_UIHandler_Test_DummyGui_main()) |
| |
| }//f_ |
| |
| //========================================================== |
| //= as_EPTF_UIHandler_Test_DummyGui_main |
| //========================================================== |
| altstep as_EPTF_UIHandler_Test_DummyGui_main() runs on EPTF_UIHandler_Test_DummyGui_CT |
| { |
| var ASP_XTDP vl_xtdp_message; |
| var ASP_XTDP_Close vl_close; |
| [] EPTF_DummyGui_PCO.receive( ASP_XTDP:{ client_id:=*, data:= { noNamespaceSchemaLocation:=*, xtdp_Message:={ xtdp_Requests:=? }}}) -> value vl_xtdp_message { |
| } |
| [] EPTF_DummyGui_PCO.receive( ASP_XTDP:ts_ASP_XTDP_layoutRequest) -> value vl_xtdp_message { |
| log("The message received: ", vl_xtdp_message); |
| repeat |
| } |
| // [] EPTF_DummyGui_PCO.receive( ASP_XTDP_Bye:?) { |
| // log("Bye received by DummyGui"); |
| // } |
| // [] EPTF_DummyGui_PCO.receive(ASP_XTDP_Shutdown:?) { |
| // } |
| [] EPTF_DummyGui_PCO.receive(ASP_XTDP_Close:?){} |
| //[] EPTF_DummyGui_PCO.receive(?) { log("Unrecognized message received: ");} |
| }//altstep |
| |
| //altstep as_EPTF_UIHandler_Test_ |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_CliBaseBehaviour |
| //========================================================== |
| function f_EPTF_UIHandler_Test_DummyGuiBehavior(in charstring pl_selfName) runs on EPTF_UIHandler_Test_DummyGui_CT |
| { |
| timer T_gui := 3.0; |
| T_gui.start; |
| f_EPTF_UIHandler_Test_DummyGui_init(pl_selfName); |
| |
| alt{ |
| [] as_EPTF_UIHandler_Test_DummyGui_main(); |
| [] T_gui.timeout {} |
| } |
| log("----DummyGui finished---"); |
| } |
| |
| /* |
| altstep as_EPTF_UIHandler_HostAdmin_T1() runs on EPTF_UIHandler_HostAdmin_Test_CT { |
| [] T1.timeout { |
| f_EPTF_UIHandler_Test_setVerdict(f_EPTF_UIHandlerClient_widgetExists("HostAdminTabId") == wtTab); |
| f_EPTF_UIHandler_Test_setVerdict(f_EPTF_UIHandlerClient_widgetExists(c_HostAdminTreeId) == wtTree); |
| } |
| } |
| * |
| }//DummyGui |
| */ |
| |
| external function f_EPTF_runTop() return float |
| |
| function f_EPTF_UIHandlerClient_generateSubscribeMes_cleanup() runs on EPTF_UIHandlerClient_CT { |
| var integer vl_varIdx := f_EPTF_Var_getId("charVarProv"); |
| action("Number of adjusts: ", f_EPTF_Var_getCharstringValue(vl_varIdx)); |
| } |
| |
| function f_EPTF_UIHandlerClient_generateSubscribeMes_behaviour(in integer pl_id) runs on EPTF_UIHandlerClient_CT { |
| f_EPTF_UIHandlerClient_init_CT( |
| pl_selfName := "UIHandler_PerfTest_subscribeMe.client."&int2str(pl_id), |
| pl_DefaultUIHandler := mtc |
| ); |
| |
| f_EPTF_Base_registerCleanup(refers(f_EPTF_UIHandlerClient_generateSubscribeMes_cleanup)); |
| |
| var Widgets vl_xul := c_MainHBox; |
| vl_xul.hbox.id := vl_xul.hbox.id&int2str(pl_id); |
| var charstring vl_parentWidget := "EPTF_Main_hbox_Textboxes"&int2str(pl_id);//vl_xul.xtdp_hbox.id; |
| f_EPTF_UIHandlerClient_XSD_addElementToGUI(vl_xul, tsp_EPTF_GUI_Main_Window_WidgetId); |
| |
| // generate subscribeMe-s: |
| var integer i := 0, j:=0; |
| var integer vl_widgetNum := 500; |
| timer t_subscribe := 0.0; |
| t_subscribe.start; |
| timer t_adjust := 3.0; |
| var float vl_adjustStart; |
| |
| var integer vl_charVarIdx; |
| f_EPTF_Var_newCharstring("charVarProv", "Component: "&int2str(pl_id), vl_charVarIdx); |
| |
| alt { |
| [] t_subscribe.timeout { |
| i:=i+1; |
| if (f_EPTF_Base_getRelTimeInSecs()<30.0 and i<vl_widgetNum) { |
| var charstring vl_widgetId := "textBox"&int2str(pl_id)&"_"&int2str(i); |
| f_EPTF_UIHandlerClient_XSD_addElementToGUI( |
| { |
| textbox := { |
| customclass := omit, |
| disabled := false, |
| disabledongui := false, |
| flex := omit, |
| focusafterchange := omit, |
| id := vl_widgetId, |
| multiline := false, |
| readonly := false, |
| rows := omit, |
| tooltiptext := "", |
| value_ := omit, |
| widgetType := omit, |
| wrap := omit, |
| externaldata := omit |
| } |
| }, |
| vl_parentWidget |
| ); |
| f_EPTF_UIHandlerClient_subscribeMe("charVarProv", "GUI.charVarProv"&vl_widgetId, vl_widgetId, realtime); |
| t_subscribe.start; |
| } else { |
| action("Number of widgets: ", i); |
| t_adjust.start; |
| vl_adjustStart := f_EPTF_Base_getRelTimeInSecs(); |
| } |
| |
| //if (i<4) { |
| repeat; |
| //} |
| } |
| [] t_adjust.timeout { |
| j:=j+1; |
| f_EPTF_Var_adjustContent(vl_charVarIdx, {charstringVal := "Component: "&int2str(pl_id)&" realtime, j: " & int2str(j)& " Elapsed time: " &float2str(f_EPTF_Base_getRelTimeInSecs()-vl_adjustStart)& " Period: "&float2str((f_EPTF_Base_getRelTimeInSecs()-vl_adjustStart)/int2float(j))}); |
| t_adjust.start; |
| repeat; |
| } |
| } |
| |
| f_EPTF_Base_wait4Shutdown(); |
| } |
| |
| |
| function f_EPTF_UIHandler_Test_CheckGUI(in Widgets pl_windowIN, in template Widgets pl_windowOUT) runs on EPTF_UIHandler_Test_CT { |
| v_ready := false; |
| f_EPTF_UIHandler_init_CT( "UIHandlerTestComponent" ); |
| f_EPTF_DataSource_registerReadyCallback(refers(f_EPTF_ExecCtrl_Test_DataSourceClientReady )); |
| var EPTF_UIHandler_Test_DataSourceClient_CT vl_client1 := EPTF_UIHandler_Test_DataSourceClient_CT.create; |
| vl_client1.start(f_EPTF_UIHandler_Test_clientBehavior(self)); |
| |
| f_EPTF_UIHandler_clearGUI(); |
| |
| timer T_guard, T_alt; |
| T_alt.start( 0.0 ); |
| T_guard.start( 5.0 ); |
| // wait until DataSource is registered |
| alt{ |
| [] T_guard.timeout{ |
| setverdict(fail,"Timeout during config"); |
| f_EPTF_Base_stopAll(); |
| } |
| [v_ready] T_alt.timeout{} |
| } |
| |
| var charstring vl_windowIn := f_EPTF_UIHandler_XSD_encodeXUL(pl_windowIN); |
| if(false == f_EPTF_UIHandler_createGUI(vl_windowIn)){ |
| setverdict(fail, "CreateGUI failed."); |
| } |
| |
| var charstring vl_snapshot := f_EPTF_UIHandler_snapshot(); |
| var Widgets vl_result2; |
| dec_Widgets(char2oct(vl_snapshot), vl_result2); |
| |
| if(not match(vl_result2, pl_windowOUT)){ |
| setverdict(fail, "Snapshot does not match the expected output :" & log2str(match(vl_result2, pl_windowOUT))); |
| } |
| f_EPTF_Base_cleanup_CT(); |
| } |
| |
| function f_EPTF_UIHandler_Test_CheckGUIFromFile( |
| in charstring pl_fileNameIN, |
| in charstring pl_fileNameOUT, |
| in charstring pl_fileNameIN2 := "", |
| in boolean pl_clearGUI := true, |
| in charstring pl_checkWarningMsg := "", |
| in charstring pl_EPTF_GUI_Main_Window_WidgetId := tsp_EPTF_GUI_Main_Window_WidgetId) |
| runs on EPTF_UIHandler_Test_CT { |
| v_ready := false; |
| f_EPTF_UIHandler_init_CT( "UIHandlerTestComponent" ); |
| if(pl_checkWarningMsg != ""){ |
| f_EPTF_UIHandler_Test_ExpectedWarning_setExpectedWarning(pl_checkWarningMsg, true); |
| } |
| f_EPTF_DataSource_registerReadyCallback(refers(f_EPTF_ExecCtrl_Test_DataSourceClientReady )); |
| var EPTF_UIHandler_Test_DataSourceClient_CT vl_client1 := EPTF_UIHandler_Test_DataSourceClient_CT.create; |
| vl_client1.start(f_EPTF_UIHandler_Test_clientBehavior(self)); |
| |
| if(pl_clearGUI){ |
| f_EPTF_UIHandler_clearGUI(); |
| f_EPTF_UIHandler_addWindow(); |
| } |
| |
| timer T_guard, T_alt; |
| T_alt.start( 0.0 ); |
| T_guard.start( 5.0 ); |
| // wait until DataSource is registered |
| alt{ |
| [] T_guard.timeout{ |
| setverdict(fail,"Timeout during config"); |
| f_EPTF_Base_stopAll(); |
| } |
| [v_ready] T_alt.timeout{} |
| } |
| |
| if(false == f_EPTF_UIHandler_createGUIFromFile(pl_fileNameIN, pl_EPTF_GUI_Main_Window_WidgetId)){ |
| setverdict(fail, "CreateGUI failed."); |
| } |
| |
| |
| if(pl_fileNameIN2 != ""){ |
| T_guard.start( 1.0 ); |
| // wait until the gui is completed |
| T_guard.timeout; |
| |
| if(false == f_EPTF_UIHandler_createGUIFromFile(pl_fileNameIN2, pl_EPTF_GUI_Main_Window_WidgetId)){ |
| setverdict(fail, "CreateGUI failed."); |
| } |
| } |
| |
| |
| T_guard.start( 5.0 ); |
| // wait until the gui is completed |
| T_guard.timeout; |
| |
| |
| var charstring vl_snapshot := f_EPTF_UIHandler_snapshot(); |
| var Widgets vl_result2; |
| dec_Widgets(char2oct(vl_snapshot), vl_result2); |
| |
| var charstring vl_fileContent := ""; |
| f_EPTF_UIHandler_readFileToCharstring(pl_fileNameOUT, vl_fileContent); |
| var Widgets vl_expectedWidget; |
| dec_Widgets(char2oct(vl_fileContent), vl_expectedWidget); |
| |
| if(not match(vl_result2, vl_expectedWidget)){ |
| setverdict(fail, "Snapshot does not match the expected output :" & log2str(match(vl_result2, vl_expectedWidget))); |
| } |
| f_EPTF_Base_cleanup_CT(); |
| } |
| |
| |
| group newGUI_concept{ |
| |
| const charstring c_EPTF_UIHandler_Test_var_prefix := "szevasz-tavasz"; |
| function f_EPTF_ExecCtrl_Test_DataSourceClientReady( |
| in charstring pl_source, |
| in charstring pl_ptcName) |
| runs on EPTF_UIHandler_Test_CT{ |
| if(pl_source == "ExecCtrl") { |
| v_ready := true; |
| } |
| } |
| |
| function f_EPTF_ExecCtrl_Test_DataSourceClientReadyUIHandler( |
| in charstring pl_source, |
| in charstring pl_ptcName) |
| runs on EPTF_UIHandler_Test_CT{ |
| if(pl_source == "UIHandler") { |
| v_ready := true; |
| } |
| } |
| type record EPTF_UIHandler_Test_ClientAdditionalVar{ |
| charstring varName, |
| charstring elementName, |
| EPTF_Var_DirectContent initValue |
| } |
| |
| type record EPTF_UIHandler_Test_VarDataPair{ |
| charstring varname, |
| charstring elementName |
| } |
| type record of EPTF_UIHandler_Test_VarDataPair EPTF_UIHandler_Test_VarDataPairList; |
| type component EPTF_UIHandler_Test_DataSourceClient_CT extends EPTF_DataSourceClient_CT{ |
| var EPTF_UIHandler_Test_VarDataPairList v_extraVars := {}; |
| } |
| type record of EPTF_UIHandler_Test_ClientAdditionalVar EPTF_UIHandler_Test_ClientAdditionalVarList; |
| |
| public function f_EPTF_UIHandler_Test_clientBehavior( |
| in EPTF_DataSource_CT pl_server, |
| in EPTF_UIHandler_Test_ClientAdditionalVarList pl_additionalVars := {}, |
| in boolean pl_postproc := false) |
| runs on EPTF_UIHandler_Test_DataSourceClient_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_UIHandler_Test_var_prefix & "LGens", vl_cList ,vl_idx); |
| vl_cList := {"EG1", "EG2", "EG3", "EG4"} |
| f_EPTF_Var_newCharstringlist(c_EPTF_UIHandler_Test_var_prefix & "EntityGroups", vl_cList ,vl_idx); |
| vl_cList := {"SC1", "SC2", "SC3"} |
| f_EPTF_Var_newCharstringlist(c_EPTF_UIHandler_Test_var_prefix & "Scenarios", vl_cList ,vl_idx); |
| |
| vl_cList := {} |
| for(var integer vl_i := 1; vl_i < 6 ; vl_i := vl_i + 1){ |
| vl_cList := vl_cList & {"X_Depends" & log2str(vl_i-1)}; |
| f_EPTF_Var_newCharstringlist(c_EPTF_UIHandler_Test_var_prefix & "X_Depends_EG" & log2str(vl_i), vl_cList ,vl_idx); |
| } |
| |
| |
| f_EPTF_Var_newInt(c_EPTF_UIHandler_Test_var_prefix & "ECount1", 101, vl_idx) |
| f_EPTF_Var_newInt(c_EPTF_UIHandler_Test_var_prefix & "ECount2", 102, vl_idx) |
| f_EPTF_Var_newInt(c_EPTF_UIHandler_Test_var_prefix & "ECount3", 103, vl_idx) |
| f_EPTF_Var_newInt(c_EPTF_UIHandler_Test_var_prefix & "ECount4", 104, vl_idx) |
| f_EPTF_Var_newInt(c_EPTF_UIHandler_Test_var_prefix & "ECount5", 105, vl_idx) |
| |
| f_EPTF_DataSourceClient_registerData("LGenBase", "LGen1", refers(f_EPTF_UIHandler_Test_preProcessorData)); |
| f_EPTF_DataSourceClient_registerData("LGenBase", "LGen2", refers(f_EPTF_UIHandler_Test_preProcessorData)); |
| f_EPTF_DataSourceClient_registerData("LGenBase", "LGen3", refers(f_EPTF_UIHandler_Test_preProcessorData)); |
| f_EPTF_DataSourceClient_registerData("ExecCtrl", "LGen1", refers(f_EPTF_UIHandler_Test_preProcessorData)); |
| f_EPTF_DataSourceClient_registerData("ExecCtrl", "" , refers(f_EPTF_UIHandler_Test_preProcessorData)); |
| f_EPTF_DataSourceClient_registerCondition("ExecCtrl", "", refers(f_EPTF_UIHandler_Test_ConditionHandler_isUnpair), "isUnpair") |
| |
| for ( var integer vl_i := 0; vl_i < sizeof(pl_additionalVars) ; vl_i := vl_i+1 ){ |
| var integer vl_varToSubscribe := f_EPTF_Var_newVar(pl_additionalVars[vl_i].varName, pl_additionalVars[vl_i].initValue); |
| v_extraVars[vl_i].varname := pl_additionalVars[vl_i].varName; |
| v_extraVars[vl_i].elementName := pl_additionalVars[vl_i].elementName; |
| if(pl_postproc){ |
| f_EPTF_Var_addPostProcFn(vl_varToSubscribe, {refers(f_EPTF_Test_PostProc),{}}) |
| } |
| } |
| |
| |
| f_EPTF_DataSourceClient_sendReady("ExecCtrl",""); |
| |
| f_EPTF_Base_wait4Shutdown(); |
| } |
| |
| private function f_EPTF_Test_PostProc(in integer pl_idx, in EPTF_IntegerList pl_argList) runs on EPTF_UIHandler_Test_DataSourceClient_CT { |
| action("Postproc ", pl_idx); |
| var integer vl_idx := f_EPTF_Var_getId("selected"); |
| if(vl_idx == pl_idx){ |
| var EPTF_Var_DirectContent vl_content, vl_content2; |
| f_EPTF_Var_getContent(vl_idx, vl_content); |
| action("Change the second to : kettes", vl_content); |
| var integer vl_idx2 := f_EPTF_Var_getId("selected2"); |
| vl_content2 := { charstringVal := "kettes" & vl_content.charstringVal } |
| f_EPTF_Var_adjustContent(vl_idx2, vl_content2); |
| |
| } |
| } |
| |
| //Returns true, if the # sc is unpair |
| function f_EPTF_UIHandler_Test_ConditionHandler_isUnpair( |
| 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(1 > sizeof(pl_params)){ |
| pl_conditionValue := false; |
| return -1; |
| } |
| var integer pos := lengthof(pl_params[0].paramValue)-1; |
| pl_conditionValue := (1 == str2int(substr(pl_params[0].paramValue,pos, 1)) mod 2); |
| return 0; |
| } |
| |
| private function f_EPTF_UIHandler_Test_getParams( |
| in EPTF_DataSource_Params pl_params, |
| in EPTF_CharstringList pl_needed, |
| out EPTF_CharstringList pl_result, |
| in boolean pl_noWarning := false) |
| runs on EPTF_DataSourceClient_CT return integer { |
| pl_result := {}; |
| if(sizeof(pl_params) == sizeof(pl_needed)){ |
| for(var integer j := 0; j < sizeof(pl_needed); j := j + 1){ |
| for(var integer i := 0; i < sizeof(pl_params); i:= i + 1){ |
| if(pl_params[i].paramName == pl_needed[j]){ |
| pl_result[sizeof(pl_result)] := pl_params[i].paramValue; |
| } |
| } |
| } |
| if(sizeof(pl_result) != sizeof(pl_needed)){ |
| if(not pl_noWarning){ |
| var EPTF_CharstringList vl_error := {}; |
| for(var integer i := 0; i < sizeof(pl_params); i:= i + 1){ |
| vl_error[i] := pl_params[i].paramName; |
| } |
| setverdict(inconc,%definitionId& ": Parameters are not correct: "& |
| "\nReceived: "& log2str(vl_error)& |
| "\nNeeded : "& log2str(pl_needed)); |
| } |
| return -1; |
| } |
| return 0; |
| } else{ |
| if(not pl_noWarning){ |
| var EPTF_CharstringList vl_error := {}; |
| for(var integer i := 0; i < sizeof(pl_params); i:= i + 1){ |
| vl_error[i] := pl_params[i].paramName; |
| } |
| if(sizeof(pl_params) < sizeof(pl_needed)){ |
| setverdict(inconc,%definitionId& ": Too few parameter is given: "& |
| "\nReceived: "& log2str(vl_error)& |
| "\nNeeded : "& log2str(pl_needed)); |
| } else { |
| setverdict(inconc,%definitionId& ": Too many parameters are given: "& |
| "\nReceived: "& log2str(vl_error)& |
| "\nNeeded : "& log2str(pl_needed)); |
| } |
| } |
| return -1; |
| } |
| } |
| |
| |
| public function f_EPTF_UIHandler_Test_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_UIHandler_Test_DataSourceClient_CT return integer{ |
| //action(%definitionId&": ",pl_source, ",",pl_element) |
| if(pl_element == "LGenList"){ |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "LGens" |
| return 0; |
| } |
| else if(pl_element == "EntityGroups"){ |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "EntityGroups" |
| return 0; |
| } |
| else if(pl_element == "Scenarios"){ |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "Scenarios" |
| return 0; |
| } |
| else if(pl_element == "EntityCount"){ |
| if ( pl_params[0].paramValue == "EG1" ){ |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "ECount1" |
| return 0; |
| } |
| else if ( pl_params[0].paramValue == "EG2" ){ |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "ECount2" |
| return 0; |
| } |
| else if ( pl_params[0].paramValue == "EG3" ){ |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "ECount3" |
| return 0; |
| } |
| else if ( pl_params[0].paramValue == "EG4" ){ |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "ECount4" |
| return 0; |
| } |
| else if ( pl_params[0].paramValue == "EG5" ){ |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "ECount5" |
| return 0; |
| } |
| else if ( pl_params[0].paramValue == "EG_WAIT" ){ |
| action("Wait starts, connect with runtimegui"); |
| timer t := 10.0; |
| t.start; |
| t.timeout; |
| action("Wait ended"); |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "ECount4" |
| return 0; |
| } |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "Scenarios" |
| return 0; |
| } |
| else if(pl_element == "X_Depends_EG"){ |
| if ( pl_params[0].paramValue == "EG1" ){ |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "X_Depends_EG1" |
| return 0; |
| } |
| else if ( pl_params[0].paramValue == "EG2" ){ |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "X_Depends_EG2" |
| return 0; |
| } |
| else if ( pl_params[0].paramValue == "EG3" ){ |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "X_Depends_EG3" |
| return 0; |
| } |
| else if ( pl_params[0].paramValue == "EG4" ){ |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "X_Depends_EG4" |
| return 0; |
| } |
| else if ( pl_params[0].paramValue == "EG5" ){ |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "X_Depends_EG5" |
| return 0; |
| } else { |
| action("No data is available"); |
| return -1; |
| } |
| } else { |
| for ( var integer vl_i := 0; vl_i < sizeof(v_extraVars) ; vl_i := vl_i+1 ){ |
| if(pl_element == v_extraVars[vl_i].elementName){ |
| pl_dataVarName := v_extraVars[vl_i].varname; |
| return 0; |
| } |
| } |
| } |
| return -1; |
| } |
| } |
| |
| |
| |
| |
| |
| }//FunctionTestFunctions |
| |
| |
| |
| public function f_EPTF_UIHandler_ManualTest_disableWidgetsOfVarPreProcessorData( |
| 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_UIHandler_Test_DataSourceClient_CT |
| return integer |
| { |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & pl_element; |
| return 0; |
| } |
| |
| function f_EPTF_UIHandler_ManualTest_disableWidgetsOfVarButtonPushed( |
| in integer pl_idx, |
| in EPTF_IntegerList pl_argList) |
| runs on EPTF_UIHandler_Test_DataSourceClient_CT |
| { |
| //action(f_EPTF_Var_getName(pl_idx) , " = ", f_EPTF_Var_getIntValue(pl_idx)); |
| //action("disabling ", f_EPTF_Var_getName(pl_idx)); |
| //action("enabling ", f_EPTF_Var_getName(pl_argList[0])); |
| f_EPTF_Var_setSubsCanAdjust(pl_idx, false); |
| f_EPTF_Var_setSubsCanAdjust(pl_argList[0], true); |
| } |
| |
| function f_EPTF_UIHandler_ManualTest_disableWidgetsOfVarExit( |
| in integer pl_idx, |
| in EPTF_IntegerList pl_argList) |
| runs on EPTF_UIHandler_Test_DataSourceClient_CT |
| { |
| f_EPTF_Var_setSubsCanAdjust(f_EPTF_Var_getId(c_EPTF_UIHandler_Test_var_prefix & "button1"), false); |
| f_EPTF_Var_setSubsCanAdjust(f_EPTF_Var_getId(c_EPTF_UIHandler_Test_var_prefix & "button2"), false); |
| f_EPTF_Var_setSubsCanAdjust(f_EPTF_Var_getId(c_EPTF_UIHandler_Test_var_prefix & "exit"), false); |
| timer T_wait := 1.0; |
| T_wait.start; |
| T_wait.timeout; |
| f_EPTF_Base_stopAll(pass); |
| } |
| |
| function f_EPTF_UIHandler_ManualTest_disableWidgetsOfVarClientBehavior( |
| in EPTF_DataSource_CT pl_server) |
| runs on EPTF_UIHandler_Test_DataSourceClient_CT |
| { |
| const charstring c_selfName := "disableWidgetsOfVarClientBehavior"; |
| f_EPTF_Var_init_CT(c_selfName); |
| f_EPTF_DataSourceClient_init_CT(c_selfName, pl_server); |
| |
| var integer vl_b1, vl_b2, vl_e; |
| f_EPTF_Var_newInt(c_EPTF_UIHandler_Test_var_prefix & "button1", 0, vl_b1); |
| f_EPTF_Var_newInt(c_EPTF_UIHandler_Test_var_prefix & "button2", 0, vl_b2); |
| f_EPTF_Var_newInt(c_EPTF_UIHandler_Test_var_prefix & "exit", 0, vl_e); |
| |
| f_EPTF_Var_addPostProcFn( vl_b1, { refers(f_EPTF_UIHandler_ManualTest_disableWidgetsOfVarButtonPushed), {vl_b2}} ); |
| f_EPTF_Var_addPostProcFn( vl_b2, { refers(f_EPTF_UIHandler_ManualTest_disableWidgetsOfVarButtonPushed), {vl_b1}} ); |
| f_EPTF_Var_addPostProcFn( vl_e, { refers(f_EPTF_UIHandler_ManualTest_disableWidgetsOfVarExit), {}} ); |
| f_EPTF_Var_setSubsCanAdjust(vl_b2, false); |
| |
| f_EPTF_DataSourceClient_registerData("dsclient", "", refers(f_EPTF_UIHandler_ManualTest_disableWidgetsOfVarPreProcessorData)); |
| |
| f_EPTF_DataSourceClient_sendReady("dsclient",""); |
| |
| f_EPTF_Base_wait4Shutdown(); |
| } |
| |
| group CheckExcpectedWarning { |
| |
| private function f_EPTF_UIHandler_Test_ExpectedWarning_init(in boolean pl_negativeMode := false) runs on EPTF_UIHandler_Test_CT { |
| if (v_UIHandler_Test_expectedWarningInitialized) { |
| return; |
| } |
| v_UIHandler_Test_expectedWarningInitialized:=true; |
| v_UIHandler_Test_expectedWarningArrived := false; |
| v_UIHandler_Test_expectedWarningMsg:=""; |
| v_UIHandler_Test_negativeMode := pl_negativeMode; |
| f_EPTF_Base_registerCleanup(refers(f_EPTF_UIHandler_Test_ExpectedWarning_cleanup)); |
| f_EPTF_Logging_registerPreambleFn(refers(f_EPTF_UIHandler_Test_ExpectedWarning_checkExpectedWarning_preamble_FT)); |
| } |
| |
| private function f_EPTF_UIHandler_Test_ExpectedWarning_cleanup() runs on EPTF_UIHandler_Test_CT { |
| if (not v_UIHandler_Test_expectedWarningInitialized) { |
| return; |
| } |
| v_UIHandler_Test_expectedWarningInitialized:=false; |
| action("call->f_EPTF_UIHandler_Test_ExpectedWarning_cleanup[",v_UIHandler_Test_negativeMode,"]:",v_UIHandler_Test_expectedWarningMsg); |
| if(v_UIHandler_Test_negativeMode){ |
| if (v_UIHandler_Test_expectedWarningMsg != "" and not v_UIHandler_Test_expectedWarningArrived) { |
| setverdict(pass,"Warning message ",v_UIHandler_Test_expectedWarningMsg," was not logged!"); |
| } else { |
| setverdict(fail,"The given warning message was logged"); |
| } |
| } else { |
| if (v_UIHandler_Test_expectedWarningMsg != "" and not v_UIHandler_Test_expectedWarningArrived) { |
| setverdict(fail,"Expected warning message ",v_UIHandler_Test_expectedWarningMsg," was not logged!"); |
| } else { |
| setverdict(pass,"Expected warning message was logged"); |
| } |
| } |
| } |
| |
| public function f_EPTF_UIHandler_Test_ExpectedWarning_setExpectedWarning(in charstring pl_expectedWarningMsg, |
| in boolean pl_negativeMode := false) runs on EPTF_UIHandler_Test_CT { |
| if (pl_expectedWarningMsg=="") { |
| return; |
| } |
| f_EPTF_UIHandler_Test_ExpectedWarning_init(pl_negativeMode); |
| v_UIHandler_Test_expectedWarningMsg := pl_expectedWarningMsg; |
| } |
| |
| private function f_EPTF_UIHandler_Test_ExpectedWarning_checkExpectedWarning_preamble_FT(in charstring pl_message) runs on EPTF_UIHandler_Test_CT { |
| if (not match(pl_message,pattern "*Warning*")) { |
| return; |
| } |
| log("Check match: ", match(pl_message,pattern v_UIHandler_Test_expectedWarningMsg)) |
| action("call->f_EPTF_UIHandler_Test_ExpectedWarning_checkExpectedWarning_preamble_FT->",pl_message); |
| if (match(pl_message,pattern v_UIHandler_Test_expectedWarningMsg)) { |
| v_UIHandler_Test_expectedWarningArrived := true; |
| } |
| } |
| |
| } |
| |
| function f_EPTF_UIHandler_Test_Data_Handler( |
| 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_UIHandler_Test_CT return integer { |
| pl_dataVarName := pl_element; |
| return 0; |
| } |
| |
| group BrowserGUI_Test { |
| |
| public function f_EPTF_UIHandler_Test_HandleMsgs( |
| in EPTF_Transport_TransportType pl_transportType, |
| in ConnectionId pl_connId, |
| in HostName pl_remHost, |
| in PortNumber pl_remPort, |
| in HostName pl_locHost, |
| in PortNumber pl_locPort, |
| in ProtoTuple pl_proto, |
| in integer pl_userData, |
| in octetstring pl_msg) runs on BrowserSimulation_CT { |
| var charstring vl_receivedMessage := oct2str(pl_msg); |
| action("Incomming message : ", vl_receivedMessage); |
| if(not v_receiveFunction == null){ |
| v_receiveFunction.apply( pl_msg ) |
| } |
| } |
| |
| public function f_EPTF_UIHandler_Test_GUIHandleMsgs( |
| in EPTF_Transport_TransportType pl_transportType, |
| in ConnectionId pl_connId, |
| in HostName pl_remHost, |
| in PortNumber pl_remPort, |
| in HostName pl_locHost, |
| in PortNumber pl_locPort, |
| in ProtoTuple pl_proto, |
| in integer pl_userData, |
| in octetstring pl_msg) runs on RTGSimulation_CT { |
| var Result vl_result; |
| |
| if(v_received < 4){ |
| action("Send reconnect string"); |
| f_EPTF_Transport_sendTo( |
| IPL4, |
| reconnectionId, |
| pl_remHost, |
| pl_remPort, |
| '47554920726573706F6E73653A'O, |
| vl_result, |
| false) |
| } else { |
| var ttcn_ericsson_se_protocolModules_xtdp_xtdp.XTDP_Message vl_receivedMessage; |
| XTDP_EncDecFunctions.dec_XTDP_Message(f_EPTF_UIHandler_getRawMsg_XTDP(pl_msg), vl_receivedMessage); |
| action(" Incoming XTDP message :", vl_receivedMessage); |
| //check duplicatedID when addrequest has happening. |
| if(ischosen(vl_receivedMessage.choice.xTDP_AddRequests)){ |
| action("addrequest"); |
| v_addrequest := v_addrequest + 1; |
| if(v_addrequest > 1){ |
| //ideiglenes megoldas, ezt ki kene okositani |
| setverdict(fail,"More than one addrequest has been arrived"); |
| } |
| /* for( var integer vl_i := 0; vl_i < sizeof(vl_receivedMessage.choice.xTDP_AddRequests.xTDP_AddRequest_list); vl_i := vl_i + 1){ |
| var EPTF_CharstringList vl_widgetIds; |
| f_EPTF_UIHandler_getWidgetIDs(vl_receivedMessage.choice.xTDP_AddRequests.xTDP_AddRequest_list[vl_i].widgets, vl_widgetIds); |
| for( var integer vl_j := 0; vl_j < sizeof(vl_widgetIds); vl_j := vl_j + 1){ |
| action("WidgetId : ", vl_widgetIds[vl_j]); |
| } |
| }*/ |
| } |
| } |
| v_received := v_received + 1; |
| |
| } |
| |
| friend function f_EPTF_UIHandler_getWidgetIDs(in Widgets pl_widget, out EPTF_CharstringList pl_widgetIds){ |
| pl_widgetIds := {}; |
| //ke kellene greppelni az " id := """ bol stringet |
| } |
| |
| function f_EPTF_UIHandler_Test_Browser_ReceiveMsg(in octetstring pl_message) runs on BrowserSimulation_CT{ |
| var HTTPMessage vl_HTTP_msg, vl_HTTP_msg_fromOct; |
| dec_HTTPMessage(pl_message, vl_HTTP_msg, false); |
| if(ischosen(vl_HTTP_msg.response)) { |
| v_receivedStatus := vl_HTTP_msg.response.statuscode; |
| v_reveivedMsg := vl_HTTP_msg.response.body; |
| } else { |
| var octetstring vl_bodycontent := vl_HTTP_msg.response_binary.body; |
| v_receivedStatus := vl_HTTP_msg.response_binary.statuscode; |
| dec_HTTPMessage(vl_bodycontent,vl_HTTP_msg_fromOct, false); |
| v_reveivedMsg := vl_HTTP_msg_fromOct.erronous_msg.msg; |
| } |
| if(v_negativeTest == true){ |
| if(match(v_reveivedMsg, pattern v_expectedMsg)) { |
| setverdict(fail, match(v_reveivedMsg, pattern v_expectedMsg)); |
| } else { |
| setverdict(pass); |
| } |
| |
| } else { |
| |
| if(not match(v_reveivedMsg, pattern v_expectedMsg)) { |
| setverdict(fail, match(v_reveivedMsg, pattern v_expectedMsg)); |
| } else { |
| if(0<v_expectedStatus and v_receivedStatus!=v_expectedStatus){ |
| setverdict(fail, "Unexpected response status:"&log2str(v_receivedStatus)&" expected: "&log2str(v_expectedStatus)); |
| } else { |
| setverdict(pass); |
| } |
| } |
| } |
| |
| |
| } |
| |
| function f_EPTF_UIHandler_Test_Browser_SendMsg() runs on BrowserSimulation_CT { |
| timer t_action; |
| t_action.start(1.0); |
| |
| alt { |
| [] t_action.timeout { |
| var Result vl_result; |
| f_EPTF_Transport_send(IPL4, connectionId, enc_HTTPMessage(v_MsgToSend), vl_result, false) |
| repeat; |
| } |
| } |
| log("exitClient"); |
| } |
| |
| private function f_UIhandler_Test_Browser_getMsgLen_XTDP |
| ( |
| in EPTF_Transport_TransportType pl_transportType, |
| in octetstring pl_stream, |
| inout EPTF_IntegerList pl_args |
| ) |
| return integer |
| { |
| return f_HTTPMessage_len(pl_stream); |
| } |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_Browser_init |
| //========================================================== |
| function f_EPTF_UIHandler_Test_Browser_init( |
| in charstring pl_selfName, |
| in f_EPTF_UIHandler_Test_Browser_receive_CT pl_recevieFn, |
| in f_EPTF_UIHandler_Test_Browser_send_CT pl_sendFn, |
| in charstring pl_connectToAddress, |
| in integer pl_connectToPort, |
| in verdicttype pl_verdictIfNoConnection, |
| in charstring pl_verdictIfConnection |
| ) runs on BrowserSimulation_CT |
| { |
| f_EPTF_Base_init_CT(pl_selfName); |
| f_EPTF_Transport_init(IPL4, pl_selfName) |
| f_EPTF_Transport_registerMsgLenCallback4LGenType(IPL4, refers(f_UIhandler_Test_Browser_getMsgLen_XTDP), {}, c_UIHandler_Test_Browser_LGenType); |
| f_EPTF_Transport_registerMsgCallback(IPL4, c_UIHandler_Test_Browser_LGenType, refers(f_EPTF_UIHandler_Test_HandleMsgs)); |
| f_EPTF_Base_registerCleanup(refers(f_EPTF_UIHandler_Test_Browser_Cleanup)); |
| |
| v_receiveFunction := pl_recevieFn; |
| v_sendFunction := pl_sendFn; |
| |
| //Connect as a client: |
| var Result vl_result; |
| f_EPTF_Transport_connect( IPL4, {tcp := {}}, tsp_EPTF_UIHandler_Browser_RemoteAddress, 0, pl_connectToAddress, pl_connectToPort, c_UIHandler_Test_Browser_LGenType, vl_result, true); |
| if(ispresent(vl_result.connId)){ |
| connectionId := vl_result.connId; |
| select(pl_verdictIfConnection){ |
| case ("pass") { |
| setverdict(pass,"Making Connection OK on : ", pl_connectToAddress, ":",pl_connectToPort); |
| } |
| case ("fail") { |
| setverdict(fail,"Making Connection OKon : ", pl_connectToAddress, ":",pl_connectToPort, " , altough it should not connect with these parameters"); |
| } |
| } |
| } else { |
| setverdict(pl_verdictIfNoConnection,"No connection on : ", pl_connectToAddress, ":",pl_connectToPort ); |
| if(pl_verdictIfNoConnection != pass){f_EPTF_Base_stopAll(pl_verdictIfNoConnection);} |
| } |
| }//f_ |
| |
| |
| //========================================================================= |
| // Functions |
| //========================================================================= |
| private function f_GUISIM_getMsgLen_XTDP( |
| in EPTF_Transport_TransportType pl_transportType, |
| in octetstring pl_stream, |
| inout EPTF_IntegerList pl_args |
| ) |
| return integer |
| { |
| if (lengthof(pl_stream)<4) |
| { |
| return -1 |
| } |
| else |
| { |
| return oct2int(substr(pl_stream,0, 4)) |
| } |
| } |
| |
| function f_GUISIM_HandleEvent_XTDP( |
| in EPTF_Transport_TransportType pl_transportType, |
| in ConnectionId pl_connId, |
| in PortEvent pl_event) |
| runs on RTGSimulation_CT |
| { |
| if(ischosen(pl_event.connClosed)){ |
| action("Conn Close"); |
| if(v_fullConnection){ |
| f_EPTF_Base_stop(pass); |
| } |
| |
| } |
| if(ischosen(pl_event.connOpened)){ |
| action("Conn Open from: ", pl_event.connOpened.locName, ":" , pl_event.connOpened.locPort); |
| setverdict(v_verdictIfConnection,"Conn Open from: ", pl_event.connOpened.locName, ":" , pl_event.connOpened.locPort); |
| if(not v_fullConnection){ |
| f_EPTF_Base_stop(pass); |
| } else { |
| if(v_received == 4){ |
| action("Handshake"); |
| var ttcn_ericsson_se_protocolModules_xtdp_xtdp.XTDP_Message vl_handshake := { omit, { xTDP_HandshakeRequest := |
| { c_EPTF_UIHandler_xtdpMyVersion, c_EPTF_UIHandler_xtdlMyVersion, c_EPTF_UIHandler_xtdpMyVersion, c_EPTF_UIHandler_xtdlMyVersion, {}}} |
| } |
| var octetstring vl_oct := int2oct(lengthof(XTDP_EncDecFunctions.enc_XTDP_Message(vl_handshake))+4,4) & XTDP_EncDecFunctions.enc_XTDP_Message(vl_handshake); |
| var Result vl_result; |
| var boolean returnval := f_EPTF_Transport_send( |
| pl_transportType, |
| pl_connId, |
| vl_oct, |
| vl_result, |
| false); |
| } |
| } |
| } |
| } |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_RTG_init |
| //========================================================== |
| function f_EPTF_UIHandler_Test_RTG_init( |
| in charstring pl_selfName, |
| in charstring pl_connectToAddress, |
| in integer pl_connectToPort, |
| in integer pl_reconnectToPort, |
| in verdicttype pl_verdictIfNoConnection, |
| in verdicttype pl_verdictIfConnection, |
| in boolean pl_fullConnection |
| ) runs on RTGSimulation_CT |
| { |
| f_EPTF_Base_init_CT(pl_selfName); |
| f_EPTF_Transport_init(IPL4, pl_selfName) |
| |
| v_verdictIfConnection := pl_verdictIfConnection; |
| v_verdictIfNoConnection := pl_verdictIfNoConnection; |
| v_fullConnection := pl_fullConnection; |
| // f_EPTF_Transport_registerMsgLenCallback4LGenType(IPL4, refers(f_GUISIM_getMsgLen_XTDP), {}, c_UIHandler_Test_Browser_LGenType); |
| // f_EPTF_Transport_registerMsgCallback(IPL4, c_UIHandler_Test_Browser_LGenType, refers(f_EPTF_UIHandler_Test_GUIHandleMsgs), refers(f_GUISIM_HandleEvent_XTDP)); |
| f_EPTF_Base_registerCleanup(refers(f_EPTF_UIHandler_Test_GUICleanup)); |
| |
| |
| // c_EPTF_UIHandler_XTDPType instead of c_UIHandler_Test_Browser_LGenType |
| f_EPTF_Transport_registerMsgLenCallback4LGenType(IPL4, refers(f_GUISIM_getMsgLen_XTDP), {}, c_EPTF_UIHandler_XTDPType); |
| f_EPTF_Transport_registerMsgCallback(IPL4, c_EPTF_UIHandler_XTDPType, refers(f_EPTF_UIHandler_Test_GUIHandleMsgs), refers(f_GUISIM_HandleEvent_XTDP)); |
| |
| |
| //Connect as a client: |
| var Result vl_result; |
| // f_EPTF_Transport_listen( IPL4, {tcp := {}}, pl_connectToAddress, pl_connectToPort, c_UIHandler_Test_Browser_LGenType, vl_result, true); |
| f_EPTF_Transport_listen( IPL4, {tcp := {}}, pl_connectToAddress, pl_connectToPort, c_EPTF_UIHandler_XTDPType, vl_result, true); |
| |
| if(ispresent(vl_result.connId)){ |
| connectionId := vl_result.connId; |
| } else { |
| setverdict(inconc,"No listening on : ", pl_connectToAddress, ":",pl_connectToPort ); |
| if(pl_verdictIfNoConnection != pass){f_EPTF_Base_stopAll(pl_verdictIfNoConnection);} |
| } |
| //f_EPTF_Transport_listen( IPL4, {udp := {}}, pl_connectToAddress, pl_reconnectToPort, c_UIHandler_Test_Browser_LGenType, vl_result, true); |
| f_EPTF_Transport_listen( IPL4, {udp := {}}, pl_connectToAddress, pl_reconnectToPort, c_EPTF_UIHandler_XTDPType, vl_result, true); |
| if(ispresent(vl_result.connId)){ |
| reconnectionId := vl_result.connId; |
| } else { |
| setverdict(inconc,"No reconnection listening on : ", pl_connectToAddress, ":",pl_reconnectToPort ); |
| } |
| //if(not pl_fullConnection){ |
| f_EPTF_Base_wait4Shutdown(); |
| //} |
| }//f_ |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_Browser_Behavior |
| //========================================================== |
| function f_EPTF_UIHandler_Test_Browser_Behavior(in charstring pl_selfName, |
| in f_EPTF_UIHandler_Test_Browser_receive_CT pl_recevieFn, |
| in f_EPTF_UIHandler_Test_Browser_send_CT pl_sendFn, |
| in HTTPMessage pl_Msg, |
| in charstring pl_expectedMsg, |
| in integer pl_expectedStatus, |
| in charstring pl_connectToAddress, |
| in integer pl_connectToPort, |
| in verdicttype pl_verdictIfNoConnection, |
| in charstring pl_verdictIfConnection, |
| in boolean pl_negativeTest |
| ) runs on BrowserSimulation_CT |
| { |
| |
| f_EPTF_UIHandler_setMsgToSend(pl_Msg); |
| f_EPTF_UIHandler_setExpectedMsg(pl_expectedMsg); |
| f_EPTF_UIHandler_setExpectedStatus(pl_expectedStatus); |
| f_EPTF_UIHandler_setNegativeTest(pl_negativeTest); |
| |
| f_EPTF_UIHandler_Test_Browser_init(pl_selfName, pl_recevieFn, pl_sendFn, pl_connectToAddress, pl_connectToPort, pl_verdictIfNoConnection, pl_verdictIfConnection); |
| if(not pl_sendFn == null) {pl_sendFn.apply( );} |
| |
| } |
| |
| //========================================================== |
| //= f_EPTF_UIHandler_Test_RTGBehavior |
| //========================================================== |
| function f_EPTF_UIHandler_Test_RTGBehavior(in charstring pl_selfName, |
| in charstring pl_connectToAddress, |
| in integer pl_connectToPort, |
| in integer pl_reconnectToPort, |
| in verdicttype pl_verdictIfNoConnection, |
| in verdicttype pl_verdictIfConnection, |
| in boolean pl_fullConnection |
| ) runs on RTGSimulation_CT |
| { |
| f_EPTF_UIHandler_Test_RTG_init(pl_selfName, pl_connectToAddress, pl_connectToPort, pl_reconnectToPort, pl_verdictIfNoConnection, pl_verdictIfConnection, pl_fullConnection); |
| } |
| |
| public function f_EPTF_UIHandler_Test_Browser_createFunction( |
| in HTTPMessage pl_HTTPMsg, //the HTTP Message to send to server |
| in charstring pl_expectedMsg, //the patern, what we waiting in response |
| in charstring pl_connectToAddress := tsp_EPTF_UIHandler_Browser_RemoteAddress, |
| in integer pl_connectToPort := tsp_EPTF_UIHandler_Browser_RemotePort, |
| in verdicttype pl_verdictIfNoConnection := inconc, |
| in charstring pl_verdictIfConnection := "", |
| in integer pl_expectedStatus := 0 |
| ) runs on EPTF_UIHandler_Test_CT { |
| |
| f_EPTF_UIHandler_init_CT( "UIHandlerTestComponent"); |
| |
| const charstring c_gui := " <Widgets xmlns='http://ttcn.ericsson.se/protocolModules/xtdp/xtdl'>"& |
| " <window height='300.000000' id='Window' orientation='vertical' title='WindowTitle - UIHandler Test' width='800.000000'>"& |
| " <hbox flex='1.000000' orientation='horizontal'>"& |
| " <label value=\"BrowserGUI Test\"></label>"& |
| " <textbox id=\"mydata_id\" value=\"\">"& |
| " <externaldata element='mydata' source='HtmlTest'>"& |
| " </externaldata>"& |
| " </textbox>"& |
| " <tabpages flex='1.000000'>"& |
| " <tabpage id='first_tabpage' label='First tabpage' >"& |
| " <label value='First tabpage label'/>"& |
| " </tabpage>"& |
| " <tabpage id='second_tabpage' label='Second tabpage' >"& |
| " <label value='Second tabpage label'/>"& |
| " </tabpage>"& |
| " </tabpages>"& |
| " </hbox>"& |
| " </window>"& |
| " </Widgets>"; |
| var integer vl_idx; |
| f_EPTF_Var_newInt("mydata", 10, vl_idx) |
| |
| f_EPTF_DataSourceClient_registerData( |
| pl_source := "HtmlTest", |
| pl_ptcName := f_EPTF_Base_selfName(), |
| pl_dataHandler := refers(f_EPTF_UIHandler_Test_Data_Handler), |
| pl_sourceCompRef := self |
| ); |
| |
| timer t_Wait; |
| t_Wait.start( 2.0 ); |
| t_Wait.timeout; |
| |
| f_EPTF_UIHandler_clearGUI(); |
| f_EPTF_UIHandler_createGUI(c_gui); |
| |
| f_EPTF_UIHandler_Test_Browser_createBrowserSimulation( pl_HTTPMsg, pl_expectedMsg, pl_connectToAddress, pl_connectToPort , pl_verdictIfNoConnection, pl_verdictIfConnection, pl_expectedStatus := pl_expectedStatus) |
| } |
| |
| public function f_EPTF_UIHandler_Test_Browser_createBrowserSimulation( |
| in HTTPMessage pl_HTTPMsg, //the HTTP Message to send to server |
| in charstring pl_expectedMsg, //the patern, what we waiting in response |
| in charstring pl_connectToAddress := tsp_EPTF_UIHandler_Browser_RemoteAddress, |
| in integer pl_connectToPort := tsp_EPTF_UIHandler_Browser_RemotePort, |
| in verdicttype pl_verdictIfNoConnection := inconc, |
| in charstring pl_verdictIfConnection := "", |
| in charstring pl_selfName := "BrowserComponent", |
| in boolean pl_negativeTest := false, |
| in integer pl_expectedStatus := 0 |
| ) runs on EPTF_UIHandler_Test_CT { |
| |
| var BrowserSimulation_CT vc_browser := BrowserSimulation_CT.create(pl_selfName); |
| vc_browser.start(f_EPTF_UIHandler_Test_Browser_Behavior( |
| pl_selfName, |
| refers(f_EPTF_UIHandler_Test_Browser_ReceiveMsg), |
| refers(f_EPTF_UIHandler_Test_Browser_SendMsg), |
| pl_HTTPMsg, |
| pl_expectedMsg, |
| pl_expectedStatus, |
| pl_connectToAddress, |
| pl_connectToPort, |
| pl_verdictIfNoConnection, |
| pl_verdictIfConnection, |
| pl_negativeTest |
| )); |
| } |
| |
| public function f_EPTF_UIHandler_Test_RTG_createFunction( |
| in charstring pl_connectToAddress := tsp_xtdp_listen_addr, |
| in integer pl_connectToPort := tsp_xtdp_listen_port, |
| in integer pl_reconnectToPort := tsp_EPTF_UIHandler_udp_port, |
| in verdicttype pl_verdictIfNoConnection := inconc, |
| in verdicttype pl_verdictIfConnection := pass |
| ) runs on EPTF_UIHandler_Test_CT { |
| |
| f_EPTF_UIHandler_setGuiHostPort(pl_connectToAddress,pl_connectToPort); |
| f_EPTF_UIHandler_init_CT( "UIHandlerTestComponent"); |
| |
| const charstring c_gui := ""& |
| " <Widgets xmlns='http://ttcn.ericsson.se/protocolModules/xtdp/xtdl'>"& |
| " <window height='300.000000' id='Window' orientation='vertical' title='tc_EPTF_StatManager_Test_base' width='800.000000'>"& |
| " <hbox flex='1.000000' orientation='horizontal'>"& |
| " <label value=\"BrowserGUI Test\"></label>"& |
| " <textbox id=\"mydata_id\" value=\"\">"& |
| " <externaldata element='mydata' source='HtmlTest'>"& |
| " </externaldata>"& |
| " </textbox>"& |
| " <tabpages flex='1.000000'>"& |
| " <tabpage id='first_tabpage' label='First tabpage' >"& |
| " <label value='First tabpage label'/>"& |
| " </tabpage>"& |
| " <tabpage id='second_tabpage' label='Second tabpage' >"& |
| " <label value='Second tabpage label'/>"& |
| " </tabpage>"& |
| " </tabpages>"& |
| " </hbox>"& |
| " </window>"& |
| " </Widgets>"; |
| |
| var integer vl_idx; |
| f_EPTF_Var_newInt("mydata", 10, vl_idx) |
| |
| f_EPTF_DataSourceClient_registerData( |
| pl_source := "HtmlTest", |
| pl_ptcName := f_EPTF_Base_selfName(), |
| pl_dataHandler := refers(f_EPTF_UIHandler_Test_Data_Handler), |
| pl_sourceCompRef := self |
| ); |
| |
| timer t_Wait; |
| t_Wait.start( 2.0 ); |
| t_Wait.timeout; |
| |
| f_EPTF_UIHandler_clearGUI(); |
| f_EPTF_UIHandler_createGUI(c_gui); |
| |
| f_EPTF_UIHandler_Test_createRTGSimulation( pl_connectToAddress, pl_connectToPort , pl_reconnectToPort, pl_verdictIfNoConnection, pl_verdictIfConnection) |
| } |
| |
| public function f_EPTF_UIHandler_Test_createRTGSimulation( |
| in charstring pl_connectToAddress := tsp_xtdp_listen_addr, |
| in integer pl_connectToPort := tsp_xtdp_listen_port, |
| in integer pl_reconnectToPort := tsp_EPTF_UIHandler_udp_port, |
| in verdicttype pl_verdictIfNoConnection := inconc, |
| in verdicttype pl_verdictIfConnection := pass, |
| in float pl_delay := 0.0 |
| ) runs on EPTF_UIHandler_Test_CT { |
| |
| if(pl_delay == 0.0){ |
| var RTGSimulation_CT vc_gui := RTGSimulation_CT.create("RTGComponent"); |
| vc_gui.start(f_EPTF_UIHandler_Test_RTGBehavior( |
| "RTGComponent", |
| pl_connectToAddress, |
| pl_connectToPort, |
| pl_reconnectToPort, |
| pl_verdictIfNoConnection, |
| pl_verdictIfConnection, |
| false |
| )); |
| } else { |
| //active an altstep, start a timer |
| action(" Delay started !! "); |
| v_RTGSimulation_connectToAddress:= pl_connectToAddress; |
| v_RTGSimulation_connectToPort := pl_connectToPort; |
| v_RTGSimulation_reconnectToPort := pl_reconnectToPort; |
| v_RTGSimulation_verdictIfNoConnection := pl_verdictIfNoConnection; |
| v_RTGSimulation_verdictIfConnection := pl_verdictIfConnection; |
| v_RTGSimulation_fullConnection := true; |
| v_test_defaltstep := activate(as_test_startRTG()); |
| t_rtgdelay.start( pl_delay ); |
| } |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Altstep: as_test_startRTG |
| // Purpose: |
| // The start RTG with a delay altstep |
| /////////////////////////////////////////////////////////////// |
| friend altstep as_test_startRTG() runs on EPTF_UIHandler_Test_CT { |
| [] t_rtgdelay.timeout{ |
| action(" Start GUI "); |
| var RTGSimulation_CT vc_gui := RTGSimulation_CT.create("RTGComponent"); |
| vc_gui.start(f_EPTF_UIHandler_Test_RTGBehavior( |
| "RTGComponent", |
| v_RTGSimulation_connectToAddress, |
| v_RTGSimulation_connectToPort, |
| v_RTGSimulation_reconnectToPort, |
| v_RTGSimulation_verdictIfNoConnection, |
| v_RTGSimulation_verdictIfConnection, |
| v_RTGSimulation_fullConnection |
| )); |
| |
| |
| repeat; |
| } |
| |
| } |
| |
| |
| function f_EPTF_UIHandler_getReceivedMsg() runs on BrowserSimulation_CT |
| return charstring { |
| return v_reveivedMsg; |
| } |
| |
| function f_EPTF_UIHandler_setMsgToSend(in HTTPMessage pl_Msg) runs on BrowserSimulation_CT { |
| v_MsgToSend := pl_Msg; |
| } |
| |
| function f_EPTF_UIHandler_setExpectedMsg(in charstring pl_expectedMsg) runs on BrowserSimulation_CT { |
| v_expectedMsg := pl_expectedMsg; |
| } |
| |
| function f_EPTF_UIHandler_setExpectedStatus(in integer pl_expectedStatus) runs on BrowserSimulation_CT { |
| v_expectedStatus := pl_expectedStatus; |
| } |
| |
| function f_EPTF_UIHandler_setNegativeTest(in boolean pl_negativeTest) runs on BrowserSimulation_CT { |
| v_negativeTest := pl_negativeTest; |
| } |
| |
| function f_EPTF_UIHandler_Test_Browser_Cleanup() runs on BrowserSimulation_CT { |
| if(none == getverdict) { |
| if(not match("No response message received", pattern v_expectedMsg)) { |
| setverdict(fail, log2str("'No response message received' does not match with pattern: ", v_expectedMsg, match("No response message received", pattern v_expectedMsg))); |
| } else { |
| setverdict(pass); |
| } |
| } |
| } |
| |
| function f_EPTF_UIHandler_Test_GUICleanup() runs on RTGSimulation_CT { |
| if(none == getverdict) { |
| setverdict(v_verdictIfNoConnection, "No connection to the GUI."); |
| } |
| |
| var Result vl_result |
| f_EPTF_Transport_close(IPL4, reconnectionId, vl_result) |
| reconnectionId := -1; |
| |
| f_EPTF_Transport_close(IPL4, connectionId, vl_result) |
| connectionId := -1; |
| |
| } |
| |
| function f_EPTF_UIHandler_TestDSBehaviour(in charstring pl_selfName) runs on EPTF_UIHandler_Test_CT { |
| f_EPTF_UIHandler_Test_init_CT(pl_selfName, true); |
| timer t := 15.0; |
| t.start; |
| t.timeout; |
| var integer vl_idx; |
| var EPTF_CharstringList vl_charstringIDs := {}; |
| for(var integer vl_i := 0; vl_i < 5000; vl_i := vl_i + 1) { |
| vl_charstringIDs[sizeof(vl_charstringIDs)] := int2str(vl_i); |
| } |
| f_EPTF_Var_newCharstringlist("charstringIDslist", vl_charstringIDs, vl_idx); |
| f_EPTF_DataSourceClient_registerData(f_EPTF_Base_selfName(), f_EPTF_Base_selfName(), refers(f_EPTF_UIHandler_Test_intDSProcessData), self); |
| t.start; |
| t.timeout; |
| var charstring c_gui :="<Widgets xmlns='http://ttcn.ericsson.se/protocolModules/xtdp/xtdl'>"& |
| " <window height='300.000000' id='Window' orientation='vertical' title='tc_EPTF_UIHandler_Browser_Manual_RTGUIvsBrowser' width='800.000000'>"& |
| " <tabpages>" & |
| " <tabpage label=\"Components Data\">" & |
| " <hbox flex='1.000000' orientation='horizontal'>"& |
| " <tree disabled='false' hidecolumnpicker='false' id='tree1'>"& |
| " <treecols>"& |
| " <treecol editable='false' flex='1.000000' label='1.comp' widgetType='string'/>"& |
| " </treecols>"& |
| " <treechildren>"& |
| " <treeitem>"& |
| " <iterator element='charstringIDslist' id='arrayid' source='UIHandler_Component'>"& |
| " <treerow>"& |
| " <treecell label=''>"& |
| " <externaldata element='intvar%arrayid%' source='DSClient' ptcname='DSClient1_Component'>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " </treerow>"& |
| " </iterator>"& |
| " </treeitem>"& |
| " </treechildren>"& |
| " </tree>"& |
| " </hbox>"& |
| " </tabpage>" & |
| " <tabpage label=\"Components Data\">" & |
| " <hbox flex='1.000000' orientation='horizontal'>"& |
| " <tree disabled='false' hidecolumnpicker='false' id='tree2'>"& |
| " <treecols>"& |
| " <treecol editable='false' flex='1.000000' label='2.comp' widgetType='string'/>"& |
| " </treecols>"& |
| " <treechildren>"& |
| " <treeitem>"& |
| " <iterator element='charstringIDslist' id='arrayid' source='UIHandler_Component'>"& |
| " <treerow>"& |
| " <treecell label=''>"& |
| " <externaldata element='intvar%arrayid%' source='DSClient' ptcname='DSClient2_Component'>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " </treerow>"& |
| " </iterator>"& |
| " </treeitem>"& |
| " </treechildren>"& |
| " </tree>"& |
| " </hbox>"& |
| " </tabpage>" & |
| " <tabpage label=\"Components Data\">" & |
| " <hbox flex='1.000000' orientation='horizontal'>"& |
| " <tree disabled='false' hidecolumnpicker='false' id='tree3'>"& |
| " <treecols>"& |
| " <treecol editable='false' flex='1.000000' label='3.comp' widgetType='string'/>"& |
| " </treecols>"& |
| " <treechildren>"& |
| " <treeitem>"& |
| " <iterator element='charstringIDslist' id='arrayid' source='UIHandler_Component'>"& |
| " <treerow>"& |
| " <treecell label=''>"& |
| " <externaldata element='intvar%arrayid%' source='DSClient' ptcname='DSClient3_Component'>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " </treerow>"& |
| " </iterator>"& |
| " </treeitem>"& |
| " </treechildren>"& |
| " </tree>"& |
| " </hbox>"& |
| " </tabpage>" & |
| " <tabpage id=\"HostAdminServer.tab\" label=\"HostAdminServer\" orientation=\"vertical\">" & |
| " <condition element=\"isMultipleHosts\" id=\"cond_multipleHosts\" source=\"HostAdminServer\">" & |
| " <insertif id=\"cond_multipleHosts\">"& |
| " <hbox>"& |
| " <tree disabled=\"false\" flex=\"1.000000\" hidecolumnpicker=\"true\""& |
| " id=\"HostAdmin.%host%.hostStats\" rows=\"1.000000\">"& |
| " <treecols>"& |
| " <treecol editable=\"false\" flex=\"1.000000\" label=\"Host\""& |
| " widgetType=\"string\" />"& |
| " <treecol editable=\"false\" flex=\"1.000000\" label=\"CPU Load [%]\""& |
| " widgetType=\"string\" />"& |
| " <treecol editable=\"false\" flex=\"1.000000\" label=\"Physical Memory\""& |
| " widgetType=\"string\" />"& |
| " <treecol editable=\"false\" flex=\"1.000000\" label=\"Free Memory\""& |
| " widgetType=\"string\" />"& |
| " </treecols>"& |
| " <treechildren>"& |
| " <treeitem>"& |
| " <iterator element=\"Hosts\" id=\"host\" source=\"HostAdminServer\">"& |
| " <treerow>"& |
| " <treecell label=\"%host%\" />"& |
| " <treecell>"& |
| " <externaldata element=\"CpuLoad\" source=\"HostAdminServer\">"& |
| " <params>"& |
| " <dataparam name=\"HostName\" value=\"%host%\" />"& |
| " </params>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " <treecell>"& |
| " <externaldata element=\"PhysicalMemHRF\" source=\"HostAdminServer\">"& |
| " <params>"& |
| " <dataparam name=\"HostName\" value=\"%host%\" />"& |
| " </params>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " <treecell>"& |
| " <externaldata element=\"FreeMemHRF\" source=\"HostAdminServer\">"& |
| " <params>"& |
| " <dataparam name=\"HostName\" value=\"%host%\" />"& |
| " </params>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " </treerow>"& |
| " </iterator>"& |
| " </treeitem>"& |
| " </treechildren>"& |
| " </tree>"& |
| " </hbox>"& |
| " </insertif>"& |
| " </condition>"& |
| " <tabpages layout=\"LISTCARD\">"& |
| " <iterator element=\"Hosts\" id=\"host\" source=\"HostAdminServer\">"& |
| " <tabpage id=\"HostAdmin.%host%\" label=\"%host%\" orientation=\"vertical\">"& |
| " <tree disabled=\"false\" flex=\"1.000000\" hidecolumnpicker=\"true\""& |
| " id=\"HostAdmin.%host%.hostStats\" rows=\"1.000000\">"& |
| " <treecols>"& |
| " <treecol editable=\"false\" flex=\"1.000000\" label=\"Host Statistics\""& |
| " widgetType=\"string\" />"& |
| " <treecol editable=\"false\" flex=\"1.000000\" label=\"Value\""& |
| " widgetType=\"string\" />"& |
| " </treecols>"& |
| " <treechildren>"& |
| " <treeitem>"& |
| " <treerow>"& |
| " <treecell label=\"Physical Memory\" />"& |
| " <treecell>"& |
| " <externaldata element=\"PhysicalMemHRF\" source=\"HostAdminServer\">"& |
| " <params>"& |
| " <dataparam name=\"HostName\" value=\"%host%\" />"& |
| " </params>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " </treerow>"& |
| " <treerow>"& |
| " <treecell label=\"Free Memory\" />"& |
| " <treecell>"& |
| " <externaldata element=\"FreeMemHRF\" source=\"HostAdminServer\">"& |
| " <params>"& |
| " <dataparam name=\"HostName\" value=\"%host%\" />"& |
| " </params>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " </treerow>"& |
| " <treerow>"& |
| " <treecell label=\"CPU Load [%]\" />"& |
| " <treecell>"& |
| " <externaldata element=\"CpuLoad\" source=\"HostAdminServer\">"& |
| " <params>"& |
| " <dataparam name=\"HostName\" value=\"%host%\" />"& |
| " </params>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " </treerow>"& |
| " <iterator element=\"CPUs\" id=\"CpuIdx\" source=\"HostAdminServer\">"& |
| " <params>"& |
| " <dataparam name=\"HostName\" value=\"%host%\" />"& |
| " </params>"& |
| " <treerow>"& |
| " <treecell label=\"CPU %CpuIdx% Load [%]\" />"& |
| " <treecell>"& |
| " <externaldata element=\"PerCpuLoad\" source=\"HostAdminServer\">"& |
| " <params>"& |
| " <dataparam name=\"HostName\" value=\"%host%\" />"& |
| " <dataparam name=\"CpuIdx\" value=\"%CpuIdx%\" />"& |
| " </params>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " </treerow>"& |
| " </iterator>"& |
| " </treeitem>"& |
| " </treechildren>"& |
| " </tree>"& |
| " <label value=\"Processes on this host:\" />"& |
| " <hbox orientation=\"horizontal\" flex=\"0.0\">"& |
| " <label value=\"Sort processes by:\" flex=\"0.0\" />"& |
| " <menulist id=\"dummyId%host%\" disabled=\"false\" editable=\"true\""& |
| " flex=\"1.0\">"& |
| " <menupopup>"& |
| " <iterator element=\"ProcessSortOptionList\" id=\"pSortOption\""& |
| " source=\"HostAdminServer\">"& |
| " <menuitem label=\"%pSortOption%\" selected=\"false\" />"& |
| " </iterator>"& |
| " </menupopup>"& |
| " <externaldata element=\"ProcessSortOption\" source=\"HostAdminServer\" />"& |
| " </menulist>"& |
| " </hbox>"& |
| " <tree disabled=\"false\" flex=\"1.000000\" hidecolumnpicker=\"true\""& |
| " id=\"HostAdmin.%host%.processStats\" rows=\"1.000000\">"& |
| " <treecols>"& |
| " <treecol editable=\"false\" flex=\"1.000000\" label=\"EPTF Process\""& |
| " widgetType=\"string\" />"& |
| " <treecol editable=\"false\" flex=\"1.000000\" label=\"PID\""& |
| " widgetType=\"string\" />"& |
| " <treecol editable=\"false\" flex=\"1.000000\" label=\"CPU Load [%]\""& |
| " widgetType=\"statusLEDWithText\" />"& |
| " <treecol editable=\"false\" flex=\"1.000000\" label=\"Memory Usage\""& |
| " widgetType=\"string\" />"& |
| " </treecols>"& |
| " <treechildren>"& |
| " <treeitem>"& |
| " <iterator element=\"ProcessesOnHost\" id=\"processIdx\""& |
| " source=\"HostAdminServer\">"& |
| " <params>"& |
| " <dataparam name=\"HostName\" value=\"%host%\" />"& |
| " </params>"& |
| " <treerow>"& |
| " <treecell>"& |
| " <externaldata element=\"SelfName\" source=\"HostAdminServer\">"& |
| " <params>"& |
| " <dataparam name=\"HostName\" value=\"%host%\" />"& |
| " <dataparam name=\"ProcessIdx\" value=\"%processIdx%\" />"& |
| " </params>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " <treecell>"& |
| " <externaldata element=\"PID\" source=\"HostAdminServer\">"& |
| " <params>"& |
| " <dataparam name=\"HostName\" value=\"%host%\" />"& |
| " <dataparam name=\"ProcessIdx\" value=\"%processIdx%\" />"& |
| " </params>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " <externalvalue id='srcVar' element='CpuLoad' source='HostAdminServer'>"& |
| " <params>"& |
| " <dataparam name=\"HostName\" value=\"%host%\" />"& |
| " <dataparam name=\"ProcessIdx\" value=\"%processIdx%\" />"& |
| " </params>"& |
| " <treecell tooltiptext=\"CPUload\">"& |
| " <externaldata element=\"LEDlimit\" source=\"StatManager\">"& |
| " <params>"& |
| " <dataparam name='VarId' value='%srcVar::ref%' />"& |
| " <dataparam name='greenLimit' value='0.0' />"& |
| " <dataparam name='yellowLimit' value='80.0' />"& |
| " <dataparam name='redLimit' value='95.0' />"& |
| " <dataparam name='defaultColor' value='black' />"& |
| " <dataparam name='enableValueInLEDText' value='yes' />"& |
| " </params>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " </externalvalue>"& |
| " <treecell>"& |
| " <externaldata element=\"MemUsageHRF\" source=\"HostAdminServer\">"& |
| " <params>"& |
| " <dataparam name=\"HostName\" value=\"%host%\" />"& |
| " <dataparam name=\"ProcessIdx\" value=\"%processIdx%\" />"& |
| " </params>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " </treerow>"& |
| " </iterator>"& |
| " </treeitem>"& |
| " </treechildren>"& |
| " </tree>"& |
| " <label value=\"All EPTF processes:\" />"& |
| " <tree disabled=\"false\" flex=\"1.000000\" hidecolumnpicker=\"true\""& |
| " id=\"HostAdmin.%host%.allProcessStats\" rows=\"1.000000\">"& |
| " <treecols>"& |
| " <treecol editable=\"false\" flex=\"1.000000\" label=\"EPTF Process\""& |
| " widgetType=\"string\" />"& |
| " <treecol editable=\"false\" flex=\"1.000000\" label=\"Host\""& |
| " widgetType=\"string\" />"& |
| " <treecol editable=\"false\" flex=\"1.000000\" label=\"PID\""& |
| " widgetType=\"string\" />"& |
| " <treecol editable=\"false\" flex=\"1.000000\" label=\"CPU Load [%]\""& |
| " widgetType=\"string\" />"& |
| " <treecol editable=\"false\" flex=\"1.000000\" label=\"Memory Usage\""& |
| " widgetType=\"string\" />"& |
| " </treecols>"& |
| " <treechildren>"& |
| " <treeitem>"& |
| " <iterator element=\"ProcessNames\" id=\"selfName\" source=\"HostAdminServer\">"& |
| " <treerow>"& |
| " <treecell label=\"%selfName%\" />"& |
| " <treecell>"& |
| " <externaldata element=\"HostName\" source=\"HostAdminServer\">"& |
| " <params>"& |
| " <dataparam name=\"SelfName\" value=\"%selfName%\" />"& |
| " </params>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " <treecell>"& |
| " <externaldata element=\"PID\" source=\"HostAdminServer\">"& |
| " <params>"& |
| " <dataparam name=\"SelfName\" value=\"%selfName%\" />"& |
| " </params>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " <treecell>"& |
| " <externaldata element=\"CpuLoad\" source=\"HostAdminServer\">"& |
| " <params>"& |
| " <dataparam name=\"SelfName\" value=\"%selfName%\" />"& |
| " </params>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " <treecell>"& |
| " <externaldata element=\"MemUsageHRF\" source=\"HostAdminServer\">"& |
| " <params>"& |
| " <dataparam name=\"SelfName\" value=\"%selfName%\" />"& |
| " </params>"& |
| " </externaldata>"& |
| " </treecell>"& |
| " </treerow>"& |
| " </iterator>"& |
| " </treeitem>"& |
| " </treechildren>"& |
| " </tree>"& |
| " </tabpage>"& |
| " </iterator>"& |
| " </tabpages>"& |
| " </tabpage>"& |
| " </tabpages>"& |
| " </window>"& |
| " </Widgets>"; |
| f_EPTF_UIHandler_createGUI(c_gui); |
| |
| timer T_idle := 0.0; |
| T_idle.start; |
| alt { |
| [] T_idle.timeout{ |
| repeat; |
| } |
| } |
| } |
| |
| function f_EPTF_UIHandler_TestDSClientBehaviour(in charstring pl_selfName, in EPTF_DataSource_CT pl_sourceCompRef) runs on EPTF_DataSourceClient_CT { |
| f_EPTF_DataSourceClient_init_CT(pl_selfName, pl_sourceCompRef); |
| var integer vl_i, vl_idx; |
| for(vl_i := 0; vl_i < 5000; vl_i := vl_i + 1) { |
| f_EPTF_Var_newInt("intvar" & int2str(vl_i), vl_i, vl_idx); |
| } |
| f_EPTF_DataSourceClient_registerData("DSClient", f_EPTF_Base_selfName(), refers(f_EPTF_UIHandler_Test_intDSProcessData), pl_sourceCompRef); |
| timer T_idle := 0.9; |
| T_idle.start; |
| alt { |
| [] T_idle.timeout{ |
| for(vl_i := 0; vl_i < 5000; vl_i := vl_i + 1) { |
| var integer vl_varID := f_EPTF_Var_getId("intvar" & int2str(vl_i)); |
| var integer vl_newValue := f_EPTF_Var_getIntValue(vl_varID) + 1; |
| f_EPTF_Var_adjustContent(vl_varID, { intVal := vl_newValue }); |
| } |
| T_idle.start; |
| repeat; |
| } |
| } |
| |
| } |
| |
| function f_EPTF_UIHandler_Test_intDSProcessData(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{ |
| var integer vl_varIdx := f_EPTF_Var_getId(pl_element); |
| if(vl_varIdx == -1){ |
| return -1; |
| } else { |
| pl_dataVarName := pl_element; |
| return 0; |
| } |
| } |
| |
| function f_EPTF_UIHandler_TestHostAdminBehaviour(in charstring pl_selfName, in EPTF_DataSource_CT pl_sourceCompRef) runs on EPTF_HostAdminServer_CT { |
| f_EPTF_HostAdminServer_init_CT(pl_selfName, pl_sourceCompRef); |
| timer T_idle := 0.0; |
| T_idle.start; |
| alt { |
| [] T_idle.timeout{ |
| repeat; |
| } |
| } |
| } |
| |
| } |
| |
| |
| function f_EPTF_UIHandler_Test_TextboxGrowingBehavior(in charstring pl_gui ) runs on EPTF_UIHandler_Test_CT { |
| v_ready := false; |
| f_EPTF_UIHandler_init_CT( "UIHandlerTestComponent" ); |
| f_EPTF_DataSource_registerReadyCallback(refers(f_EPTF_ExecCtrl_Test_DataSourceClientReady )); |
| var EPTF_UIHandler_Test_DataSourceClient_CT vl_client1 := EPTF_UIHandler_Test_DataSourceClient_CT.create; |
| vl_client1.start(f_EPTF_UIHandler_Test_clientBehavior(self,{{"selected","selected",{charstringVal := ""}}})); |
| timer T_guard, T_alt; |
| T_alt.start( 0.0 ); |
| T_guard.start( 5.0 ); |
| // wait until DataSource is registered |
| alt{ |
| [] T_guard.timeout{ |
| setverdict(fail,"Timeout during config"); |
| f_EPTF_Base_stopAll(); |
| } |
| [v_ready] T_alt.timeout{} |
| } |
| var integer vl_varSubscribedIdx |
| f_EPTF_Var_subscribeRemote(vl_client1, "selected", realtime, vl_varSubscribedIdx); |
| //f_EPTF_Var_addPostProcFn(vl_varSubscribedIdx, {refers(f_EPTF_UIHandler_Test_menuListExternalData_selectionChanged),{}}) |
| f_EPTF_UIHandler_clearGUI(); |
| if(false == f_EPTF_UIHandler_createGUI(pl_gui)){ |
| setverdict(fail, "CreateGUI failed."); |
| } |
| |
| var charstring vl_textboxtext := ""; |
| for(var integer i := 0; i < 100; i:= i + 1){ |
| vl_textboxtext := vl_textboxtext & "1"; |
| } |
| |
| var EPTF_Var_DirectContent vl_content := {charstringVal := vl_textboxtext}; |
| f_EPTF_Var_adjustContent(vl_varSubscribedIdx, vl_content); |
| |
| T_guard.start( 5.0 ); |
| T_guard.timeout; |
| |
| vl_textboxtext := ""; |
| for(var integer i := 0; i < 100; i:= i + 1){ |
| vl_textboxtext := vl_textboxtext & "2"; |
| } |
| f_EPTF_Var_getContent(vl_varSubscribedIdx, vl_content); |
| vl_content.charstringVal := vl_content.charstringVal & vl_textboxtext; |
| f_EPTF_Var_adjustContent(vl_varSubscribedIdx, vl_content); |
| |
| T_guard.start( 5.0 ); |
| T_guard.timeout; |
| |
| vl_textboxtext := ""; |
| for(var integer i := 0; i < 100; i:= i + 1){ |
| vl_textboxtext := vl_textboxtext & "3"; |
| } |
| f_EPTF_Var_getContent(vl_varSubscribedIdx, vl_content); |
| vl_content.charstringVal := vl_content.charstringVal & vl_textboxtext; |
| f_EPTF_Var_adjustContent(vl_varSubscribedIdx, vl_content); |
| |
| T_guard.start( 5.0 ); |
| T_guard.timeout; |
| |
| vl_textboxtext := ""; |
| for(var integer i := 0; i < 100; i:= i + 1){ |
| vl_textboxtext := vl_textboxtext & "4"; |
| } |
| f_EPTF_Var_getContent(vl_varSubscribedIdx, vl_content); |
| vl_content.charstringVal := vl_content.charstringVal & vl_textboxtext; |
| f_EPTF_Var_adjustContent(vl_varSubscribedIdx, vl_content); |
| |
| T_guard.start( 5.0 ); |
| T_guard.timeout; |
| |
| vl_textboxtext := ""; |
| for(var integer i := 0; i < 100; i:= i + 1){ |
| vl_textboxtext := vl_textboxtext & "5"; |
| } |
| f_EPTF_Var_getContent(vl_varSubscribedIdx, vl_content); |
| vl_content.charstringVal := vl_content.charstringVal & vl_textboxtext; |
| f_EPTF_Var_adjustContent(vl_varSubscribedIdx, vl_content); |
| |
| T_guard.start( 5.0 ); |
| T_guard.timeout; |
| |
| vl_textboxtext := ""; |
| for(var integer i := 0; i < 100; i:= i + 1){ |
| vl_textboxtext := vl_textboxtext & "6"; |
| } |
| f_EPTF_Var_getContent(vl_varSubscribedIdx, vl_content); |
| vl_content.charstringVal := vl_content.charstringVal & vl_textboxtext; |
| f_EPTF_Var_adjustContent(vl_varSubscribedIdx, vl_content); |
| |
| T_guard.start( 5.0 ); |
| T_guard.timeout; |
| |
| vl_textboxtext := ""; |
| for(var integer i := 0; i < 100; i:= i + 1){ |
| vl_textboxtext := vl_textboxtext & "7"; |
| } |
| f_EPTF_Var_getContent(vl_varSubscribedIdx, vl_content); |
| vl_content.charstringVal := vl_content.charstringVal & vl_textboxtext; |
| f_EPTF_Var_adjustContent(vl_varSubscribedIdx, vl_content); |
| |
| action("End elott"); |
| |
| T_guard.start( 15.0 ); |
| T_guard.timeout; |
| |
| action("End"); |
| |
| setverdict(pass); |
| f_EPTF_Base_stop(pass); |
| } |
| |
| |
| public function f_EPTF_UIHandler_Test_startDataSource(out integer pl_varSubscribedIdx,out integer pl_varSubscribedIdx2,out integer pl_varSubscribedIdx3) |
| runs on EPTF_UIHandler_Test_CT |
| { |
| v_ready := false; |
| f_EPTF_UIHandler_init_CT( "UIHandlerTestComponent" ); |
| |
| f_EPTF_DataSource_registerReadyCallback(refers(f_EPTF_ExecCtrl_Test_DataSourceClientReady )); |
| var EPTF_UIHandler_Test_DataSourceClient_CT vl_client1 := EPTF_UIHandler_Test_DataSourceClient_CT.create; |
| vl_client1.start(f_EPTF_UIHandler_Test_clientBehavior(self)); |
| timer T_guard, T_alt; |
| T_alt.start( 0.0 ); |
| T_guard.start( 5.0 ); |
| // wait until DataSource is registered |
| alt{ |
| [] T_guard.timeout{ |
| setverdict(fail,"Timeout during config"); |
| f_EPTF_Base_stopAll(); |
| } |
| [v_ready] T_alt.timeout{} |
| } |
| f_EPTF_Var_subscribeRemote(vl_client1, c_EPTF_UIHandler_Test_var_prefix & "LGens", realtime, pl_varSubscribedIdx); |
| f_EPTF_Var_subscribeRemote(vl_client1, c_EPTF_UIHandler_Test_var_prefix & "EntityGroups", realtime, pl_varSubscribedIdx2); |
| f_EPTF_Var_subscribeRemote(vl_client1, c_EPTF_UIHandler_Test_var_prefix & "X_Depends_EG2", realtime, pl_varSubscribedIdx3); |
| } |
| |
| //////////////////////////////////////////////////////////////////////////////////////// |
| // // |
| // Function f_EPTF_UIHandler_Test_iteratorChange // |
| // // |
| // Purpose : // |
| // A customGUI is built from pl_guiToLoad. After a few second, // |
| // we change the content of the iterator to pl_iteratorNewContent // |
| // and want to see the gui elements to change according to pl_guiExpected. // |
| // // |
| //////////////////////////////////////////////////////////////////////////////////////// |
| public function f_EPTF_UIHandler_Test_iteratorChange( |
| in charstring pl_guiToLoad, |
| in charstring pl_guiExpected, |
| in EPTF_Var_DirectContent pl_iteratorLGensNewContent, |
| in boolean pl_updateIteratorEGs := false, |
| in EPTF_Var_DirectContent pl_iteratorEGsNewContent := { charstringlistVal := {}}, |
| in boolean pl_updateIteratorXs := false, |
| in EPTF_Var_DirectContent pl_iteratorXsNewContent := { charstringlistVal := {}}, |
| in charstring pl_gui2ToLoad := "", |
| in boolean pl_add2AsWidget := false, |
| in charstring pl_gui3ToLoad := "", |
| in boolean pl_add3AsWidget := false, |
| in boolean pl_addToHbox := false, |
| in charstring pl_addToMoreHboxAndRemove := "", |
| in charstring pl_warning := "", |
| in template Widgets pl_guiExpectedWidgets := omit, |
| in charstring pl_widgetIdToPutMoreGUI := "EPTF_Main_Window", |
| in charstring pl_widgetIdToRemoveFromGUI := "", |
| in EPTF_UIHandler_Test_ClientAdditionalVarList pl_additionalVars := {}) |
| runs on EPTF_UIHandler_Test_CT |
| { |
| v_ready := false; |
| f_EPTF_UIHandler_init_CT( "UIHandlerTestComponent" ); |
| if(pl_warning != "") { f_EPTF_UIHandler_Test_ExpectedWarning_setExpectedWarning(pl_warning) } |
| |
| f_EPTF_DataSource_registerReadyCallback(refers(f_EPTF_ExecCtrl_Test_DataSourceClientReady )); |
| var EPTF_UIHandler_Test_DataSourceClient_CT vl_client1 := EPTF_UIHandler_Test_DataSourceClient_CT.create; |
| vl_client1.start(f_EPTF_UIHandler_Test_clientBehavior(self,pl_additionalVars)); |
| timer T_guard, T_alt; |
| T_alt.start( 0.0 ); |
| T_guard.start( 2.0 ); |
| // wait until DataSource is registered |
| alt{ |
| [] T_guard.timeout{ |
| setverdict(fail,"Timeout during config"); |
| f_EPTF_Base_stopAll(); |
| } |
| [v_ready] T_alt.timeout{} |
| } |
| var integer vl_varSubscribedIdx; |
| f_EPTF_Var_subscribeRemote(vl_client1, c_EPTF_UIHandler_Test_var_prefix & "LGens", realtime, vl_varSubscribedIdx); |
| var integer vl_varSubscribedIdx2; |
| f_EPTF_Var_subscribeRemote(vl_client1, c_EPTF_UIHandler_Test_var_prefix & "EntityGroups", realtime, vl_varSubscribedIdx2); |
| var integer vl_varSubscribedIdx3; |
| f_EPTF_Var_subscribeRemote(vl_client1, c_EPTF_UIHandler_Test_var_prefix & "X_Depends_EG2", realtime, vl_varSubscribedIdx3); |
| |
| //f_EPTF_Var_addPostProcFn(vl_varSubscribedIdx, {refers(f_EPTF_UIHandler_Test_menuListExternalData_selectionChanged),{}}) |
| f_EPTF_UIHandler_clearGUI(); |
| if(false == f_EPTF_UIHandler_createGUI(pl_guiToLoad)){ |
| setverdict(fail, "CreateGUI failed."); |
| } |
| if(pl_addToHbox != true){ |
| if(pl_gui2ToLoad != "" and pl_add2AsWidget == true){ |
| var Widgets vl_widget := f_EPTF_UIHandler_XSD_decodeXUL(pl_gui2ToLoad); |
| var boolean vl_widgetExists := false; |
| if( false == f_EPTF_UIHandler_XSD_addElementToGui(vl_widget, pl_widgetIdToPutMoreGUI, vl_widgetExists)){ |
| setverdict(fail, "addElementToGUI failed for the second guipart."); |
| } |
| } else { |
| if(pl_gui2ToLoad != "" and false == f_EPTF_UIHandler_createGUI(pl_gui2ToLoad, pl_widgetIdToPutMoreGUI)){ |
| setverdict(fail, "CreateGUI failed for the second guipart."); |
| } |
| } |
| |
| if(pl_gui3ToLoad != "" and pl_add3AsWidget == true){ |
| var Widgets vl_widget := f_EPTF_UIHandler_XSD_decodeXUL(pl_gui3ToLoad); |
| var boolean vl_widgetExists := false; |
| if( false == f_EPTF_UIHandler_XSD_addElementToGui(vl_widget, pl_widgetIdToPutMoreGUI, vl_widgetExists)){ |
| setverdict(fail, "addElementToGUI failed for the third guipart."); |
| } |
| } else { |
| if(pl_gui3ToLoad != "" and false == f_EPTF_UIHandler_createGUI(pl_gui3ToLoad, pl_widgetIdToPutMoreGUI)){ |
| setverdict(fail, "CreateGUI failed for the third guipart."); |
| } |
| } |
| } else { |
| if(pl_gui2ToLoad != "" and pl_add2AsWidget == true){ |
| var Widgets vl_widget := f_EPTF_UIHandler_XSD_decodeXUL(pl_gui2ToLoad); |
| var boolean vl_widgetExists := false; |
| if( false == f_EPTF_UIHandler_XSD_addElementToGui(vl_widget, "hboxid_0", vl_widgetExists)){ |
| setverdict(fail, "addElementToGUI failed for the second guipart."); |
| } |
| |
| if( pl_addToMoreHboxAndRemove != ""){ |
| var Widgets vl_widget2 := f_EPTF_UIHandler_XSD_decodeXUL(pl_addToMoreHboxAndRemove); |
| if(false == f_EPTF_UIHandler_XSD_addElementToGui(vl_widget2, "hboxid_1", vl_widgetExists)){ |
| setverdict(fail, "addElementToGUI failed for the third guipart."); |
| } else { |
| if(false == f_EPTF_UIHandler_removeElementFromGui("XX1")){ |
| setverdict(fail, "removeElementFromGUI failed for the third guipart."); |
| } |
| } |
| } |
| |
| } else { |
| if(pl_gui2ToLoad != "" and false == f_EPTF_UIHandler_createGUI(pl_gui2ToLoad, "hboxid_0")){ |
| setverdict(fail, "CreateGUI failed for the second guipart."); |
| } |
| } |
| } |
| |
| if(pl_widgetIdToRemoveFromGUI != ""){ |
| if(false == f_EPTF_UIHandler_removeElementFromGui(pl_widgetIdToRemoveFromGUI)){ |
| setverdict(fail, "removeElementFromGUI failed for the widget:" & pl_widgetIdToRemoveFromGUI ); |
| } |
| } |
| |
| T_guard.start( tsp_EPTF_Var_SyncInterval+2.0 ); //wait for refresh with "" value |
| T_guard.timeout; |
| var charstring vl_snapshot := f_EPTF_UIHandler_snapshotWindow(); |
| |
| f_EPTF_Var_adjustContent(vl_varSubscribedIdx, pl_iteratorLGensNewContent); |
| if(pl_updateIteratorEGs){ |
| f_EPTF_Var_adjustContent(vl_varSubscribedIdx2, pl_iteratorEGsNewContent); |
| } |
| |
| if(pl_updateIteratorXs){ |
| f_EPTF_Var_adjustContent(vl_varSubscribedIdx3, pl_iteratorXsNewContent); |
| } |
| |
| T_guard.start( tsp_EPTF_Var_SyncInterval+2.0 ); |
| T_guard.timeout; |
| |
| |
| vl_snapshot := f_EPTF_UIHandler_snapshotWindow(); |
| vl_snapshot := f_replaceEveryOccurenceOfSubstring( vl_snapshot, "xmlns='http://ttcn.ericsson.se/protocolModules/xtdp/xtdl'", ""); |
| vl_snapshot := f_replaceEveryOccurenceOfSubstring( vl_snapshot, "tq0001:", ""); |
| vl_snapshot := f_replaceEveryOccurenceOfSubstring( vl_snapshot, ":tq0001", ""); |
| vl_snapshot := "<Widgets xmlns='http://ttcn.ericsson.se/protocolModules/xtdp/xtdl'> " & vl_snapshot & " </Widgets>"; |
| var Widgets vl_received := f_EPTF_UIHandler_XSD_decodeXUL(vl_snapshot); |
| |
| var Widgets vl_xul_int; |
| f_EPTF_UIHandler_buildXUL(vl_xul_int); |
| |
| if(ispresent(pl_guiExpectedWidgets)){ |
| if(match(vl_received, pl_guiExpectedWidgets)){ |
| setverdict(pass, "GUI is the same as expected."); |
| }else{ |
| setverdict(fail,log2str(match(vl_received, pl_guiExpectedWidgets))); |
| } |
| } else { |
| var Widgets vl_convertedXul := f_EPTF_UIHandler_XSD_decodeXUL(pl_guiExpected); |
| f_EPTF_UIHandler_printAllXMLfor_Tests(); |
| |
| if(match(vl_received, vl_convertedXul)){ |
| setverdict(pass, "GUI is the same as expected."); |
| }else{ |
| setverdict(fail,log2str(match(vl_received, vl_convertedXul))); |
| } |
| } |
| |
| T_guard.start( 5.0 ) |
| T_guard.timeout; |
| f_EPTF_Base_stopAll(pass); |
| |
| } |
| |
| group WouldBlockTest { |
| |
| function f_EPTF_UIHandler_Test_wouldBlock_ReadyCallback( |
| in charstring pl_source, |
| in charstring pl_ptcName) runs on EPTF_UIHandler_Test_CT { |
| |
| vl_intStringlistIdx := vl_intStringlistIdx - 1; |
| |
| if (vl_intStringlistIdx==0) { |
| v_ready := true; |
| } |
| } |
| |
| function f_EPTF_UIHandler_Test_wouldBlock_UIHandlerBehaviour( |
| in integer pl_numSources, |
| in EPTF_CharstringList pl_fileNames := { "WouldBlockTest_GUIFile1.xml", "WouldBlockTest_GUIFile2.xml"} |
| ) runs on EPTF_UIHandler_Test_CT { |
| |
| var charstring vl_EPTF_GUI_Main_Window_WidgetId := ""; |
| |
| f_EPTF_UIHandler_init_CT(pl_selfName := "WouldBlockTest_UIHandler", pl_servermode := true); |
| |
| |
| // wait for data sources: |
| vl_intStringlistIdx := pl_numSources + 1; |
| v_ready := false; |
| f_EPTF_DataSource_registerReadyCallback(refers(f_EPTF_UIHandler_Test_wouldBlock_ReadyCallback)); |
| |
| timer t_ready := 0.0; |
| timer t_maxWait := 10.0; |
| t_maxWait.start; |
| t_ready.start; |
| alt { |
| [v_ready] t_ready.timeout {} |
| [] t_maxWait.timeout { |
| setverdict(fail,"The dataSources are not ready in time"); |
| f_EPTF_Base_stopAll(none); |
| } |
| } |
| |
| |
| var float vl_startTime := f_EPTF_Base_getRelTimeInSecs(); |
| // create GUI: |
| for (var integer i:=0; i<sizeof(pl_fileNames); i:=i+1) { |
| action("Loading gui from ", pl_fileNames[i]); |
| if(false == f_EPTF_UIHandler_createGUIFromFile(pl_fileNames[i], vl_EPTF_GUI_Main_Window_WidgetId)){ |
| setverdict(fail, "CreateGUI failed."); |
| } |
| } |
| var float vl_endTime := f_EPTF_Base_getRelTimeInSecs(); |
| |
| action("GUIBuildUptime: ",vl_endTime-vl_startTime); |
| |
| setverdict(pass); |
| timer t_wait := 20.0; |
| t_wait.start; t_wait.timeout; |
| f_EPTF_Base_stopAll(none); |
| |
| } |
| |
| //--------------------------- MAIN ------------------------------- |
| type component EPTF_UIHandler_Test_WouldBlockMain_CT extends EPTF_DataSourceClient_CT, EPTF_Var_CT { |
| } |
| |
| function f_EPTF_UIHandler_Test_WouldBlockMain_dataHandler( |
| 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_UIHandler_Test_WouldBlockMain_CT return integer { |
| |
| if(pl_element=="Tabpages") { |
| pl_dataVarName := "Tabpages"; |
| return 0; |
| } |
| return 1; // error |
| } |
| |
| function f_EPTF_UIHandler_Test_WouldBlockMain_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_UIHandler_Test_WouldBlockMain_CT return integer { |
| pl_conditionValue := false; |
| if (pl_method=="myCondition") { |
| pl_conditionValue := true; |
| return 0 |
| } |
| return 1; |
| } |
| |
| function f_EPTF_UIHandler_Test_wouldBlock_Main_createVars(in integer pl_numSources) runs on EPTF_UIHandler_Test_WouldBlockMain_CT { |
| var EPTF_CharstringList vl_tabpages := {}; |
| for(var integer i:=0;i<pl_numSources; i:=i+1) { |
| vl_tabpages := vl_tabpages & {"tab"&int2str(i)} |
| } |
| |
| var integer vl_idx; |
| f_EPTF_Var_newCharstringlist("Tabpages", vl_tabpages, vl_idx); |
| } |
| |
| function f_EPTF_UIHandler_Test_wouldBlock_MainBehaviour(in EPTF_DataSource_CT pl_dataSourceCompRef, in integer pl_numSources) runs on EPTF_UIHandler_Test_WouldBlockMain_CT { |
| f_EPTF_DataSourceClient_init_CT("WouldBlockMain", pl_dataSourceCompRef); |
| |
| f_EPTF_Var_init_CT(f_EPTF_Base_selfName()); |
| |
| f_EPTF_UIHandler_Test_wouldBlock_Main_createVars(pl_numSources); |
| |
| f_EPTF_DataSourceClient_registerData("Main",-,refers(f_EPTF_UIHandler_Test_WouldBlockMain_dataHandler)); |
| f_EPTF_DataSourceClient_registerCondition("Main",-,refers(f_EPTF_UIHandler_Test_WouldBlockMain_conditionHandler),"myCondition"); |
| |
| f_EPTF_DataSourceClient_sendReady("Main",f_EPTF_Base_selfName()); |
| |
| f_EPTF_Base_wait4Shutdown(); |
| |
| } |
| |
| //--------------------------- SOURCE ------------------------------- |
| type component EPTF_UIHandler_Test_WouldBlockSource_CT extends EPTF_DataSourceClient_CT { |
| } |
| |
| function f_EPTF_UIHandler_Test_WouldBlockSource_dataHandler( |
| 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_UIHandler_Test_WouldBlockSource_CT return integer { |
| |
| if(pl_element=="TreeCols") { |
| pl_dataVarName := "TreeCols"; |
| return 0; |
| } else if(pl_element=="TreeRows") { |
| pl_dataVarName := "TreeRows"; |
| return 0; |
| } else if(pl_element=="CellData") { |
| |
| var integer vl_col := -1; |
| var integer vl_row := -1; |
| |
| var charstring vl_otherData := ""; |
| |
| for(var integer i:=0; i<sizeof(pl_params); i:=i+1) { |
| if (pl_params[i].paramName=="Col") { |
| vl_col := str2int(pl_params[i].paramValue); |
| } else if (pl_params[i].paramName=="Row") { |
| vl_row := str2int(pl_params[i].paramValue); |
| } else { |
| vl_otherData := vl_otherData & "+"&pl_params[i].paramName&":"&pl_params[i].paramValue; |
| } |
| } |
| |
| |
| pl_dataVarName := "CellData"&int2str(vl_row)&":"&int2str(vl_col)&vl_otherData; |
| var integer vl_idx; |
| vl_idx := f_EPTF_Var_getId(pl_dataVarName); |
| if (vl_idx==-1) { |
| f_EPTF_Var_newStatusLED(pl_dataVarName,{led_green, int2str(vl_row)&":"&int2str(vl_col)&vl_otherData},vl_idx); |
| } |
| |
| return 0; |
| } |
| return 1; // error |
| } |
| |
| function f_EPTF_UIHandler_Test_WouldBlockSource_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_UIHandler_Test_WouldBlockSource_CT return integer { |
| pl_conditionValue := false; |
| if (pl_method=="myCondition") { |
| pl_conditionValue := true; |
| return 0 |
| } |
| return 1; |
| } |
| |
| function f_EPTF_UIHandler_Test_wouldBlock_Source_createVars(in integer pl_numTreeCols, in integer pl_numTreeRows) runs on EPTF_UIHandler_Test_WouldBlockSource_CT { |
| var EPTF_CharstringList vl_treecols := {}; |
| for(var integer i:=0;i<pl_numTreeCols; i:=i+1) { |
| vl_treecols := vl_treecols & {"Col"&int2str(i)} |
| } |
| |
| var integer vl_idx; |
| f_EPTF_Var_newCharstringlist("TreeCols", vl_treecols, vl_idx); |
| |
| |
| var EPTF_CharstringList vl_treerows := {}; |
| for(var integer i:=0;i<pl_numTreeRows; i:=i+1) { |
| vl_treerows := vl_treerows & {"Row"&int2str(i)} |
| } |
| |
| f_EPTF_Var_newCharstringlist("TreeRows", vl_treerows, vl_idx); |
| } |
| |
| function f_EPTF_UIHandler_Test_wouldBlock_SourceBehaviour( |
| in EPTF_DataSource_CT pl_dataSourceCompRef, |
| in integer pl_sourceId, |
| in integer pl_numTreeCols, |
| in integer pl_numTreeRows |
| ) runs on EPTF_UIHandler_Test_WouldBlockSource_CT { |
| f_EPTF_DataSourceClient_init_CT("WouldBlockSource#"&int2str(pl_sourceId), pl_dataSourceCompRef); |
| |
| f_EPTF_Var_init_CT(f_EPTF_Base_selfName()); |
| |
| f_EPTF_UIHandler_Test_wouldBlock_Source_createVars(pl_numTreeCols, pl_numTreeRows); |
| |
| f_EPTF_DataSourceClient_registerData("Source"&int2str(pl_sourceId),-,refers(f_EPTF_UIHandler_Test_WouldBlockSource_dataHandler)); |
| f_EPTF_DataSourceClient_registerCondition("Source"&int2str(pl_sourceId),-,refers(f_EPTF_UIHandler_Test_WouldBlockSource_conditionHandler),"myCondition"); |
| |
| f_EPTF_DataSourceClient_sendReady("Source"&int2str(pl_sourceId),f_EPTF_Base_selfName()); |
| |
| f_EPTF_Base_wait4Shutdown(); |
| |
| } |
| |
| }// group WouldBlockTest |
| |
| group ParallelCreateGUI { |
| |
| const charstring c_ParallelCreateGUI_Main_wid1 := "MainWidgetID1"; |
| const charstring c_ParallelCreateGUI_Main_wid2 := "MainWidgetID2"; |
| |
| const charstring c_ParallelCreateGUI_gui_1 := ""& |
| "<Widgets xmlns='http://ttcn.ericsson.se/protocolModules/xtdp/xtdl'>"& |
| " <hbox>"& |
| " <iterator id='it1' element='GetIterator' source='DS1'>"& |
| " <iterator id='it2' element='GetIterator' source='DS1'>"& |
| " <externalvalue id='ev1' element='GetFloat' source='DS1'>"& |
| " <params>"& |
| " <dataparam name='Param' value='%it1%:%it2%' />"& |
| " </params>"& |
| " <label value='IT:%it1%:%it2% Value: %ev1%'/>"& |
| " </externalvalue>"& |
| " </iterator>"& |
| " </iterator>"& |
| " </hbox>"& |
| "</Widgets>"; |
| |
| const charstring c_ParallelCreateGUI_gui_2 := ""& |
| "<Widgets xmlns='http://ttcn.ericsson.se/protocolModules/xtdp/xtdl'>"& |
| " <hbox>"& |
| " <iterator id='it1' element='GetIterator' source='DS2'>"& |
| " <iterator id='it2' element='GetIterator' source='DS2'>"& |
| " <externalvalue id='ev1' element='GetFloat' source='DS2'>"& |
| " <params>"& |
| " <dataparam name='Param' value='%it1%:%it2%' />"& |
| " </params>"& |
| " <label value='IT:%it1%:%it2% Value: %ev1%'/>"& |
| " </externalvalue>"& |
| " </iterator>"& |
| " </iterator>"& |
| " </hbox>"& |
| "</Widgets>"; |
| |
| const charstring c_ParallelCreateGUI_gui_differentITIds := ""& |
| "<Widgets xmlns='http://ttcn.ericsson.se/protocolModules/xtdp/xtdl'>"& |
| " <hbox>"& |
| " <iterator id='it13' element='GetIterator' source='DS2'>"& |
| " <iterator id='it23' element='GetIterator' source='DS2'>"& |
| " <externalvalue id='ev13' element='GetFloat' source='DS2'>"& |
| " <params>"& |
| " <dataparam name='Param' value='%it13%:%it23%' />"& |
| " </params>"& |
| " <label value='IT:%it13%:%it23% Value: %ev13%'/>"& |
| " </externalvalue>"& |
| " </iterator>"& |
| " </iterator>"& |
| " </hbox>"& |
| "</Widgets>"; |
| |
| function f_EPTF_UIHandler_Test_parallelCreateGUI_readyCallback( |
| in charstring pl_source, |
| in charstring pl_ptcName |
| ) runs on EPTF_UIHandler_Test_CT { |
| if(pl_source == "DS1") { |
| f_EPTF_UIHandler_createGUI(c_ParallelCreateGUI_gui_1, c_ParallelCreateGUI_Main_wid1); |
| } |
| else if(pl_source == "DS2") |
| { |
| f_EPTF_UIHandler_createGUI(c_ParallelCreateGUI_gui_2, c_ParallelCreateGUI_Main_wid1); |
| } |
| } |
| |
| |
| function f_EPTF_UIHandler_Test_parallelCreateGUI_readyCallback_differentITIds( |
| in charstring pl_source, |
| in charstring pl_ptcName |
| ) runs on EPTF_UIHandler_Test_CT { |
| if(pl_source == "DS1") { |
| f_EPTF_UIHandler_createGUI(c_ParallelCreateGUI_gui_1, c_ParallelCreateGUI_Main_wid1); |
| } |
| else if(pl_source == "DS2") |
| { |
| f_EPTF_UIHandler_createGUI(c_ParallelCreateGUI_gui_differentITIds, c_ParallelCreateGUI_Main_wid1); |
| } |
| } |
| |
| |
| function f_EPTF_UIHandler_Test_parallelCreateGUI_DSClient_Behaviour(in charstring pl_DSName, in EPTF_DataSource_CT pl_sourceCompRef) runs on EPTF_DataSourceClient_CT { |
| |
| f_EPTF_DataSourceClient_init_CT("DSClient_"&pl_DSName, pl_sourceCompRef); |
| |
| |
| var integer vl_idx; |
| |
| var EPTF_CharstringList vl_cList := {"LGen1", "LGen2", "LGen3", "LGen4", "LGen5", "LGen6", "LGen7", "LGen8", "LGen9", "LGen10"}; |
| f_EPTF_Var_newCharstringlist(c_EPTF_UIHandler_Test_var_prefix & "Iterator", vl_cList ,vl_idx); |
| |
| f_EPTF_Var_newFloat(c_EPTF_UIHandler_Test_var_prefix & "FloatVal", 12.3, vl_idx); |
| |
| f_EPTF_DataSourceClient_registerData(pl_DSName, f_EPTF_Base_selfName(), refers(f_EPTF_UIHandler_Test_parallelCreateGUI_processData)); |
| |
| f_EPTF_DataSourceClient_sendReady(pl_DSName,""); |
| |
| f_EPTF_Base_wait4Shutdown(); |
| |
| } |
| |
| public function f_EPTF_UIHandler_Test_parallelCreateGUI_processData( 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{ |
| //action(%definitionId&": ",pl_source, ",",pl_element) |
| if(pl_element == "GetIterator"){ |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "Iterator"; |
| return 0; |
| } |
| else if(pl_element == "GetFloat"){ |
| pl_dataVarName := c_EPTF_UIHandler_Test_var_prefix & "FloatVal"; |
| return 0; |
| } |
| return -1; |
| } |
| |
| }// group ParallelCreateGUI { |
| |
| }//module |