AnsweredAssumed Answered

How to iterate over a persistent model map in javascript step?

Question asked by venkatraj02 on Apr 4, 2017
Latest reply on Apr 5, 2017 by Joel NeSmith

I have a requirement, to find the duplicacy of a particular value in the request. for example, there is a request parameter session ID in my incoming request with values as SessionID = 12345; if one more request with the same Session ID is received by the VSI I have to set an error response. So I have to store the session ID in a persistent model map and whenever a request is coming, the map will hold all the values, to find the duplicate ID i have to iterate over the persistent model map. Can someone help on how to iterate ?

code:

com.itko.lisa.coordinator.TestRegistry tr = com.itko.lisa.test.Environment.getTestRegistry();
    String sessionID="";
   
boolean sessionexpired=false;
   
try {
        Request req = (Request) testExec.getStateValue(
"lisa.vse.request");
       
ParameterList args = req.getArguments();
        sessionID = args.get(
"SessionID");
       
if (tr.getAllMapValues("ExpiryData").size()>0) {  // new values will be added in the map//
            tr.putMapValue(
"ExpiryData", "sessionID", sessionID);
            sessionexpired=
false;
        }
else {
            iterate over the map and check if the value is already present or not.

Outcomes