use of org.apache.jmeter.control.TransactionController in project jmeter by apache.
the class TransactionControllerGui method createTestElement.
@Override
public TestElement createTestElement() {
TransactionController lc = new TransactionController();
// change default for new test elements
lc.setIncludeTimers(false);
configureTestElement(lc);
return lc;
}
use of org.apache.jmeter.control.TransactionController in project jmeter by apache.
the class TestCompiler method subtractNode.
/**
* {@inheritDoc}
*/
@Override
public void subtractNode() {
if (log.isDebugEnabled()) {
log.debug("Subtracting node, stack size = {}", stack.size());
}
TestElement child = stack.getLast();
trackIterationListeners(stack);
if (child instanceof Sampler) {
saveSamplerConfigs((Sampler) child);
} else if (child instanceof TransactionController) {
saveTransactionControllerConfigs((TransactionController) child);
}
stack.removeLast();
if (!stack.isEmpty()) {
TestElement parent = stack.getLast();
boolean duplicate = false;
// Bug 53750: this condition used to be in ObjectPair#addTestElements()
if (parent instanceof Controller && (child instanceof Sampler || child instanceof Controller)) {
if (parent instanceof TestCompilerHelper) {
TestCompilerHelper te = (TestCompilerHelper) parent;
duplicate = !te.addTestElementOnce(child);
} else {
// this is only possible for 3rd party controllers by default
ObjectPair pair = new ObjectPair(child, parent);
synchronized (PAIRING) {
// Called from multiple threads
if (!PAIRING.contains(pair)) {
parent.addTestElement(child);
PAIRING.add(pair);
} else {
duplicate = true;
}
}
}
}
if (duplicate) {
if (log.isWarnEnabled()) {
log.warn("Unexpected duplicate for {} and {}", parent.getClass(), child.getClass());
}
}
}
}
use of org.apache.jmeter.control.TransactionController in project jmeter by apache.
the class TestCompiler method saveTransactionControllerConfigs.
private void saveTransactionControllerConfigs(TransactionController tc) {
List<ConfigTestElement> configs = new ArrayList<>();
List<Controller> controllers = new ArrayList<>();
List<SampleListener> listeners = new ArrayList<>();
List<Timer> timers = new ArrayList<>();
List<Assertion> assertions = new ArrayList<>();
List<PostProcessor> posts = new ArrayList<>();
List<PreProcessor> pres = new ArrayList<>();
for (int i = stack.size(); i > 0; i--) {
addDirectParentControllers(controllers, stack.get(i - 1));
for (Object item : testTree.list(stack.subList(0, i))) {
if (item instanceof SampleListener) {
listeners.add((SampleListener) item);
}
if (item instanceof Assertion) {
assertions.add((Assertion) item);
}
}
}
SamplePackage pack = new SamplePackage(configs, listeners, timers, assertions, posts, pres, controllers);
pack.setSampler(new TransactionSampler(tc, tc.getName()));
pack.setRunningVersion(true);
transactionControllerConfigMap.put(tc, pack);
}
use of org.apache.jmeter.control.TransactionController in project jmeter by apache.
the class ProxyControl method addTransactionController.
/**
* Helper method to add a Transaction Controller to contain the samplers.
* Called from Application Thread that needs to update GUI (JMeterTreeModel)
*
* @param model Test component tree model
* @param node Node in the tree where we will add the Controller
* @param name A name for the Controller
*/
private void addTransactionController(final JMeterTreeModel model, final JMeterTreeNode node, String name) {
final TransactionController sc = new TransactionController();
sc.setIncludeTimers(false);
sc.setProperty(TestElement.GUI_CLASS, TRANSACTION_CONTROLLER_GUI);
sc.setName(name);
safelyAddComponent(model, node, sc);
}
use of org.apache.jmeter.control.TransactionController in project jmeter by apache.
the class TransactionControllerGui method modifyTestElement.
@Override
public void modifyTestElement(TestElement el) {
configureTestElement(el);
((TransactionController) el).setGenerateParentSample(generateParentSample.isSelected());
TransactionController tc = (TransactionController) el;
tc.setGenerateParentSample(generateParentSample.isSelected());
tc.setIncludeTimers(includeTimers.isSelected());
}
Aggregations