Service Virtualization

  • 1.  Why do JSR-223 steps behave different in ITR then when deployed?

    Posted Feb 24, 2017 04:16 PM

    I have a JSR-223 script in my VSM running this line of code:

     

      return testExec.getStateValue("lisa.vse.http.current.transaction").uri;

     

    Works as designed in ITR mode, but when deployed on a VSE, fails with:

     

    Script throw an exception: bsh.EvalError: Sourced file: inline evaluation of:
    ``return testExec.getStateValue("lisa.vse.http.current.transaction").uri;
    : reflection error: bsh.ReflectError: No such field: uri :

     

     

     

    SakthivelThanabalan62134482



  • 2.  Re: Why do JSR-223 steps behave different in ITR then when deployed?

    Broadcom Employee
    Posted Feb 24, 2017 04:44 PM

    When does failure occur - on deploy time or at run time when a request reaches this model?

     

    If it at run time - is there any other error before : reflection error: bsh.ReflectError: No such field: uri :

     

    One thing to keep in mind - testExec.getStateValue("lisa.vse.http.current.transaction") will return null in case "lisa.vse.http.current.transaction" property does not exist at the time of JSR script execution - so it is better to add a null check to make your model more robust rather than directly returning testExec.getStateValue("lisa.vse.http.current.transaction").uri;



  • 3.  Re: Why do JSR-223 steps behave different in ITR then when deployed?

    Posted Feb 24, 2017 04:55 PM

    Failure occurs when an transaction is triggered.  Null case checking is being addressed and this workaround works - 

    return testExec.getStateValue("lisa.vse.request").getOperation().split(" ")[1];

    (but still has both null and out of bounds errors to guard against)

     

    My concern is about how it works in ITR but fails in VSE.

     

    No errors before the one listed.

     

    ============================================================================
    | Exception: 
    ============================================================================
    | Message: Script throw an exception: bsh.EvalError: Sourced file: inline evaluation of: ``return testExec.getStateValue("lisa.vse.http.current.transaction").uri; //testE . . . '' : reflection error: bsh.ReflectError: No such field: uri : at Line: 1 : in file: inline evaluation of: ``return testExec.getStateValue("lisa.vse.http.current.transaction").uri; //testE . . . '' : .uri
    in inline evaluation of: ``return testExec.getStateValue("lisa.vse.http.current.transaction").uri; //testE . . . '' at line number 1
    ----------------------------------------------------------------------------
    | Trapped Exception: bsh.EvalError: Sourced file: inline evaluation of: ``return testExec.getStateValue("lisa.vse.http.current.transaction").uri; //testE . . . '' : reflection error: bsh.ReflectError: No such field: uri : at Line: 1 : in file: inline evaluation of: ``return testExec.getStateValue("lisa.vse.http.current.transaction").uri; //testE . . . '' : .uri
    in inline evaluation of: ``return testExec.getStateValue("lisa.vse.http.current.transaction").uri; //testE . . . '' at line number 1
    | Trapped Message: javax.script.ScriptException: bsh.EvalError: Sourced file: inline evaluation of: ``return testExec.getStateValue("lisa.vse.http.current.transaction").uri; //testE . . . '' : reflection error: bsh.ReflectError: No such field: uri : at Line: 1 : in file: inline evaluation of: ``return testExec.getStateValue("lisa.vse.http.current.transaction").uri; //testE . . . '' : .uri
    in inline evaluation of: ``return testExec.getStateValue("lisa.vse.http.current.transaction").uri; //testE . . . '' at line number 1
    ----------------------------------------------------------------------------
    STACK TRACE
    javax.script.ScriptException: bsh.EvalError: Sourced file: inline evaluation of: ``return testExec.getStateValue("lisa.vse.http.current.transaction").uri; //testE . . . '' : reflection error: bsh.ReflectError: No such field: uri : at Line: 1 : in file: inline evaluation of: ``return testExec.getStateValue("lisa.vse.http.current.transaction").uri; //testE . . . '' : .uri
    in inline evaluation of: ``return testExec.getStateValue("lisa.vse.http.current.transaction").uri; //testE . . . '' at line number 1
    at bsh.BshScriptEngine.evalSource(BshScriptEngine.java:102)
    at bsh.BshScriptEngine.eval(BshScriptEngine.java:61)
    at javax.script.AbstractScriptEngine.eval(Unknown Source)
    at com.itko.lisa.test.ScriptExecHandler.executeScript(ScriptExecHandler.java:674)
    at com.itko.lisa.test.ScriptExecHandler.executeScript(ScriptExecHandler.java:427)
    at com.itko.lisa.test.UserScriptNode._execute(UserScriptNode.java:210)
    at com.itko.lisa.test.UserScriptNode.execute(UserScriptNode.java:175)
    at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981)
    at com.itko.lisa.test.TestCase.execute(TestCase.java:1288)
    at com.itko.lisa.test.TestCase.execute(TestCase.java:1203)
    at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1188)
    at com.itko.lisa.test.TestCase.executeTest(TestCase.java:1129)
    at com.itko.lisa.coordinator.Instance.run(Instance.java:204)
    ============================================================================



  • 4.  Re: Why do JSR-223 steps behave different in ITR then when deployed?
    Best Answer

    Broadcom Employee
    Posted Feb 24, 2017 05:17 PM

    It may have to do with different Java security settings on Devtest workstation vs the VSE environment.

     

    You could try using   testExec.getStateValue("lisa.vse.http.current.transaction").getRequestedURI() with appropriate null checks instead of .uri (in case you are on DevTest 9.5.1)

     

    Please remember the underlying APIs can change & both .uri & testExec.getStateValue("lisa.vse.http.current.transaction").getRequestedURI() may not work in future versions.



  • 5.  Re: Why do JSR-223 steps behave different in ITR then when deployed?

    Posted Feb 24, 2017 05:40 PM

    .getRequestedURI() worked - I didn't find this when I was digging around in the jar file for options.  Is the API published somewhere by version?  Is there anything that can be done to have ITR and VSE behave the same?

     

    Thanks



  • 6.  Re: Why do JSR-223 steps behave different in ITR then when deployed?

    Broadcom Employee
    Posted Feb 24, 2017 06:04 PM

    Regarding the API - the publicly available one is located under DEVTESTHOME\doc\SDKJavaDoc.zip folder - all others including testExec.getStateValue("lisa.vse.http.current.transaction").getRequestedURI() are internal to the product.

     

    As for ITR / VSE to behave the same - please check the java security settings used by java processes that start the Workstation / VSE