[prev in list] [next in list] [prev in thread] [next in thread]
List: slide-dev
Subject: svn commit: r1195404 - in /jakarta/jmeter/trunk:
From: pmouawad () apache ! org
Date: 2011-10-31 10:50:11
Message-ID: 20111031105012.619C0238897A () eris ! apache ! org
[Download RAW message or body]
Author: pmouawad
Date: Mon Oct 31 10:50:11 2011
New Revision: 1195404
URL: http://svn.apache.org/viewvc?rev=1195404&view=rev
Log:
Fix to Start Next Loop broken feature, fixes following issues:
- Bug 51865 - Infinite loop inside thread group does not work properly if "Start next \
loop after a Sample error" option set
- Bug 51868 - A lot of exceptions in jmeter.log while using option "Start next loop" \
for thread
- Bug 51866 - Counter under loop doesn't work properly if "Start next loop on error" \
option set for thread group
Added:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/FindTestElementsUpToRootTraverser.java \
(with props) Modified:
jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/ForeachController.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/Controller.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/RunTime.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/WhileController.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/AbstractThreadGroup.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
jakarta/jmeter/trunk/xdocs/changes.xml
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/ForeachController.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/ForeachController.java?rev=1195404&r1=1195403&r2=1195404&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/ForeachController.java \
(original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/ForeachController.java \
Mon Oct 31 10:50:11 2011 @@ -182,4 +182,13 @@ public class ForeachController extends \
G incrementLoopCount();
recoverRunningVersion();
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void triggerEndOfLoop() {
+ super.triggerEndOfLoop();
+ resetLoopCount();
+ }
}
\ No newline at end of file
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/Controller.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/Controller.java?rev=1195404&r1=1195403&r2=1195404&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/Controller.java \
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/Controller.java Mon Oct \
31 10:50:11 2011 @@ -62,4 +62,9 @@ public interface Controller extends Test
* @param iterationListener {@link LoopIterationListener}
*/
public void removeIterationListener(LoopIterationListener iterationListener);
+
+ /**
+ * Trigger end of loop condition on controller (used by Start Next Loop feature)
+ */
+ public void triggerEndOfLoop();
}
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java?rev=1195404&r1=1195403&r2=1195404&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java \
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java \
Mon Oct 31 10:50:11 2011 @@ -222,6 +222,13 @@ public class GenericController extends \
A reInitialize();
return null;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public void triggerEndOfLoop() {
+ reInitialize();
+ }
/**
* Called to re-initialize a index of controller's elements (Bug 50032)
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java?rev=1195404&r1=1195403&r2=1195404&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java \
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java Mon Oct \
31 10:50:11 2011 @@ -181,6 +181,15 @@ public class IfController extends Generi
return null;
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void triggerEndOfLoop() {
+ reInitializeSubController();
+ super.triggerEndOfLoop();
+ }
public boolean isEvaluateAll() {
return getPropertyAsBoolean(EVALUATE_ALL,false);
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java?rev=1195404&r1=1195403&r2=1195404&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java \
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java Mon \
Oct 31 10:50:11 2011 @@ -129,7 +129,16 @@ public class LoopController extends Gene
}
return next();
}
-
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void triggerEndOfLoop() {
+ super.triggerEndOfLoop();
+ resetLoopCount();
+ }
+
protected void incrementLoopCount() {
loopCount++;
}
@@ -156,4 +165,11 @@ public class LoopController extends Gene
incrementLoopCount();
recoverRunningVersion();
}
+
+ /**
+ * Start next iteration
+ */
+ public void startNextLoop() {
+ reInitialize();
+ }
}
\ No newline at end of file
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/RunTime.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/RunTime.java?rev=1195404&r1=1195403&r2=1195404&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/RunTime.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/RunTime.java Mon Oct 31 \
10:50:11 2011 @@ -122,4 +122,13 @@ public class RunTime extends GenericCont
incrementLoopCount();
recoverRunningVersion();
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void triggerEndOfLoop() {
+ super.triggerEndOfLoop();
+ resetLoopCount();
+ }
}
\ No newline at end of file
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/WhileController.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/WhileController.java?rev=1195404&r1=1195403&r2=1195404&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/WhileController.java \
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/WhileController.java Mon \
Oct 31 10:50:11 2011 @@ -81,6 +81,15 @@ public class WhileController extends Gen
}
return next();
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void triggerEndOfLoop() {
+ super.triggerEndOfLoop();
+ endOfLoop(true);
+ }
/**
* This skips controller entirely if the condition is false on first entry.
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/AbstractThreadGroup.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/AbstractThreadGroup.java?rev=1195404&r1=1195403&r2=1195404&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/AbstractThreadGroup.java \
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/AbstractThreadGroup.java \
Mon Oct 31 10:50:11 2011 @@ -127,6 +127,20 @@ public abstract class \
AbstractThreadGrou }
/**
+ * Start next iteration after an error
+ */
+ public void startNextLoop() {
+ ((LoopController) getSamplerController()).startNextLoop();
+ }
+
+ /**
+ * NOOP
+ */
+ public void triggerEndOfLoop() {
+ // NOOP
+ }
+
+ /**
* Set the total number of threads to start
*
* @param numThreads
Added: jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/FindTestElementsUpToRootTraverser.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/FindTestElementsUpToRootTraverser.java?rev=1195404&view=auto
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/FindTestElementsUpToRootTraverser.java \
(added)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/FindTestElementsUpToRootTraverser.java \
Mon Oct 31 10:50:11 2011 @@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter.threads;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.jmeter.control.Controller;
+import org.apache.jmeter.testelement.TestElement;
+import org.apache.jorphan.collections.HashTree;
+import org.apache.jorphan.collections.HashTreeTraverser;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
+
+/**
+ * HashTreeTraverser implementation that stores in a Stack all
+ * the Test Elements on the path to a particular node.
+ */
+public class FindTestElementsUpToRootTraverser implements HashTreeTraverser {
+ private static final Logger log = LoggingManager.getLoggerForClass();
+
+ private final LinkedList<TestElement> stack = new LinkedList<TestElement>();
+
+ /**
+ * Node to find in TestTree
+ */
+ private Object nodeToFind;
+ /**
+ * Once we find the node in the Tree we stop recording nodes
+ */
+ private boolean stopRecording = false;
+
+ /**
+ * @param nodeToFind Node to find
+ */
+ public FindTestElementsUpToRootTraverser(Object nodeToFind) {
+ this.nodeToFind = nodeToFind;
+ }
+
+ /** {@inheritDoc} */
+ public void addNode(Object node, HashTree subTree) {
+ if(stopRecording) {
+ return;
+ }
+ if(node == nodeToFind) {
+ this.stopRecording = true;
+ }
+ stack.addLast((TestElement) node);
+ }
+
+ /** {@inheritDoc} */
+ public void subtractNode() {
+ if(stopRecording) {
+ return;
+ }
+ if(log.isDebugEnabled()) {
+ log.debug("Subtracting node, stack size = " + stack.size());
+ }
+ stack.removeLast();
+ }
+
+ /** {@inheritDoc} */
+ public void processPath() {
+ //NOOP
+ }
+
+ /**
+ * Returns all controllers that where in Tree down to nodeToFind in reverse \
order (from leaf to root) + * @return List<Controller>
+ */
+ public List<Controller> getControllersToRoot() {
+ List<Controller> result = new ArrayList<Controller>(stack.size());
+ LinkedList<TestElement> stackLocalCopy = new LinkedList<TestElement>(stack);
+ while(stackLocalCopy.size()>0) {
+ TestElement te = stackLocalCopy.getLast();
+ if(te instanceof Controller) {
+ result.add((Controller)te);
+ }
+ stackLocalCopy.removeLast();
+ }
+ return result;
+ }
+}
Propchange: jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/FindTestElementsUpToRootTraverser.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java?rev=1195404&r1=1195403&r2=1195404&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java \
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java Mon Oct \
31 10:50:11 2011 @@ -285,12 +285,23 @@ public class JMeterThread implements Run
process_sampler(sam, null, threadContext);
sam = controller.next();
} else {
- // Last not ok. start get the begining of the tree
- sam = controller.next(); // need perfom a until loop for \
special case (tc as parent)
- while (sam != null && !sam.equals(firstSampler)) { // \
while the thread is NOT on the begining of the tree
- sam = controller.next();
+ // Find parent controllers of current sampler
+ FindTestElementsUpToRootTraverser pathToRootTraverser = \
new FindTestElementsUpToRootTraverser(sam); + \
testTree.traverse(pathToRootTraverser); + List<Controller> \
controllersToReinit = pathToRootTraverser.getControllersToRoot(); +
+ // Trigger end of loop condition on all parent \
controllers of current sampler + for (Iterator<Controller> \
iterator = controllersToReinit + .iterator(); \
iterator.hasNext();) { + Controller parentController = \
iterator.next(); + if(parentController instanceof \
ThreadGroup) { + ThreadGroup tg = (ThreadGroup) \
parentController; + tg.startNextLoop();
+ } else {
+ parentController.triggerEndOfLoop();
+ }
}
- // At this point: begining tree, thus Last must Ok
+ sam = null;
threadContext.getVariables().put(LAST_SAMPLE_OK, TRUE);
}
} else {
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=1195404&r1=1195403&r2=1195404&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Mon Oct 31 10:50:11 2011
@@ -110,6 +110,9 @@ these occurs, Sampler is marked as faile
<h3>Controllers</h3>
<ul>
+<li>Bug 51865 - Infinite loop inside thread group does not work properly if "Start \
next loop after a Sample error" option set</li> +<li>Bug 51868 - A lot of exceptions \
in jmeter.log while using option "Start next loop" for thread</li> +<li>Bug 51866 - \
Counter under loop doesn't work properly if "Start next loop on error" option set for \
thread group</li> </ul>
<h3>Listeners</h3>
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
For additional commands, e-mail: notifications-help@jakarta.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic