use of org.apache.jmeter.threads.JMeterContext in project jmeter-plugins by undera.
the class XMLFormatPostProcessor method process.
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());
}
}
use of org.apache.jmeter.threads.JMeterContext in project jmeter-plugins by undera.
the class XMLFormatPostProcessorTest method testProcess.
/**
* Test of process method, of class XMLFormatPostProcessor.
*/
@Test
public void testProcess() {
System.out.println("process");
JMeterContext threadContext = JMeterContextService.getContext();
SampleResult res = new SampleResult();
threadContext.setPreviousResult(res);
XMLFormatPostProcessor instance = new XMLFormatPostProcessor();
instance.process();
// TODO review the generated test code and remove the default call to fail.
}
use of org.apache.jmeter.threads.JMeterContext in project jmeter-plugins by undera.
the class AbstractSimpleThreadGroup method start.
@Override
public void start(int groupCount, ListenerNotifier notifier, ListedHashTree threadGroupTree, StandardJMeterEngine engine) {
running = true;
int numThreads = getNumThreads();
log.info("Starting thread group number " + groupCount + " threads " + numThreads);
// needs to be same time for all threads in the group
long now = System.currentTimeMillis();
final JMeterContext context = JMeterContextService.getContext();
for (int i = 0; running && i < numThreads; i++) {
JMeterThread jmThread = makeThread(groupCount, notifier, threadGroupTree, engine, i, context);
// set start and end time
scheduleThread(jmThread, now);
Thread newThread = new Thread(jmThread, jmThread.getThreadName());
registerStartedThread(jmThread, newThread);
newThread.start();
}
log.info("Started thread group number " + groupCount);
}
use of org.apache.jmeter.threads.JMeterContext in project jmeter by apache.
the class XmlAssertionTest method setUp.
@BeforeEach
public void setUp() {
JMeterContext jmctx = JMeterContextService.getContext();
assertion = new XMLAssertion();
assertion.setThreadContext(jmctx);
JMeterVariables vars = new JMeterVariables();
jmctx.setVariables(vars);
sampleResult = new SampleResult();
}
use of org.apache.jmeter.threads.JMeterContext in project jmeter by apache.
the class TestCVSDataSet method setUp.
@BeforeEach
public void setUp() {
JMeterContext jmcx = JMeterContextService.getContext();
jmcx.setVariables(new JMeterVariables());
threadVars = jmcx.getVariables();
threadVars.put("b", "value");
}
Aggregations