Author: pmouawad
Date: Mon Dec 14 20:15:22 2015
New Revision: 1720000
URL: http://svn.apache.org/viewvc?rev=1720000&view=rev
Log:
Transaction Controller clarification : rename variables and methods to make it
easier to understand
#resolve #59
Modified:
jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java
jmeter/trunk/src/core/org/apache/jmeter/control/gui/TransactionControllerGui.java
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=1720000&r1=1719999&r2=1720000&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java
Mon Dec 14 20:15:22 2015
@@ -52,7 +52,7 @@ public class TransactionController exten
private static final String TRUE = Boolean.toString(true); // i.e. "true"
- private static final String PARENT = "TransactionController.parent";//
$NON-NLS-1$
+ private static final String GENERATE_PARENT_SAMPLE =
"TransactionController.parent";// $NON-NLS-1$
private static final String INCLUDE_TIMERS =
"TransactionController.includeTimers";// $NON-NLS-1$
@@ -111,12 +111,22 @@ public class TransactionController exten
return this;
}
- public void setParent(boolean _parent){
- setProperty(new BooleanProperty(PARENT, _parent));
+ public void setGenerateParentSample(boolean _parent) {
+ setProperty(new BooleanProperty(GENERATE_PARENT_SAMPLE, _parent));
}
- public boolean isParent(){
- return getPropertyAsBoolean(PARENT);
+ public boolean isGenerateParentSample() {
+ return getPropertyAsBoolean(GENERATE_PARENT_SAMPLE);
+ }
+
+ @Deprecated
+ public boolean isParent() {
+ return isGenerateParentSample();
+ }
+
+ @Deprecated
+ public void setParent(boolean _parent) {
+ setGenerateParentSample(_parent);
}
/**
@@ -124,15 +134,15 @@ public class TransactionController exten
*/
@Override
public Sampler next(){
- if (isParent()){
- return next1();
+ if (isGenerateParentSample()){
+ return nextWithTransactionSampler();
}
- return next2();
+ return nextWithoutTransactionSampler();
}
///////////////// Transaction Controller - parent ////////////////
- private Sampler next1() {
+ private Sampler nextWithTransactionSampler() {
// Check if transaction is done
if(transactionSampler != null &&
transactionSampler.isTransactionDone()) {
if (log.isDebugEnabled()) {
@@ -164,7 +174,7 @@ public class TransactionController exten
@Override
protected Sampler nextIsAController(Controller controller) throws
NextIsNullException {
- if (!isParent()) {
+ if (!isGenerateParentSample()) {
return super.nextIsAController(controller);
}
Sampler returnValue;
@@ -183,7 +193,7 @@ public class TransactionController exten
////////////////////// Transaction Controller - additional sample
//////////////////////////////
- private Sampler next2() {
+ private Sampler nextWithoutTransactionSampler() {
if (isFirst()) // must be the start of the subtree
{
calls = 0;
@@ -237,9 +247,9 @@ public class TransactionController exten
*/
@Override
public void triggerEndOfLoop() {
- if(!isParent()) {
+ if(!isGenerateParentSample()) {
if (res != null) {
- res.setIdleTime(pauseTime+res.getIdleTime());
+ res.setIdleTime(pauseTime + res.getIdleTime());
res.sampleEnd();
res.setSuccessful(TRUE.equals(JMeterContextService.getContext().getVariables().get(JMeterThread.LAST_SAMPLE_OK)));
res.setResponseMessage(TransactionController.NUMBER_OF_SAMPLES_IN_TRANSACTION_PREFIX
+ calls + ", number of failing samples : " + noFailingSamples);
@@ -288,7 +298,7 @@ public class TransactionController exten
@Override
public void sampleOccurred(SampleEvent se) {
- if (!isParent()) {
+ if (!isGenerateParentSample()) {
// Check if we are still sampling our children
if(res != null && !se.isTransactionSampleEvent()) {
SampleResult sampleResult = se.getResult();
Modified:
jmeter/trunk/src/core/org/apache/jmeter/control/gui/TransactionControllerGui.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/control/gui/TransactionControllerGui.java?rev=1720000&r1=1719999&r2=1720000&view=diff
==============================================================================
---
jmeter/trunk/src/core/org/apache/jmeter/control/gui/TransactionControllerGui.java
(original)
+++
jmeter/trunk/src/core/org/apache/jmeter/control/gui/TransactionControllerGui.java
Mon Dec 14 20:15:22 2015
@@ -27,15 +27,16 @@ import org.apache.jorphan.gui.layout.Ver
/**
* A Transaction controller component.
- *
*/
public class TransactionControllerGui extends AbstractControllerGui {
private static final long serialVersionUID = 240L;
- private JCheckBox parent; // If selected, then generate parent sample,
otherwise as per original controller
+ /** If selected, then generate parent sample, otherwise as per original
controller */
+ private JCheckBox generateParentSample;
- private JCheckBox includeTimers; // if selected, add duration of timers to
total runtime
+ /** if selected, add duration of timers to total runtime */
+ private JCheckBox includeTimers;
/**
* Create a new TransactionControllerGui instance.
@@ -44,7 +45,6 @@ public class TransactionControllerGui ex
init();
}
- /* Implements JMeterGUIComponent.createTestElement() */
@Override
public TestElement createTestElement() {
TransactionController lc = new TransactionController();
@@ -56,17 +56,16 @@ public class TransactionControllerGui ex
@Override
public void configure(TestElement el) {
super.configure(el);
- parent.setSelected(((TransactionController) el).isParent());
+ generateParentSample.setSelected(((TransactionController)
el).isGenerateParentSample());
includeTimers.setSelected(((TransactionController)
el).isIncludeTimers());
}
- /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
@Override
public void modifyTestElement(TestElement el) {
configureTestElement(el);
- ((TransactionController) el).setParent(parent.isSelected());
+ ((TransactionController)
el).setGenerateParentSample(generateParentSample.isSelected());
TransactionController tc = ((TransactionController) el);
- tc.setParent(parent.isSelected());
+ tc.setGenerateParentSample(generateParentSample.isSelected());
tc.setIncludeTimers(includeTimers.isSelected());
}
@@ -82,8 +81,8 @@ public class TransactionControllerGui ex
setLayout(new VerticalLayout(5, VerticalLayout.BOTH,
VerticalLayout.TOP));
setBorder(makeBorder());
add(makeTitlePanel());
- parent = new
JCheckBox(JMeterUtils.getResString("transaction_controller_parent")); //
$NON-NLS-1$
- add(parent);
+ generateParentSample = new
JCheckBox(JMeterUtils.getResString("transaction_controller_parent")); //
$NON-NLS-1$
+ add(generateParentSample);
includeTimers = new
JCheckBox(JMeterUtils.getResString("transaction_controller_include_timers"),
true); // $NON-NLS-1$
add(includeTimers);
}