You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by se...@apache.org on 2011/11/26 15:21:10 UTC

svn commit: r1206441 - /jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java

Author: sebb
Date: Sat Nov 26 14:21:09 2011
New Revision: 1206441

URL: http://svn.apache.org/viewvc?rev=1206441&view=rev
Log:
Fix up validation for NO_OTHER - typeEditor can provide the tags
Add check for unconfigured properties.

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java?rev=1206441&r1=1206440&r2=1206441&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java Sat Nov 26 14:21:09 2011
@@ -107,7 +107,15 @@ public class GenericTestBeanCustomizer e
 
     public static final String ORDER = "order"; //$NON-NLS-1$
 
-    /** Array of permissible values. Must be provided if {@link #NOT_OTHER} is TRUE */
+    /**
+     * Array of permissible values.
+     * <p>
+     * Must be provided if:
+     * <ul>
+     * <li>{@link #NOT_OTHER} is TRUE, and</li>
+     * <li>{@link PropertyEditor#getTags()} is null</li>
+     * </ul>
+     */
     public static final String TAGS = "tags"; //$NON-NLS-1$
 
     /** 
@@ -207,8 +215,6 @@ public class GenericTestBeanCustomizer e
                 continue;
             }
 
-            validateAttributes(descriptor);
-
             PropertyEditor propertyEditor;
             Object guiType = descriptor.getValue(GUITYPE);
             if (guiType instanceof GuiEditor) {
@@ -248,6 +254,8 @@ public class GenericTestBeanCustomizer e
                 log.debug("Property " + name + " has property editor " + propertyEditor);
             }
 
+            validateAttributes(descriptor, propertyEditor);
+
             if (!propertyEditor.supportsCustomEditor()) {
                 propertyEditor = createWrapperEditor(propertyEditor, descriptor);
 
@@ -281,13 +289,14 @@ public class GenericTestBeanCustomizer e
     /**
      * Validate the descriptor attributes.
      * 
-     * @param pd
+     * @param pd the descriptor
+     * @param pe the propertyEditor
      */
-    private static void validateAttributes(PropertyDescriptor pd) {
+    private static void validateAttributes(PropertyDescriptor pd, PropertyEditor pe) {
         if (notNull(pd) && pd.getValue(DEFAULT) == null) {
             log.warn(getDetails(pd) + " requires a value but does not provide a default.");
         }
-        if (notOther(pd) && pd.getValue(TAGS) == null) {
+        if (notOther(pd) && pd.getValue(TAGS) == null && pe.getTags() == null) {
             log.warn(getDetails(pd) + " does not have tags but other values are not allowed.");
         }
         if (!notNull(pd)) {
@@ -296,6 +305,9 @@ public class GenericTestBeanCustomizer e
                 log.warn(getDetails(pd) + " allows null but is a primitive type");
             }
         }
+        if (!pd.attributeNames().hasMoreElements()) {
+            log.warn(getDetails(pd) + " does not appear to have been configured");            
+        }
     }
 
     /**