Service Virtualization

 View Only
  • 1.  How to retrieve Recording or Playback mode value in VSE with RRParis in SDP

    Posted Sep 14, 2016 12:49 AM

    I am trying to modify the incoming request when I am creating the VSE using RR Pairs. During the creation only I need to add some changes in request using Scriptable Data Protocol scripts. and that logic should skipped during play back. How I can validate current mode is Recording or Playback mode in Scriptable Data Protocol scripts? 



  • 2.  Re: How to retrieve Recording or Playback mode value in VSE with RRParis in SDP
    Best Answer

    Posted Sep 14, 2016 11:56 AM

    You could always remove the Scriptable from the Listen Step after the VSM is built.  But, that is not hugely optimal.

     

    One approach is to place an RR Sidecar file in the RR Pairs directory.  

     Request/Response Pairs - DevTest Solutions - 9.5 - CA Technologies Documentation  

     

    Only one sidecar file is required and it would be named:  meta-req.properties.  

    - Add a single property in this file called  RecordMode=Y.

    - In your Scriptable DPH, add logic to check to see if the incoming request Meta Data it contains a property called RecordMode.  If so, you know you are in Record mode.  If not, you are in playback mode since the system under test would never send this element in the header.  If in record mode, remove the RecordMode property from the META data so it will not appear in the recorded transactions.

     

    For example:  <pardon typos>

    import com.itko.util.*;

    ParameterList metadata = lisa_vse_request.getMetaData();
    if ( ! metadata.containsKey("RecordMode") ){

           return;  // Get out of script we are not in Record mode

                    // and should not execute any more logic

    }

     

    metadata.removeParameter("RecordMode");
    lisa_vse_request.setMetaData(metadata);
    :

    : // rest of Record Mode logic goes here



  • 3.  Re: How to retrieve Recording or Playback mode value in VSE with RRParis in SDP

    Posted Sep 14, 2016 02:22 PM

    Hi Nesmith,

     

         Thanks for you reply , it is working fine with Sidecar file and I would like to go with that route because we are creating the service multiple people and standard file will help one time check in. How I can have meta-req.properties for each messages we are supporting. Because we have updateRequest and getRequest messages .We need to mention individual  meta-req.properties each messages. 

     

    File names are 

    updateRequest-1-req.xml

    updateRequest-1-res.xml

    updateRequest-2-req.xml

    updateRequest-2-res.xml

    getRequest -1-req.xml

    getRequest -1-res.xml

    getRequest -2-req.xml

    getRequest -2-res.xml



  • 4.  Re: How to retrieve Recording or Playback mode value in VSE with RRParis in SDP

    Posted Sep 14, 2016 04:17 PM

    When you build a file with the name meta-req.properites, this sidecar file will apply to every request in your directory that ends with "-req.xml".  So, in effect, the meta-req properties file is applied to every one of your valid R/R pairs when they are processed.

     

    If you have a file in your R/R pair directory named updateRequest1-req.xml, and you want to specifically add a property to this and only this request, you would create a updateRequest1-req.properties sidecar file.   



  • 5.  Re: How to retrieve Recording or Playback mode value in VSE with RRParis in SDP

    Posted Sep 14, 2016 04:31 PM

    When I tried above approach DevTest creates one more operation with empty name. It is is not treated as meta for request. File names I used are 

     

    updateRequest1-req.xml

    updateRequest1-req.properties

    updateRequest1-rsp.xml



  • 6.  Re: How to retrieve Recording or Playback mode value in VSE with RRParis in SDP

    Posted Sep 14, 2016 04:45 PM

    You may need to raise a support ticket with CA Support.  

    The 9.5 documentation states that a global sidecar file applies to requests and must be named meta-req.properties. The doco also states that the entries in a specific sidecar file (for example, updateRequest1-req.properties) take precedence over the entries in a global sidecar file.  It appears that you are not experiencing this behavior.

     

    I do not know why an operation with no name would be created.



  • 7.  Re: How to retrieve Recording or Playback mode value in VSE with RRParis in SDP

    Posted Sep 14, 2016 05:30 PM

    Nesmith,

       it is working fine with slight change in naming

    updateRequest1-req.xml

    updateRequest1-req-meta.properties

    updateRequest1-rsp.xml

     

    Thanks for your support.