jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject [jmeter] branch master updated: Use order property for renderes to select default renderer
Date Wed, 12 Feb 2020 17:14:57 GMT
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
     new 243e0d1  Use order property for renderes to select default renderer
243e0d1 is described below

commit 243e0d1d8d875e6205d8da57189a28ff74e4953a
Author: Felix Schumacher <felix.schumacher@internetallee.de>
AuthorDate: Tue Feb 11 23:33:21 2020 +0100

    Use order property for renderes to select default renderer
    
    Use first renderer from view.results.tree.renderers_order property as default in View
Results Tree
    
    Bugzilla Id: 64119
---
 .../visualizers/ViewResultsFullVisualizer.java     | 24 ++++++++++++++--------
 xdocs/changes.xml                                  |  2 ++
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/components/src/main/java/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
b/src/components/src/main/java/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
index 3153453..5e5e154 100644
--- a/src/components/src/main/java/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
+++ b/src/components/src/main/java/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
@@ -449,15 +449,18 @@ implements ActionListener, TreeSelectionListener, Clearable, ItemListener
{
         } catch (IOException e1) {
             // ignored
         }
-        String textRenderer = JMeterUtils.getResString("view_results_render_text"); // $NON-NLS-1$
-        Object textObject = null;
+        String defaultRenderer = expandToClassname(".RenderAsText"); // $NON-NLS-1$
+        if (VIEWERS_ORDER.length() > 0) {
+            defaultRenderer = expandToClassname(VIEWERS_ORDER.split(",", 2)[0]);
+        }
+        Object defaultObject = null;
         Map<String, ResultRenderer> map = new HashMap<>(classesToAdd.size());
         for (String clazz : classesToAdd) {
             try {
                 // Instantiate render classes
                 final ResultRenderer renderer = (ResultRenderer) Class.forName(clazz).getDeclaredConstructor().newInstance();
-                if (textRenderer.equals(renderer.toString())){
-                    textObject=renderer;
+                if (defaultRenderer.equals(clazz)) {
+                    defaultObject=renderer;
                 }
                 renderer.setBackgroundColor(getBackground());
                 map.put(renderer.getClass().getName(), renderer);
@@ -473,9 +476,7 @@ implements ActionListener, TreeSelectionListener, Clearable, ItemListener
{
         }
         if (VIEWERS_ORDER.length() > 0) {
             Arrays.stream(VIEWERS_ORDER.split(","))
-                    .map(key -> key.startsWith(".")
-                            ? "org.apache.jmeter.visualizers" + key //$NON-NLS-1$
-                            : key)
+                    .map(this::expandToClassname)
                     .forEach(key -> {
                         ResultRenderer renderer = map.remove(key);
                         if (renderer != null) {
@@ -490,10 +491,17 @@ implements ActionListener, TreeSelectionListener, Clearable, ItemListener
{
         }
         // Add remaining (plugins or missed in property)
         map.values().forEach(renderer -> selectRenderPanel.addItem(renderer));
-        nodesModel.setSelectedItem(textObject); // preset to "Text" option
+        nodesModel.setSelectedItem(defaultObject); // preset to "Text" option or the first
option from the view.results.tree.renderers_order property
         return selectRenderPanel;
     }
 
+    private String expandToClassname(String name) {
+        if (name.startsWith(".")) {
+            return "org.apache.jmeter.visualizers" + name; // $NON-NLS-1$
+        }
+        return name;
+    }
+
     /** {@inheritDoc} */
     @Override
     public void actionPerformed(ActionEvent event) {
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index ce9f557..aef1ed3 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -119,6 +119,8 @@ to view the last release notes of version 5.2.1.
 <h3>General</h3>
 <ul>
   <li><bug>63458</bug><pr>551</pr>Add new template "Functional
Testing Test Plan [01]". Contributed by Sebastian Boga (sebastian.boga at endava.com)</li>
+  <li><big>64119</bug>Use first renderer from <code>view.results.tree.renderers_order</code>
property as default in View Results Tree</li>
+</li>
 </ul>
 
 <ch_section>Non-functional changes</ch_section>


Mime
View raw message