jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1406416 - in /jmeter/trunk/src/core/org/apache/jmeter/util: JSR223BeanInfoSupport.java ScriptingBeanInfoSupport.java
Date Wed, 07 Nov 2012 01:37:03 GMT
Author: sebb
Date: Wed Nov  7 01:37:03 2012
New Revision: 1406416

URL: http://svn.apache.org/viewvc?rev=1406416&view=rev
Log:
createPropertyGroup does not work properly if called by a sub-class of ScriptingBeanInfoSupport
Bugzilla Id: 54107

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/util/JSR223BeanInfoSupport.java
    jmeter/trunk/src/core/org/apache/jmeter/util/ScriptingBeanInfoSupport.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/util/JSR223BeanInfoSupport.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/JSR223BeanInfoSupport.java?rev=1406416&r1=1406415&r2=1406416&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/util/JSR223BeanInfoSupport.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/util/JSR223BeanInfoSupport.java Wed Nov  7 01:37:03
2012
@@ -18,7 +18,6 @@
 
 package org.apache.jmeter.util;
 
-import java.beans.PropertyDescriptor;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -30,8 +29,6 @@ import javax.script.ScriptEngineManager;
  * Parent class to handle common GUI design for JSR223 test elements
  */
 public abstract class JSR223BeanInfoSupport extends ScriptingBeanInfoSupport {
-    private static final String CACHE_KEY = "cacheKey";
-    private static final String CACHE_KEY_GROUP = "cacheKey_group";
 
     private static final String[] LANGUAGE_TAGS;
 
@@ -53,14 +50,6 @@ public abstract class JSR223BeanInfoSupp
 
     protected JSR223BeanInfoSupport(Class<?> beanClass) {
         super(beanClass, LANGUAGE_TAGS);
-        
-        PropertyDescriptor p = property(CACHE_KEY);
-        p.setValue(NOT_UNDEFINED, Boolean.TRUE);
-        p.setValue(DEFAULT, ""); // $NON-NLS-1$
-
-        createPropertyGroup(CACHE_KEY_GROUP, new String[] { 
-                CACHE_KEY });
-
     }
 
 }

Modified: jmeter/trunk/src/core/org/apache/jmeter/util/ScriptingBeanInfoSupport.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/ScriptingBeanInfoSupport.java?rev=1406416&r1=1406415&r2=1406416&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/util/ScriptingBeanInfoSupport.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/util/ScriptingBeanInfoSupport.java Wed Nov  7
01:37:03 2012
@@ -56,6 +56,38 @@ public abstract class ScriptingBeanInfoS
         createPropertyGroup("filenameGroup",  // $NON-NLS-1$
                 new String[] { "filename" }); // $NON-NLS-1$
 
+        /*
+         * If we are creating a JSR223 element, add the cache key property.
+         * 
+         * Note that this cannot be done in the JSR223BeanInfoSupport class
+         * because that causes problems with the group; its properties are
+         * not always set up before they are needed. This cause various
+         * issues with the GUI:
+         * - wrong field attributes (should not allow null)
+         * - sometimes GUI is completely mangled
+         * - field appears at start rather than at end.
+         * - the following warning is logged:
+         * jmeter.testbeans.gui.GenericTestBeanCustomizer: 
+         * org.apache.jmeter.util.JSR223TestElement#cacheKey does not appear to have been
configured
+         * 
+         * Adding the group here solves these issues, and it's also
+         * possible to add the key just before the script panel
+         * to which it relates.
+         * 
+         * It's not yet clear why this should be, but it looks as though
+         * createPropertyGroup does not work properly if it is called from
+         * any subclasses of this class.
+         * 
+         */
+        if (JSR223TestElement.class.isAssignableFrom(beanClass) ) {
+            p = property("cacheKey"); // $NON-NLS-1$
+            p.setValue(NOT_UNDEFINED, Boolean.TRUE);
+            p.setValue(DEFAULT, ""); // $NON-NLS-1$
+    
+            createPropertyGroup("cacheKey_group", // $NON-NLS-1$
+                new String[] { "cacheKey" }); // $NON-NLS-1$
+        }
+
         p = property("script"); // $NON-NLS-1$
         p.setValue(NOT_UNDEFINED, Boolean.TRUE);
         p.setValue(DEFAULT, ""); // $NON-NLS-1$



Mime
View raw message