jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1718720 - in /jmeter/trunk: src/core/org/apache/jmeter/gui/action/CheckDirty.java src/core/org/apache/jmeter/gui/action/Save.java src/core/org/apache/jmeter/gui/tree/JMeterTreeModel.java xdocs/changes.xml
Date Tue, 08 Dec 2015 21:56:27 GMT
Author: pmouawad
Date: Tue Dec  8 21:56:27 2015
New Revision: 1718720

URL: http://svn.apache.org/viewvc?rev=1718720&view=rev
Log:
Bug 58699 : Workbench changes neither saved nor prompted for saving upon close
#resolve #45
Bugzilla Id: 58699

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/CheckDirty.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/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/CheckDirty.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/CheckDirty.java?rev=1718720&r1=1718719&r2=1718720&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/CheckDirty.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/CheckDirty.java Tue Dec  8 21:56:27
2015
@@ -28,6 +28,7 @@ import java.util.Set;
 import org.apache.jmeter.gui.GuiPackage;
 import org.apache.jmeter.gui.tree.JMeterTreeNode;
 import org.apache.jmeter.testelement.TestElement;
+import org.apache.jmeter.testelement.WorkBench;
 import org.apache.jorphan.collections.HashTree;
 import org.apache.jorphan.collections.HashTreeTraverser;
 import org.apache.jorphan.collections.ListedHashTree;
@@ -87,6 +88,9 @@ public class CheckDirty extends Abstract
         } else if (action.equals(ActionNames.ADD_ALL)) {
             previousGuiItems.clear();
             GuiPackage.getInstance().getTreeModel().getTestPlan().traverse(this);
+            if (isWorkbenchSaveable()) {
+                GuiPackage.getInstance().getTreeModel().getWorkBench().traverse(this);
+            }
         } else if (action.equals(ActionNames.CHECK_REMOVE)) {
             GuiPackage guiPackage = GuiPackage.getInstance();
             JMeterTreeNode[] nodes = guiPackage.getTreeListener().getSelectedNodes();
@@ -99,6 +103,7 @@ public class CheckDirty extends Abstract
                 removeMode = false;
             }
         }
+        
         // If we are merging in another test plan, we know the test plan is dirty now
         if(action.equals(ActionNames.SUB_TREE_MERGED)) {
             dirty = true;
@@ -109,6 +114,14 @@ public class CheckDirty extends Abstract
             try {
                 HashTree wholeTree = GuiPackage.getInstance().getTreeModel().getTestPlan();
                 wholeTree.traverse(this);
+                
+                // check the workbench for modification
+                if(!dirty) {
+                    if (isWorkbenchSaveable()) {
+                        HashTree workbench = GuiPackage.getInstance().getTreeModel().getWorkBench();
+                        workbench.traverse(this);
+                    }
+                }
             } finally {
                 checkMode = false;
             }
@@ -117,6 +130,14 @@ public class CheckDirty extends Abstract
     }
 
     /**
+     * check if the workbench should be saved
+     */
+    private boolean isWorkbenchSaveable() {
+        JMeterTreeNode workbenchNode = (JMeterTreeNode) ((JMeterTreeNode) GuiPackage.getInstance().getTreeModel().getRoot()).getChildAt(1);
+        return ((WorkBench) workbenchNode.getUserObject()).getSaveWorkBench();
+    }
+
+    /**
      * The tree traverses itself depth-first, calling addNode for each
      * object it encounters as it goes.
      */

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=1718720&r1=1718719&r2=1718720&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 Tue Dec  8 21:56:27 2015
@@ -109,8 +109,7 @@ public class Save implements Command {
     /**
      * Constructor for the Save object.
      */
-    public Save() {
-    }
+    public Save() {}
 
     /**
      * Gets the ActionNames attribute of the Save object.
@@ -167,8 +166,7 @@ public class Save implements Command {
             fullSave = true;
             HashTree testPlan = GuiPackage.getInstance().getTreeModel().getTestPlan();
             // If saveWorkBench 
-            JMeterTreeNode workbenchNode = (JMeterTreeNode) ((JMeterTreeNode) GuiPackage.getInstance().getTreeModel().getRoot()).getChildAt(1);
-            if (((WorkBench)workbenchNode.getUserObject()).getSaveWorkBench()) {
+            if (isWorkbenchSaveable()) {
                 HashTree workbench = GuiPackage.getInstance().getTreeModel().getWorkBench();
                 testPlan.add(workbench);
             }
@@ -227,6 +225,10 @@ public class Save implements Command {
             SaveService.saveTree(subTree, ostream);
             if (fullSave) { // Only update the stored copy of the tree for a full save
                 subTree = GuiPackage.getInstance().getTreeModel().getTestPlan(); // refetch,
because convertSubTree affects it
+                if (isWorkbenchSaveable()) {
+                    HashTree workbench = GuiPackage.getInstance().getTreeModel().getWorkBench();
+                    subTree.add(workbench);
+                }
                 ActionRouter.getInstance().doActionNow(new ActionEvent(subTree, e.getID(),
ActionNames.SUB_TREE_SAVED));
             }
             
@@ -392,6 +394,14 @@ public class Save implements Command {
         }
         return expiredFiles;
     }
+    
+    /**
+     * check if the workbench should be saved
+     */
+    private boolean isWorkbenchSaveable() {
+        JMeterTreeNode workbenchNode = (JMeterTreeNode) ((JMeterTreeNode) GuiPackage.getInstance().getTreeModel().getRoot()).getChildAt(1);
+        return ((WorkBench) workbenchNode.getUserObject()).getSaveWorkBench();
+    }
 
     /**
      * Check nodes does not contain a node of type TestPlan or ThreadGroup

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=1718720&r1=1718719&r2=1718720&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 Tue Dec  8 21:56:27
2015
@@ -48,9 +48,6 @@ public class JMeterTreeModel extends Def
 
     public JMeterTreeModel() {
         this(new TestPlanGui().createTestElement(),new WorkBenchGui().createTestElement());
-//        super(new JMeterTreeNode(new WorkBenchGui().createTestElement(), null));
-//        TestElement tp = new TestPlanGui().createTestElement();
-//        initTree(tp);
     }
 
     /**
@@ -62,9 +59,6 @@ public class JMeterTreeModel extends Def
     @Deprecated
     public JMeterTreeModel(Object o) {
         this(new TestPlan(),new WorkBench());
-//      super(new JMeterTreeNode(new WorkBench(), null));
-//      TestElement tp = new TestPlan();
-//      initTree(tp, new WorkBench());
     }
 
     /**

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1718720&r1=1718719&r2=1718720&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Tue Dec  8 21:56:27 2015
@@ -144,6 +144,7 @@ Summary
 <li><bug>58689</bug>Add shortcuts to expand / collapse a part of the tree.
Contributed by Benoit Wiart (benoit dot wiart at gmail.com)</li>
 <li><bug>58696</bug>Create Ant task to setup Eclipse project</li>
 <li><bug>58653</bug>New JMeter Dashboard/Report with Dynamic Graphs, Tables
to help analyzing load test results. Developed by Ubik-Ingenierie and contributed by Decathlon
S.A. and Ubik-Ingenierie/UbikLoadPack</li>
+<li><bug>58699</bug>Workbench changes neither saved nor prompted for saving
upon close. Contributed by Benoit Wiart (benoit dot wiart at gmail.com)</li>
 </ul>
 <ch_section>Non-functional changes</ch_section>
 <ul>



Mime
View raw message