changeset 499:5588b03739b0

HttpScopes.updateSessionId
author Devel 1
date Wed, 16 Aug 2017 10:23:21 +0200
parents 4d25ddc19ecb
children 32113de80f6d
files stress-tester/src/main/java/com/passus/st/client/http/HttpScopes.java
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/HttpScopes.java	Wed Aug 16 09:33:45 2017 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/http/HttpScopes.java	Wed Aug 16 10:23:21 2017 +0200
@@ -92,6 +92,24 @@
         return false;
     }
 
+    public ParametersBag updateSession(String oldId, String newId) {
+        return updateSession(oldId, newId, ZONE_DEFAULT);
+    }
+
+    public ParametersBag updateSession(String oldId, String newId, String zone) {
+        return updateSession(oldId, newId, zone, true);
+    }
+
+    public ParametersBag updateSession(String oldId, String newId, String zone, boolean autocreate) {
+        Map<String, ParametersBag> zoneSessions = getZoneSessions(zone, autocreate);
+        ParametersBag params = zoneSessions.remove(oldId);
+        if (params == null && autocreate) {
+            params = new ParametersBag();
+        }
+        zoneSessions.put(newId, params);
+        return params;
+    }
+
     public ParametersBag getSession(String sessionId) {
         return getSession(sessionId, ZONE_DEFAULT);
     }