jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1465406 - in /jmeter/trunk: src/core/org/apache/jmeter/control/gui/ src/core/org/apache/jmeter/gui/action/ src/core/org/apache/jmeter/gui/tree/ src/core/org/apache/jmeter/resources/ src/core/org/apache/jmeter/testelement/ xdocs/
Date Sun, 07 Apr 2013 14:55:37 GMT
Author: pmouawad
Date: Sun Apr  7 14:55:37 2013
New Revision: 1465406

URL: http://svn.apache.org/r1465406
Log:
Bug 42428 - Workbench not saved with Test Plan
Bugzilla Id: 42428

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/control/gui/WorkBenchGui.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/Save.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeModel.java
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
    jmeter/trunk/src/core/org/apache/jmeter/testelement/WorkBench.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/control/gui/WorkBenchGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/control/gui/WorkBenchGui.java?rev=1465406&r1=1465405&r2=1465406&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/control/gui/WorkBenchGui.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/control/gui/WorkBenchGui.java Sun Apr  7 14:55:37
2013
@@ -21,12 +21,14 @@ package org.apache.jmeter.control.gui;
 import java.awt.BorderLayout;
 import java.util.Collection;
 
+import javax.swing.JCheckBox;
 import javax.swing.JMenu;
 import javax.swing.JPopupMenu;
 
 import org.apache.jmeter.gui.AbstractJMeterGuiComponent;
 import org.apache.jmeter.gui.action.ActionNames;
 import org.apache.jmeter.gui.util.MenuFactory;
+import org.apache.jmeter.gui.util.VerticalPanel;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.testelement.WorkBench;
 import org.apache.jmeter.util.JMeterUtils;
@@ -38,6 +40,8 @@ import org.apache.jmeter.util.JMeterUtil
  */
 public class WorkBenchGui extends AbstractJMeterGuiComponent {
     private static final long serialVersionUID = 240L;
+    // This check-box defines whether to save  WorkBench content or not
+    private JCheckBox saveWorkBench;
 
     /**
      * Create a new WorkbenchGui.
@@ -72,9 +76,34 @@ public class WorkBenchGui extends Abstra
     @Override
     public void modifyTestElement(TestElement wb) {
         super.configureTestElement(wb);
+        ((WorkBench)wb).setSaveWorkBench(saveWorkBench.isSelected());
     }
 
     /**
+     * A newly created component can be initialized with the contents of a Test
+     * Element object by calling this method. The component is responsible for
+     * querying the Test Element object for the relevant information to display
+     * in its GUI.
+     *
+     * @param el
+     *            the TestElement to configure
+     */
+    @Override
+    public void configure(TestElement el) {
+        super.configure(el);
+        if (el instanceof WorkBench) {
+            WorkBench tp = (WorkBench) el;
+            saveWorkBench.setSelected(tp.getSaveWorkBench());
+        }
+    }
+    
+    @Override
+    public void clearGui() {
+        super.clearGui();
+        saveWorkBench.setSelected(false);
+    }
+    
+    /**
      * When a user right-clicks on the component in the test tree, or selects
      * the edit menu when the component is selected, the component will be asked
      * to return a JPopupMenu that provides all the options available to the
@@ -115,9 +144,15 @@ public class WorkBenchGui extends Abstra
      * Initialize the components and layout of this component.
      */
     private void init() {
-        setLayout(new BorderLayout());
+        setLayout(new BorderLayout(0, 5));
+
         setBorder(makeBorder());
 
         add(makeTitlePanel(), BorderLayout.NORTH);
+        VerticalPanel workBenchPropsPanel = new VerticalPanel(5, 0);
+
+        saveWorkBench = new JCheckBox(JMeterUtils.getResString("save_workbench"));
+        workBenchPropsPanel.add(saveWorkBench);
+        add(workBenchPropsPanel, BorderLayout.CENTER);
     }
 }

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/Save.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/Save.java?rev=1465406&r1=1465405&r2=1465406&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/Save.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/Save.java Sun Apr  7 14:55:37 2013
@@ -36,6 +36,7 @@ import org.apache.jmeter.gui.tree.JMeter
 import org.apache.jmeter.gui.util.FileDialoger;
 import org.apache.jmeter.save.SaveService;
 import org.apache.jmeter.testelement.TestElement;
+import org.apache.jmeter.testelement.WorkBench;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.collections.HashTree;
 import org.apache.jorphan.logging.LoggingManager;
@@ -95,7 +96,14 @@ public class Save implements Command {
             subTree = GuiPackage.getInstance().getCurrentSubTree();
         } else {
             fullSave = true;
-            subTree = GuiPackage.getInstance().getTreeModel().getTestPlan();
+            HashTree testPlan = GuiPackage.getInstance().getTreeModel().getTestPlan();
+            // If saveWorkBench 
+            JMeterTreeNode workbenchNode = (JMeterTreeNode) ((JMeterTreeNode) GuiPackage.getInstance().getTreeModel().getRoot()).getChildAt(1);
+            if (((WorkBench)workbenchNode.getUserObject()).getSaveWorkBench()) {
+                HashTree workbench = GuiPackage.getInstance().getTreeModel().getWorkBench();
+                testPlan.add(workbench);
+            }
+            subTree = testPlan;
         }
 
         String updateFile = GuiPackage.getInstance().getTestPlanFile();

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=1465406&r1=1465405&r2=1465406&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 Sun Apr  7 14:55:37
2013
@@ -195,6 +195,10 @@ public class JMeterTreeModel extends Def
         return getCurrentSubTree((JMeterTreeNode) ((JMeterTreeNode) this.getRoot()).getChildAt(0));
     }
 
+    public HashTree getWorkBench() {
+        return getCurrentSubTree((JMeterTreeNode) ((JMeterTreeNode) this.getRoot()).getChildAt(1));
+    }
+
     /**
      * Clear the test plan, and use default node for test plan and workbench.
      *

Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=1465406&r1=1465405&r2=1465406&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties Sun Apr  7 14:55:37
2013
@@ -878,6 +878,7 @@ save_threadname=Save Thread Name
 save_time=Save Elapsed Time
 save_timestamp=Save Time Stamp
 save_url=Save URL
+save_workbench=Save WorkBench
 sbind=Single bind/unbind
 scheduler=Scheduler
 scheduler_configuration=Scheduler Configuration

Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties?rev=1465406&r1=1465405&r2=1465406&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties Sun Apr  7 14:55:37
2013
@@ -871,6 +871,7 @@ save_threadname=Nom d'unit\u00E9
 save_time=Temps \u00E9coul\u00E9
 save_timestamp=Horodatage
 save_url=URL
+save_workbench=Sauvegarder le plan de travail
 sbind=Simple connexion/d\u00E9connexion
 scheduler=Programmateur de d\u00E9marrage
 scheduler_configuration=Configuration du programmateur

Modified: jmeter/trunk/src/core/org/apache/jmeter/testelement/WorkBench.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testelement/WorkBench.java?rev=1465406&r1=1465405&r2=1465406&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/testelement/WorkBench.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/testelement/WorkBench.java Sun Apr  7 14:55:37
2013
@@ -21,6 +21,9 @@ package org.apache.jmeter.testelement;
 public class WorkBench extends AbstractTestElement {
 
     private static final long serialVersionUID = 240L;
+    // Used in Save.java to define whether to save WorkBench content or not.
+    public static final String SAVE_WORKBENCH = "WorkBench.save";
+
 
     /**
      * Constructor for the WorkBench object.
@@ -31,4 +34,12 @@ public class WorkBench extends AbstractT
 
     public WorkBench() {
     }
+
+    public boolean getSaveWorkBench() {
+        return getPropertyAsBoolean(SAVE_WORKBENCH, false);
+    }
+
+    public void setSaveWorkBench(boolean saveWorkBench) {
+        setProperty(SAVE_WORKBENCH, saveWorkBench, false);
+    }
 }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1465406&r1=1465405&r2=1465406&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sun Apr  7 14:55:37 2013
@@ -180,6 +180,7 @@ of JMeter crash (very rare). To revert t
 <ul>
 <li><bugzilla>54584</bugzilla> - MongoDB plugin</li>
 <li><bugzilla>54669</bugzilla> - Add flag forcing non-GUI JVM to exit after
test</li>
+<li><bugzilla>42428</bugzilla> - Workbench not saved with Test Plan</li>
 </ul>
 
 <h2>Non-functional changes</h2>



Mime
View raw message