private void configureWithConfigElements(Sampler sam, List<ConfigTestElement> configs) { sam.clearTestElementChildren(); for (ConfigTestElement config : configs) { if (!(config instanceof NoConfigMerge)) { if(sam instanceof ConfigMergabilityIndicator) { if(((ConfigMergabilityIndicator)sam).applies(config)) { sam.addTestElement(config); } } else { // Backward compatibility sam.addTestElement(config); } } } } }
@Override /** * Get current thread group using sampler's context */ public String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { JMeterContext context; if (currentSampler != null) { context = currentSampler.getThreadContext(); } else { context = JMeterContextService.getContext(); } return context.getThreadGroup().getName(); }
sampler.setThreadContext(threadContext); sampler.setThreadName(threadName); TestBeanHelper.prepare(sampler); return sampler.sample(null); } finally { if (!sampleMonitors.isEmpty()) {
rd.append("SamplerProperties\n"); sb.append("SamplerProperties:\n"); formatPropertyIterator(sb, threadContext.getCurrentSampler().propertyIterator()); sb.append("\n");
/** * Recover each member of SamplePackage to the state before the call of setRunningVersion(true) * @see TestElement#recoverRunningVersion() */ public void recoverRunningVersion() { recoverRunningVersion(configs); recoverRunningVersion(sampleListeners); recoverRunningVersion(assertions); recoverRunningVersion(timers); recoverRunningVersion(postProcessors); recoverRunningVersion(preProcessors); recoverRunningVersion(controllers); sampler.recoverRunningVersion(); }
/** * Make the SamplePackage the running version, or make it no longer the * running version. This tells to each element of the SamplePackage that it's current state must * be retrievable by a call to recoverRunningVersion(). * @param running boolean * @see TestElement#setRunningVersion(boolean) */ public void setRunningVersion(boolean running) { setRunningVersion(configs, running); setRunningVersion(sampleListeners, running); setRunningVersion(assertions, running); setRunningVersion(timers, running); setRunningVersion(postProcessors, running); setRunningVersion(preProcessors, running); setRunningVersion(controllers, running); sampler.setRunningVersion(running); }
/** {@inheritDoc} */ @Override public String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String name = ""; if (currentSampler != null) { // will be null if function is used on TestPlan name = currentSampler.getName(); } if (values.length > 0){ JMeterVariables vars = getVariables(); if (vars != null) {// May be null if function is used on TestPlan String varName = ((CompoundVariable) values[0]).execute().trim(); if (varName.length() > 0) { vars.put(varName, name); } } } return name; }
throw new IllegalStateException( "Got null subSampler calling findRealSampler for:" + (sampler != null ? sampler.getName() : "null") + ", sampler:" + sampler);
} catch (Exception e) { if (current != null) { log.error("Error while processing sampler: '{}'.", current.getName(), e); } else { log.error("Error while processing sampler.", e);