private void Init() { variables = null; previousResult = null; currentSampler = null; previousSampler = null; samplingStarted = false; threadNum = 0; nThread = null; isReinitSubControllers = false; samplerContext.Clear(); restartNextLoop = false; }
private sealed object interruptLock = new object(); // ensure that interrupt cannot overlap with shutdown public NetMeterThread(HashTree test, NetMeterThreadMonitor monitor, ListenerNotifier note) { this.monitor = monitor; threadVars = new NetMeterVariables(); testTree = test; compiler = new TestCompiler(testTree); controller = (Controller)testTree.GetArray()[0]; SearchByType <TestIterationListener> threadListenerSearcher = new SearchByType <TestIterationListener>(); test.Traverse(threadListenerSearcher); testIterationStartListeners = threadListenerSearcher.GetSearchResults(); notifier = note; running = true; }
public void AddNode(Object node, HashTree subTree) { if(isRemote && typeof(ResultCollector).IsAssignableFrom(node.GetType())) { try { replacer.ReplaceValues((TestElement) node); } catch (InvalidVariableException e) { log.Error("invalid variables", e); } } if (isRemote) { return; } if(typeof(TestElement).IsAssignableFrom(node.GetType())) { try { replacer.ReplaceValues((TestElement) node); } catch (Exception ex) { log.Error("invalid variables", e); } } if (typeof(TestPlan).IsAssignableFrom(node.GetType())) { ((TestPlan)node).prepareForPreCompile(); //A hack to make user-defined variables in the testplan element more dynamic Dictionary<String, String> args = ((TestPlan) node).GetUserDefinedVariables(); replacer.SetUserDefinedVariables(args); NetMeterVariables vars = new NetMeterVariables(); vars.PutAll(args); NetMeterContextManager.GetContext().SetVariables(vars); } if (typeof(Arguments).IsAssignableFrom(node.GetType())) { ((Arguments)node).setRunningVersion(true); Dictionary<String, String> args = ((Arguments) node).GetArgumentsAsMap(); replacer.AddVariables(args); NetMeterContextManager.GetContext().GetVariables().PutAll(args); } }
public void SetVariables(NetMeterVariables vars) { this.variables = vars; }
/** * @param result * @param threadGroup * @param jmvars * @param isTransactionSampleEvent */ public ExecutionEvent(ExecuteResult result, String threadGroup, NetMeterVariables jmvars, Boolean isTransactionSampleEvent) : this(result, threadGroup, HOSTNAME, isTransactionSampleEvent) { saveVars(jmvars); }
/** * Contructor used for normal samples, saves variable values if any are defined. * * @param result * @param threadGroup name * @param jmvars Jmeter variables */ public ExecutionEvent(ExecuteResult result, String threadGroup, NetMeterVariables jmvars) : this(result, threadGroup, jmvars, false) { }
private void saveVars(NetMeterVariables vars) { for(int i = 0; i < variableNames.Length; i++) { values[i] = vars.get(variableNames[i]); } }
public void PutAll(NetMeterVariables vars) { PutAll(vars.variables); }
public NetMeterThread(HashTree test, NetMeterThreadMonitor monitor, ListenerNotifier note) { this.monitor = monitor; threadVars = new NetMeterVariables(); testTree = test; compiler = new TestCompiler(testTree); controller = (Controller) testTree.GetArray()[0]; SearchByType<TestIterationListener> threadListenerSearcher = new SearchByType<TestIterationListener>(); test.Traverse(threadListenerSearcher); testIterationStartListeners = threadListenerSearcher.GetSearchResults(); notifier = note; running = true; }