Service Virtualization

Expand all | Collapse all

How to add two or more values for a particular field in the Request data arguments in the VSI?

  • 1.  How to add two or more values for a particular field in the Request data arguments in the VSI?

    Posted Apr 04, 2017 02:47 AM

    I need to add, two or more than 2 values in the value field.

    How do I add?



  • 2.  Re: How to add two or more values for a particular field in the Request data arguments in the VSI?

    Posted Apr 04, 2017 03:02 AM

    Please try using Regular Expression in the Comparison Operator column and provide the appropriate regex in the Value column, for any specific transaction. Hope this helps!!!



  • 3.  Re: How to add two or more values for a particular field in the Request data arguments in the VSI?

    Posted Apr 04, 2017 07:08 AM

    Hi, 

    What I am trying to do is to add two or more values in the values column, i.e i have to return a particular response if the values are not eqaul to x,y,z. So in the comparison operator I will use != operator only, I cannot use regex operator. I need to know how can I add two or more values in the value column. Please provide any other suggestion. Thanks!



  • 4.  Re: How to add two or more values for a particular field in the Request data arguments in the VSI?

    Posted Apr 04, 2017 10:18 AM

    you can use Match script something like below... 

     

    boolean operationsMatch = incomingRequest.getOperation().equals(sourceRequest.getOperation());
    if (operationsMatch) {
    String incomingValue = incomingRequest.getArguments().get("request_arg");
    boolean ret = !incomingValue.equals("111111") || !incomingValue2.startsWith("222222");
    return ret;
    }
    // false means no match
    return false;

     

    compare the incoming value with expected value and return true or false... if false then it will proceed with the next transaction in order... if true, it will respond with the current txn response. 

     

    hope this helps !!



  • 5.  Re: How to add two or more values for a particular field in the Request data arguments in the VSI?

    Broadcom Employee
    Posted Apr 04, 2017 04:24 PM

    I would recommend using Regular expression instead of the Match script.



  • 6.  Re: How to add two or more values for a particular field in the Request data arguments in the VSI?

    Posted Apr 05, 2017 01:27 AM

    Can you give me an example on how to use regex in this case?



  • 7.  Re: How to add two or more values for a particular field in the Request data arguments in the VSI?

    Broadcom Employee
    Posted Apr 05, 2017 11:11 AM

    what are the values you are trying to ignore?



  • 8.  Re: How to add two or more values for a particular field in the Request data arguments in the VSI?

    Posted Apr 06, 2017 01:42 AM

    I am trying to ignore 10,15,17,20 from the value column. i.e if sessionID is not equal to 10, 15, 17, 20 then return error code = 404 in the response.



  • 9.  Re: How to add two or more values for a particular field in the Request data arguments in the VSI?

    Broadcom Employee
    Posted Apr 06, 2017 02:23 PM

    You can try something like [^10|15|17|20] in Value field and Comparison operator to be "Regular Expression". Argument will match any value other than 10,15,17 or 20.



  • 10.  Re: How to add two or more values for a particular field in the Request data arguments in the VSI?

    Posted Apr 17, 2017 11:28 AM

    Venkat,

    Did Prema's example help you out with this issue?

    Regards,

    Reid



  • 11.  Re: How to add two or more values for a particular field in the Request data arguments in the VSI?
    Best Answer

    Posted Apr 20, 2017 03:07 AM

    No.. I tired using the regular expression, but it didn't work. So I have written a script to validate the fields required.