Service Virtualization

Expand all | Collapse all

Match Script

Jump to Best Answer
  • 1.  Match Script

    Posted 08-18-2020 05:42 PM
    Hi,

    The scenario is Rest service request attribute as a string, if user passes string should return error response. I have added 2 responses first one with positive response and second one negative response. Using below Match script but getting Meta response instead of response 1 and 2.

    String incomingValue = incomingRequest.getArguments().get("argumentName");

    if(incomingValue.equalsIgnoreCase("Text") {

        // true means these arguments match

    return true;

    else

    return to next response2.

     

     Could you please suggest me the correct syntax for the same or guide me how to handle this scenario.




    ------------------------------
    Thanks,
    Naga
    ------------------------------


  • 2.  RE: Match Script
    Best Answer

    Broadcom Employee
    Posted 08-18-2020 06:24 PM
    In your you are reading the Arguments not Attributes which is not right.

    You can try using the Request Data Manger DPH and make the Attribute as an Argument then you can use Comparison Operator as Regular expression and look for String or Digits.

    Documentation on Request Data manager DPH is available at https://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-enterprise-software/devops/devtest-solutions/10-6/using/using-service-virtualization/using-devtest-workstation-with-service-virtualization/creating-service-images/using-data-protocols/request-data-manager-data-protocol.html.



  • 3.  RE: Match Script

    Posted 08-20-2020 12:25 PM
    Thanks Premalatha!