/** * Helper for testing outside of JMeter */ public static void main(String[] args) { LoadGenerator generator = new LoadGenerator(); // Mock out JMeter environment JMeterVariables variables = new JMeterVariables(); JMeterContextService.getContext().setVariables(variables); generator.setFileName("config1.json"); generator.setVariableName("kafka_message"); generator.iterationStart(null); for (Map.Entry<String, Object> entry : variables.entrySet()) { System.out.println(entry.getKey() + " : " + entry.getValue()); } } }
@Override public void run() { try { // Copy in ThreadStarter thread context from calling Thread JMeterContextService.getContext().setVariables(this.context.getVariables()); supplyActiveThreads(); } catch (InterruptedException e) { log.debug("Interrupted", e); } log.debug("Thread starter has done its job"); }
@Override public void run() { try { // Copy in ThreadStarter thread context from calling Thread JMeterContextService.getContext().setVariables(this.context.getVariables()); supplyActiveThreads(); } catch (InterruptedException e) { log.debug("Interrupted", e); } log.debug("Thread starter has done its job"); }
JMeterContextService.getContext().setVariables(variables);
try { JMeterContextService.getContext().setVariables(this.context.getVariables()); long endtime = 0; final boolean usingScheduler = getScheduler();
threadContext.setVariables(threadVars); threadContext.setThreadNum(getThreadNum()); threadContext.getVariables().put(LAST_SAMPLE_OK, TRUE);
CompoundVariable function = new CompoundVariable(functionCall); JMeterContext threadContext = JMeterContextService.getContext(); threadContext.setVariables(jMeterVariables); threadContext.setThreadNum(1); threadContext.getVariables().put(JMeterThread.LAST_SAMPLE_OK, "true");
JMeterTreeListener jMeterTreeListener = new JMeterTreeListener(); jMeterTreeListener.setModel(jMeterTreeModel); JMeterContextService.getContext().setVariables(new JMeterVariables()); StandardJMeterEngine engine = new EmulatorJmeterEngine(); JMeterThreadMonitor monitor = new EmulatorThreadMonitor();
JMeterTreeListener jMeterTreeListener = new JMeterTreeListener(); jMeterTreeListener.setModel(jMeterTreeModel); JMeterContextService.getContext().setVariables(new JMeterVariables()); StandardJMeterEngine engine = new EmulatorJmeterEngine(); JMeterThreadMonitor monitor = new EmulatorThreadMonitor();
JMeterContextService.getContext().setVariables(vars);
/** * Update the worker thread jmeter context with the main thread one * @param isInit if true the context a full copy is done, if false only update is done */ private void syncContext(boolean isInit) { // jmeter context synchronisation JMeterContext current = JMeterContextService.getContext(); JMeterContext ctx = this.getThreadContext(); if (isInit) { current.setCurrentSampler(ctx.getCurrentSampler()); current.setEngine(ctx.getEngine()); current.setRestartNextLoop(ctx.isRestartNextLoop()); current.setSamplingStarted(ctx.isSamplingStarted()); current.setThread(ctx.getThread()); current.setThreadGroup(ctx.getThreadGroup()); current.setThreadNum(ctx.getThreadNum()); } current.setVariables(ctx.getVariables()); current.setPreviousResult(ctx.getPreviousResult()); //current.getSamplerContext().putAll(ctx.getSamplerContext()); }
/** * Update the worker thread jmeter context with the main thread one * @param isInit if true the context a full copy is done, if false only update is done */ private void syncContext(boolean isInit) { // jmeter context synchronisation JMeterContext current = JMeterContextService.getContext(); JMeterContext ctx = this.getThreadContext(); if (isInit) { current.setCurrentSampler(ctx.getCurrentSampler()); current.setEngine(ctx.getEngine()); current.setRestartNextLoop(ctx.isRestartNextLoop()); current.setSamplingStarted(ctx.isSamplingStarted()); current.setThread(ctx.getThread()); current.setThreadGroup(ctx.getThreadGroup()); current.setThreadNum(ctx.getThreadNum()); } current.setVariables(ctx.getVariables()); current.setPreviousResult(ctx.getPreviousResult()); //current.getSamplerContext().putAll(ctx.getSamplerContext()); }
/** * Update the worker thread jmeter context with the main thread one * @param isInit if true the context a full copy is done, if false only update is done */ private void syncContext(boolean isInit) { // jmeter context synchronisation JMeterContext current = JMeterContextService.getContext(); JMeterContext ctx = this.getThreadContext(); if (isInit) { current.setCurrentSampler(ctx.getCurrentSampler()); current.setEngine(ctx.getEngine()); current.setRestartNextLoop(ctx.isRestartNextLoop()); current.setSamplingStarted(ctx.isSamplingStarted()); current.setThread(ctx.getThread()); current.setThreadGroup(ctx.getThreadGroup()); current.setThreadNum(ctx.getThreadNum()); } current.setVariables(ctx.getVariables()); current.setPreviousResult(ctx.getPreviousResult()); //current.getSamplerContext().putAll(ctx.getSamplerContext()); } @Override