@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(); }
@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); } }
JSONFormatter extends AbstractTestElement implements PostProcessor { @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); } } }
JSONFormatter extends AbstractTestElement implements PostProcessor { @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); } } JSONFormatter(); }
JSONFormatter extends AbstractTestElement implements PostProcessor { @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); } } JSONFormatter(); @Override void process(); }
JSONFormatter extends AbstractTestElement implements PostProcessor { @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); } } JSONFormatter(); @Override void process();  }