Service Virtualization

 View Only
  • 1.  Change Execution Mode via Beanshell

    Posted Apr 09, 2020 03:07 PM
    I have been trying to modify the mode of execution of the virtual service through bean shell code in DevTest Workstation. Below, some codes I tested:

    // To change the service to efficient
    testExec.setStateValue ("lisa.vse.execution.mode", ExecutionMode.LIVE);

    // To return the execution mode
    return ExecutionMode.LIVE;

    However, none of the above methods work. When I request the service, the code is executed, however the execution mode remains set to Most Efficient.

    Is there anything that must be done for these codes to work?


  • 2.  RE: Change Execution Mode via Beanshell

    Posted Apr 10, 2020 01:15 AM
    Hi Matheus,

    Try updating value for lisa.vse.execution.mode in local.properties file . By default it is "Efficient'

    Thanks

    ------------------------------
    Regards,
    Vaibhav Jain
    Capgemini
    ------------------------------



  • 3.  RE: Change Execution Mode via Beanshell

    Posted Apr 10, 2020 02:11 PM
    Hi Vaibhav,

    I'm trying update value for lisa.vse.execution.mode with:

    testExec.setStateValue ("lisa.vse.execution.mode", ExecutionMode.LIVE);

    And

    testExec.setStateValue ("lisa.vse.execution.mode", "LIVE");

    But this not working. When making a service requirement, the execution mode is not modified on the portal, remaining efficient.


  • 4.  RE: Change Execution Mode via Beanshell

    Posted Apr 13, 2020 05:14 AM

    Hi Matheus,

    You can configure the value for "lisa.vse.execution.mode" as LIVE in project. config file and then try. Once configured and saved, virtual service deployment will be in LIVE mode.

    Thanks.



    ------------------------------
    Regards,
    Vaibhav Jain
    Capgemini
    ------------------------------



  • 5.  RE: Change Execution Mode via Beanshell

    Posted Apr 13, 2020 07:59 AM
    Hi Vaibhav,
    Yes, the mode of execution is modified. However, what I want to do is create code within one step of the .vsm file so that, when making a request in the deployed service, the execution mode is modified according to a value contained in a file.
    I have already tested using the testExec.setStateValue("lisa.vse.execution.mode", ExecutionMode.EFFICIENT); to change the value of the variable lisa.vse.execution.mode but that doesn't work.


  • 6.  RE: Change Execution Mode via Beanshell
    Best Answer

    Posted Apr 13, 2020 08:33 AM
    Hi Matheus,

    In that case, i would recommend you deploy the service in DYNAMIC mode and put the validation/rules in Virtual service router image. It will get executed only if you deploy the service in DYNAMIC mode, same code will not work if service is deployed in EFFICIENT mode (I have tested it earlier successfully.)

    Sample: 
    -------------
    import com.itko.lisa.vse.ExecutionMode;

    if (lisa_vse_request.getOperation().equals("Vaibhav_Test")) {

        return ExecutionMode.TRACK;

    } else {

        return ExecutionMode.LIVE;

    }

    -------------
    Thanks

    ------------------------------
    Regards,
    Vaibhav Jain
    Capgemini
    ------------------------------



  • 7.  RE: Change Execution Mode via Beanshell

    Posted Apr 13, 2020 03:31 PM
    Thank you Vaibhav!
    This solution worked for me, along with setting the dynamic mode.

    ------------------------------
    Matheus Ednei
    Capgemini