jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vladimirsitni...@apache.org
Subject [jmeter] branch master updated: Initialize GUI_CLASS in TestBeanGUI so the icons are rendered properly
Date Sat, 28 Mar 2020 18:04:29 GMT
This is an automated email from the ASF dual-hosted git repository.

vladimirsitnikov 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 1e361f7  Initialize GUI_CLASS in TestBeanGUI so the icons are rendered properly
1e361f7 is described below

commit 1e361f722ac2625cc7d81397f3385dfa7a6aa437
Author: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
AuthorDate: Sat Mar 28 21:03:57 2020 +0300

    Initialize GUI_CLASS in TestBeanGUI so the icons are rendered properly
    
    Since 0bdbe5bd17f6e2385a5fe58216e259dd85a04054 JMeter skips
    TestBeanGUI#getMenuCategories() for most of the beans,
    and it turns out that method was initializing GUI_CLASS which is used
    for icon rendering.
    
    The solution for now is to explicitly initialize GUI_CLASS when TestBeanGUI's
    UI is first initialized.
---
 .../java/org/apache/jmeter/testbeans/gui/TestBeanGUI.java    | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/core/src/main/java/org/apache/jmeter/testbeans/gui/TestBeanGUI.java b/src/core/src/main/java/org/apache/jmeter/testbeans/gui/TestBeanGUI.java
index a3d4bbb..7016849 100644
--- a/src/core/src/main/java/org/apache/jmeter/testbeans/gui/TestBeanGUI.java
+++ b/src/core/src/main/java/org/apache/jmeter/testbeans/gui/TestBeanGUI.java
@@ -122,6 +122,9 @@ public class TestBeanGUI extends AbstractJMeterGuiComponent implements
JMeterGUI
     /** Whether the GUI components have been created. */
     private boolean initialized = false;
 
+    /** The list of categories this UI participates in */
+    private List<String> menuCategories;
+
     static {
         List<String> paths = new LinkedList<>();
         paths.add("org.apache.jmeter.testbeans.gui");// $NON-NLS-1$
@@ -298,6 +301,8 @@ public class TestBeanGUI extends AbstractJMeterGuiComponent implements
JMeterGUI
     public void configure(TestElement element) {
         if (!initialized){
             init();
+            // It populates GUI_CLASS bean property which is used for icon display
+            setupGuiClassesList();
         }
         clearGui();
         super.configure(element);
@@ -368,7 +373,11 @@ public class TestBeanGUI extends AbstractJMeterGuiComponent implements
JMeterGUI
      * @return matches
      */
     private List<String> setupGuiClassesList() {
-        List<String> menuCategories = new ArrayList<>();
+        List<String> menuCategories = this.menuCategories;
+        if (menuCategories != null) {
+            return menuCategories;
+        }
+        menuCategories = new ArrayList<>(1);
         // TODO: there must be a nicer way...
         BeanDescriptor bd = beanInfo.getBeanDescriptor();
         if (Assertion.class.isAssignableFrom(testBeanClass)) {
@@ -403,6 +412,7 @@ public class TestBeanGUI extends AbstractJMeterGuiComponent implements
JMeterGUI
             menuCategories.add(MenuFactory.TIMERS);
             bd.setValue(TestElement.GUI_CLASS, AbstractTimerGui.class.getName());
         }
+        this.menuCategories = menuCategories;
         return menuCategories;
     }
 


Mime
View raw message