Service Virtualization

Expand all | Collapse all

How should I get the ten(any no of days) days after date and time in response?How To implement the following scenario's in LISA 9.5.1?

  • 1.  How should I get the ten(any no of days) days after date and time in response?How To implement the following scenario's in LISA 9.5.1?

    Posted May 12, 2017 04:06 AM

    How should I get the ten days after date and time in response? 



  • 2.  Re: How should I get the ten(any no of days) days after date and time in response?How To implement the following scenario's in LISA 9.5.1?

    Posted May 12, 2017 10:42 AM
    You can use Execute script (JSR-223) ( java script) step and wirte code to add number of days/hours/minutes you want. See below sample code. you would need to change as you per your requirement.  Also deploy JAR in case not present in hot deploy folder of Devtest. 
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import java.util.TimeZone;
    import java.util.Date;
    import java.string;
    DateFormat DFTimeSec=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    cal = Calendar.getInstance(); 
    //add days
    cal.add(Calendar.Day, 10);
    testExec.setStateValue("TripStartDate", DFTimeSec.format(cal.getTime())+ "T" + DFTimeSec.format(cal.getTime())+"-06:00");
    Hope this helps
    Thanks, 
    Rajesh k Singh


  • 3.  Re: How should I get the ten(any no of days) days after date and time in response?How To implement the following scenario's in LISA 9.5.1?

    Posted May 16, 2017 02:23 AM

    try this with the required date/time format.

    {{=doDateDeltaFromCurrent("yyyy-MM-dd'T'HH:mm:ss.SSSXXX","10D");/*2015-01-30T14:20:42.079-06:00*/}}



  • 4.  Re: How should I get the ten(any no of days) days after date and time in response?How To implement the following scenario's in LISA 9.5.1?
    Best Answer

    Broadcom Employee
    Posted May 16, 2017 03:14 AM

    I presume you would like DevTest to do this automatically?

     

    There are three lines to add in DEVTEST_HOME/lisa.properties.

    Search that file for "datechecker".

    In that section, you want to find lines like these, and add these lines to the corresponding places (I haven't syntax-checked these lines):

     

    1st addition:

    lisa.vse.datechecker.customwstimestampregex=\\d\\d\\d\\d((1[012])|(0\\d)|0[1-9]|[1-9])(([12]\\d)|(3[01])|(0?[1-9]))T(([012]?\\d)|(2[0123])):(([012345]\\d)|(60)):(([012345]\\d)|(60))\\.\\d\\d\\d[-+]\\d\\d:\\d\\d

     

    2nd addition:

    lisa.vse.datechecker.customwstimestampformat=yyyyMMdd'T'HH:mm:ss.SSSXXX

     

    Then find the following line:

    lisa.vse.datechecker.top.priorityorder=lisa.vse.datechecker.wstimestampformat

    and add this line directly below it:
    lisa.vse.datechecker.date.priorityorder=lisa.vse.datechecker.customwstimestampformat&\

     

    Now restart your DevTest Workstation.

    Open your service image. There is a toolbar button with tooltip of "regenerate magic strings and dates". Press that button.

    DevTest scans your whole service image for strings and dates that can be abstracted. It should find your date format and do what Syed suggested. You can then change the number of days (and any other piece of the date) to match your requirements.