| ///////////////////////////////////////////////////////////////////////////////
|
| // //
|
| // Copyright (c) 2000-2019 Ericsson Telecom AB // |
| // // |
| // All rights reserved. This program and the accompanying materials // |
| // are made available under the terms of the Eclipse Public License v2.0 // |
| // which accompanies this distribution, and is available at // |
| // https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html //
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Module: SimpleHello_Demo
|
| //
|
| // Purpose:
|
| // This module contains simple testcases for SimpleHello protocol.
|
| //
|
| // Module Parameters:
|
| // -
|
| //
|
| // Module depends on:
|
| // -
|
| //
|
| // Current Owner:
|
| // Attila Fulop (EFLOATT), Bence Molnar (EBENMOL)
|
| //
|
| // Last Review Date:
|
| // 2009-04-15
|
| //
|
| // Detailed Comments:
|
| // This module contains simple testcases for SimpleHello protocol.
|
| //
|
| ///////////////////////////////////////////////////////////////
|
| module SimpleHello_Demo
|
| {
|
|
|
| import from EPTF_CLL_Base_Functions all;
|
| import from EPTF_CLL_LGenBase_Definitions all;
|
| import from EPTF_CLL_LGenBase_Functions all;
|
| import from EPTF_CLL_LGenBase_ConfigDefinitions all;
|
| import from EPTF_CLL_LGenBase_ConfigFunctions all;
|
| import from EPTF_CLL_LGenBase_TemplateFunctions all;
|
| import from EPTF_SimpleHello_LGen_Definitions all;
|
| import from EPTF_SimpleHello_LGen_Functions all;
|
| import from EPTF_SimpleHello_Definitions all;
|
| import from EPTF_SimpleHello_Transport_Definitions all;
|
| import from EPTF_SimpleHello_Transport_Functions all;
|
| import from EPTF_SimpleHello_Logger_Definitions all;
|
| import from EPTF_CLL_TransportCommPortUDP_Definitions all;
|
|
|
| import from EPTF_CLL_Common_Definitions all;
|
| import from EPTF_CLL_Logging_Functions all;
|
| import from EPTF_CLL_LoggingUI_Functions all;
|
| import from EPTF_CLL_LoggingUI_Definitions all;
|
| import from EPTF_CLL_LoggingUI_PrivateFunctions all;
|
| import from XTDP_PDU_Defs language "ASN.1:2002" all;
|
| import from EPTF_CLL_Variable_Functions all;
|
| import from EPTF_CLL_UIHandlerClient_Functions all;
|
| import from EPTF_CLL_UIHandler_Definitions all;
|
| import from EPTF_CLL_UIHandler_WidgetFunctions all;
|
| import from EPTF_CLL_UIHandler_XTDPTemplateDefinitions all;
|
| import from EPTF_CLL_UIHandler_XULFunctions all;
|
|
|
| import from EPTF_CLL_ExecCtrlUIHandler_Definitions all;
|
| import from EPTF_CLL_ExecCtrlUIHandler_Functions all;
|
| import from EPTF_CLL_ExecCtrl_Definitions all;
|
| import from EPTF_CLL_ExecCtrl_Functions all;
|
| import from EPTF_CLL_ExecCtrlClient_Functions all;
|
| modulepar
|
| {
|
| integer tsp_numEntities := 10;
|
| float tsp_testDuration := 30.0;
|
| integer tsp_nrOfLGens := 1;
|
| EPTF_LGenBase_TcMgmt_CompactFsmTableDeclaratorList tsp_modulePar_compactFsmTables := {};
|
| charstring tsp_EPTF_SimpleHello_templPath_CustomRequest := "";
|
| }
|
|
|
| //=========================================================================
|
| //Component Types
|
| //=========================================================================
|
| // Component Type declaration of the Remote_MyLGen_CT
|
| // The component extends the Applib component and the Remote Transport component.
|
| type component SimpleHello_Remote_MyLGen_CT
|
| extends EPTF_LGenBase_CT, EPTF_SimpleHello_LGen_CT, EPTF_SimpleHello_RemoteTransport_CT, EPTF_LoggingUIClient_CT,EPTF_ExecCtrlClient_UIHandler_CT, EPTF_UIHandler_CT
|
| {
|
| var integer v_myBIdx;
|
| }
|
|
|
| // Component Type declaration of the Local_MyLGen_CT
|
| // The component extends the Applib, Local Transport and
|
| // the UDP communication Port component.
|
| type component SimpleHello_Local_MyLGen_CT
|
| extends EPTF_LGenBase_CT, EPTF_SimpleHello_LGen_CT, EPTF_SimpleHello_LocalTransport_CT, EPTF_LoggingUI_CT, EPTF_ExecCtrlClient_UIHandler_CT, EPTF_UIHandler_CT
|
| {}
|
|
|
| type component MyLogger_CT extends EPTF_SimpleHello_LocalTransport_CT, EPTF_UIHandler_CT, EPTF_LoggingUI_CT {
|
| var integer v_MyLogger_loggerEnabled;
|
| }
|
|
|
| //=========================================================================
|
| //Functions
|
| //=========================================================================
|
| ///////////////////////////////////////////////////////////
|
| // Function: f_EPTF_SimpleHello_Remote_MyLGen_init
|
| //
|
| // Purpose:
|
| // Function to initialize the user defined remote MyLGen component
|
| //
|
| // Detailed Comments:
|
| // The init function initializes the Remote_MyLGen component and register
|
| // the callback functions
|
| //
|
| ///////////////////////////////////////////////////////////
|
| function f_EPTF_SimpleHello_Remote_MyLGen_init(in integer pl_senderId, in EPTF_ExecCtrl_CT pl_ExecCtrlRef )
|
| runs on SimpleHello_Remote_MyLGen_CT
|
| {
|
| var integer nof_entity := 7;
|
| f_EPTF_LGenBase_init(int2str(pl_senderId), 0, "Demo Entity#");
|
|
|
|
|
| //init generic SimpleHello LGEN
|
| f_EPTF_SimpleHello_init(c_EPTF_SimpleHello_behaviorType_server, c_EPTF_SimpleHello_maxEntityCount);
|
| //set outgoing message handler to remote send
|
| f_EPTF_SimpleHello_setSendRequestFunction(refers(f_EPTF_SimpleHello_RemoteTransport_sendMessage));
|
| //init remote transport
|
| f_EPTF_SimpleHello_RemoteTransport_init_CT(refers(f_EPTF_SimpleHello_messageReceived));
|
| f_EPTF_LGenBase_TcMgmt_declareCompactFsmTables(tsp_modulePar_compactFsmTables);
|
| var integer vl_eTypeIdx := f_EPTF_LGenBase_declareEntityType("Entity_SimpleHelloServer", {c_EPTF_SimpleHello_behaviorType_server});
|
| vl_eTypeIdx := f_EPTF_LGenBase_declareEntityType("Entity_SimpleHelloClien", {c_EPTF_SimpleHello_behaviorType_server});
|
| f_EPTF_ExecCtrlClient_UIHandler_init_CT("SimpleHello",pl_ExecCtrlRef,mtc,mtc);
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Function: f_EPTF_SimpleHello_Local_MyLGen_init
|
| //
|
| // Purpose:
|
| // Function to initialize the user defined local MyLGen component
|
| //
|
| // Detailed Comments:
|
| // The init function initialize the Local_MyLGen component and register
|
| // the callback functions
|
| //
|
| ///////////////////////////////////////////////////////////
|
| function f_EPTF_SimpleHello_Local_MyLGen_init(in EPTF_ExecCtrl_CT pl_ExecCtrlRef)
|
| runs on SimpleHello_Local_MyLGen_CT
|
| {
|
| var integer nof_entity := 7;
|
| f_EPTF_LGenBase_init("SimpleHello", nof_entity, "Demo Entity#");
|
| //init generic SimpleHello LGEN
|
| f_EPTF_SimpleHello_init(c_EPTF_SimpleHello_behaviorType_server, c_EPTF_SimpleHello_maxEntityCount);
|
| //set outgoing message handler to local (direct)send
|
| f_EPTF_SimpleHello_setSendRequestFunction(refers(f_EPTF_SimpleHello_LocalTransport_sendMessage));
|
| //init local transport
|
| f_EPTF_SimpleHello_LocalTransport_init_CT(refers(f_EPTF_SimpleHello_messageReceived));
|
| f_EPTF_LGenBase_TcMgmt_declareCompactFsmTables(tsp_modulePar_compactFsmTables);
|
| var integer vl_eTypeIdx := f_EPTF_LGenBase_declareEntityType("Entity_SimpleHelloServer", {c_EPTF_SimpleHello_behaviorType_server});
|
| //vl_eTypeIdx := f_EPTF_LGenBase_declareEntityType("Entity_SimpleHelloClien", {c_EPTF_SimpleHello_behaviorType_server});
|
| f_EPTF_ExecCtrlClient_UIHandler_init_CT("SimpleHello",pl_ExecCtrlRef,self,self); //mtc?
|
|
|
| log(%definitionId,": Local_MyLGen initialized");
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Function: f_EPTF_SimpleHello_Remote_MyLGen_start
|
| //
|
| // Purpose:
|
| // Function to start the user defined remote MyLGen component
|
| //
|
| // Parameters:
|
| // pl_msg - *in* <charstring> - the message string
|
| // pl_senderId - *in* <integer> - the id of the sender
|
| //
|
| // Detailed Comments:
|
| // The behavior of the Remote MyLGen component
|
| //
|
| ///////////////////////////////////////////////////////////
|
| function f_EPTF_SimpleHello_Remote_MyLGen_start(
|
| in charstring pl_msg,
|
| in integer pl_senderId,
|
| in EPTF_ExecCtrl_CT pl_ExecCtrlRef
|
| )
|
| runs on SimpleHello_Remote_MyLGen_CT
|
| {
|
| log(%definitionId,": Remote_MyLGen started");
|
|
|
| f_EPTF_SimpleHello_Remote_MyLGen_init(pl_senderId,pl_ExecCtrlRef );
|
|
|
| setverdict(pass);
|
| f_EPTF_Base_wait4Shutdown();
|
|
|
| //log(%definitionId,": Remote_MyLGen finished");
|
| //f_EPTF_Base_stop(none);
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Function: f_EPTF_SimpleHello_Mapper_start
|
| //
|
| // Purpose:
|
| // Function to start the applib specific MyMApper component
|
| //
|
| // Detailed Comments:
|
| // This is an applib specific behavior
|
| //
|
| ///////////////////////////////////////////////////////////
|
| function f_EPTF_SimpleHello_Mapper_start()
|
| runs on EPTF_SimpleHello_Mapper_CT
|
| {
|
| log(%definitionId,": Mapper started");
|
| f_EPTF_SimpleHello_Mapper_init_CT();
|
|
|
| setverdict(pass);
|
| f_EPTF_Base_wait4Shutdown();
|
|
|
| //log(%definitionId,": Mapper finished");
|
| //f_EPTF_Base_stop(none);
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Function: f_EPTF_SimpleHello_Local_MyLgen_start
|
| //
|
| // Purpose:
|
| // Function to start the user defined local MyLGen component
|
| //
|
| // Parameters:
|
| // pl_msg - *in* <charstring> - the message string
|
| // pl_senderId - *in* <integer> - the id of the sender
|
| //
|
| // Detailed Comments:
|
| // The behavior of the Local MyLGen component
|
| //
|
| ///////////////////////////////////////////////////////////
|
| function f_EPTF_SimpleHello_Local_MyLgen_start(
|
| in charstring pl_msg,
|
| in integer pl_senderId,
|
| in EPTF_ExecCtrl_CT pl_ExecCtrlRef )
|
| runs on SimpleHello_Local_MyLGen_CT
|
| {
|
| log(%definitionId,": Local_MyLGen started");
|
| f_EPTF_SimpleHello_Local_MyLGen_init(pl_ExecCtrlRef);
|
|
|
| setverdict(pass);
|
| f_EPTF_Base_wait4Shutdown();
|
|
|
| //log(%definitionId,": Local_MyLGen finished");
|
| //f_EPTF_Base_stop(none);
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Function: f_SimpleHello_Demo_initGui
|
| //
|
| // Purpose:
|
| // Function for initializing GUI
|
| //
|
| // Parameters:
|
| // -
|
| //
|
| // Detailed Comments:
|
| // This function puts the main window to the GUI
|
| ///////////////////////////////////////////////////////////
|
| function f_SimpleHello_Demo_initGui() runs on EPTF_UIHandler_CT{
|
|
|
| var XTDP_XML_Tag demoMainWindow := {
|
| xtdp_tabpanel := {
|
| id := omit,
|
| maxheight := omit,
|
| orient := "vertical",
|
| widgets := {
|
| {
|
| hbox := {
|
| id := omit,
|
| flex := omit,
|
| disabled := omit,
|
| orient := "horizontal",
|
| widgets := {
|
| {
|
| hbox := {
|
| id := omit,
|
| flex := omit,
|
| disabled := omit,
|
| orient := "vertical",
|
| widgets := {
|
| {
|
| tabbox := {
|
| id := c_EPTF_GUI_Main_Tabbox_WidgetId,
|
| flex := omit,
|
| disabled := omit,
|
| layout := omit,
|
| tabs := {
|
| {
|
| id := "Execution_Control.tab",
|
| tablabel := "USER Execution Control"
|
| }
|
| },
|
| tabpanels := {
|
| }
|
| }
|
| }
|
| }
|
| }
|
| }
|
| }
|
| }
|
| }
|
| }
|
| }
|
| };
|
| var boolean widgetExist := false;
|
| log("demoMainWindow: ", demoMainWindow);
|
| f_EPTF_UIHandler_addElementToGui(
|
| demoMainWindow,
|
| "",
|
| widgetExist);
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Function: f_EPTF_SimpleHello_Demo_myExecCtrlBehavior
|
| //
|
| // Purpose:
|
| // Function for ExecControl behavior
|
| //
|
| // Parameters:
|
| // -
|
| //
|
| // Detailed Comments:
|
| // Function for ExecControl behavior
|
| ///////////////////////////////////////////////////////////
|
| function f_EPTF_SimpleHello_Demo_myExecCtrlBehavior(in charstring pl_selfName, in integer pl_nrOfClients)
|
| runs on EPTF_ExecCtrl_CT
|
| {
|
| f_EPTF_ExecCtrl_behavior(pl_selfName, pl_nrOfClients);
|
| }
|
|
|
| //=========================================================================
|
| // Testcases
|
| //=========================================================================
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Testcase: tc_remoteExecutionTest
|
| //
|
| // Purpose:
|
| // Remote test case with 2 Remote LGen component and 1 MyMapper component
|
| //
|
| // Requirement:
|
| // RuntimeGUI should be started
|
| //
|
| ///////////////////////////////////////////////////////////
|
| testcase tc_remoteExecutionTest() runs on /*System_CT*/EPTF_SimpleHello_Mapper_CT{
|
| var SimpleHello_Remote_MyLGen_CT vl_LGen_first;
|
| var SimpleHello_Remote_MyLGen_CT vl_LGen_second;
|
| var integer i:=0;
|
| vl_LGen_first := SimpleHello_Remote_MyLGen_CT.create;
|
| //vl_LGen_second := SimpleHello_Remote_MyLGen_CT.create;
|
|
|
|
|
|
|
|
|
| f_EPTF_UIHandler_init_CT("SimpleHello", true); // default altsteps
|
|
|
| f_EPTF_UIHandler_clearGUI();
|
| if (not f_EPTF_UIHandler_addWindow()) {
|
| log(%definitionId,": Cannot add main window. Exiting...");
|
| f_EPTF_Base_stopAll(fail);
|
| }
|
|
|
| f_SimpleHello_Demo_initGui();
|
|
|
| f_EPTF_LoggingUI_init_CT(
|
| "SimpleHello", self, c_EPTF_GUI_Main_Tabbox_WidgetId);
|
| f_EPTF_Base_init_CT("SimpleHello_Demo");
|
| log(%definitionId,": Creating ExecCtrl...");
|
|
|
|
|
| var EPTF_ExecCtrl_UIHandler_CT ExtCtrl := EPTF_ExecCtrl_UIHandler_CT.create;
|
| ExtCtrl.start(f_EPTF_ExecCtrl_UIHandler_behavior("ExecCtrl", tsp_nrOfLGens, self,c_EPTF_GUI_Main_Tabbox_WidgetId));
|
|
|
|
|
|
|
|
|
| connect(vl_LGen_first:SimpleHello_PCO,vl_LGen_first:SimpleHello_PCO);
|
| // connect(vl_LGen_second:SimpleHello_PCO,self:SimpleHello_PCO);
|
| // map(self:UDP_Port,system:UDP_Port);
|
| timer t:=1.0;
|
| t.start;
|
| t.timeout;
|
| vl_LGen_first.start(f_EPTF_SimpleHello_Remote_MyLGen_start("Hello 1",1,ExtCtrl));
|
| //vl_LGen_second.start(f_EPTF_SimpleHello_Remote_MyLGen_start("Hello 2",2,ExecCtrlRef));
|
| f_EPTF_SimpleHello_Mapper_start ();
|
|
|
| log(%definitionId,": Stopping...");
|
| f_EPTF_Base_stop(none);
|
|
|
| disconnect(vl_LGen_first:SimpleHello_PCO,self:SimpleHello_PCO);
|
| //disconnect(vl_LGen_second:SimpleHello_PCO,self:SimpleHello_PCO);
|
| //unmap(self:UDP_Port,system:UDP_Port);
|
|
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Testcase: tc_localExecutionTest
|
| //
|
| // Purpose:
|
| // Local test case with only one LGen component
|
| // Both the server side and the client side is in one component
|
| //
|
| // Requirement:
|
| // RuntimeGUI should be started
|
| //
|
| // Detailed Comments:
|
| // This is a local testcase with only one LoadGen component created. This LGen component contains a server and a client side which sends various messages.
|
| // A RuntimeGUI should be started for running this test. An ExecControl UIhandler component will be created, which will control the GUI.
|
| // The test puts all ExecControl related widgets on the USER Execution Control Tab. The traffic cases then can be controlled with the help of various
|
| // buttons. Logging can be turned on and off on the Logging Tab. A third component will be created too. This will be the transport logger component.
|
| //
|
| ///////////////////////////////////////////////////////////
|
| testcase tc_localExecutionTest() runs on /*System_CT*/SimpleHello_Local_MyLGen_CT{
|
| //map(self:UDP_Port,system:UDP_Port);
|
|
|
| f_EPTF_Base_init_CT("SimpleHello_Demo");
|
|
|
| f_EPTF_UIHandler_init_CT("SimpleHello", true); // default altsteps
|
|
|
| f_EPTF_UIHandler_clearGUI();
|
| if (not f_EPTF_UIHandler_addWindow()) {
|
| log(%definitionId,": Cannot add main window. Exiting...");
|
| f_EPTF_Base_stopAll(fail);
|
| }
|
|
|
| f_SimpleHello_Demo_initGui();
|
|
|
| f_EPTF_LoggingUI_init_CT(
|
| "SimpleHello", self, c_EPTF_GUI_Main_Tabbox_WidgetId);
|
|
|
| log(%definitionId,": Creating ExecCtrl...");
|
| var EPTF_ExecCtrl_UIHandler_CT ExtCtrl := EPTF_ExecCtrl_UIHandler_CT.create;
|
| ExtCtrl.start(f_EPTF_ExecCtrl_UIHandler_behavior("ExecCtrl", tsp_nrOfLGens, self,c_EPTF_GUI_Main_Tabbox_WidgetId));//, self));
|
|
|
|
|
| f_EPTF_SimpleHello_Local_MyLgen_start("Hello 1",1,ExtCtrl);
|
|
|
| f_EPTF_Base_stopAll(none);
|
|
|
| //unmap(self:UDP_Port,system:UDP_Port);
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Testcase: tc_localExecutionTestNoGui
|
| //
|
| // Purpose:
|
| // Local test case with only one LGen component
|
| // Both the server side and the client side is in one component
|
| //
|
| // Requirement:
|
| // -
|
| //
|
| // Detailed Comments:
|
| // This test case is similar to tc_localExecutionTest(), but no GUI required to start. The test runs and sends simpleHello messages automatically.
|
| //
|
| ///////////////////////////////////////////////////////////
|
| testcase tc_localExecutionTestNoGui() runs on /*System_CT*/SimpleHello_Local_MyLGen_CT{
|
| //map(self:UDP_Port,system:UDP_Port);
|
|
|
| f_EPTF_Base_init_CT("SimpleHello_Demo");
|
|
|
| log(%definitionId,": Creating ExecCtrl...");
|
| var EPTF_ExecCtrl_CT ExtCtrl := EPTF_ExecCtrl_CT.create;
|
| ExtCtrl.start(f_EPTF_SimpleHello_Demo_myExecCtrlBehavior("ExecCtrl", tsp_nrOfLGens));
|
|
|
| //init LGenBase
|
| var integer nof_entity := 7;
|
| f_EPTF_LGenBase_init("SimpleHello", nof_entity, "Demo Entity#");
|
| //init generic SimpleHello LGEN
|
| f_EPTF_SimpleHello_init(c_EPTF_SimpleHello_behaviorType_server, c_EPTF_SimpleHello_maxEntityCount);
|
| //set outgoing message handler to local (direct)send
|
| f_EPTF_SimpleHello_setSendRequestFunction(refers(f_EPTF_SimpleHello_LocalTransport_sendMessage));
|
| //init local transport
|
| f_EPTF_SimpleHello_LocalTransport_init_CT(refers(f_EPTF_SimpleHello_messageReceived));
|
| f_EPTF_LGenBase_TcMgmt_declareCompactFsmTables(tsp_modulePar_compactFsmTables);
|
| var integer vl_eTypeIdx := f_EPTF_LGenBase_declareEntityType("Entity_SimpleHelloServer", {c_EPTF_SimpleHello_behaviorType_server});
|
| f_EPTF_ExecCtrlClient_init_CT("SimpleHello",ExtCtrl);
|
|
|
| log(%definitionId,": Local_MyLGen initialized");
|
|
|
| timer t;
|
| t.start(10.0);
|
|
|
| alt{
|
| [] t.timeout{}
|
| }
|
|
|
| log(%definitionId,": Local_MyLGen finished");
|
| setverdict(pass);
|
|
|
| f_EPTF_Base_stopAll(none);
|
|
|
| //unmap(self:UDP_Port,system:UDP_Port);
|
| }
|
|
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Testcase: tc_graphicalLogger
|
| //
|
| // Purpose:
|
| // testcase with graphical logger
|
| //
|
| // Requirement:
|
| // RuntimeGUI should be started
|
| //
|
| ///////////////////////////////////////////////////////////
|
| testcase tc_graphicalLogger() runs on MyLogger_CT
|
| { timer t_wait := 5.0;
|
| var integer i := 0;
|
|
|
|
|
| var XTDP_XML_Tag pl_xul;
|
| var boolean vl_exist;
|
|
|
| f_EPTF_UIHandler_init_CT("LoggingUIHandler");
|
|
|
| f_EPTF_UIHandler_clearGUI();
|
| f_EPTF_UIHandler_addWindow();
|
| f_EPTF_LoggingUI_createTabBox("EPTF_Main_tabbox",pl_xul);
|
| f_EPTF_UIHandler_addElementToGui(pl_xul,"EPTF_Main_Window",vl_exist);
|
|
|
| f_EPTF_LoggingUI_init_CT("LoggingUIHandler",self,"EPTF_Main_tabbox");
|
|
|
| f_EPTF_SimpleHello_LocalTransport_init_CT(null,self,self,"EPTF_LoggingUI_tabbox");
|
|
|
| log("Init sikeres");
|
|
|
| var PDU_SimpleHello_Request vl_request :=
|
| {
|
| header :=
|
| {
|
| lossP := 0.0,
|
| nackP := 1.0,
|
| delay := 2.0
|
| },
|
| transId := 3,
|
| senderId := 4,
|
| msg := "HEHE",
|
| payload := omit
|
| }
|
|
|
| var EPTF_SimpleHello_LoggerMessage vl_msg :=
|
| {
|
| octetMessage := f_enc_SimpleHello_Request(vl_request),
|
| isRequest := true
|
| }
|
|
|
| t_wait.start;
|
|
|
| alt{
|
| [] t_wait.timeout {
|
| vf_EPTF_SimpleHello_LoggerClient_sendFunction.apply(vl_msg);
|
| if (i != 5 ) {
|
|
|
| t_wait.start;
|
| i := i + 1;
|
| repeat;
|
|
|
| }
|
| }
|
|
|
| }
|
| log(%definitionId,": MyLogger finished");
|
| setverdict(pass);
|
|
|
| f_EPTF_Base_stopAll(none);
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Testcase: tc_usingExternalTemplate
|
| //
|
| // Purpose:
|
| // Local test case with only one LGen component
|
| // Both the server side and the client side is in one component
|
| // The thest case uses external template
|
| //
|
| // Requirement:
|
| // An external template file (suggested: demo\request_templ.txt)
|
| //
|
| // Detailed Comments:
|
| // This test case is similar to tc_localExecutionTest(), but no GUI required to start. The test runs and sends simpleHello messages automatically.
|
| // The request messages are changed with an external template file
|
| //
|
| ///////////////////////////////////////////////////////////
|
| testcase tc_usingExternalTemplate() runs on /*System_CT*/SimpleHello_Local_MyLGen_CT{
|
| //map(self:UDP_Port,system:UDP_Port);
|
|
|
| f_EPTF_Base_init_CT("SimpleHello_Demo");
|
|
|
| log(%definitionId,": Creating ExecCtrl...");
|
| var EPTF_ExecCtrl_CT ExtCtrl := EPTF_ExecCtrl_CT.create;
|
| ExtCtrl.start(f_EPTF_SimpleHello_Demo_myExecCtrlBehavior("ExecCtrl", tsp_nrOfLGens));
|
|
|
| //init LGenBase
|
| var integer nof_entity := 7;
|
| f_EPTF_LGenBase_init("SimpleHello", nof_entity, "Demo Entity#");
|
| // adding external template file
|
| f_EPTF_LGenBase_loadExtTempl( tsp_EPTF_SimpleHello_templPath_CustomRequest, c_EPTF_SimpleHello_templName_CustomRequest );
|
| if ( f_EPTF_LGenBase_getExtTemplIdx(c_EPTF_SimpleHello_templName_CustomRequest) >= 0 )
|
| {
|
| log("External template loaded OK");
|
| } else {
|
| log("Could not load external templates");
|
| setverdict(fail);
|
| }
|
|
|
| //init generic SimpleHello LGEN
|
| f_EPTF_SimpleHello_init(c_EPTF_SimpleHello_behaviorType_server, c_EPTF_SimpleHello_maxEntityCount);
|
| //set outgoing message handler to local (direct)send
|
| f_EPTF_SimpleHello_setSendRequestFunction(refers(f_EPTF_SimpleHello_LocalTransport_sendMessage));
|
| //init local transport
|
| f_EPTF_SimpleHello_LocalTransport_init_CT(refers(f_EPTF_SimpleHello_messageReceived));
|
| f_EPTF_LGenBase_TcMgmt_declareCompactFsmTables(tsp_modulePar_compactFsmTables);
|
| var integer vl_eTypeIdx := f_EPTF_LGenBase_declareEntityType("Entity_SimpleHelloServer", {c_EPTF_SimpleHello_behaviorType_server});
|
| f_EPTF_ExecCtrlClient_init_CT("SimpleHello",ExtCtrl);
|
|
|
| log(%definitionId,": Local_MyLGen initialized");
|
|
|
| timer t;
|
| t.start(10.0);
|
|
|
| alt{
|
| [] t.timeout{}
|
| }
|
|
|
| log(%definitionId,": Local_MyLGen finished");
|
| setverdict(pass);
|
|
|
| f_EPTF_Base_stopAll(none);
|
|
|
| //unmap(self:UDP_Port,system:UDP_Port);
|
| }
|
|
|
| //=========================================================================
|
| // Control
|
| //=========================================================================
|
|
|
| control
|
| {
|
| execute(tc_remoteExecutionTest());
|
| execute(tc_localExecutionTest());
|
| execute(tc_localExecutionTestNoGui());
|
| execute(tc_graphicalLogger());
|
| execute(tc_usingExternalTemplate());
|
| }
|
|
|
|
|
| }// end of module
|
|
|