jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1521971 - in /jmeter/trunk: src/core/org/apache/jmeter/gui/ src/core/org/apache/jmeter/gui/tree/ src/core/org/apache/jmeter/testelement/ src/reports/org/apache/jmeter/report/gui/tree/ xdocs/
Date Wed, 11 Sep 2013 18:18:01 GMT
Author: sebb
Date: Wed Sep 11 18:18:00 2013
New Revision: 1521971

URL: http://svn.apache.org/r1521971
Log:
Tidy up use of TestElement.ENABLED; use TestElement.isEnabled()/setEnabled() throughout
Bugzilla Id: 55548

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/AbstractJMeterGuiComponent.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeModel.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java
    jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java
    jmeter/trunk/src/core/org/apache/jmeter/testelement/TestElement.java
    jmeter/trunk/src/reports/org/apache/jmeter/report/gui/tree/ReportTreeModel.java
    jmeter/trunk/src/reports/org/apache/jmeter/report/gui/tree/ReportTreeNode.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/AbstractJMeterGuiComponent.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/AbstractJMeterGuiComponent.java?rev=1521971&r1=1521970&r2=1521971&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/AbstractJMeterGuiComponent.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/AbstractJMeterGuiComponent.java Wed Sep 11
18:18:00 2013
@@ -32,8 +32,6 @@ import javax.swing.border.Border;
 
 import org.apache.jmeter.gui.util.VerticalPanel;
 import org.apache.jmeter.testelement.TestElement;
-import org.apache.jmeter.testelement.property.BooleanProperty;
-import org.apache.jmeter.testelement.property.NullProperty;
 import org.apache.jmeter.testelement.property.StringProperty;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jmeter.visualizers.Printable;
@@ -190,11 +188,7 @@ public abstract class AbstractJMeterGuiC
     @Override
     public void configure(TestElement element) {
         setName(element.getName());
-        if (element.getProperty(TestElement.ENABLED) instanceof NullProperty) {
-            enabled = true;
-        } else {
-            enabled = element.getPropertyAsBoolean(TestElement.ENABLED);
-        }
+        enabled = element.isEnabled();
         getCommentPanel().setText(element.getComment());
     }
 
@@ -236,7 +230,7 @@ public abstract class AbstractJMeterGuiC
 
         // This stores the state of the TestElement
         log.debug("setting element to enabled: " + enabled);
-        mc.setProperty(new BooleanProperty(TestElement.ENABLED, enabled));
+        mc.setEnabled(enabled);
         mc.setComment(getComment());
     }
 

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeModel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeModel.java?rev=1521971&r1=1521970&r2=1521971&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeModel.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeModel.java Wed Sep 11 18:18:00
2013
@@ -34,7 +34,6 @@ import org.apache.jmeter.gui.JMeterGUICo
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.testelement.TestPlan;
 import org.apache.jmeter.testelement.WorkBench;
-import org.apache.jmeter.testelement.property.NullProperty;
 import org.apache.jorphan.collections.HashTree;
 import org.apache.jorphan.collections.ListedHashTree;
 
@@ -135,13 +134,8 @@ public class JMeterTreeModel extends Def
         // This check the state of the TestElement and if returns false it
         // disable the loaded node
         try {
-            if (component.getProperty(TestElement.ENABLED) instanceof NullProperty
-                    || component.getPropertyAsBoolean(TestElement.ENABLED)) {
-                newNode.setEnabled(true);
-            } else {
-                newNode.setEnabled(false);
-            }
-        } catch (Exception e) {
+            newNode.setEnabled(component.isEnabled());
+        } catch (Exception e) { // TODO - can this eever happen?
             newNode.setEnabled(true);
         }
 

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java?rev=1521971&r1=1521970&r2=1521971&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java Wed Sep 11 18:18:00
2013
@@ -35,9 +35,7 @@ import javax.swing.tree.TreeNode;
 import org.apache.jmeter.gui.GUIFactory;
 import org.apache.jmeter.gui.GuiPackage;
 import org.apache.jmeter.testbeans.TestBean;
-import org.apache.jmeter.testelement.AbstractTestElement;
 import org.apache.jmeter.testelement.TestElement;
-import org.apache.jmeter.testelement.property.BooleanProperty;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
 
@@ -64,11 +62,11 @@ public class JMeterTreeNode extends Defa
     }
 
     public boolean isEnabled() {
-        return ((AbstractTestElement) getTestElement()).getPropertyAsBoolean(TestElement.ENABLED);
+        return getTestElement().isEnabled();
     }
 
     public void setEnabled(boolean enabled) {
-        getTestElement().setProperty(new BooleanProperty(TestElement.ENABLED, enabled));
+        getTestElement().setEnabled(enabled);
         treeModel.nodeChanged(this);
     }
     

Modified: jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java?rev=1521971&r1=1521970&r2=1521971&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java Wed Sep 11
18:18:00 2013
@@ -621,6 +621,7 @@ public abstract class AbstractTestElemen
         return getProperty(TestElement.ENABLED) instanceof NullProperty || getPropertyAsBoolean(TestElement.ENABLED);
     }
 
+    @Override
     public void setEnabled(boolean enabled) {
         setProperty(new BooleanProperty(TestElement.ENABLED, enabled));
     }

Modified: jmeter/trunk/src/core/org/apache/jmeter/testelement/TestElement.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testelement/TestElement.java?rev=1521971&r1=1521970&r2=1521971&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/testelement/TestElement.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/testelement/TestElement.java Wed Sep 11 18:18:00
2013
@@ -68,6 +68,12 @@ public interface TestElement extends Clo
     boolean isEnabled();
 
     /**
+     * Set the enabled status of the test element
+     * @param enabled the status to set
+     */
+    void setEnabled(boolean enabled);
+
+    /**
      * Returns true or false whether the element is the running version.
      */
     boolean isRunningVersion();

Modified: jmeter/trunk/src/reports/org/apache/jmeter/report/gui/tree/ReportTreeModel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/reports/org/apache/jmeter/report/gui/tree/ReportTreeModel.java?rev=1521971&r1=1521970&r2=1521971&view=diff
==============================================================================
--- jmeter/trunk/src/reports/org/apache/jmeter/report/gui/tree/ReportTreeModel.java (original)
+++ jmeter/trunk/src/reports/org/apache/jmeter/report/gui/tree/ReportTreeModel.java Wed Sep
11 18:18:00 2013
@@ -33,7 +33,6 @@ import org.apache.jmeter.gui.JMeterGUICo
 import org.apache.jmeter.report.gui.tree.ReportTreeNode;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.testelement.ReportPlan;
-import org.apache.jmeter.testelement.property.NullProperty;
 import org.apache.jorphan.collections.HashTree;
 import org.apache.jorphan.collections.ListedHashTree;
 
@@ -104,13 +103,8 @@ public class ReportTreeModel extends Def
         // This check the state of the TestElement and if returns false it
         // disable the loaded node
         try {
-            if (component.getProperty(TestElement.ENABLED) instanceof NullProperty
-                    || component.getPropertyAsBoolean(TestElement.ENABLED)) {
-                newNode.setEnabled(true);
-            } else {
-                newNode.setEnabled(false);
-            }
-        } catch (Exception e) {
+            newNode.setEnabled(component.isEnabled());
+        } catch (Exception e) { // TODO can this ever happen?
             newNode.setEnabled(true);
         }
 

Modified: jmeter/trunk/src/reports/org/apache/jmeter/report/gui/tree/ReportTreeNode.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/reports/org/apache/jmeter/report/gui/tree/ReportTreeNode.java?rev=1521971&r1=1521970&r2=1521971&view=diff
==============================================================================
--- jmeter/trunk/src/reports/org/apache/jmeter/report/gui/tree/ReportTreeNode.java (original)
+++ jmeter/trunk/src/reports/org/apache/jmeter/report/gui/tree/ReportTreeNode.java Wed Sep
11 18:18:00 2013
@@ -32,9 +32,7 @@ import org.apache.jmeter.gui.GUIFactory;
 import org.apache.jmeter.gui.ReportGuiPackage;
 import org.apache.jmeter.gui.tree.NamedTreeNode;
 import org.apache.jmeter.testbeans.TestBean;
-import org.apache.jmeter.testelement.AbstractTestElement;
 import org.apache.jmeter.testelement.TestElement;
-import org.apache.jmeter.testelement.property.BooleanProperty;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
 
@@ -60,13 +58,11 @@ public class ReportTreeNode extends Defa
     }
 
     public boolean isEnabled() {
-        return ((AbstractTestElement) getTestElement())
-                .getPropertyAsBoolean(TestElement.ENABLED);
+        return getTestElement().isEnabled();
     }
 
     public void setEnabled(boolean enabled) {
-        getTestElement().setProperty(
-                new BooleanProperty(TestElement.ENABLED, enabled));
+        getTestElement().setEnabled(enabled);
         treeModel.nodeChanged(this);
     }
 

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1521971&r1=1521970&r2=1521971&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Wed Sep 11 18:18:00 2013
@@ -454,11 +454,12 @@ Previously the default was 1, which coul
 <li><bugzilla>54903</bugzilla> - Remove the dependency on the Activation
Framework. Contributed by Emmanuel Bourg (ebourg at apache.org)</li>
 <li>Moved commons-lang (2.6) to lib/doc as it's only needed by Velocity.</li>
 <li>Re-organised and simplified NOTICE and LICENSE files.</li>
-<li><bugzilla>55411</bugzilla> -  NativeCommand could be useful elsewhere.
Copied code to o.a.jorphan.exec.</li>
+<li><bugzilla>55411</bugzilla> - NativeCommand could be useful elsewhere.
Copied code to o.a.jorphan.exec.</li>
 <li><bugzilla>55435</bugzilla> - ComboStringEditor could be simplified
to make most settings final</li>
 <li><bugzilla>55436</bugzilla> - ComboStringEditor should implement ClearGui</li>
 <li><bugzilla>55463</bugzilla> - Component.requestFocus() is discouraged;
use requestFocusInWindow() instead</li>
 <li><bugzilla>55486</bugzilla> - New JMeter Logo. Contributed by UBIK Load
Pack (support at ubikloadpack.com)</li>
+<li><bugzilla>55548</bugzilla> - Tidy up use of TestElement.ENABLED; use
TestElement.isEnabled()/setEnabled() throughout</li>
 </ul>
 
 <h2>Thanks</h2>



Mime
View raw message