use of org.apache.jmeter.threads.JMeterContext in project jmeter-plugins by undera.
the class JSONFormatterTest method testProcess_float.
@Test
public void testProcess_float() {
System.out.println("process float");
JSONFormatter instance = new JSONFormatter();
JMeterContext threadContext = JMeterContextService.getContext();
SampleResult res = new SampleResult();
res.setResponseData("3.14", "UTF8");
threadContext.setPreviousResult(res);
instance.process();
}
use of org.apache.jmeter.threads.JMeterContext in project jmeter-plugins by undera.
the class JSONFormatterTest method testProcess_array.
@Test
public void testProcess_array() {
System.out.println("process array");
JSONFormatter instance = new JSONFormatter();
JMeterContext threadContext = JMeterContextService.getContext();
SampleResult res = new SampleResult();
res.setResponseData("[]", "UTF8");
threadContext.setPreviousResult(res);
instance.process();
}
use of org.apache.jmeter.threads.JMeterContext in project jmeter-plugins by undera.
the class CaseFormatTest method setUp.
@Before
public void setUp() {
changeCase = new CaseFormat();
result = new SampleResult();
JMeterContext jmctx = JMeterContextService.getContext();
String data = "dummy data";
result.setResponseData(data, null);
JMeterVariables vars = new JMeterVariables();
jmctx.setVariables(vars);
jmctx.setPreviousResult(result);
params = new LinkedList<>();
}
use of org.apache.jmeter.threads.JMeterContext in project jmeter-plugins by undera.
the class Base64DecodeTest method testExecute.
@Test
public void testExecute() throws Exception {
JMeterContext context = JMeterContextService.getContext();
context.setVariables(new JMeterVariables());
Collection<CompoundVariable> parameters = new ArrayList<>();
parameters.add(new CompoundVariable("dGVzdCBzdHJpbmc="));
parameters.add(new CompoundVariable("b64dec_res"));
Base64Decode instance = new Base64Decode();
instance.setParameters(parameters);
String res = instance.execute(null, null);
Assert.assertEquals("test string", res);
Assert.assertNotNull(context.getVariables().get("b64dec_res"));
}
use of org.apache.jmeter.threads.JMeterContext in project jmeter-plugins by undera.
the class JSONPathExtractorTest method testProcess_default.
@Test
public void testProcess_default() {
System.out.println("process def");
JMeterContext context = JMeterContextService.getContext();
SampleResult res = new SampleResult();
context.setPreviousResult(res);
JSONPathExtractor instance = new JSONPathExtractor();
instance.setDefaultValue("DEFAULT");
instance.setVar("test");
instance.process();
JMeterVariables vars = context.getVariables();
assertEquals("DEFAULT", vars.get("test"));
}
Aggregations