Java Code Examples for org.apache.jmeter.samplers.SampleResult#addSubResult()
The following examples show how to use
org.apache.jmeter.samplers.SampleResult#addSubResult() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HitsPerSecondGuiTest.java From jmeter-plugins with Apache License 2.0 | 6 votes |
@Test public void testAdd_issue48() { System.out.println("add48"); SampleResult res = new SampleResult(); res.setAllThreads(0); res.setThreadName("test 1-2"); res.setResponseMessage(null); SampleResult subres = new SampleResult(); subres.sampleStart(); subres.sampleEnd(); res.sampleStart(); res.addSubResult(subres); try { Thread.sleep(10); } catch (InterruptedException ex) { } HitsPerSecondGui instance = new HitsPerSecondGui(); instance.add(res); }
Example 2
Source File: NoOp.java From jmeter-bzm-plugins with Apache License 2.0 | 5 votes |
@Override public SampleResult perform(JMeterXMPPSampler sampler, SampleResult res) throws Exception { long counter = 0; for (Packet packet : incomingPackets) { incomingPackets.remove(packet); SampleResult subRes = new SampleResult(); subRes.setSuccessful(true); subRes.setResponseCode("200"); subRes.setResponseMessage("OK"); subRes.setSampleLabel(packet.getClass().getSimpleName().isEmpty() ? packet.getClass().getName() : packet.getClass().getSimpleName()); subRes.setResponseData(packet.toXML().toString().getBytes()); if ((packet instanceof Presence) && (((Presence) packet).getType() == Presence.Type.error)) { subRes.setSuccessful(false); subRes.setResponseCode("500"); subRes.setResponseMessage(packet.getError().toString()); } else if ((packet instanceof Message) && (((Message) packet).getType() == Message.Type.error)) { subRes.setSuccessful(false); subRes.setResponseCode("500"); subRes.setResponseMessage(packet.getError().toString()); } else if ((packet instanceof IQ) && (((IQ) packet).getType() == IQ.Type.error)) { subRes.setSuccessful(false); subRes.setResponseCode("500"); subRes.setResponseMessage(packet.getError().toString()); } res.addSubResult(subRes); counter++; } res.setResponseData(("Received packets: " + counter).getBytes()); return counter > 0 ? res : null; }
Example 3
Source File: DummySubPostProcessor.java From jmeter-plugins with Apache License 2.0 | 5 votes |
@Override public void process() { JMeterContext context = getThreadContext(); SampleResult res = context.getPreviousResult(); SampleResult sample = dummy.sample(); res.addSubResult(sample); }