本文整理汇总了Java中org.apache.jmeter.JMeter.convertSubTree方法的典型用法代码示例。如果您正苦于以下问题:Java JMeter.convertSubTree方法的具体用法?Java JMeter.convertSubTree怎么用?Java JMeter.convertSubTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jmeter.JMeter
的用法示例。
在下文中一共展示了JMeter.convertSubTree方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.apache.jmeter.JMeter; //导入方法依赖的package包/类
public void start() {
log.debug("Start debugging");
frontend.started();
HashTree hashTree = getSelectedTree();
StandardJMeterEngine.register(new StateListener()); // oh, dear, they use static field then clean it...
engine = new DebuggerEngine(JMeterContextService.getContext());
engine.setStepper(this);
JMeter.convertSubTree(hashTree);
engine.configure(hashTree);
try {
engine.runTest();
} catch (JMeterEngineException e) {
log.error("Failed to pauseContinue debug", e);
stop();
}
}
示例2: runRealEngine
import org.apache.jmeter.JMeter; //导入方法依赖的package包/类
@Test
public void runRealEngine() throws Exception {
TestTreeProvider prov = new TestProvider();
HashTree hashTree = prov.getTestTree();
JMeter.convertSubTree(hashTree);
StandardJMeterEngine engine = new StandardJMeterEngine();
engine.configure(hashTree);
engine.runTest();
while (engine.isActive()) {
Thread.sleep(1000);
}
}
示例3: startEngine
import org.apache.jmeter.JMeter; //导入方法依赖的package包/类
/**
* Start JMeter engine
* @param noTimer ignore timers
*/
private void startEngine(boolean ignoreTimer) {
GuiPackage gui = GuiPackage.getInstance();
HashTree testTree = gui.getTreeModel().getTestPlan();
JMeter.convertSubTree(testTree);
testTree.add(testTree.getArray()[0], gui.getMainFrame());
log.debug("test plan before cloning is running version: "
+ ((TestPlan) testTree.getArray()[0]).isRunningVersion());
TreeCloner cloner = cloneTree(testTree, ignoreTimer);
engine = new StandardJMeterEngine();
engine.configure(cloner.getClonedTree());
try {
engine.runTest();
} catch (JMeterEngineException e) {
JOptionPane.showMessageDialog(gui.getMainFrame(), e.getMessage(),
JMeterUtils.getResString("error_occurred"), JOptionPane.ERROR_MESSAGE); //$NON-NLS-1$
}
log.debug("test plan after cloning and running test is running version: "
+ ((TestPlan) testTree.getArray()[0]).isRunningVersion());
}
示例4: runDebugEngine
import org.apache.jmeter.JMeter; //导入方法依赖的package包/类
@Test
public void runDebugEngine() throws Exception {
TestProvider prov = new TestProvider();
Debugger sel = new Debugger(prov, new FrontendMock());
AbstractThreadGroup tg = prov.getTG(0);
sel.selectThreadGroup(tg);
HashTree testTree = sel.getSelectedTree();
DebuggingThreadGroup tg2 = (DebuggingThreadGroup) getFirstTG(testTree);
LoopController samplerController = (LoopController) tg2.getSamplerController();
samplerController.setLoops(1);
samplerController.setContinueForever(false);
JMeter.convertSubTree(testTree);
DebuggerEngine engine = new DebuggerEngine(JMeterContextService.getContext());
StepTriggerCounter hook = new StepTriggerCounter();
engine.setStepper(hook);
engine.configure(testTree);
engine.runTest();
while (engine.isActive()) {
Thread.sleep(1000);
}
assertEquals(88, hook.cnt);
}
示例5: selectThreadGroup
import org.apache.jmeter.JMeter; //导入方法依赖的package包/类
private void selectThreadGroup(AbstractThreadGroup tg) {
debugger.selectThreadGroup(tg);
treeModel.clearTestPlan();
HashTree origTree = debugger.getSelectedTree();
TreeCloner cloner = new TreeCloner();
origTree.traverse(cloner);
HashTree selectedTree = cloner.getClonedTree();
// Hack to resolve ModuleControllers from JMeter.java
SearchClass<ReplaceableController> replaceableControllers = new SearchClass<>(ReplaceableController.class);
selectedTree.traverse(replaceableControllers);
Collection<ReplaceableController> replaceableControllersRes = replaceableControllers.getSearchResults();
for (ReplaceableController replaceableController : replaceableControllersRes) {
replaceableController.resolveReplacementSubTree((JMeterTreeNode) treeModel.getRoot());
}
JMeter.convertSubTree(selectedTree);
try {
treeModel.addSubTree(selectedTree, (JMeterTreeNode) treeModel.getRoot());
} catch (IllegalUserActionException e) {
throw new RuntimeException(e);
}
// select TG for visual convenience
SearchByClass<DebuggingThreadGroup> tgs = new SearchByClass<>(DebuggingThreadGroup.class);
selectedTree.traverse(tgs);
for (DebuggingThreadGroup forSel : tgs.getSearchResults()) {
Wrapper<AbstractThreadGroup> wtg = new ThreadGroupWrapper();
wtg.setWrappedElement(forSel);
selectTargetInTree(wtg);
}
}
示例6: runVariablesDebugEngine
import org.apache.jmeter.JMeter; //导入方法依赖的package包/类
@Test
public void runVariablesDebugEngine() throws Exception {
TestProvider prov = new TestProvider("/com/blazemeter/jmeter/debugger/vars.jmx", "vars.jmx");
Debugger sel = new Debugger(prov, new FrontendMock());
AbstractThreadGroup tg = prov.getTG(0);
sel.selectThreadGroup(tg);
HashTree testTree = sel.getSelectedTree();
TestSampleListener listener = new TestSampleListener();
testTree.add(testTree.getArray()[0], listener);
DebuggingThreadGroup tg2 = (DebuggingThreadGroup) getFirstTG(testTree);
LoopController samplerController = (LoopController) tg2.getSamplerController();
samplerController.setLoops(1);
samplerController.setContinueForever(false);
JMeter.convertSubTree(testTree);
DebuggerEngine engine = new DebuggerEngine(JMeterContextService.getContext());
StepTriggerCounter hook = new StepTriggerCounter();
engine.setStepper(hook);
engine.configure(testTree);
engine.runTest();
while (engine.isActive()) {
Thread.sleep(1000);
}
assertEquals(8, hook.cnt);
assertEquals(3, listener.events.size());
for (SampleEvent event : listener.events) {
SampleResult res = event.getResult();
String label = res.getSampleLabel();
assertTrue("Label: " + label + " must end with '123'", label.endsWith("123"));
assertFalse("Variable ${VAR} must be changed to '123' value. label: " + label, label.contains("${VAR}"));
assertTrue("label: '" + label + "' response: '" + res.getResponseMessage() +"'", res.isSuccessful());
}
}
示例7: runVariablesInAssertions
import org.apache.jmeter.JMeter; //导入方法依赖的package包/类
@Test
public void runVariablesInAssertions() throws Exception {
TestProvider prov = new TestProvider("/com/blazemeter/jmeter/debugger/debug.jmx", "debug.jmx");
Debugger sel = new Debugger(prov, new FrontendMock());
AbstractThreadGroup tg = prov.getTG(0);
sel.selectThreadGroup(tg);
HashTree testTree = sel.getSelectedTree();
TestSampleListener listener = new TestSampleListener();
testTree.add(testTree.getArray()[0], listener);
DebuggingThreadGroup tg2 = (DebuggingThreadGroup) getFirstTG(testTree);
LoopController samplerController = (LoopController) tg2.getSamplerController();
samplerController.setLoops(1);
samplerController.setContinueForever(false);
JMeter.convertSubTree(testTree);
DebuggerEngine engine = new DebuggerEngine(JMeterContextService.getContext());
StepTriggerCounter hook = new StepTriggerCounter();
engine.setStepper(hook);
engine.configure(testTree);
engine.runTest();
while (engine.isActive()) {
Thread.sleep(1000);
}
assertEquals(4, hook.cnt);
assertEquals(1, listener.events.size());
SampleEvent event = listener.events.get(0);
SampleResult result = event.getResult();
AssertionResult[] assertionResults = result.getAssertionResults();
assertEquals(1, assertionResults.length);
AssertionResult assertionRes = assertionResults[0];
assertNull(assertionRes.getFailureMessage());
}
示例8: runVariablesInControllers
import org.apache.jmeter.JMeter; //导入方法依赖的package包/类
@Test
public void runVariablesInControllers() throws Exception {
TestProvider prov = new TestProvider("/com/blazemeter/jmeter/debugger/loops.jmx", "loops.jmx");
Debugger sel = new Debugger(prov, new FrontendMock());
AbstractThreadGroup tg = prov.getTG(0);
sel.selectThreadGroup(tg);
HashTree testTree = sel.getSelectedTree();
TestSampleListener listener = new TestSampleListener();
testTree.add(testTree.getArray()[0], listener);
DebuggingThreadGroup tg2 = (DebuggingThreadGroup) getFirstTG(testTree);
LoopController samplerController = (LoopController) tg2.getSamplerController();
samplerController.setLoops(1);
samplerController.setContinueForever(false);
JMeter.convertSubTree(testTree);
DebuggerEngine engine = new DebuggerEngine(JMeterContextService.getContext());
StepTriggerCounter hook = new StepTriggerCounter();
engine.setStepper(hook);
engine.configure(testTree);
engine.runTest();
while (engine.isActive()) {
Thread.sleep(1000);
}
assertEquals(12, hook.cnt);
assertEquals(3, listener.events.size());
}
示例9: initEngine
import org.apache.jmeter.JMeter; //导入方法依赖的package包/类
/**
* Initializes test on engine.
*
* @param engine
* remote engine object
*/
private void initEngine(JMeterEngine engine) {
GuiPackage gui = GuiPackage.getInstance();
HashTree testTree = gui.getTreeModel().getTestPlan();
JMeter.convertSubTree(testTree);
testTree.add(testTree.getArray()[0], gui.getMainFrame());
// Used for remote notification of threads start/stop,see BUG 54152
testTree.add(testTree.getArray()[0], new RemoteThreadsListenerTestElement());
engine.configure(testTree);
}