jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1509647 - in /jmeter/trunk: src/core/org/apache/jmeter/JMeter.java xdocs/changes.xml
Date Fri, 02 Aug 2013 12:02:03 GMT
Author: pmouawad
Date: Fri Aug  2 12:02:03 2013
New Revision: 1509647

URL: http://svn.apache.org/r1509647
Log:
Bug 55334 - Adding Include Controller to test plan (made of Include Controllers) without saving
TestPlan leads to included code not being taken into account until save
Bugzilla Id: 55334

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java?rev=1509647&r1=1509646&r2=1509647&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/JMeter.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/JMeter.java Fri Aug  2 12:02:03 2013
@@ -842,16 +842,7 @@ public class JMeter implements JMeterPlu
                 TestElement item = (TestElement) o;
                 if (item.isEnabled()) {
                     if (item instanceof ReplaceableController) {
-                        ReplaceableController rc;
-
-                        // TODO this bit of code needs to be tidied up
-                        // Unfortunately ModuleController is in components, not core
-                        if (item.getClass().getName().equals("org.apache.jmeter.control.ModuleController")){
// Bug 47165
-                            rc = (ReplaceableController) item;
-                        } else {
-                            // HACK: force the controller to load its tree
-                            rc = (ReplaceableController) item.clone();
-                        }
+                        ReplaceableController rc = ensureReplaceableControllerIsLoaded(item);
 
                         HashTree subTree = tree.getTree(item);
                         if (subTree != null) {
@@ -861,9 +852,7 @@ public class JMeter implements JMeterPlu
                                 tree.replace(item, rc);
                                 tree.set(rc, replacementTree);
                             }
-                        } else { // null subTree
-                            convertSubTree(tree.getTree(item));
-                        }
+                        } 
                     } else { // not Replaceable Controller
                         convertSubTree(tree.getTree(item));
                     }
@@ -876,10 +865,11 @@ public class JMeter implements JMeterPlu
                     // Replacement only needs to occur when starting the engine
                     // @see StandardJMeterEngine.run()
                     if (item.getUserObject() instanceof ReplaceableController) {
-                        ReplaceableController rc =
-                            (ReplaceableController) item.getTestElement();
-                        HashTree subTree = tree.getTree(item);
+                        TestElement controllerAsItem = item.getTestElement();
+                        ReplaceableController rc = ensureReplaceableControllerIsLoaded(controllerAsItem);
 
+                        HashTree subTree = tree.getTree(item);
+                        
                         if (subTree != null) {
                             HashTree replacementTree = rc.getReplacementSubTree();
                             if (replacementTree != null) {
@@ -900,6 +890,25 @@ public class JMeter implements JMeterPlu
         }
     }
 
+    /**
+     * Ensures the {@link ReplaceableController} is loaded
+     * @param item {@link TestElement}
+     * @return {@link ReplaceableController} loaded
+     */
+    private static ReplaceableController ensureReplaceableControllerIsLoaded(
+            TestElement item) {
+        ReplaceableController rc;
+        // TODO this bit of code needs to be tidied up
+        // Unfortunately ModuleController is in components, not core
+        if (item.getClass().getName().equals("org.apache.jmeter.control.ModuleController")){
// Bug 47165
+            rc = (ReplaceableController) item;
+        } else {
+            // HACK: force the controller to load its tree
+            rc = (ReplaceableController) item.clone();
+        }
+        return rc;
+    }
+
     private JMeterEngine doRemoteInit(String hostName, HashTree testTree) {
         JMeterEngine engine = null;
         try {

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1509647&r1=1509646&r2=1509647&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Fri Aug  2 12:02:03 2013
@@ -238,6 +238,7 @@ Previously the default was 1, which coul
 <li><bugzilla>54985</bugzilla> - Make Transaction Controller set Response
Code of Generated Parent Sampler to response code of first failing child in case of failure
of one of its children</li>
 <li><bugzilla>54950</bugzilla> - ModuleController : Changes to referenced
Module are not taken into account if changes occur after first run and referenced node is
disabled</li>
 <li><bugzilla>55201</bugzilla> - ForEach controller excludes start index
and includes end index (clarified documentation)</li>
+<li><bugzilla>55334</bugzilla> - Adding Include Controller to test plan
(made of Include Controllers) without saving TestPlan leads to included code not being taken
into account until save</li>
 </ul>
 
 <h3>Listeners</h3>



Mime
View raw message