private void Init()
 {
     variables              = null;
     previousResult         = null;
     currentSampler         = null;
     previousSampler        = null;
     samplingStarted        = false;
     threadNum              = 0;
     nThread                = null;
     isReinitSubControllers = false;
     samplerContext.Clear();
     restartNextLoop = false;
 }
Exemple #2
0
        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;
        }
Exemple #3
0
        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);
            }
        }
Exemple #4
0
 private void Init()
 {
     variables = null;
     previousResult = null;
     currentSampler = null;
     previousSampler = null;
     samplingStarted = false;
     threadNum = 0;
     nThread = null;
     isReinitSubControllers = false;
     samplerContext.Clear();
     restartNextLoop = false;
 }
Exemple #5
0
 public void SetVariables(NetMeterVariables vars)
 {
     this.variables = vars;
 }
Exemple #6
0
 /**
  * @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);
 }
Exemple #7
0
 /**
  * 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)
 {
 }
Exemple #8
0
 private void saveVars(NetMeterVariables vars)
 {
     for(int i = 0; i < variableNames.Length; i++)
     {
         values[i] = vars.get(variableNames[i]);
     }
 }
Exemple #9
0
 public void PutAll(NetMeterVariables vars)
 {
     PutAll(vars.variables);
 }
Exemple #10
0
 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;
 }
Exemple #11
0
 public void PutAll(NetMeterVariables vars)
 {
     PutAll(vars.variables);
 }
 public void SetVariables(NetMeterVariables vars)
 {
     this.variables = vars;
 }