@Override public void process() { JMeterContext context = getThreadContext(); String responseData = context.getPreviousResult().getResponseDataAsString(); context.getPreviousResult().setResponseData((this.formatJSON(responseData)).getBytes()); } }
public void process() { JMeterContext threadContext = getThreadContext(); String responseString = threadContext.getPreviousResult().getResponseDataAsString(); try { threadContext.getPreviousResult().setResponseData(serialize2(responseString).getBytes("UTF-8")); } catch (Exception e) { log.info("Error while formating response xml - " + e.getMessage()); } }
public void process() { JMeterContext threadContext = getThreadContext(); String responseString = threadContext.getPreviousResult().getResponseDataAsString(); try { threadContext.getPreviousResult().setResponseData(serialize2(responseString).getBytes("UTF-8")); } catch (Exception e) { log.info("Error while formating response xml - " + e.getMessage()); } }
public void process() { JMeterContext threadContext = getThreadContext(); String responseString = threadContext.getPreviousResult().getResponseDataAsString(); try { threadContext.getPreviousResult().setResponseData(serialize2(responseString).getBytes("UTF-8")); } catch (Exception e) { log.info("Error while formating response xml - " + e.getMessage()); } }
public String execute() { if (isDynamic || permanentResults == null) { JMeterContext context = JMeterContextService.getContext(); SampleResult previousResult = context.getPreviousResult(); Sampler currentSampler = context.getCurrentSampler(); return execute(previousResult, currentSampler); } return permanentResults; // $NON-NLS-1$ }
public String execute() throws InvalidVariableException { JMeterContext context = JMeterContextService.getContext(); SampleResult previousResult = context.getPreviousResult(); Sampler currentSampler = context.getCurrentSampler(); return execute(previousResult, currentSampler); }
@Override public void process() { JMeterContext context = getThreadContext(); String responseData = context.getPreviousResult().getResponseDataAsString(); try { String str = this.formatJSON(responseData); context.getPreviousResult().setResponseData(str.getBytes()); } catch (JSONException e) { log.warn("Failed to format JSON: " + e.getMessage()); log.debug("Failed to format JSON", e); } } }
SampleResult prev = jmctx.getPreviousResult(); bindings.put("prev", prev); // $NON-NLS-1$ (this name is fixed)
@Override public void process() { JMeterContext jmctx = JMeterContextService.getContext(); SampleResult prev = jmctx.getPreviousResult(); if (prev == null) { return; // TODO - should we skip processing here? } final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter(); if (bshInterpreter == null) { log.error("BeanShell not found"); return; } try { // Add variables for access to context and variables bshInterpreter.set("data", prev.getResponseData());//$NON-NLS-1$ processFileOrScript(bshInterpreter); } catch (JMeterException e) { if (log.isWarnEnabled()) { log.warn("Problem in BeanShell script: {}", e.toString()); } } }
sr.setResponseOK(); sr.sampleEnd(); threadContext.getPreviousResult().addSubResult(sr);
res.setSuccessful(true); Sampler sampler = context.getPreviousSampler(); SampleResult sr = context.getPreviousResult(); String jmsSelector = getJMSSelector(); if (JMSSampler.PREV_SAMPLER.equals(jmsSelector)
bshInterpreter.set("ctx", jmctx);//$NON-NLS-1$ bshInterpreter.set("Label", getName()); //$NON-NLS-1$ bshInterpreter.set("prev", jmctx.getPreviousResult());//$NON-NLS-1$ bshInterpreter.set("props", JMeterUtils.getJMeterProperties()); bshInterpreter.set("vars", vars);//$NON-NLS-1$
protected void initManager(BSFManager mgr) throws BSFException{ final String label = getName(); final String fileName = getFilename(); final String scriptParameters = getParameters(); // Use actual class name for log final Logger logger = LoggerFactory.getLogger(getClass()); mgr.declareBean("log", logger, Logger.class); // $NON-NLS-1$ mgr.declareBean("Label",label, String.class); // $NON-NLS-1$ mgr.declareBean("FileName",fileName, String.class); // $NON-NLS-1$ mgr.declareBean("Parameters", scriptParameters, String.class); // $NON-NLS-1$ String [] args=JOrphanUtils.split(scriptParameters, " ");//$NON-NLS-1$ mgr.declareBean("args",args,args.getClass());//$NON-NLS-1$ // Add variables for access to context and variables JMeterContext jmctx = JMeterContextService.getContext(); JMeterVariables vars = jmctx.getVariables(); Properties props = JMeterUtils.getJMeterProperties(); mgr.declareBean("ctx", jmctx, jmctx.getClass()); // $NON-NLS-1$ mgr.declareBean("vars", vars, vars.getClass()); // $NON-NLS-1$ mgr.declareBean("props", props, props.getClass()); // $NON-NLS-1$ // For use in debugging: mgr.declareBean("OUT", System.out, PrintStream.class); // $NON-NLS-1$ // Most subclasses will need these: Sampler sampler = jmctx.getCurrentSampler(); mgr.declareBean("sampler", sampler, Sampler.class); SampleResult prev = jmctx.getPreviousResult(); mgr.declareBean("prev", prev, SampleResult.class); }
public void process() { JMeterContext context = getThreadContext(); SampleResult previousResult = context.getPreviousResult(); if (previousResult == null) { return;
JMeterContext context = getThreadContext(); JMeterVariables vars = context.getVariables(); SampleResult previousResult = context.getPreviousResult(); String responseData; if (getSubject().equals(SUBJECT_VARIABLE)) {
/** * 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
/** * 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()); }
JMeterContext context = getThreadContext(); JMeterVariables vars = context.getVariables(); SampleResult previousResult = context.getPreviousResult(); String responseData; if (getSubject().equals(SUBJECT_VARIABLE)) {
return; SampleResult responseText = ctx.getPreviousResult(); if (responseText == null) { return;