return elements;
}
private void placeSampler(HTTPSamplerBase sampler, TestElement[] subConfigs, JMeterTreeNode myTarget) {
try {
JMeterTreeModel treeModel = GuiPackage.getInstance().getTreeModel();
boolean firstInBatch = false;
long now = System.currentTimeMillis();
long deltaT = now - lastTime;
if (deltaT > sampleGap) {
if (!myTarget.isLeaf() && groupingMode == GROUPING_ADD_SEPARATORS) {
addDivider(treeModel, myTarget);
}
if (groupingMode == GROUPING_IN_SIMPLE_CONTROLLERS) {
addSimpleController(treeModel, myTarget, sampler.getName());
}
if (groupingMode == GROUPING_IN_TRANSACTION_CONTROLLERS) {
addTransactionController(treeModel, myTarget, sampler.getName());
}
firstInBatch = true;// Remember this was first in its batch
}
if (lastTime == 0) {
deltaT = 0; // Decent value for timers
}
lastTime = now;
if (groupingMode == GROUPING_STORE_FIRST_ONLY) {
if (!firstInBatch) {
return; // Huh! don't store this one!
}
// If we're not storing subsequent samplers, we'll need the
// first sampler to do all the work...:
sampler.setFollowRedirects(true);
sampler.setImageParser(true);
}
if (groupingMode == GROUPING_IN_SIMPLE_CONTROLLERS ||
groupingMode == GROUPING_IN_TRANSACTION_CONTROLLERS) {
// Find the last controller in the target to store the
// sampler there:
for (int i = myTarget.getChildCount() - 1; i >= 0; i--) {
JMeterTreeNode c = (JMeterTreeNode) myTarget.getChildAt(i);
if (c.getTestElement() instanceof GenericController) {
myTarget = c;
break;
}
}
}
JMeterTreeNode newNode = treeModel.addComponent(sampler, myTarget);
if (firstInBatch) {
if (addAssertions) {
addAssertion(treeModel, newNode);
}
addTimers(treeModel, newNode, deltaT);
firstInBatch = false;
}
for (int i = 0; subConfigs != null && i < subConfigs.length; i++) {
if (subConfigs[i] instanceof HeaderManager) {
subConfigs[i].setProperty(TestElement.GUI_CLASS, HEADER_PANEL);
treeModel.addComponent(subConfigs[i], newNode);
}
}
} catch (IllegalUserActionException e) {
JMeterUtils.reportErrorToUser(e.getMessage());
}