1 18 19 package org.apache.jmeter.threads; 20 21 import java.util.HashMap ; 22 import java.util.Iterator ; 23 import java.util.Map ; 24 25 28 public class JMeterVariables 29 { 30 private Map variables = new HashMap (); 31 private int iteration = 0; 32 33 public JMeterVariables() 34 { 35 } 36 37 public String getThreadName() 38 { 39 return Thread.currentThread().getName(); 40 } 41 42 public int getIteration() 43 { 44 return iteration; 45 } 46 47 public void incIteration() 48 { 49 iteration++; 50 } 51 52 public void initialize() 53 { 54 variables.clear(); 55 } 56 57 public Object remove(String key) 58 { 59 return variables.remove(key); 60 } 61 public void put(String key, String value) 62 { 63 variables.put(key, value); 64 } 65 66 public void putObject(String key, Object value) 67 { 68 variables.put(key, value); 69 } 70 71 public void putAll(Map vars) 72 { 73 Iterator iter = vars.keySet().iterator(); 74 while (iter.hasNext()) 75 { 76 String item = (String ) iter.next(); 77 put(item, (String ) vars.get(item)); 78 79 } 80 } 81 82 public void putAll(JMeterVariables vars) 83 { 84 putAll(vars.variables); 85 } 86 87 91 public String get(String key) 92 { 93 return (String ) variables.get(key); 94 } 95 96 public Object getObject(String key) 97 { 98 return variables.get(key); 99 } 100 } | Popular Tags |