ASF Bugzilla – Attachment 19730 Details for
Bug 39693
View Result in Table should use colors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Suggested patch
patch_for_39693_2.patch (text/plain), 6.87 KB, created by
Alf Hogemark
on 2007-03-17 15:09:59 UTC
(
hide
)
Description:
Suggested patch
Filename:
MIME Type:
Creator:
Alf Hogemark
Created:
2007-03-17 15:09:59 UTC
Size:
6.87 KB
patch
obsolete
>Index: C:/Documents and Settings/alf/workspace/Jmeter/src/components/org/apache/jmeter/visualizers/TableVisualizer.java >=================================================================== >--- C:/Documents and Settings/alf/workspace/Jmeter/src/components/org/apache/jmeter/visualizers/TableVisualizer.java (revision 519440) >+++ C:/Documents and Settings/alf/workspace/Jmeter/src/components/org/apache/jmeter/visualizers/TableVisualizer.java (working copy) >@@ -25,6 +25,7 @@ > import java.text.SimpleDateFormat; > > import javax.swing.BorderFactory; >+import javax.swing.ImageIcon; > import javax.swing.JLabel; > import javax.swing.JPanel; > import javax.swing.JScrollPane; >@@ -33,6 +34,7 @@ > import javax.swing.border.Border; > import javax.swing.border.EmptyBorder; > >+import org.apache.jmeter.assertions.AssertionResult; > import org.apache.jmeter.samplers.Clearable; > import org.apache.jmeter.samplers.SampleResult; > import org.apache.jmeter.util.Calculator; >@@ -55,7 +57,13 @@ > */ > public class TableVisualizer extends AbstractVisualizer implements Clearable { > private static final Logger log = LoggingManager.getLoggerForClass(); >+ >+ private static final ImageIcon imageSuccess = JMeterUtils.getImage( >+ JMeterUtils.getPropDefault("viewResultsTree.success", "icon_success_sml.gif")); > >+ private static final ImageIcon imageFailure = JMeterUtils.getImage( >+ JMeterUtils.getPropDefault("viewResultsTree.failure", "icon_warning_sml.gif")); >+ > private final String[] COLUMNS = new String[] { > JMeterUtils.getResString("table_visualizer_sample_num"), // $NON-NLS-1$ > JMeterUtils.getResString("table_visualizer_start_time"), // $NON-NLS-1$ >@@ -63,6 +71,7 @@ > JMeterUtils.getResString("sampler_label"), // $NON-NLS-1$ > JMeterUtils.getResString("table_visualizer_sample_time"), // $NON-NLS-1$ > JMeterUtils.getResString("success?"), // $NON-NLS-1$ >+ JMeterUtils.getResString("table_visualizer_assertions"), // $NON-NLS-1$ > JMeterUtils.getResString("table_visualizer_bytes") }; // $NON-NLS-1$ > > private ObjectTableModel model = null; >@@ -91,7 +100,7 @@ > public TableVisualizer() { > super(); > model = new ObjectTableModel(COLUMNS, >- Sample.class, // The object used for each row >+ TableSample.class, // The object used for each row > new Functor[] { > new Functor("getCount"), // $NON-NLS-1$ > new Functor("getStartTimeFormatted", // $NON-NLS-1$ >@@ -99,11 +108,12 @@ > new Functor("getThreadName"), // $NON-NLS-1$ > new Functor("getLabel"), // $NON-NLS-1$ > new Functor("getData"), // $NON-NLS-1$ >- new Functor("isSuccess"), // $NON-NLS-1$ >+ new SampleSuccessFunctor("isSuccess"), // $NON-NLS-1$ >+ new Functor("getAssertionStatus"), // $NON-NLS-1$ > new Functor("getBytes") }, // $NON-NLS-1$ >- new Functor[] { null, null, null, null, null, null, null }, >+ new Functor[] { null, null, null, null, null, null, null, null }, > new Class[] { >- Long.class, String.class, String.class, String.class, Long.class, Boolean.class, Integer.class }); >+ Long.class, String.class, String.class, String.class, Long.class, ImageIcon.class, String.class, Integer.class }); > init(); > } > >@@ -129,9 +139,9 @@ > synchronized (calc) { > calc.addValue(currentData); > int count = calc.getCount(); >- Sample newS = new Sample(res.getSampleLabel(), res.getTime(), 0, 0, 0, 0, 0, 0, >+ TableSample newS = new TableSample(res.getSampleLabel(), res.getTime(), 0, 0, 0, 0, 0, 0, > res.isSuccessful(), count, res.getEndTime(),res.getBytes(), >- res.getThreadName()); >+ res.getThreadName(), res.getAssertionResults()); > model.addRow(newS); > } > updateTextFields(); >@@ -237,4 +247,72 @@ > this.add(mainPanel, BorderLayout.NORTH); > this.add(tablePanel, BorderLayout.CENTER); > } >+ >+ /** >+ * Class for holding samples for the table, >+ * needed to get the extra property for assertion status >+ * >+ */ >+ public class TableSample extends Sample { >+ private String assertionStatus; >+ >+ public TableSample(String name, long data, long average, long deviation, long median, long distributionLine, >+ double throughput, long errorCount, boolean success, long num, long endTime, int bytes, String threadName, >+ AssertionResult[] assertionResults) { >+ super(name, data, average, deviation, median, distributionLine, >+ throughput, errorCount, success, num, endTime, bytes, threadName); >+ // Check if we have any assertions, >+ // and how many passed and how many failed >+ if(assertionResults != null) { >+ int passed = 0; >+ int failed = 0; >+ for(int i = 0; i < assertionResults.length; i++) { >+ AssertionResult ar = assertionResults[i]; >+ if(ar.isError() || ar.isFailure()) { >+ failed++; >+ } >+ else { >+ passed++; >+ } >+ } >+ // Check if we had any assertions >+ if(passed > 0 || failed > 0) { >+ this.assertionStatus = "" + // $NON-NLS-1$ >+ passed + " " + JMeterUtils.getResString("table_visualizer_assertions_ok") + // $NON-NLS-1$ // $NON-NLS-2$ >+ ", " + failed + " " + // $NON-NLS-1$ // $NON-NLS-2$ >+ JMeterUtils.getResString("table_visualizer_assertions_failed"); // $NON-NLS-1$ >+ } >+ } >+ >+ } >+ >+ public String getAssertionStatus() { >+ return assertionStatus; >+ } >+ } >+ >+ /** >+ * Class for returning status image for boolean >+ */ >+ public class SampleSuccessFunctor extends Functor { >+ public SampleSuccessFunctor(String methodName) { >+ super(methodName); >+ } >+ >+ public Object invoke(Object p_invokee) { >+ Boolean success = (Boolean)super.invoke(p_invokee); >+ >+ if(success != null) { >+ if(success.booleanValue()) { >+ return imageSuccess; >+ } >+ else { >+ return imageFailure; >+ } >+ } >+ else { >+ return null; >+ } >+ } >+ } > } >Index: C:/Documents and Settings/alf/workspace/Jmeter/src/core/org/apache/jmeter/resources/messages.properties >=================================================================== >--- C:/Documents and Settings/alf/workspace/Jmeter/src/core/org/apache/jmeter/resources/messages.properties (revision 519440) >+++ C:/Documents and Settings/alf/workspace/Jmeter/src/core/org/apache/jmeter/resources/messages.properties (working copy) >@@ -684,6 +684,9 @@ > summary_report=Summary Report > switch_controller_label=Switch Value > switch_controller_title=Switch Controller >+table_visualizer_assertions=Assertions >+table_visualizer_assertions_ok=ok >+table_visualizer_assertions_failed=failed > table_visualizer_bytes=Bytes > table_visualizer_sample_num=Sample # > table_visualizer_sample_time=Sample Time(ms)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 39693
:
19729
| 19730