| 1 | |
package kg.apc.jmeter.reporters; |
| 2 | |
|
| 3 | |
import java.awt.BorderLayout; |
| 4 | |
import javax.swing.JScrollPane; |
| 5 | |
import javax.swing.JTextArea; |
| 6 | |
import kg.apc.jmeter.JMeterPluginsUtils; |
| 7 | |
import org.apache.jmeter.testelement.TestElement; |
| 8 | |
import org.apache.jmeter.visualizers.gui.AbstractListenerGui; |
| 9 | |
|
| 10 | |
public class ConsoleStatusLoggerGui extends AbstractListenerGui { |
| 11 | |
|
| 12 | |
public static final String WIKIPAGE = "ConsoleStatusLogger"; |
| 13 | |
|
| 14 | |
public ConsoleStatusLoggerGui() { |
| 15 | 4 | super(); |
| 16 | 4 | init(); |
| 17 | 4 | } |
| 18 | |
|
| 19 | |
@Override |
| 20 | |
public String getStaticLabel() { |
| 21 | 9 | return JMeterPluginsUtils.prefixLabel("Console Status Logger"); |
| 22 | |
} |
| 23 | |
|
| 24 | |
@Override |
| 25 | |
public String getLabelResource() { |
| 26 | 1 | return getClass().getCanonicalName(); |
| 27 | |
} |
| 28 | |
|
| 29 | |
@Override |
| 30 | |
public TestElement createTestElement() { |
| 31 | 1 | TestElement te = new ConsoleStatusLogger(); |
| 32 | 1 | modifyTestElement(te); |
| 33 | 1 | te.setComment(JMeterPluginsUtils.getWikiLinkText(WIKIPAGE)); |
| 34 | 1 | return te; |
| 35 | |
} |
| 36 | |
|
| 37 | |
@Override |
| 38 | |
public void modifyTestElement(TestElement te) { |
| 39 | 2 | super.configureTestElement(te); |
| 40 | 2 | } |
| 41 | |
|
| 42 | |
private void init() { |
| 43 | 4 | setLayout(new BorderLayout(0, 5)); |
| 44 | 4 | setBorder(makeBorder()); |
| 45 | 4 | add(JMeterPluginsUtils.addHelpLinkToPanel(makeTitlePanel(), WIKIPAGE), BorderLayout.NORTH); |
| 46 | 4 | JTextArea info = new JTextArea(); |
| 47 | 4 | info.setEditable(false); |
| 48 | 4 | info.setWrapStyleWord(true); |
| 49 | 4 | info.setOpaque(false); |
| 50 | 4 | info.setLineWrap(true); |
| 51 | 4 | info.setColumns(20); |
| 52 | |
|
| 53 | 4 | JScrollPane jScrollPane1 = new javax.swing.JScrollPane(); |
| 54 | 4 | jScrollPane1.setViewportView(info); |
| 55 | 4 | jScrollPane1.setBorder(null); |
| 56 | |
|
| 57 | 4 | info.setText("This is a simple listener that prints short summary log to console while JMeter is running in non-GUI mode. " |
| 58 | |
+ "It also writes the same info into jmeter.log in GUI mode." |
| 59 | |
+ "\n\nNote that response time and latency values printed are averages."); |
| 60 | |
|
| 61 | 4 | add(jScrollPane1, BorderLayout.CENTER); |
| 62 | 4 | } |
| 63 | |
} |