Author: pmouawad
Date: Fri Feb 26 16:38:10 2016
New Revision: 1732514
URL: http://svn.apache.org/viewvc?rev=1732514&view=rev
Log:
Bug 59067 - JMeter fails to iterate over Controllers that are children of a
TransactionController having "Generate parent sample" checked after an
assertion error occurs on a Thread Group with "Start Next Thread Loop"
Bugzilla Id: 59067
Modified:
jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java
jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
jmeter/trunk/xdocs/changes.xml
Modified:
jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java?rev=1732514&r1=1732513&r2=1732514&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java
Fri Feb 26 16:38:10 2016
@@ -283,7 +283,6 @@ public class TransactionController exten
// update them with SubSamplerResult
if(subSampler instanceof TransactionSampler) {
TransactionSampler tc = (TransactionSampler) subSampler;
- tc.getTransactionController().triggerEndOfLoop();
transactionSampler.addSubSamplerResult(tc.getTransactionResult());
}
transactionSampler.setTransactionDone();
Modified: jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java?rev=1732514&r1=1732513&r2=1732514&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java Fri Feb
26 16:38:10 2016
@@ -308,15 +308,17 @@ public class JMeterThread implements Run
* @param threadContext
*/
private void triggerEndOfLoopOnParentControllers(Sampler sam,
JMeterContext threadContext) {
- // Find parent controllers of current sampler
- FindTestElementsUpToRootTraverser pathToRootTraverser = null;
TransactionSampler transactionSampler = null;
if(sam instanceof TransactionSampler) {
transactionSampler = (TransactionSampler) sam;
- pathToRootTraverser = new
FindTestElementsUpToRootTraverser(transactionSampler.getTransactionController());
- } else {
- pathToRootTraverser = new FindTestElementsUpToRootTraverser(sam);
}
+
+ Sampler realSampler = findRealSampler(sam);
+ if(realSampler == null) {
+ throw new IllegalStateException("Got null subSampler calling
findRealSampler for:"+sam.getName()+", sam:"+sam);
+ }
+ // Find parent controllers of current sampler
+ FindTestElementsUpToRootTraverser pathToRootTraverser = new
FindTestElementsUpToRootTraverser(realSampler);
testTree.traverse(pathToRootTraverser);
// Trigger end of loop condition on all parent controllers of current
sampler
@@ -341,6 +343,23 @@ public class JMeterThread implements Run
}
/**
+ * Find the Real sampler (Not TransactionSampler) that really generated an
error
+ * The Sampler provided is not always the "real" one, it can be a
TransactionSampler,
+ * if there are some other controllers (SimpleController or other
implementations) between this TransactionSampler and the real sampler,
+ * triggerEndOfLoop will not be called for those controllers leaving them
in "ugly" state.
+ * the following method will try to find the sampler that really generate
an error
+ * @param sampler
+ * @return {@link Sampler}
+ */
+ private Sampler findRealSampler(Sampler sampler) {
+ Sampler realSampler = sampler;
+ while(realSampler instanceof TransactionSampler) {
+ realSampler = ((TransactionSampler) realSampler).getSubSampler();
+ }
+ return realSampler;
+ }
+
+ /**
* Process the current sampler, handling transaction samplers.
*
* @param current sampler
Modified: jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1732514&r1=1732513&r2=1732514&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Fri Feb 26 16:38:10 2016
@@ -284,6 +284,7 @@ Summary
<li><bug>58600</bug>Display correct filenames, when they are searched by
IncludeController</li>
<li><bug>58678</bug>Module Controller : limit target element selection.
Contributed by Benoit Wiart (benoit dot wiart at gmail.com)</li>
<li><bug>58714</bug>Module controller : it should not be possible to add a
timer as child. Contributed by Benoit Wiart (benoit dot wiart at gmail.com)</li>
+ <li><bug>59067</bug>JMeter fails to iterate over Controllers that are
children of a TransactionController having "Generate parent sample" checked
after an assertion error occurs on a Thread Group with "Start Next Thread
Loop". Contributed by Benoit Wiart (benoit dot wiart at gmail.com)</li>
</ul>
<h3>Listeners</h3>