Scheduling coverage scenario
You can schedule Interact Simulation execution through operating system cron job.
About this task
- System creates simple standalone java application to invoke execution service through Restful API.
- System provides operating system based scripts to execute simple java application.
- Set operating system-level cron job to invoke execution scripts.
Procedure
-
The main class support run Coverage Scenario from OS based scripts:
System-created simple SimulatorMain class is located in Interact Design Time. It covers the following main functions:
- Read execution config file (simulator.properties).
- Communicate with Interact DT Simulation Execution Server through Platform security authentication.
- Send request to invoke Simulator Execution Restful API to execute coverage scenario. Receive the response of execution results.
- Logging all request/response message.
- Support internationalization of display message.
-
The system provides two scripts:
The scripts are available in the /InteractDT/tools/simulator directory.
- The script for Microsoft Windows is runSimulator.bat.
- The script for Linux is runSimulators.sh.
-
How to execute runSimulator.sh/runSimulator.bat:
We will take the example of runSimulator.sh
- Command for executing Coverage
Scenario:
$ ./runSimulator.sh -conf ./conf/simulator.properties -p test123 -action execution
- Command to get running
status:
$ ./runSimulator.sh -conf ./conf/simulator.properties -p test123 -action status
- Command for canceling running Coverage
Scenario:
$ ./runSimulator.sh -conf ./conf/simulator.properties -p test123 -action cancel
- Command for executing Coverage
Scenario:
-
Requested ./conf/simulator.properties:
######################################################################################## The following properties request by runSimulator scripts. # Request parameters for run Simulator: # # platformUrl - the Platform URL (host:port) of the Platform instance. # designTimeUrl - the URL (host:port) of the Interact design time instance. # interactChannelIdOrName - the Id or Name of the interactive channel containing the simulator. # scenarioIdOrName - Simulation Scenario Id or Name # serverGroupName - Name of Server Group where interact instance running # request for action=execution, status , cancel # rtInstanceName - Interact Instance Name, for example rtInstanceName=interact1 # rtInstanceUrl - Interact Instance URL, for example = http://localhost:7005/Interact # request of configuration of rtInstanceName and rtInstanceUrl: # 1) not need set value to both parameters - rtInstanceName, rtInstanceUrl ( system will find ServerGroup associated interact instance, and run coverage simulation. ) # 2) set value to one parameter - either rtInstanceName or rtInstanceUrl # 3) set value to both parameters - rtInstanceName, rtInstanceUrl # resultTableOverWrite - if set false, system will check if already has data in simulation result table, # than system will skip the execution of coverage simulation. # userName - is the user name currently logged in to the Interact design time. # locale - using for processing data (optional) # ###################################################################################### # Sample Data for run Simulator: action=execution # $./runSimulator.sh -conf ./conf/simulator.properties -p asm_admin -action execution ###################################################################################### #platformUrl=http://localhost:7005/unica #designTimeUrl=http://localhost:7005/Campaign #interactChannelIdOrName=20 #scenarioIdOrName=testsim3 #serverGroupName=defaultServerGroup #rtInstanceName=instanceA #rtInstanceUrl=http://localhost:7005/Interact #resultTableOverWrite=false #userName=asm_admin #locale=en ####################################################################################
-
Set OS level cron job to invoke execution scripts:
#Run a simulatorException.sh every 6 hour 0 */6 * * * /…/InteractDT/tools/simulator/runSimulator.sh
Example 1: runSimulator.sh missing parameter
$ ./runSimulator.sh Start Run Simulator 2022-11-15 08:29:32,093 INFO service.SimulatorMain [432] - Run Simulator Script, Missing pass arguments: USAGE: runSimulator.sh\bat -conf <propertiesFile> -p <password> -action <Execution> COMMANDLINE PARAMETERS: <propertiesFile> Properties file to read simulator execution parameters from. <Execution> execution - Execution of coverage simulation. <Execution> status - Get coverage simulation running status. <Execution> cancel - Cancel coverage simulation. 2022-11-15 08:29:32,095 ERROR service.SimulatorMain [132] - Run Simulator script, Missing arguments : -conf <propertiesFile> -p <Password> -action <Execution> End Run Simulator
Example 2: runSimulator.sh missing properties file:
$ ./runSimulator.sh -conf abc -p test -action execution Start Run Simulator 2022-11-15 08:31:02,284 INFO service.SimulatorMain [432] - Run Simulator, Missing pass arguments: <propertiesFile>. 2022-11-15 08:31:02,286 ERROR service.SimulatorMain [158] - Run Simulator script, Missing arguments : <propertiesFile> End Run Simulator
Example 3: Execute and Get Response