src_fm_fc_ms_ff
stringlengths
43
86.8k
target
stringlengths
20
276k
ParameterizedControllerGui extends AbstractControllerGui { @Override public String getStaticLabel() { return JMeterPluginsUtils.prefixLabel("Parameterized Controller"); } ParameterizedControllerGui(); TestElement createTestElement(); void modifyTestElement(TestElement te); String getLabelResource(); @Override String getStaticLabel(); @Override void clearGui(); @Override void configure(TestElement te); static final String WIKIPAGE; }
@Test public void testGetStaticLabel() { System.out.println("getStaticLabel"); String result = instance.getStaticLabel(); assertTrue(result.length() > 0); }
ParameterizedControllerGui extends AbstractControllerGui { @Override public void clearGui() { super.clearGui(); argsPanel.clear(); } ParameterizedControllerGui(); TestElement createTestElement(); void modifyTestElement(TestElement te); String getLabelResource(); @Override String getStaticLabel(); @Override void clearGui(); @Override void configure(TestElement te); static final String WIKIPAGE; }
@Test public void testClearGui() { System.out.println("clearGui"); instance.clearGui(); }
FilterPanel extends JPanel { public void setExcludeSampleLabels(String str) { jTextFieldExclude.setText(str); } FilterPanel(); String getIncludeSampleLabels(); void setIncludeSampleLabels(String str); String getExcludeSampleLabels(); void setExcludeSampleLabels(String str); boolean isSelectedRegExpInc(); void setSelectedRegExpInc(boolean b); boolean isSelectedRegExpExc(); void setSelectedRegExpExc(boolean b); String getStartOffset(); void setStartOffset(long startOffset); String getEndOffset(); void setEndOffset(long endOffset); void clearGui(); }
@Test public void testSetExcludeSampleLabels() { System.out.println("setExcludeSampleLabels"); FilterPanel instance = new FilterPanel(); instance.setExcludeSampleLabels("exclude"); }
ParameterizedControllerGui extends AbstractControllerGui { @Override public void configure(TestElement te) { super.configure(te); ParameterizedController controller = (ParameterizedController) te; final JMeterProperty udv = controller.getUserDefinedVariablesAsProperty(); if (udv != null && !(udv instanceof NullProperty)) { argsPanel.configure((Arguments) udv.getObjectValue()); } } ParameterizedControllerGui(); TestElement createTestElement(); void modifyTestElement(TestElement te); String getLabelResource(); @Override String getStaticLabel(); @Override void clearGui(); @Override void configure(TestElement te); static final String WIKIPAGE; }
@Test public void testConfigure() { System.out.println("configure"); ParameterizedController te = new ParameterizedController(); te.setUserDefinedVariables(new Arguments()); te.setName("test"); te.setComment("test"); instance.configure(te); }
HexStringUDPDecoder implements UDPTrafficDecoder { public ByteBuffer encode(String data) { return ByteBuffer.wrap(BinaryTCPClientImpl.hexStringToByteArray(data)); } ByteBuffer encode(String data); byte[] decode(byte[] buf); }
@Test public void testEncode() { System.out.println("encode"); String data = "74657374"; HexStringUDPDecoder instance = new HexStringUDPDecoder(); ByteBuffer result = instance.encode(data); Assert.assertEquals("test", FileChannelEmul.byteBufferToString(result)); }
HexStringUDPDecoder implements UDPTrafficDecoder { public byte[] decode(byte[] buf) { return JOrphanUtils.baToHexString(buf).getBytes(); } ByteBuffer encode(String data); byte[] decode(byte[] buf); }
@Test public void testDecode() { System.out.println("decode"); byte[] buf = "test".getBytes(); HexStringUDPDecoder instance = new HexStringUDPDecoder(); byte[] result = instance.decode(buf); assertEquals("74657374", new String(result)); }
UDPSampler extends AbstractIPSampler implements UDPTrafficDecoder, ThreadListener { @Override public void threadStarted() { try { Class<?> c = Thread.currentThread().getContextClassLoader().loadClass(getEncoderClass()); Object o = c.newInstance(); if (!(o instanceof UDPTrafficDecoder)) { throw new ClassNotFoundException("Class does not implement " + UDPTrafficDecoder.class.getCanonicalName()); } encoder = (UDPTrafficDecoder) o; log.debug("Using decoder: " + encoder); } catch (Exception ex) { if (!getEncoderClass().isEmpty()) { log.warn("Problem loading encoder " + getEncoderClass() + ", raw data will be used", ex); } encoder = this; } } boolean isWaitResponse(); boolean isCloseChannel(); String getEncoderClass(); void setWaitResponse(boolean selected); void setCloseChannel(boolean selected); void setEncoderClass(String text); String getBindAddress(); void setBindAddress(String text); String getBindPort(); int getBindPortAsInt(); void setBindPort(String text); @Override ByteBuffer encode(String data); @Override byte[] decode(byte[] buf); @Override void threadStarted(); @Override void threadFinished(); @Override boolean interrupt(); static final String ENCODECLASS; static final String WAITRESPONSE; static final String CLOSECHANNEL; static final String BIND_ADDRESS; static final String BIND_PORT; }
@Test public void testSample() { System.out.println("sample"); instance.threadStarted(); SampleResult result = instance.sample(null); assertTrue(result.isSuccessful()); } @Test public void testThreadStarted() { System.out.println("threadStarted"); instance.threadStarted(); }
UDPSampler extends AbstractIPSampler implements UDPTrafficDecoder, ThreadListener { public boolean isWaitResponse() { return getPropertyAsBoolean(WAITRESPONSE); } boolean isWaitResponse(); boolean isCloseChannel(); String getEncoderClass(); void setWaitResponse(boolean selected); void setCloseChannel(boolean selected); void setEncoderClass(String text); String getBindAddress(); void setBindAddress(String text); String getBindPort(); int getBindPortAsInt(); void setBindPort(String text); @Override ByteBuffer encode(String data); @Override byte[] decode(byte[] buf); @Override void threadStarted(); @Override void threadFinished(); @Override boolean interrupt(); static final String ENCODECLASS; static final String WAITRESPONSE; static final String CLOSECHANNEL; static final String BIND_ADDRESS; static final String BIND_PORT; }
@Test public void testIsWaitResponse() { System.out.println("isWaitResponse"); boolean result = instance.isWaitResponse(); assertEquals(false, result); }
UDPSampler extends AbstractIPSampler implements UDPTrafficDecoder, ThreadListener { public String getEncoderClass() { return getPropertyAsString(ENCODECLASS); } boolean isWaitResponse(); boolean isCloseChannel(); String getEncoderClass(); void setWaitResponse(boolean selected); void setCloseChannel(boolean selected); void setEncoderClass(String text); String getBindAddress(); void setBindAddress(String text); String getBindPort(); int getBindPortAsInt(); void setBindPort(String text); @Override ByteBuffer encode(String data); @Override byte[] decode(byte[] buf); @Override void threadStarted(); @Override void threadFinished(); @Override boolean interrupt(); static final String ENCODECLASS; static final String WAITRESPONSE; static final String CLOSECHANNEL; static final String BIND_ADDRESS; static final String BIND_PORT; }
@Test public void testGetEncoderClass() { System.out.println("getEncoderClass"); String result = instance.getEncoderClass(); assertNotNull(result); }
UDPSampler extends AbstractIPSampler implements UDPTrafficDecoder, ThreadListener { public void setWaitResponse(boolean selected) { setProperty(WAITRESPONSE, selected); } boolean isWaitResponse(); boolean isCloseChannel(); String getEncoderClass(); void setWaitResponse(boolean selected); void setCloseChannel(boolean selected); void setEncoderClass(String text); String getBindAddress(); void setBindAddress(String text); String getBindPort(); int getBindPortAsInt(); void setBindPort(String text); @Override ByteBuffer encode(String data); @Override byte[] decode(byte[] buf); @Override void threadStarted(); @Override void threadFinished(); @Override boolean interrupt(); static final String ENCODECLASS; static final String WAITRESPONSE; static final String CLOSECHANNEL; static final String BIND_ADDRESS; static final String BIND_PORT; }
@Test public void testSetWaitResponse() { System.out.println("setWaitResponse"); instance.setWaitResponse(false); }
UDPSampler extends AbstractIPSampler implements UDPTrafficDecoder, ThreadListener { public void setEncoderClass(String text) { setProperty(ENCODECLASS, text); } boolean isWaitResponse(); boolean isCloseChannel(); String getEncoderClass(); void setWaitResponse(boolean selected); void setCloseChannel(boolean selected); void setEncoderClass(String text); String getBindAddress(); void setBindAddress(String text); String getBindPort(); int getBindPortAsInt(); void setBindPort(String text); @Override ByteBuffer encode(String data); @Override byte[] decode(byte[] buf); @Override void threadStarted(); @Override void threadFinished(); @Override boolean interrupt(); static final String ENCODECLASS; static final String WAITRESPONSE; static final String CLOSECHANNEL; static final String BIND_ADDRESS; static final String BIND_PORT; }
@Test public void testSetEncoderClass() { System.out.println("setEncoderClass"); String text = ""; instance.setEncoderClass(text); }
UDPSampler extends AbstractIPSampler implements UDPTrafficDecoder, ThreadListener { @Override protected AbstractSelectableChannel getChannel() throws IOException { DatagramChannel c; if (isWaitResponse()) { c = DatagramChannelWithTimeouts.open(); ((DatagramChannelWithTimeouts) c).setReadTimeout(getTimeoutAsInt()); } else { c = DatagramChannel.open(); } String bindAddress = getBindAddress(); if (bindAddress.isEmpty()) { bindAddress = "0.0.0.0"; } int adr = getBindPortAsInt(); c.bind(new InetSocketAddress(bindAddress, adr)); int port = Integer.parseInt(getPort()); c.connect(new InetSocketAddress(getHostName(), port)); return c; } boolean isWaitResponse(); boolean isCloseChannel(); String getEncoderClass(); void setWaitResponse(boolean selected); void setCloseChannel(boolean selected); void setEncoderClass(String text); String getBindAddress(); void setBindAddress(String text); String getBindPort(); int getBindPortAsInt(); void setBindPort(String text); @Override ByteBuffer encode(String data); @Override byte[] decode(byte[] buf); @Override void threadStarted(); @Override void threadFinished(); @Override boolean interrupt(); static final String ENCODECLASS; static final String WAITRESPONSE; static final String CLOSECHANNEL; static final String BIND_ADDRESS; static final String BIND_PORT; }
@Test public void testGetChannel() throws Exception { System.out.println("getChannel"); DatagramChannel result = (DatagramChannel) instance.getChannel(); assertNotNull(result); }
UDPSampler extends AbstractIPSampler implements UDPTrafficDecoder, ThreadListener { @Override public ByteBuffer encode(String data) { try { return ByteBuffer.wrap(data.getBytes("Windows-1252")); } catch (UnsupportedEncodingException ex) { throw new RuntimeException(ex); } } boolean isWaitResponse(); boolean isCloseChannel(); String getEncoderClass(); void setWaitResponse(boolean selected); void setCloseChannel(boolean selected); void setEncoderClass(String text); String getBindAddress(); void setBindAddress(String text); String getBindPort(); int getBindPortAsInt(); void setBindPort(String text); @Override ByteBuffer encode(String data); @Override byte[] decode(byte[] buf); @Override void threadStarted(); @Override void threadFinished(); @Override boolean interrupt(); static final String ENCODECLASS; static final String WAITRESPONSE; static final String CLOSECHANNEL; static final String BIND_ADDRESS; static final String BIND_PORT; }
@Test public void testEncode() { System.out.println("encode"); String data = "test"; ByteBuffer result = instance.encode(data); Assert.assertEquals(data, FileChannelEmul.byteBufferToString(result)); }
FilterPanel extends JPanel { public boolean isSelectedRegExpInc() { return jCheckBoxInclude.isSelected(); } FilterPanel(); String getIncludeSampleLabels(); void setIncludeSampleLabels(String str); String getExcludeSampleLabels(); void setExcludeSampleLabels(String str); boolean isSelectedRegExpInc(); void setSelectedRegExpInc(boolean b); boolean isSelectedRegExpExc(); void setSelectedRegExpExc(boolean b); String getStartOffset(); void setStartOffset(long startOffset); String getEndOffset(); void setEndOffset(long endOffset); void clearGui(); }
@Test public void testIsSelectedRegExpInc() { System.out.println("isSelectedRegExpInc"); FilterPanel instance = new FilterPanel(); boolean expResult = false; boolean result = instance.isSelectedRegExpInc(); assertEquals(expResult, result); }
UDPSampler extends AbstractIPSampler implements UDPTrafficDecoder, ThreadListener { @Override public byte[] decode(byte[] buf) { return buf; } boolean isWaitResponse(); boolean isCloseChannel(); String getEncoderClass(); void setWaitResponse(boolean selected); void setCloseChannel(boolean selected); void setEncoderClass(String text); String getBindAddress(); void setBindAddress(String text); String getBindPort(); int getBindPortAsInt(); void setBindPort(String text); @Override ByteBuffer encode(String data); @Override byte[] decode(byte[] buf); @Override void threadStarted(); @Override void threadFinished(); @Override boolean interrupt(); static final String ENCODECLASS; static final String WAITRESPONSE; static final String CLOSECHANNEL; static final String BIND_ADDRESS; static final String BIND_PORT; }
@Test public void testDecode() { System.out.println("decode"); byte[] result = instance.decode("test".getBytes()); assertEquals(4, result.length); }
UDPSampler extends AbstractIPSampler implements UDPTrafficDecoder, ThreadListener { @Override public void threadFinished() { try { if (channel != null) { channel.close(); } } catch (IOException ex) { log.error("Cannot close channel", ex); } } boolean isWaitResponse(); boolean isCloseChannel(); String getEncoderClass(); void setWaitResponse(boolean selected); void setCloseChannel(boolean selected); void setEncoderClass(String text); String getBindAddress(); void setBindAddress(String text); String getBindPort(); int getBindPortAsInt(); void setBindPort(String text); @Override ByteBuffer encode(String data); @Override byte[] decode(byte[] buf); @Override void threadStarted(); @Override void threadFinished(); @Override boolean interrupt(); static final String ENCODECLASS; static final String WAITRESPONSE; static final String CLOSECHANNEL; static final String BIND_ADDRESS; static final String BIND_PORT; }
@Test public void testThreadFinished() { System.out.println("threadFinished"); instance.threadFinished(); }
UDPSampler extends AbstractIPSampler implements UDPTrafficDecoder, ThreadListener { @Override public boolean interrupt() { if (channel != null && channel.isOpen()) { try { channel.close(); } catch (IOException ex) { log.warn("Exception while interrupting channel: ", ex); return false; } } return true; } boolean isWaitResponse(); boolean isCloseChannel(); String getEncoderClass(); void setWaitResponse(boolean selected); void setCloseChannel(boolean selected); void setEncoderClass(String text); String getBindAddress(); void setBindAddress(String text); String getBindPort(); int getBindPortAsInt(); void setBindPort(String text); @Override ByteBuffer encode(String data); @Override byte[] decode(byte[] buf); @Override void threadStarted(); @Override void threadFinished(); @Override boolean interrupt(); static final String ENCODECLASS; static final String WAITRESPONSE; static final String CLOSECHANNEL; static final String BIND_ADDRESS; static final String BIND_PORT; }
@Test public void testInterrupt() { System.out.println("interrupt"); boolean result = instance.interrupt(); assertEquals(true, result); }
UDPSampler extends AbstractIPSampler implements UDPTrafficDecoder, ThreadListener { public boolean isCloseChannel() { return getPropertyAsBoolean(CLOSECHANNEL); } boolean isWaitResponse(); boolean isCloseChannel(); String getEncoderClass(); void setWaitResponse(boolean selected); void setCloseChannel(boolean selected); void setEncoderClass(String text); String getBindAddress(); void setBindAddress(String text); String getBindPort(); int getBindPortAsInt(); void setBindPort(String text); @Override ByteBuffer encode(String data); @Override byte[] decode(byte[] buf); @Override void threadStarted(); @Override void threadFinished(); @Override boolean interrupt(); static final String ENCODECLASS; static final String WAITRESPONSE; static final String CLOSECHANNEL; static final String BIND_ADDRESS; static final String BIND_PORT; }
@Test public void testIsCloseChannel() { System.out.println("isCloseChannel"); UDPSampler instance = new UDPSampler(); boolean result = instance.isCloseChannel(); assertEquals(false, result); }
UDPSampler extends AbstractIPSampler implements UDPTrafficDecoder, ThreadListener { public void setCloseChannel(boolean selected) { setProperty(CLOSECHANNEL, selected); } boolean isWaitResponse(); boolean isCloseChannel(); String getEncoderClass(); void setWaitResponse(boolean selected); void setCloseChannel(boolean selected); void setEncoderClass(String text); String getBindAddress(); void setBindAddress(String text); String getBindPort(); int getBindPortAsInt(); void setBindPort(String text); @Override ByteBuffer encode(String data); @Override byte[] decode(byte[] buf); @Override void threadStarted(); @Override void threadFinished(); @Override boolean interrupt(); static final String ENCODECLASS; static final String WAITRESPONSE; static final String CLOSECHANNEL; static final String BIND_ADDRESS; static final String BIND_PORT; }
@Test public void testSetCloseChannel() { System.out.println("setCloseChannel"); UDPSampler instance = new UDPSampler(); instance.setCloseChannel(false); }
UDPSamplerGui extends AbstractSamplerGui { @Override public String getStaticLabel() { return JMeterPluginsUtils.prefixLabel("UDP Request"); } UDPSamplerGui(); @Override String getStaticLabel(); @Override String getLabelResource(); @Override void configure(TestElement element); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement el); @Override void clearGui(); }
@Test public void testGetStaticLabel() { System.out.println("getStaticLabel"); UDPSamplerGui instance = new UDPSamplerGui(); String result = instance.getStaticLabel(); assertTrue(result.length() > 0); }
UDPSamplerGui extends AbstractSamplerGui { @Override public String getLabelResource() { return getClass().getCanonicalName(); } UDPSamplerGui(); @Override String getStaticLabel(); @Override String getLabelResource(); @Override void configure(TestElement element); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement el); @Override void clearGui(); }
@Test public void testGetLabelResource() { System.out.println("getLabelResource"); UDPSamplerGui instance = new UDPSamplerGui(); String result = instance.getLabelResource(); assertTrue(result.length() > 0); }
UDPSamplerGui extends AbstractSamplerGui { @Override public void configure(TestElement element) { super.configure(element); if (element instanceof UDPSampler) { UDPSampler sampler = (UDPSampler) element; hostName.setText(sampler.getHostName()); port.setText(sampler.getPort()); timeout.setText(sampler.getTimeout()); waitResponse.setSelected(sampler.isWaitResponse()); closeChannel.setSelected(sampler.isCloseChannel()); messageEncodeClass.setText(sampler.getEncoderClass()); requestData.setText(sampler.getRequestData()); bindAddress.setText(sampler.getBindAddress()); bindPort.setText(sampler.getBindPort()); } } UDPSamplerGui(); @Override String getStaticLabel(); @Override String getLabelResource(); @Override void configure(TestElement element); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement el); @Override void clearGui(); }
@Test public void testConfigure() { System.out.println("configure"); TestElement element = new UDPSampler(); UDPSamplerGui instance = new UDPSamplerGui(); instance.configure(element); }
UDPSamplerGui extends AbstractSamplerGui { @Override public TestElement createTestElement() { UDPSampler sampler = new UDPSampler(); modifyTestElement(sampler); sampler.setComment(JMeterPluginsUtils.getWikiLinkText(WIKIPAGE)); return sampler; } UDPSamplerGui(); @Override String getStaticLabel(); @Override String getLabelResource(); @Override void configure(TestElement element); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement el); @Override void clearGui(); }
@Test public void testCreateTestElement() { System.out.println("createTestElement"); UDPSamplerGui instance = new UDPSamplerGui(); TestElement result = instance.createTestElement(); assertNotNull(result); }
FilterPanel extends JPanel { public void setSelectedRegExpInc(boolean b) { jCheckBoxInclude.setSelected(b); } FilterPanel(); String getIncludeSampleLabels(); void setIncludeSampleLabels(String str); String getExcludeSampleLabels(); void setExcludeSampleLabels(String str); boolean isSelectedRegExpInc(); void setSelectedRegExpInc(boolean b); boolean isSelectedRegExpExc(); void setSelectedRegExpExc(boolean b); String getStartOffset(); void setStartOffset(long startOffset); String getEndOffset(); void setEndOffset(long endOffset); void clearGui(); }
@Test public void testSetSelectedRegExpInc() { System.out.println("setSelectedRegExpInc"); FilterPanel instance = new FilterPanel(); instance.setSelectedRegExpInc(true); }
UDPSamplerGui extends AbstractSamplerGui { @Override public void modifyTestElement(TestElement el) { super.configureTestElement(el); if (el instanceof UDPSampler) { UDPSampler sampler = (UDPSampler) el; sampler.setHostName(hostName.getText()); sampler.setPort(port.getText()); sampler.setWaitResponse(waitResponse.isSelected()); sampler.setCloseChannel(closeChannel.isSelected()); sampler.setTimeout(timeout.getText()); sampler.setRequestData(transformCRLF(requestData.getText())); sampler.setEncoderClass(messageEncodeClass.getText()); sampler.setBindAddress(bindAddress.getText()); sampler.setBindPort(bindPort.getText()); } } UDPSamplerGui(); @Override String getStaticLabel(); @Override String getLabelResource(); @Override void configure(TestElement element); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement el); @Override void clearGui(); }
@Test public void testModifyTestElement() { System.out.println("modifyTestElement"); TestElement sampler = new UDPSampler(); UDPSamplerGui instance = new UDPSamplerGui(); instance.modifyTestElement(sampler); }
UDPSamplerGui extends AbstractSamplerGui { @Override public void clearGui() { super.clearGui(); initFields(); } UDPSamplerGui(); @Override String getStaticLabel(); @Override String getLabelResource(); @Override void configure(TestElement element); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement el); @Override void clearGui(); }
@Test public void testClearGui() { System.out.println("clearGui"); UDPSamplerGui instance = new UDPSamplerGui(); instance.clearGui(); }
NewAgentConnector implements PerfMonAgentConnector { public void connect() throws IOException { log.debug(metrics.toString()); ArrayList<String> labels = new ArrayList<>(metrics.keySet()); metricLabels = labels.toArray(new String[labels.size()]); ArrayList<String> arr = new ArrayList<>(metrics.values()); String[] m = arr.toArray(new String[arr.size()]); transport.startWithMetrics(m); } void setTransport(Transport atransport); void connect(); void disconnect(); void generateSamples(PerfMonSampleGenerator collector); void addMetric(String metric, String params, String label); }
@Test public void testConnect() throws Exception { System.out.println("connect"); instance.connect(); }
NewAgentConnector implements PerfMonAgentConnector { public void disconnect() { transport.disconnect(); } void setTransport(Transport atransport); void connect(); void disconnect(); void generateSamples(PerfMonSampleGenerator collector); void addMetric(String metric, String params, String label); }
@Test public void testDisconnect() { System.out.println("disconnect"); instance.disconnect(); }
NewAgentConnector implements PerfMonAgentConnector { public void generateSamples(PerfMonSampleGenerator collector) throws IOException { String[] data = transport.readMetrics(); for (int n = 0; n < data.length; n++) { if (!data[n].isEmpty()) { try { collector.generateSample(Double.parseDouble(data[n]), metricLabels[n]); } catch (NumberFormatException | ArrayIndexOutOfBoundsException e) { collector.generateErrorSample(metricLabels[n], e.toString()); } } } } void setTransport(Transport atransport); void connect(); void disconnect(); void generateSamples(PerfMonSampleGenerator collector); void addMetric(String metric, String params, String label); }
@Test public void testGenerateSamples() throws Exception { System.out.println("generateSamples"); PerfMonSampleGenerator collector = new Gen(); channel.setBytesToRead(ByteBuffer.wrap("0.123\n".getBytes())); instance.generateSamples(collector); } @Test public void testGenerateSamples_none() throws Exception { System.out.println("generateSamples"); PerfMonSampleGenerator collector = new Gen(); channel.setBytesToRead(ByteBuffer.wrap("".getBytes())); instance.generateSamples(collector); } @Test public void testGenerateSamples_many() throws Exception { System.out.println("generateSamples"); PerfMonSampleGenerator collector = new Gen(); channel.setBytesToRead(ByteBuffer.wrap("0.123 3424\n".getBytes())); instance.generateSamples(collector); }
NewAgentConnector implements PerfMonAgentConnector { public void setTransport(Transport atransport) { transport = atransport; } void setTransport(Transport atransport); void connect(); void disconnect(); void generateSamples(PerfMonSampleGenerator collector); void addMetric(String metric, String params, String label); }
@Test public void testSetTransport() { System.out.println("setTransport"); instance.setTransport(null); }
NewAgentConnector implements PerfMonAgentConnector { public void addMetric(String metric, String params, String label) { metrics.put(label, metric.toLowerCase() + PerfMonMetricGetter.DVOETOCHIE + params); } void setTransport(Transport atransport); void connect(); void disconnect(); void generateSamples(PerfMonSampleGenerator collector); void addMetric(String metric, String params, String label); }
@Test public void testAddMetric() { System.out.println("addMetric"); String metric = ""; String params = ""; instance.addMetric(metric, params, null); }
PerfMonCollector extends CorrectedResultCollector implements Runnable, PerfMonSampleGenerator { public void setData(CollectionProperty rows) { setProperty(rows); } PerfMonCollector(); void setData(CollectionProperty rows); JMeterProperty getMetricSettings(); void sampleOccurred(SampleEvent event); @Override synchronized void run(); @Override void testStarted(String host); @Override void testEnded(String host); @Override void generateSample(double value, String label); @Override void generateErrorSample(String label, String errorMsg); @Override void generate2Samples(long[] values, String label1, String label2); @Override void generate2Samples(long[] values, String label1, String label2, double dividingFactor); static LinkedList<String> getFiles(); static void clearFiles(); static final String DATA_PROPERTY; }
@Test public void testSetData() { System.out.println("setData"); CollectionProperty rows = new CollectionProperty(); PerfMonCollector instance = new PerfMonCollector(); instance.setData(rows); }
FilterPanel extends JPanel { public boolean isSelectedRegExpExc() { return jCheckBoxExclude.isSelected(); } FilterPanel(); String getIncludeSampleLabels(); void setIncludeSampleLabels(String str); String getExcludeSampleLabels(); void setExcludeSampleLabels(String str); boolean isSelectedRegExpInc(); void setSelectedRegExpInc(boolean b); boolean isSelectedRegExpExc(); void setSelectedRegExpExc(boolean b); String getStartOffset(); void setStartOffset(long startOffset); String getEndOffset(); void setEndOffset(long endOffset); void clearGui(); }
@Test public void testIsSelectedRegExpExc() { System.out.println("isSelectedRegExpExc"); FilterPanel instance = new FilterPanel(); boolean expResult = false; boolean result = instance.isSelectedRegExpExc(); assertEquals(expResult, result); }
PerfMonCollector extends CorrectedResultCollector implements Runnable, PerfMonSampleGenerator { public JMeterProperty getMetricSettings() { return getProperty(DATA_PROPERTY); } PerfMonCollector(); void setData(CollectionProperty rows); JMeterProperty getMetricSettings(); void sampleOccurred(SampleEvent event); @Override synchronized void run(); @Override void testStarted(String host); @Override void testEnded(String host); @Override void generateSample(double value, String label); @Override void generateErrorSample(String label, String errorMsg); @Override void generate2Samples(long[] values, String label1, String label2); @Override void generate2Samples(long[] values, String label1, String label2, double dividingFactor); static LinkedList<String> getFiles(); static void clearFiles(); static final String DATA_PROPERTY; }
@Test public void testGetMetricSettings() { System.out.println("getMetricSettings"); PerfMonCollector instance = new PerfMonCollector(); JMeterProperty expResult = null; JMeterProperty result = instance.getMetricSettings(); }
PerfMonCollector extends CorrectedResultCollector implements Runnable, PerfMonSampleGenerator { public void sampleOccurred(SampleEvent event) { } PerfMonCollector(); void setData(CollectionProperty rows); JMeterProperty getMetricSettings(); void sampleOccurred(SampleEvent event); @Override synchronized void run(); @Override void testStarted(String host); @Override void testEnded(String host); @Override void generateSample(double value, String label); @Override void generateErrorSample(String label, String errorMsg); @Override void generate2Samples(long[] values, String label1, String label2); @Override void generate2Samples(long[] values, String label1, String label2, double dividingFactor); static LinkedList<String> getFiles(); static void clearFiles(); static final String DATA_PROPERTY; }
@Test public void testSampleOccurred() { System.out.println("sampleOccurred"); SampleEvent event = new SampleEvent(new PerfMonSampleResult(), "test"); PerfMonCollector instance = new PerfMonCollector(); instance.sampleOccurred(event); }
PerfMonCollector extends CorrectedResultCollector implements Runnable, PerfMonSampleGenerator { @Override public synchronized void run() { while (true) { processConnectors(); try { this.wait(interval * 1000); } catch (InterruptedException ex) { log.debug("Monitoring thread was interrupted", ex); break; } } } PerfMonCollector(); void setData(CollectionProperty rows); JMeterProperty getMetricSettings(); void sampleOccurred(SampleEvent event); @Override synchronized void run(); @Override void testStarted(String host); @Override void testEnded(String host); @Override void generateSample(double value, String label); @Override void generateErrorSample(String label, String errorMsg); @Override void generate2Samples(long[] values, String label1, String label2); @Override void generate2Samples(long[] values, String label1, String label2, double dividingFactor); static LinkedList<String> getFiles(); static void clearFiles(); static final String DATA_PROPERTY; }
@Test public void testRun() { System.out.println("run"); PerfMonCollector instance = new PerfMonCollector(); }
PerfMonCollector extends CorrectedResultCollector implements Runnable, PerfMonSampleGenerator { @Override public void testStarted(String host) { if (!isWorkingHost(host)) { return; } if (getProperty(FILENAME) == null || getProperty(FILENAME).getStringValue().trim().length() == 0) { if (autoGenerateFiles) { setupSaving(getAutoFileName()); } else { try { File tmpFile = File.createTempFile("perfmon_", ".jtl"); tmpFile.delete(); setupSaving(tmpFile.getAbsolutePath()); } catch (IOException ex) { log.info("PerfMon metrics will not be recorded! Please run the test with -JforcePerfmonFile=true", ex); } } } log.debug("PerfMon metrics will be stored in " + getPropertyAsString(FILENAME)); if (!getSaveConfig().saveAsXml() && getSaveConfig().saveFieldNames()) { filesList.add(getPropertyAsString(FILENAME)); } else { log.warn("Perfmon file saving setting is not CSV with header line: " + getPropertyAsString(FILENAME)); } initiateConnectors(); workerThread = new Thread(this); workerThread.start(); super.testStarted(host); } PerfMonCollector(); void setData(CollectionProperty rows); JMeterProperty getMetricSettings(); void sampleOccurred(SampleEvent event); @Override synchronized void run(); @Override void testStarted(String host); @Override void testEnded(String host); @Override void generateSample(double value, String label); @Override void generateErrorSample(String label, String errorMsg); @Override void generate2Samples(long[] values, String label1, String label2); @Override void generate2Samples(long[] values, String label1, String label2, double dividingFactor); static LinkedList<String> getFiles(); static void clearFiles(); static final String DATA_PROPERTY; }
@Test public void testTestStarted() { System.out.println("testStarted"); String host = ""; PerfMonCollector instance = new PerfMonCollector(); instance.testStarted(host); }
PerfMonCollector extends CorrectedResultCollector implements Runnable, PerfMonSampleGenerator { @Override public void testEnded(String host) { if (workerThread == null) { return; } workerHost = null; workerThread.interrupt(); shutdownConnectors(); autoFileBaseName = null; counter = 0; super.testEnded(host); } PerfMonCollector(); void setData(CollectionProperty rows); JMeterProperty getMetricSettings(); void sampleOccurred(SampleEvent event); @Override synchronized void run(); @Override void testStarted(String host); @Override void testEnded(String host); @Override void generateSample(double value, String label); @Override void generateErrorSample(String label, String errorMsg); @Override void generate2Samples(long[] values, String label1, String label2); @Override void generate2Samples(long[] values, String label1, String label2, double dividingFactor); static LinkedList<String> getFiles(); static void clearFiles(); static final String DATA_PROPERTY; }
@Test public void testTestEnded() { System.out.println("testEnded"); String host = ""; PerfMonCollector instance = new PerfMonCollector(); instance.testEnded(host); }
PerfMonCollector extends CorrectedResultCollector implements Runnable, PerfMonSampleGenerator { protected PerfMonAgentConnector getConnector(String host, int port) throws IOException { log.debug("Trying new connector"); SocketAddress addr = new InetSocketAddress(host, port); Transport transport; try { transport = TransportFactory.TCPInstance(addr); if (!transport.test()) { throw new IOException("Agent is unreachable via TCP"); } } catch (IOException e) { log.info("Can't connect TCP transport for host: " + addr.toString(), e); boolean useUDP = JMeterUtils.getPropDefault("jmeterPlugin.perfmon.useUDP", false); if (!useUDP) { throw e; } else { try { log.debug("Connecting UDP"); transport = TransportFactory.UDPInstance(addr); if (!transport.test()) { throw new IOException("Agent is unreachable via UDP"); } } catch (IOException ex) { log.info("Can't connect UDP transport for host: " + addr.toString(), ex); throw ex; } } } NewAgentConnector conn = new NewAgentConnector(); conn.setTransport(transport); transport.setInterval(interval); return conn; } PerfMonCollector(); void setData(CollectionProperty rows); JMeterProperty getMetricSettings(); void sampleOccurred(SampleEvent event); @Override synchronized void run(); @Override void testStarted(String host); @Override void testEnded(String host); @Override void generateSample(double value, String label); @Override void generateErrorSample(String label, String errorMsg); @Override void generate2Samples(long[] values, String label1, String label2); @Override void generate2Samples(long[] values, String label1, String label2, double dividingFactor); static LinkedList<String> getFiles(); static void clearFiles(); static final String DATA_PROPERTY; }
@Test public void testGetConnector() throws Exception { System.out.println("getConnector"); String host = ""; int port = 0; PerfMonCollector instance = new PerfMonCollector(); PerfMonAgentConnector expResult = null; try { PerfMonAgentConnector result = instance.getConnector(host, port); fail(); } catch (IOException e) { } }
PerfMonCollector extends CorrectedResultCollector implements Runnable, PerfMonSampleGenerator { @Override public void generateSample(double value, String label) { PerfMonSampleResult res = new PerfMonSampleResult(); res.setSampleLabel(label); res.setValue(value); res.setSuccessful(true); SampleEvent e = new SampleEvent(res, PERFMON); super.sampleOccurred(e); } PerfMonCollector(); void setData(CollectionProperty rows); JMeterProperty getMetricSettings(); void sampleOccurred(SampleEvent event); @Override synchronized void run(); @Override void testStarted(String host); @Override void testEnded(String host); @Override void generateSample(double value, String label); @Override void generateErrorSample(String label, String errorMsg); @Override void generate2Samples(long[] values, String label1, String label2); @Override void generate2Samples(long[] values, String label1, String label2, double dividingFactor); static LinkedList<String> getFiles(); static void clearFiles(); static final String DATA_PROPERTY; }
@Test public void testGenerateSample() { System.out.println("generateSample"); double value = 0.0; String label = ""; PerfMonCollector instance = new PerfMonCollector(); instance.generateSample(value, label); }
PerfMonCollector extends CorrectedResultCollector implements Runnable, PerfMonSampleGenerator { @Override public void generateErrorSample(String label, String errorMsg) { PerfMonSampleResult res = new PerfMonSampleResult(); res.setSampleLabel(label); res.setValue(-1L); res.setResponseMessage(errorMsg); res.setSuccessful(false); SampleEvent e = new SampleEvent(res, PERFMON); super.sampleOccurred(e); log.error("Perfmon plugin error: " + errorMsg); } PerfMonCollector(); void setData(CollectionProperty rows); JMeterProperty getMetricSettings(); void sampleOccurred(SampleEvent event); @Override synchronized void run(); @Override void testStarted(String host); @Override void testEnded(String host); @Override void generateSample(double value, String label); @Override void generateErrorSample(String label, String errorMsg); @Override void generate2Samples(long[] values, String label1, String label2); @Override void generate2Samples(long[] values, String label1, String label2, double dividingFactor); static LinkedList<String> getFiles(); static void clearFiles(); static final String DATA_PROPERTY; }
@Test public void testGenerateErrorSample() { System.out.println("generateErrorSample"); String label = ""; String errorMsg = ""; PerfMonCollector instance = new PerfMonCollector(); instance.generateErrorSample(label, errorMsg); }
PerfMonCollector extends CorrectedResultCollector implements Runnable, PerfMonSampleGenerator { @Override public void generate2Samples(long[] values, String label1, String label2) { generate2Samples(values, label1, label2, 1d); } PerfMonCollector(); void setData(CollectionProperty rows); JMeterProperty getMetricSettings(); void sampleOccurred(SampleEvent event); @Override synchronized void run(); @Override void testStarted(String host); @Override void testEnded(String host); @Override void generateSample(double value, String label); @Override void generateErrorSample(String label, String errorMsg); @Override void generate2Samples(long[] values, String label1, String label2); @Override void generate2Samples(long[] values, String label1, String label2, double dividingFactor); static LinkedList<String> getFiles(); static void clearFiles(); static final String DATA_PROPERTY; }
@Test public void testGenerate2Samples_3args() { System.out.println("generate2Samples"); long[] values = {1L, 2L}; String label1 = ""; String label2 = ""; PerfMonCollector instance = new PerfMonCollector(); instance.generate2Samples(values, label1, label2); } @Test public void testGenerate2Samples_4args() { System.out.println("generate2Samples"); long[] values = {1L, 2L}; String label1 = ""; String label2 = ""; double dividingFactor = 0.0; PerfMonCollector instance = new PerfMonCollector(); instance.generate2Samples(values, label1, label2, dividingFactor); }
FilterPanel extends JPanel { public void setSelectedRegExpExc(boolean b) { jCheckBoxExclude.setSelected(b); } FilterPanel(); String getIncludeSampleLabels(); void setIncludeSampleLabels(String str); String getExcludeSampleLabels(); void setExcludeSampleLabels(String str); boolean isSelectedRegExpInc(); void setSelectedRegExpInc(boolean b); boolean isSelectedRegExpExc(); void setSelectedRegExpExc(boolean b); String getStartOffset(); void setStartOffset(long startOffset); String getEndOffset(); void setEndOffset(long endOffset); void clearGui(); }
@Test public void testSetSelectedRegExpExc() { System.out.println("setSelectedRegExpExc"); FilterPanel instance = new FilterPanel(); instance.setSelectedRegExpExc(true); }
PerfMonSampleResult extends SampleResult { public void setValue(double value) { setStartTime(ts); setEndTime(ts + (long) (value * 1000)); } PerfMonSampleResult(); void setValue(double value); @Deprecated double getValue(); static double getValue(SampleResult res); }
@Test public void testSetValue() { System.out.println("setValue"); long value = 0L; PerfMonSampleResult instance = new PerfMonSampleResult(); instance.setValue(value); }
PerfMonSampleResult extends SampleResult { @Deprecated public double getValue() { return ((double) getTime()) / 1000d; } PerfMonSampleResult(); void setValue(double value); @Deprecated double getValue(); static double getValue(SampleResult res); }
@Test public void testGetValue_SampleResult() { System.out.println("getValue"); SampleResult res = new SampleResult(1000000, 123 * 1000); double expResult = 123; double result = PerfMonSampleResult.getValue(res); assertEquals(expResult, result, 0.0); }
UnavailableAgentConnector implements PerfMonAgentConnector { public void setMetricType(String metric) { log.debug("Dropped setMetric call"); } UnavailableAgentConnector(IOException e); void setMetricType(String metric); void setParams(String params); void connect(); void disconnect(); String getLabel(boolean translateHost); void generateSamples(PerfMonSampleGenerator collector); void addMetric(String metric, String params, String label); }
@Test public void testSetMetricType() { System.out.println("setMetricType"); String metric = ""; UnavailableAgentConnector instance = new UnavailableAgentConnector(new IOException()); instance.setMetricType(metric); }
UnavailableAgentConnector implements PerfMonAgentConnector { public void setParams(String params) { log.debug("Dropped setParams call"); } UnavailableAgentConnector(IOException e); void setMetricType(String metric); void setParams(String params); void connect(); void disconnect(); String getLabel(boolean translateHost); void generateSamples(PerfMonSampleGenerator collector); void addMetric(String metric, String params, String label); }
@Test public void testSetParams() { System.out.println("setParams"); String params = ""; UnavailableAgentConnector instance = new UnavailableAgentConnector(new IOException()); instance.setParams(params); }
UnavailableAgentConnector implements PerfMonAgentConnector { public void connect() throws IOException { log.debug("Dropped connect call"); } UnavailableAgentConnector(IOException e); void setMetricType(String metric); void setParams(String params); void connect(); void disconnect(); String getLabel(boolean translateHost); void generateSamples(PerfMonSampleGenerator collector); void addMetric(String metric, String params, String label); }
@Test public void testConnect() throws Exception { System.out.println("connect"); UnavailableAgentConnector instance = new UnavailableAgentConnector(new IOException()); instance.connect(); }
UnavailableAgentConnector implements PerfMonAgentConnector { public void disconnect() { log.debug("Dropped disconnect call"); } UnavailableAgentConnector(IOException e); void setMetricType(String metric); void setParams(String params); void connect(); void disconnect(); String getLabel(boolean translateHost); void generateSamples(PerfMonSampleGenerator collector); void addMetric(String metric, String params, String label); }
@Test public void testDisconnect() { System.out.println("disconnect"); UnavailableAgentConnector instance = new UnavailableAgentConnector(new IOException()); instance.disconnect(); }
UnavailableAgentConnector implements PerfMonAgentConnector { public String getLabel(boolean translateHost) { return cause.toString(); } UnavailableAgentConnector(IOException e); void setMetricType(String metric); void setParams(String params); void connect(); void disconnect(); String getLabel(boolean translateHost); void generateSamples(PerfMonSampleGenerator collector); void addMetric(String metric, String params, String label); }
@Test public void testGetLabel() { System.out.println("getLabel"); boolean translateHost = false; UnavailableAgentConnector instance = new UnavailableAgentConnector(new IOException()); String result = instance.getLabel(translateHost); assertNotNull(result); }
UnavailableAgentConnector implements PerfMonAgentConnector { public void generateSamples(PerfMonSampleGenerator collector) throws IOException { collector.generateErrorSample(getLabel(false), cause.toString()); } UnavailableAgentConnector(IOException e); void setMetricType(String metric); void setParams(String params); void connect(); void disconnect(); String getLabel(boolean translateHost); void generateSamples(PerfMonSampleGenerator collector); void addMetric(String metric, String params, String label); }
@Test public void testGenerateSamples() throws Exception { System.out.println("generateSamples"); PerfMonSampleGenerator collector = new Gen(); UnavailableAgentConnector instance = new UnavailableAgentConnector(new IOException()); instance.generateSamples(collector); }
UnavailableAgentConnector implements PerfMonAgentConnector { public void addMetric(String metric, String params, String label) { log.debug("Dropped addMetric call"); } UnavailableAgentConnector(IOException e); void setMetricType(String metric); void setParams(String params); void connect(); void disconnect(); String getLabel(boolean translateHost); void generateSamples(PerfMonSampleGenerator collector); void addMetric(String metric, String params, String label); }
@Test public void testAddMetric() { System.out.println("addMetric"); String metric = ""; String params = ""; String label = ""; UnavailableAgentConnector instance = new UnavailableAgentConnector(new IOException()); instance.addMetric(metric, params, label); }
PerfMonGui extends AbstractOverTimeVisualizer { @Override protected JSettingsPanel createSettingsPanel() { return new JSettingsPanel(this, JSettingsPanel.GRADIENT_OPTION | JSettingsPanel.LIMIT_POINT_OPTION | JSettingsPanel.MAXY_OPTION | JSettingsPanel.RELATIVE_TIME_OPTION | JSettingsPanel.AUTO_EXPAND_OPTION | JSettingsPanel.MARKERS_OPTION_DISABLED); } PerfMonGui(); @Override String getWikiPage(); @Override String getLabelResource(); @Override String getStaticLabel(); void clearErrorMessage(); @Override void clearData(); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void configure(TestElement te); @Override void add(SampleResult res); static final List<String> metrics; static final String[] columnIdentifiers; static final Class[] columnClasses; }
@Test public void testCreateSettingsPanel() { System.out.println("createSettingsPanel"); PerfMonGui instance = new PerfMonGui(); JSettingsPanel result = instance.createSettingsPanel(); assertNotNull(result); }
FilterPanel extends JPanel { public String getStartOffset() { return jTextFieldStartOffset.getText(); } FilterPanel(); String getIncludeSampleLabels(); void setIncludeSampleLabels(String str); String getExcludeSampleLabels(); void setExcludeSampleLabels(String str); boolean isSelectedRegExpInc(); void setSelectedRegExpInc(boolean b); boolean isSelectedRegExpExc(); void setSelectedRegExpExc(boolean b); String getStartOffset(); void setStartOffset(long startOffset); String getEndOffset(); void setEndOffset(long endOffset); void clearGui(); }
@Test public void testGetStartOffset() { System.out.println("getStartOffset"); FilterPanel instance = new FilterPanel(); String expResult = ""; String result = instance.getStartOffset(); assertEquals(expResult, result); }
PerfMonGui extends AbstractOverTimeVisualizer { @Override public String getWikiPage() { return "PerfMon"; } PerfMonGui(); @Override String getWikiPage(); @Override String getLabelResource(); @Override String getStaticLabel(); void clearErrorMessage(); @Override void clearData(); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void configure(TestElement te); @Override void add(SampleResult res); static final List<String> metrics; static final String[] columnIdentifiers; static final Class[] columnClasses; }
@Test public void testGetWikiPage() { System.out.println("getWikiPage"); PerfMonGui instance = new PerfMonGui(); String result = instance.getWikiPage(); assertTrue(result.length() > 0); }
PerfMonGui extends AbstractOverTimeVisualizer { @Override public String getLabelResource() { return getClass().getSimpleName(); } PerfMonGui(); @Override String getWikiPage(); @Override String getLabelResource(); @Override String getStaticLabel(); void clearErrorMessage(); @Override void clearData(); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void configure(TestElement te); @Override void add(SampleResult res); static final List<String> metrics; static final String[] columnIdentifiers; static final Class[] columnClasses; }
@Test public void testGetLabelResource() { System.out.println("getLabelResource"); PerfMonGui instance = new PerfMonGui(); String result = instance.getLabelResource(); assertTrue(result.length() > 0); }
PerfMonGui extends AbstractOverTimeVisualizer { @Override public String getStaticLabel() { return JMeterPluginsUtils.prefixLabel("PerfMon Metrics Collector"); } PerfMonGui(); @Override String getWikiPage(); @Override String getLabelResource(); @Override String getStaticLabel(); void clearErrorMessage(); @Override void clearData(); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void configure(TestElement te); @Override void add(SampleResult res); static final List<String> metrics; static final String[] columnIdentifiers; static final Class[] columnClasses; }
@Test public void testGetStaticLabel() { System.out.println("getStaticLabel"); PerfMonGui instance = new PerfMonGui(); String result = instance.getStaticLabel(); assertTrue(result.length() > 0); }
PerfMonGui extends AbstractOverTimeVisualizer { @Override public TestElement createTestElement() { TestElement te = new PerfMonCollector(); modifyTestElement(te); te.setComment(JMeterPluginsUtils.getWikiLinkText(getWikiPage())); return te; } PerfMonGui(); @Override String getWikiPage(); @Override String getLabelResource(); @Override String getStaticLabel(); void clearErrorMessage(); @Override void clearData(); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void configure(TestElement te); @Override void add(SampleResult res); static final List<String> metrics; static final String[] columnIdentifiers; static final Class[] columnClasses; }
@Test public void testCreateTestElement() { System.out.println("createTestElement"); PerfMonGui instance = new PerfMonGui(); TestElement result = instance.createTestElement(); assertTrue(result instanceof PerfMonCollector); } @Test public void testWork() throws InterruptedException { System.out.println("work"); PerfMonGui instance = new PerfMonGui(); PerfMonCollector collector = (PerfMonCollector) instance.createTestElement(); collector.testStarted(); Thread.sleep(2000); collector.testEnded(); }
PerfMonGui extends AbstractOverTimeVisualizer { @Override public void modifyTestElement(TestElement te) { super.modifyTestElement(te); if (grid.isEditing()) { grid.getCellEditor().stopCellEditing(); } if (te instanceof PerfMonCollector) { PerfMonCollector pmte = (PerfMonCollector) te; CollectionProperty rows = JMeterPluginsUtils.tableModelRowsToCollectionProperty(tableModel, PerfMonCollector.DATA_PROPERTY); pmte.setData(rows); } super.configureTestElement(te); } PerfMonGui(); @Override String getWikiPage(); @Override String getLabelResource(); @Override String getStaticLabel(); void clearErrorMessage(); @Override void clearData(); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void configure(TestElement te); @Override void add(SampleResult res); static final List<String> metrics; static final String[] columnIdentifiers; static final Class[] columnClasses; }
@Test public void testModifyTestElement() { System.out.println("modifyTestElement"); TestElement c = new PerfMonCollector(); PerfMonGui instance = new PerfMonGui(); instance.modifyTestElement(c); }
PerfMonGui extends AbstractOverTimeVisualizer { @Override public void configure(TestElement te) { super.configure(te); PerfMonCollector pmte = (PerfMonCollector) te; JMeterProperty perfmonValues = pmte.getMetricSettings(); if (!(perfmonValues instanceof NullProperty)) { JMeterPluginsUtils.collectionPropertyToTableModelRows((CollectionProperty) perfmonValues, tableModel); } else { log.warn("Received null property instead of collection"); } } PerfMonGui(); @Override String getWikiPage(); @Override String getLabelResource(); @Override String getStaticLabel(); void clearErrorMessage(); @Override void clearData(); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void configure(TestElement te); @Override void add(SampleResult res); static final List<String> metrics; static final String[] columnIdentifiers; static final Class[] columnClasses; }
@Test public void testConfigure() { System.out.println("configure"); TestElement el = new PerfMonCollector(); PerfMonGui instance = new PerfMonGui(); instance.configure(el); }
PerfMonGui extends AbstractOverTimeVisualizer { @Override public void add(SampleResult res) { if (res.isSuccessful()) { if (isSampleIncluded(res)) { super.add(res); addPerfMonRecord(res.getSampleLabel(), normalizeTime(res.getStartTime()), PerfMonSampleResult.getValue(res)); updateGui(null); } } else { addErrorMessage(res.getResponseMessage(), res.getStartTime()); } } PerfMonGui(); @Override String getWikiPage(); @Override String getLabelResource(); @Override String getStaticLabel(); void clearErrorMessage(); @Override void clearData(); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void configure(TestElement te); @Override void add(SampleResult res); static final List<String> metrics; static final String[] columnIdentifiers; static final Class[] columnClasses; }
@Test public void testAdd() { System.out.println("add"); SampleResult res = new PerfMonSampleResult(); res.setSuccessful(true); PerfMonGuiEmul instance = new PerfMonGuiEmul(); instance.add(res); assertEquals(1, instance.getModel_multi().size()); assertEquals(1, instance.getModel_multi().firstEntry().getValue().size()); assertEquals(0, instance.getModel_aggr().size()); }
PerfMonGui extends AbstractOverTimeVisualizer { @Override protected JPanel getGraphPanelContainer() { JPanel panel = new JPanel(new BorderLayout()); JPanel innerTopPanel = new JPanel(new BorderLayout()); errorPane = new JScrollPane(); errorPane.setMinimumSize(new Dimension(100, 50)); errorPane.setPreferredSize(new Dimension(100, 50)); errorTextArea = new JTextArea(); errorTextArea.setForeground(Color.red); errorTextArea.setBackground(new Color(255, 255, 153)); errorTextArea.setEditable(false); errorPane.setViewportView(errorTextArea); registerPopup(); innerTopPanel.add(createConnectionsPanel(), BorderLayout.NORTH); innerTopPanel.add(errorPane, BorderLayout.SOUTH); innerTopPanel.add(getFilePanel(), BorderLayout.CENTER); panel.add(innerTopPanel, BorderLayout.NORTH); errorPane.setVisible(false); return panel; } PerfMonGui(); @Override String getWikiPage(); @Override String getLabelResource(); @Override String getStaticLabel(); void clearErrorMessage(); @Override void clearData(); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void configure(TestElement te); @Override void add(SampleResult res); static final List<String> metrics; static final String[] columnIdentifiers; static final Class[] columnClasses; }
@Test public void testGetGraphPanelContainer() { System.out.println("getGraphPanelContainer"); PerfMonGui instance = new PerfMonGui(); JPanel result = instance.getGraphPanelContainer(); assertNotNull(result); }
PerfMonGui extends AbstractOverTimeVisualizer { public void clearErrorMessage() { errorTextArea.setText(""); errorPane.setVisible(false); } PerfMonGui(); @Override String getWikiPage(); @Override String getLabelResource(); @Override String getStaticLabel(); void clearErrorMessage(); @Override void clearData(); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void configure(TestElement te); @Override void add(SampleResult res); static final List<String> metrics; static final String[] columnIdentifiers; static final Class[] columnClasses; }
@Test public void testClearErrorMessage() { System.out.println("clearErrorMessage"); PerfMonGui instance = new PerfMonGui(); instance.clearErrorMessage(); }
FilterPanel extends JPanel { public void setStartOffset(long startOffset) { jTextFieldStartOffset.setText(String.valueOf(startOffset)); } FilterPanel(); String getIncludeSampleLabels(); void setIncludeSampleLabels(String str); String getExcludeSampleLabels(); void setExcludeSampleLabels(String str); boolean isSelectedRegExpInc(); void setSelectedRegExpInc(boolean b); boolean isSelectedRegExpExc(); void setSelectedRegExpExc(boolean b); String getStartOffset(); void setStartOffset(long startOffset); String getEndOffset(); void setEndOffset(long endOffset); void clearGui(); }
@Test public void testSetStartOffset() { System.out.println("setStartOffset"); FilterPanel instance = new FilterPanel(); instance.setStartOffset(180); }
PerfMonGui extends AbstractOverTimeVisualizer { @Override public void clearData() { clearErrorMessage(); super.clearData(); } PerfMonGui(); @Override String getWikiPage(); @Override String getLabelResource(); @Override String getStaticLabel(); void clearErrorMessage(); @Override void clearData(); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void configure(TestElement te); @Override void add(SampleResult res); static final List<String> metrics; static final String[] columnIdentifiers; static final Class[] columnClasses; }
@Test public void testClearData() { System.out.println("clearData"); PerfMonGui instance = new PerfMonGui(); instance.clearData(); }
LockFile extends ConfigTestElement implements TestStateListener { public void testStarted() { testStarted(null); } void testStarted(); void testStarted(String string); void testEnded(); void testEnded(String string); String getFilename(); void setFilename(String filename); String getFilemask(); void setFilemask(String filemask); static boolean checkFileExistByPattern(String path, String pattern); static Logger log; static final String FILENAME; static final String FILEMASK; }
@Test public void testTestStartedHappy() { System.out.println("testStarted Happy"); testInstance.testStarted(); File f =tmpFile; assert (f.exists()); f.delete(); } @Test public void testTestStartedUnhappy() { System.out.println("testStarted Unhappy"); testInstance.testStarted(); File f = tmpFile; try { f.createNewFile(); } catch (IOException ex) { fail("Could not create lock file by hands"); } boolean thrown = false; try { testInstance.testStarted(); } catch (JMeterStopTestNowException e) { thrown = true; } assert thrown; f.delete(); } @Test public void testTestStartedUnhappyMask() { System.out.println("testStarted Unhappy by mask"); testInstance.testStarted(); File f = new File("testmask123.lock"); try { f.createNewFile(); } catch (IOException ex) { fail("Could not create lock file by hands"); } boolean thrown = false; try { testInstance.testStarted(); } catch (JMeterStopTestNowException e) { thrown = true; } assert thrown; f.delete(); } @Test public void testTestStarted_0args() { System.out.println("testStarted"); LockFile instance = new LockFile(); instance.testStarted(); } @Test public void testTestStarted_String() { System.out.println("testStarted"); String string = ""; LockFile instance = new LockFile(); instance.testStarted(string); }
LockFile extends ConfigTestElement implements TestStateListener { public void testEnded() { testEnded(null); } void testStarted(); void testStarted(String string); void testEnded(); void testEnded(String string); String getFilename(); void setFilename(String filename); String getFilemask(); void setFilemask(String filemask); static boolean checkFileExistByPattern(String path, String pattern); static Logger log; static final String FILENAME; static final String FILEMASK; }
@Test public void testTestEndedHappy() { System.out.println("testEnded Happy"); File f = tmpFile; try { f.createNewFile(); } catch (IOException ex) { fail("Could not create lock file by hands"); } testInstance.testEnded(); assert !f.exists(); } @Test public void testTestEndedUnhappy() { System.out.println("testEnded Unhappy"); File f = tmpFile; testInstance.testEnded(); assert !f.exists(); } @Test public void testTestEnded_0args() { System.out.println("testEnded"); LockFile instance = new LockFile(); instance.testEnded(); } @Test public void testTestEnded_String() { System.out.println("testEnded"); String string = ""; LockFile instance = new LockFile(); instance.testEnded(string); }
FilterPanel extends JPanel { public String getEndOffset() { return jTextFieldEndOffset.getText(); } FilterPanel(); String getIncludeSampleLabels(); void setIncludeSampleLabels(String str); String getExcludeSampleLabels(); void setExcludeSampleLabels(String str); boolean isSelectedRegExpInc(); void setSelectedRegExpInc(boolean b); boolean isSelectedRegExpExc(); void setSelectedRegExpExc(boolean b); String getStartOffset(); void setStartOffset(long startOffset); String getEndOffset(); void setEndOffset(long endOffset); void clearGui(); }
@Test public void testGetEndOffset() { System.out.println("getEndOffset"); FilterPanel instance = new FilterPanel(); String expResult = ""; String result = instance.getEndOffset(); assertEquals(expResult, result); }
LockFile extends ConfigTestElement implements TestStateListener { public String getFilename() { log.debug("Return filename: " + getPropertyAsString(FILENAME)); return getPropertyAsString(FILENAME); } void testStarted(); void testStarted(String string); void testEnded(); void testEnded(String string); String getFilename(); void setFilename(String filename); String getFilemask(); void setFilemask(String filemask); static boolean checkFileExistByPattern(String path, String pattern); static Logger log; static final String FILENAME; static final String FILEMASK; }
@Test public void testGetFilename() { System.out.println("getFilename"); LockFile instance = new LockFile(); String expResult = ""; String result = instance.getFilename(); assertEquals(expResult, result); }
LockFile extends ConfigTestElement implements TestStateListener { public void setFilename(String filename) { log.debug("Set filename to: " + filename); setProperty(FILENAME, filename); } void testStarted(); void testStarted(String string); void testEnded(); void testEnded(String string); String getFilename(); void setFilename(String filename); String getFilemask(); void setFilemask(String filemask); static boolean checkFileExistByPattern(String path, String pattern); static Logger log; static final String FILENAME; static final String FILEMASK; }
@Test public void testSetFilename() { System.out.println("setFilename"); String filename = ""; LockFile instance = new LockFile(); instance.setFilename(filename); }
LockFile extends ConfigTestElement implements TestStateListener { public String getFilemask() { log.debug("Return filemask: " + getPropertyAsString(FILEMASK)); return getPropertyAsString(FILEMASK); } void testStarted(); void testStarted(String string); void testEnded(); void testEnded(String string); String getFilename(); void setFilename(String filename); String getFilemask(); void setFilemask(String filemask); static boolean checkFileExistByPattern(String path, String pattern); static Logger log; static final String FILENAME; static final String FILEMASK; }
@Test public void testGetFilemask() { System.out.println("getFilemask"); LockFile instance = new LockFile(); String expResult = ""; String result = instance.getFilemask(); assertEquals(expResult, result); }
LockFile extends ConfigTestElement implements TestStateListener { public void setFilemask(String filemask) { log.debug("Set filemask to: " + filemask); setProperty(FILEMASK, filemask); } void testStarted(); void testStarted(String string); void testEnded(); void testEnded(String string); String getFilename(); void setFilename(String filename); String getFilemask(); void setFilemask(String filemask); static boolean checkFileExistByPattern(String path, String pattern); static Logger log; static final String FILENAME; static final String FILEMASK; }
@Test public void testSetFilemask() { System.out.println("setFilemask"); String filemask = ""; LockFile instance = new LockFile(); instance.setFilemask(filemask); }
LockFileGui extends AbstractConfigGui { @Override public String getStaticLabel() { return JMeterPluginsUtils.prefixLabel("Lock File Config"); } LockFileGui(); @Override String getStaticLabel(); @Override String getLabelResource(); @Override void configure(TestElement te); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void clearGui(); static final String WIKIPAGE; static Logger log; }
@Test public void testGetStaticLabel() { System.out.println("getStaticLabel"); LockFileGui instance = new LockFileGui(); String result = instance.getStaticLabel(); assert result.length() > 0; }
LockFileGui extends AbstractConfigGui { @Override public String getLabelResource() { return getClass().getCanonicalName(); } LockFileGui(); @Override String getStaticLabel(); @Override String getLabelResource(); @Override void configure(TestElement te); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void clearGui(); static final String WIKIPAGE; static Logger log; }
@Test public void testGetLabelResource() { System.out.println("getLabelResource"); LockFileGui instance = new LockFileGui(); String result = instance.getLabelResource(); assert result.length() > 0; }
LockFileGui extends AbstractConfigGui { @Override public void configure(TestElement te) { log.debug("[Lockfile plugin] configure"); super.configure(te); LockFile lf = (LockFile) te; tfFileName.setText(lf.getFilename()); tfFileMask.setText(lf.getFilemask()); } LockFileGui(); @Override String getStaticLabel(); @Override String getLabelResource(); @Override void configure(TestElement te); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void clearGui(); static final String WIKIPAGE; static Logger log; }
@Test public void testConfigure() { System.out.println("configure"); LockFile lf = new LockFile(); lf.setFilename("testfilename"); lf.setFilemask("testfilemask"); LockFileGui instance = new LockFileGui(); instance.configure(lf); }
LockFileGui extends AbstractConfigGui { @Override public TestElement createTestElement() { log.debug("[Lockfile plugin] createTestElement"); LockFile lockFile = new LockFile(); modifyTestElement(lockFile); lockFile.setComment(JMeterPluginsUtils.getWikiLinkText(WIKIPAGE)); return lockFile; } LockFileGui(); @Override String getStaticLabel(); @Override String getLabelResource(); @Override void configure(TestElement te); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void clearGui(); static final String WIKIPAGE; static Logger log; }
@Test public void testCreateTestElement() { System.out.println("createTestElement"); LockFileGui instance = new LockFileGui(); TestElement result = instance.createTestElement(); assert result instanceof LockFile; }
LockFileGui extends AbstractConfigGui { @Override public void modifyTestElement(TestElement te) { log.debug("[Lockfile plugin] modifyTestElement"); configureTestElement(te); LockFile lf = (LockFile) te; lf.setFilename(tfFileName.getText()); lf.setFilemask(tfFileMask.getText()); } LockFileGui(); @Override String getStaticLabel(); @Override String getLabelResource(); @Override void configure(TestElement te); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void clearGui(); static final String WIKIPAGE; static Logger log; }
@Test public void testModifyTestElement() { System.out.println("modifyTestElement"); LockFile lf = new LockFile(); lf.setFilename("testfilename"); lf.setFilemask("testfilemask"); LockFileGui instance = new LockFileGui(); instance.modifyTestElement(lf); }
LockFileGui extends AbstractConfigGui { @Override public void clearGui() { super.clearGui(); initFields(); } LockFileGui(); @Override String getStaticLabel(); @Override String getLabelResource(); @Override void configure(TestElement te); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void clearGui(); static final String WIKIPAGE; static Logger log; }
@Test public void testClearGui() { System.out.println("clearGui"); LockFileGui instance = new LockFileGui(); instance.clearGui(); }
FilterPanel extends JPanel { public void setEndOffset(long endOffset) { jTextFieldEndOffset.setText(String.valueOf(endOffset)); } FilterPanel(); String getIncludeSampleLabels(); void setIncludeSampleLabels(String str); String getExcludeSampleLabels(); void setExcludeSampleLabels(String str); boolean isSelectedRegExpInc(); void setSelectedRegExpInc(boolean b); boolean isSelectedRegExpExc(); void setSelectedRegExpExc(boolean b); String getStartOffset(); void setStartOffset(long startOffset); String getEndOffset(); void setEndOffset(long endOffset); void clearGui(); }
@Test public void testSetEndOffset() { System.out.println("setEndOffset"); FilterPanel instance = new FilterPanel(); instance.setEndOffset(180); }
PageDataExtractorOverTimeGui extends AbstractOverTimeVisualizer implements CMDLineArgumentsProcessor { @Override public TestElement createTestElement() { TestElement te = super.createTestElement(); modifyTestElement(te); te.setComment(JMeterPluginsUtils.getWikiLinkText(getWikiPage())); return te; } PageDataExtractorOverTimeGui(); @Override String getStaticLabel(); @Override String getLabelResource(); @Override String getWikiPage(); @Override TestElement createTestElement(); @Override void modifyTestElement(TestElement te); @Override void configure(TestElement te); @Override void add(SampleResult res); @Override void clearData(); void processCMDOption(String nextArg, ListIterator args); static final String[] columnIdentifiers; static final Class[] columnClasses; }
@Test public void testCreateTestElement() { System.out.println("createTestElement"); PageDataExtractorOverTimeGui instance = new PageDataExtractorOverTimeGui(); TestElement result = instance.createTestElement(); assertTrue(result instanceof ResultCollector); }
JSONPathAssertionGui extends AbstractAssertionGui implements ChangeListener { public void init() { setLayout(new BorderLayout()); setBorder(makeBorder()); add(JMeterPluginsUtils.addHelpLinkToPanel(makeTitlePanel(), WIKIPAGE), BorderLayout.NORTH); VerticalPanel panel = new VerticalPanel(); panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); JPanel groupPanel = new HorizontalPanel(); inputJSON.setActionCommand(JSONPathAssertion.INPUT_JSON); inputYAML.setActionCommand(JSONPathAssertion.INPUT_YAML); inputFormatGroup.add(inputJSON); inputFormatGroup.add(inputYAML); groupPanel.add(inputJSON); groupPanel.add(inputYAML); JPanel inputFormatPanel = new HorizontalPanel(); inputFormatPanel.add(new JLabel("Input Format: ")); inputFormatPanel.add(groupPanel); jsonPath = new JLabeledTextField("Assert JSON Path exists: "); jsonValidation = new JCheckBox("Additionally assert value"); isRegex = new JCheckBox("Match as regular expression"); jsonValue = new JLabeledTextArea("Expected Value: "); expectNull = new JCheckBox("Expect null"); invert = new JCheckBox("Invert assertion (will fail if above conditions met)"); jsonValidation.addChangeListener(this); expectNull.addChangeListener(this); panel.add(inputFormatPanel); panel.add(jsonPath); panel.add(jsonValidation); panel.add(isRegex); panel.add(jsonValue); panel.add(expectNull); panel.add(invert); add(panel, BorderLayout.CENTER); } JSONPathAssertionGui(); void init(); @Override void clearGui(); @Override TestElement createTestElement(); @Override String getLabelResource(); @Override String getStaticLabel(); @Override void modifyTestElement(TestElement element); @Override void configure(TestElement element); @Override void stateChanged(ChangeEvent e); }
@Test public void testInit() { System.out.println("init"); JSONPathAssertionGui instance = new JSONPathAssertionGui(); instance.init(); instance.stateChanged(null); }
JSONPathAssertionGui extends AbstractAssertionGui implements ChangeListener { @Override public void clearGui() { super.clearGui(); jsonPath.setText("$."); jsonValue.setText(""); jsonValidation.setSelected(false); expectNull.setSelected(false); invert.setSelected(false); isRegex.setSelected(true); inputJSON.setSelected(true); } JSONPathAssertionGui(); void init(); @Override void clearGui(); @Override TestElement createTestElement(); @Override String getLabelResource(); @Override String getStaticLabel(); @Override void modifyTestElement(TestElement element); @Override void configure(TestElement element); @Override void stateChanged(ChangeEvent e); }
@Test public void testClearGui() { System.out.println("clearGui"); JSONPathAssertionGui instance = new JSONPathAssertionGui(); instance.clearGui(); }
JSONPathAssertionGui extends AbstractAssertionGui implements ChangeListener { @Override public TestElement createTestElement() { JSONPathAssertion jpAssertion = new JSONPathAssertion(); modifyTestElement(jpAssertion); jpAssertion.setComment(JMeterPluginsUtils.getWikiLinkText(WIKIPAGE)); return jpAssertion; } JSONPathAssertionGui(); void init(); @Override void clearGui(); @Override TestElement createTestElement(); @Override String getLabelResource(); @Override String getStaticLabel(); @Override void modifyTestElement(TestElement element); @Override void configure(TestElement element); @Override void stateChanged(ChangeEvent e); }
@Test public void testCreateTestElement() { System.out.println("createTestElement"); JSONPathAssertionGui instance = new JSONPathAssertionGui(); instance.createTestElement(); }
JSONPathAssertionGui extends AbstractAssertionGui implements ChangeListener { @Override public String getLabelResource() { return this.getClass().getSimpleName(); } JSONPathAssertionGui(); void init(); @Override void clearGui(); @Override TestElement createTestElement(); @Override String getLabelResource(); @Override String getStaticLabel(); @Override void modifyTestElement(TestElement element); @Override void configure(TestElement element); @Override void stateChanged(ChangeEvent e); }
@Test public void testGetLabelResource() { System.out.println("getLabelResource"); JSONPathAssertionGui instance = new JSONPathAssertionGui(); instance.getLabelResource(); }
JSONPathAssertionGui extends AbstractAssertionGui implements ChangeListener { @Override public String getStaticLabel() { return JMeterPluginsUtils.prefixLabel("JSON/YAML Path Assertion"); } JSONPathAssertionGui(); void init(); @Override void clearGui(); @Override TestElement createTestElement(); @Override String getLabelResource(); @Override String getStaticLabel(); @Override void modifyTestElement(TestElement element); @Override void configure(TestElement element); @Override void stateChanged(ChangeEvent e); }
@Test public void testGetStaticLabel() { System.out.println("getStaticLabel"); JSONPathAssertionGui instance = new JSONPathAssertionGui(); instance.getStaticLabel(); }
JSONPathAssertionGui extends AbstractAssertionGui implements ChangeListener { @Override public void modifyTestElement(TestElement element) { super.configureTestElement(element); if (element instanceof JSONPathAssertion) { JSONPathAssertion jpAssertion = (JSONPathAssertion) element; jpAssertion.setJsonPath(jsonPath.getText()); jpAssertion.setExpectedValue(jsonValue.getText()); jpAssertion.setJsonValidationBool(jsonValidation.isSelected()); jpAssertion.setExpectNull(expectNull.isSelected()); jpAssertion.setInvert(invert.isSelected()); jpAssertion.setIsRegex(isRegex.isSelected()); if (inputFormatGroup.getSelection() != null) { jpAssertion.setInputFormat(inputFormatGroup.getSelection().getActionCommand()); } } } JSONPathAssertionGui(); void init(); @Override void clearGui(); @Override TestElement createTestElement(); @Override String getLabelResource(); @Override String getStaticLabel(); @Override void modifyTestElement(TestElement element); @Override void configure(TestElement element); @Override void stateChanged(ChangeEvent e); }
@Test public void testModifyTestElement() { System.out.println("modifyTestElement"); TestElement element = new JSONPathAssertion(); JSONPathAssertionGui instance = new JSONPathAssertionGui(); instance.modifyTestElement(element); }
JSONPathAssertionGui extends AbstractAssertionGui implements ChangeListener { @Override public void configure(TestElement element) { super.configure(element); JSONPathAssertion jpAssertion = (JSONPathAssertion) element; jsonPath.setText(jpAssertion.getJsonPath()); jsonValue.setText(jpAssertion.getExpectedValue()); jsonValidation.setSelected(jpAssertion.isJsonValidationBool()); expectNull.setSelected(jpAssertion.isExpectNull()); invert.setSelected(jpAssertion.isInvert()); isRegex.setSelected(jpAssertion.isUseRegex()); Enumeration<AbstractButton> it = inputFormatGroup.getElements(); while (it.hasMoreElements()) { AbstractButton btn = it.nextElement(); if (btn.getActionCommand().equals(jpAssertion.getInputFormat())) { btn.setSelected(true); } } } JSONPathAssertionGui(); void init(); @Override void clearGui(); @Override TestElement createTestElement(); @Override String getLabelResource(); @Override String getStaticLabel(); @Override void modifyTestElement(TestElement element); @Override void configure(TestElement element); @Override void stateChanged(ChangeEvent e); }
@Test public void testConfigure() { System.out.println("configure"); TestElement element = new JSONPathAssertion(); JSONPathAssertionGui instance = new JSONPathAssertionGui(); instance.configure(element); }
JSONPathAssertion extends AbstractTestElement implements Serializable, Assertion { public String getJsonPath() { return getPropertyAsString(JSONPATH); } void setInputFormat(String inputFormat); String getInputFormat(); String getJsonPath(); void setJsonPath(String jsonPath); String getExpectedValue(); void setExpectedValue(String expectedValue); void setJsonValidationBool(boolean jsonValidation); void setExpectNull(boolean val); boolean isExpectNull(); boolean isJsonValidationBool(); void setInvert(boolean invert); boolean isInvert(); void setIsRegex(boolean flag); boolean isUseRegex(); @Override AssertionResult getResult(SampleResult samplerResult); static final String INPUT_JSON; static final String INPUT_YAML; static final String INPUT_FORMAT; static final String JSONPATH; static final String EXPECTEDVALUE; static final String JSONVALIDATION; static final String EXPECT_NULL; static final String INVERT; static final String ISREGEX; }
@Test public void testGetJsonPath() { System.out.println("getJsonPath"); JSONPathAssertion instance = new JSONPathAssertion(); String expResult = ""; String result = instance.getJsonPath(); assertEquals(expResult, result); }
JSONPathAssertion extends AbstractTestElement implements Serializable, Assertion { public void setJsonPath(String jsonPath) { setProperty(JSONPATH, jsonPath); } void setInputFormat(String inputFormat); String getInputFormat(); String getJsonPath(); void setJsonPath(String jsonPath); String getExpectedValue(); void setExpectedValue(String expectedValue); void setJsonValidationBool(boolean jsonValidation); void setExpectNull(boolean val); boolean isExpectNull(); boolean isJsonValidationBool(); void setInvert(boolean invert); boolean isInvert(); void setIsRegex(boolean flag); boolean isUseRegex(); @Override AssertionResult getResult(SampleResult samplerResult); static final String INPUT_JSON; static final String INPUT_YAML; static final String INPUT_FORMAT; static final String JSONPATH; static final String EXPECTEDVALUE; static final String JSONVALIDATION; static final String EXPECT_NULL; static final String INVERT; static final String ISREGEX; }
@Test public void testSetJsonPath() { System.out.println("setJsonPath"); String jsonPath = ""; JSONPathAssertion instance = new JSONPathAssertion(); instance.setJsonPath(jsonPath); }
JSONPathAssertion extends AbstractTestElement implements Serializable, Assertion { public String getExpectedValue() { return getPropertyAsString(EXPECTEDVALUE); } void setInputFormat(String inputFormat); String getInputFormat(); String getJsonPath(); void setJsonPath(String jsonPath); String getExpectedValue(); void setExpectedValue(String expectedValue); void setJsonValidationBool(boolean jsonValidation); void setExpectNull(boolean val); boolean isExpectNull(); boolean isJsonValidationBool(); void setInvert(boolean invert); boolean isInvert(); void setIsRegex(boolean flag); boolean isUseRegex(); @Override AssertionResult getResult(SampleResult samplerResult); static final String INPUT_JSON; static final String INPUT_YAML; static final String INPUT_FORMAT; static final String JSONPATH; static final String EXPECTEDVALUE; static final String JSONVALIDATION; static final String EXPECT_NULL; static final String INVERT; static final String ISREGEX; }
@Test public void testGetExpectedValue() { System.out.println("getExpectedValue"); JSONPathAssertion instance = new JSONPathAssertion(); String expResult = ""; String result = instance.getExpectedValue(); assertEquals(expResult, result); }
FilterPanel extends JPanel { public void clearGui() { jTextFieldInclude.setText(""); jTextFieldExclude.setText(""); jCheckBoxInclude.setSelected(false); jCheckBoxExclude.setSelected(false); jTextFieldStartOffset.setText(""); jTextFieldEndOffset.setText(""); } FilterPanel(); String getIncludeSampleLabels(); void setIncludeSampleLabels(String str); String getExcludeSampleLabels(); void setExcludeSampleLabels(String str); boolean isSelectedRegExpInc(); void setSelectedRegExpInc(boolean b); boolean isSelectedRegExpExc(); void setSelectedRegExpExc(boolean b); String getStartOffset(); void setStartOffset(long startOffset); String getEndOffset(); void setEndOffset(long endOffset); void clearGui(); }
@Test public void testClearGui() { System.out.println("clearGui"); FilterPanel instance = new FilterPanel(); instance.clearGui(); }
JSONPathAssertion extends AbstractTestElement implements Serializable, Assertion { public void setExpectedValue(String expectedValue) { setProperty(EXPECTEDVALUE, expectedValue); } void setInputFormat(String inputFormat); String getInputFormat(); String getJsonPath(); void setJsonPath(String jsonPath); String getExpectedValue(); void setExpectedValue(String expectedValue); void setJsonValidationBool(boolean jsonValidation); void setExpectNull(boolean val); boolean isExpectNull(); boolean isJsonValidationBool(); void setInvert(boolean invert); boolean isInvert(); void setIsRegex(boolean flag); boolean isUseRegex(); @Override AssertionResult getResult(SampleResult samplerResult); static final String INPUT_JSON; static final String INPUT_YAML; static final String INPUT_FORMAT; static final String JSONPATH; static final String EXPECTEDVALUE; static final String JSONVALIDATION; static final String EXPECT_NULL; static final String INVERT; static final String ISREGEX; }
@Test public void testSetExpectedValue() { System.out.println("setExpectedValue"); String expectedValue = ""; JSONPathAssertion instance = new JSONPathAssertion(); instance.setExpectedValue(expectedValue); }
JSONPathAssertion extends AbstractTestElement implements Serializable, Assertion { public void setJsonValidationBool(boolean jsonValidation) { setProperty(JSONVALIDATION, jsonValidation); } void setInputFormat(String inputFormat); String getInputFormat(); String getJsonPath(); void setJsonPath(String jsonPath); String getExpectedValue(); void setExpectedValue(String expectedValue); void setJsonValidationBool(boolean jsonValidation); void setExpectNull(boolean val); boolean isExpectNull(); boolean isJsonValidationBool(); void setInvert(boolean invert); boolean isInvert(); void setIsRegex(boolean flag); boolean isUseRegex(); @Override AssertionResult getResult(SampleResult samplerResult); static final String INPUT_JSON; static final String INPUT_YAML; static final String INPUT_FORMAT; static final String JSONPATH; static final String EXPECTEDVALUE; static final String JSONVALIDATION; static final String EXPECT_NULL; static final String INVERT; static final String ISREGEX; }
@Test public void testSetJsonValidationBool() { System.out.println("setJsonValidationBool"); JSONPathAssertion instance = new JSONPathAssertion(); instance.setJsonValidationBool(false); }
JSONPathAssertion extends AbstractTestElement implements Serializable, Assertion { public boolean isJsonValidationBool() { return getPropertyAsBoolean(JSONVALIDATION); } void setInputFormat(String inputFormat); String getInputFormat(); String getJsonPath(); void setJsonPath(String jsonPath); String getExpectedValue(); void setExpectedValue(String expectedValue); void setJsonValidationBool(boolean jsonValidation); void setExpectNull(boolean val); boolean isExpectNull(); boolean isJsonValidationBool(); void setInvert(boolean invert); boolean isInvert(); void setIsRegex(boolean flag); boolean isUseRegex(); @Override AssertionResult getResult(SampleResult samplerResult); static final String INPUT_JSON; static final String INPUT_YAML; static final String INPUT_FORMAT; static final String JSONPATH; static final String EXPECTEDVALUE; static final String JSONVALIDATION; static final String EXPECT_NULL; static final String INVERT; static final String ISREGEX; }
@Test public void testIsJsonValidationBool() { System.out.println("isJsonValidationBool"); JSONPathAssertion instance = new JSONPathAssertion(); boolean result = instance.isJsonValidationBool(); assertFalse(result); }
JSONPathExtractor extends AbstractTestElement implements PostProcessor { public String getJsonPath() { return getPropertyAsString(JSONPATH); } JSONPathExtractor(); void setInputFormat(String inputFormat); String getInputFormat(); String getJsonPath(); void setJsonPath(String jsonPath); String getVar(); void setVar(String var); void setDefaultValue(String defaultValue); String getDefaultValue(); void setSrcVariableName(String defaultValue); String getSrcVariableName(); void setSubject(String defaultValue); String getSubject(); @Override void process(); static String objectToString(Object subj); static final String INPUT_JSON; static final String INPUT_YAML; static final String INPUT_FORMAT; static final String JSONPATH; static final String VAR; static final String DEFAULT; static final String SUBJECT; static final String SRC_VARNAME; static final String SUBJECT_BODY; static final String SUBJECT_VARIABLE; static final DecimalFormat decimalFormatter; }
@Test public void testGetJsonPath() { System.out.println("getJsonPath"); JSONPathExtractor instance = new JSONPathExtractor(); String expResult = ""; String result = instance.getJsonPath(); assertEquals(expResult, result); }
JSONPathExtractor extends AbstractTestElement implements PostProcessor { public void setJsonPath(String jsonPath) { setProperty(JSONPATH, jsonPath); } JSONPathExtractor(); void setInputFormat(String inputFormat); String getInputFormat(); String getJsonPath(); void setJsonPath(String jsonPath); String getVar(); void setVar(String var); void setDefaultValue(String defaultValue); String getDefaultValue(); void setSrcVariableName(String defaultValue); String getSrcVariableName(); void setSubject(String defaultValue); String getSubject(); @Override void process(); static String objectToString(Object subj); static final String INPUT_JSON; static final String INPUT_YAML; static final String INPUT_FORMAT; static final String JSONPATH; static final String VAR; static final String DEFAULT; static final String SUBJECT; static final String SRC_VARNAME; static final String SUBJECT_BODY; static final String SUBJECT_VARIABLE; static final DecimalFormat decimalFormatter; }
@Test public void testSetJsonPath() { System.out.println("setJsonPath"); String jsonPath = ""; JSONPathExtractor instance = new JSONPathExtractor(); instance.setJsonPath(jsonPath); }
JSONPathExtractor extends AbstractTestElement implements PostProcessor { public String getVar() { return getPropertyAsString(VAR); } JSONPathExtractor(); void setInputFormat(String inputFormat); String getInputFormat(); String getJsonPath(); void setJsonPath(String jsonPath); String getVar(); void setVar(String var); void setDefaultValue(String defaultValue); String getDefaultValue(); void setSrcVariableName(String defaultValue); String getSrcVariableName(); void setSubject(String defaultValue); String getSubject(); @Override void process(); static String objectToString(Object subj); static final String INPUT_JSON; static final String INPUT_YAML; static final String INPUT_FORMAT; static final String JSONPATH; static final String VAR; static final String DEFAULT; static final String SUBJECT; static final String SRC_VARNAME; static final String SUBJECT_BODY; static final String SUBJECT_VARIABLE; static final DecimalFormat decimalFormatter; }
@Test public void testGetVar() { System.out.println("getVar"); JSONPathExtractor instance = new JSONPathExtractor(); String expResult = ""; String result = instance.getVar(); assertEquals(expResult, result); }
JSONPathExtractor extends AbstractTestElement implements PostProcessor { @Override public void process() { JMeterContext context = getThreadContext(); JMeterVariables vars = context.getVariables(); SampleResult previousResult = context.getPreviousResult(); String responseData; if (getSubject().equals(SUBJECT_VARIABLE)) { responseData = vars.get(getSrcVariableName()); } else { responseData = previousResult.getResponseDataAsString(); } try { if (INPUT_YAML.equals(getInputFormat())) { responseData = YAMLToJSONConverter.convert(responseData); } Object jsonPathResult = JsonPath.read(responseData, getJsonPath()); if (jsonPathResult instanceof JSONArray) { Object[] arr = ((JSONArray) jsonPathResult).toArray(); if (arr.length == 0) { throw new PathNotFoundException("Extracted array is empty"); } vars.put(this.getVar(), objectToString(jsonPathResult)); vars.put(this.getVar() + "_matchNr", objectToString(arr.length)); int k = 1; while (vars.get(this.getVar() + "_" + k) != null) { vars.remove(this.getVar() + "_" + k); k++; } for (int n = 0; n < arr.length; n++) { vars.put(this.getVar() + "_" + (n + 1), objectToString(arr[n])); } } else { vars.put(this.getVar(), objectToString(jsonPathResult)); } } catch (Exception e) { log.debug("Extract failed", e); vars.put(this.getVar(), getDefaultValue()); vars.put(this.getVar() + "_matchNr", "0"); int k = 1; while (vars.get(this.getVar() + "_" + k) != null) { vars.remove(this.getVar() + "_" + k); k++; } } } JSONPathExtractor(); void setInputFormat(String inputFormat); String getInputFormat(); String getJsonPath(); void setJsonPath(String jsonPath); String getVar(); void setVar(String var); void setDefaultValue(String defaultValue); String getDefaultValue(); void setSrcVariableName(String defaultValue); String getSrcVariableName(); void setSubject(String defaultValue); String getSubject(); @Override void process(); static String objectToString(Object subj); static final String INPUT_JSON; static final String INPUT_YAML; static final String INPUT_FORMAT; static final String JSONPATH; static final String VAR; static final String DEFAULT; static final String SUBJECT; static final String SRC_VARNAME; static final String SUBJECT_BODY; static final String SUBJECT_VARIABLE; static final DecimalFormat decimalFormatter; }
@Test public void testProcess() { System.out.println("process"); JMeterContext context = JMeterContextService.getContext(); SampleResult res = new SampleResult(); res.setResponseData(json.getBytes()); context.setPreviousResult(res); JSONPathExtractor instance = new JSONPathExtractor(); instance.setDefaultValue("DEFAULT"); instance.setVar("test"); instance.setJsonPath("$.store.book[*].author"); instance.process(); JMeterVariables vars = context.getVariables(); assertEquals("[\"Nigel Rees\",\"Evelyn Waugh\",\"Herman Melville\",\"J. R. R. Tolkien\"]", vars.get("test")); }
JSONPathExtractorGui extends AbstractPostProcessorGui { @Override public void clearGui() { super.clearGui(); variableNameTextField.setText(""); jsonPathTextField.setText(""); defaultValTextField.setText(""); srcVariableName.setText(""); useBody.setSelected(true); inputJSON.setSelected(true); } JSONPathExtractorGui(); @Override void clearGui(); @Override TestElement createTestElement(); @Override String getLabelResource(); @Override String getStaticLabel(); @Override void modifyTestElement(TestElement element); @Override void configure(TestElement element); }
@Test public void testClearGui() { System.out.println("clearGui"); JSONPathExtractorGui instance = new JSONPathExtractorGui(); instance.clearGui(); }
JSONPathExtractorGui extends AbstractPostProcessorGui { @Override public TestElement createTestElement() { JSONPathExtractor extractor = new JSONPathExtractor(); modifyTestElement(extractor); extractor.setComment(JMeterPluginsUtils.getWikiLinkText(WIKIPAGE)); return extractor; } JSONPathExtractorGui(); @Override void clearGui(); @Override TestElement createTestElement(); @Override String getLabelResource(); @Override String getStaticLabel(); @Override void modifyTestElement(TestElement element); @Override void configure(TestElement element); }
@Test public void testCreateTestElement() { System.out.println("createTestElement"); JSONPathExtractorGui instance = new JSONPathExtractorGui(); TestElement expResult = null; TestElement result = instance.createTestElement(); }