• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TransactionController类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.jmeter.control.TransactionController的典型用法代码示例。如果您正苦于以下问题:Java TransactionController类的具体用法?Java TransactionController怎么用?Java TransactionController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TransactionController类属于org.apache.jmeter.control包,在下文中一共展示了TransactionController类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: next

import org.apache.jmeter.control.TransactionController; //导入依赖的package包/类
@Override
public Sampler next() {
    if (chosen) {
        Sampler result = super.next();

        if (result == null || currentCopy != current ||
                (super.getSubControllers().get(current) instanceof TransactionController)) {
            reset();
            for (TestElement element : super.getSubControllers()) {
                if (element instanceof Controller) {
                    ((Controller) element).triggerEndOfLoop();
                }
            }
            return null;
        }
        return result;
    } else {
        chosen = true;
        choose();
        return super.next();
    }
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:23,代码来源:WeightedSwitchController.java


示例2: saveTransactionControllerConfigs

import org.apache.jmeter.control.TransactionController; //导入依赖的package包/类
private void saveTransactionControllerConfigs(TransactionController tc) {
    List<ConfigTestElement> configs = new LinkedList<>();
    List<Controller> controllers = new LinkedList<>();
    List<SampleListener> listeners = new LinkedList<>();
    List<Timer> timers = new LinkedList<>();
    List<Assertion> assertions = new LinkedList<>();
    LinkedList<PostProcessor> posts = new LinkedList<>();
    LinkedList<PreProcessor> pres = new LinkedList<>();
    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);
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:27,代码来源:TestCompiler.java


示例3: addTransactionController

import org.apache.jmeter.control.TransactionController; //导入依赖的package包/类
/**
 * 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
 * @throws InvocationTargetException
 * @throws InterruptedException
 */
private void addTransactionController(final JMeterTreeModel model, final JMeterTreeNode node, String name)
        throws InterruptedException, InvocationTargetException {
    final TransactionController sc = new TransactionController();
    sc.setIncludeTimers(false);
    sc.setProperty(TestElement.GUI_CLASS, TRANSACTION_CONTROLLER_GUI);
    sc.setName(name);
    JMeterUtils.runSafe(new Runnable() {
        @Override
        public void run() {
             try {
                model.addComponent(sc, node);
            } catch (IllegalUserActionException e) {
                log.error("Program error", e);
                throw new Error(e);
            }
        }
    });
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:31,代码来源:ProxyControl.java


示例4: saveTransactionControllerConfigs

import org.apache.jmeter.control.TransactionController; //导入依赖的package包/类
private void saveTransactionControllerConfigs(TransactionController tc) {
    List<ConfigTestElement> configs = new LinkedList<ConfigTestElement>();
    List<Controller> controllers = new LinkedList<Controller>();
    List<SampleListener> listeners = new LinkedList<SampleListener>();
    List<Timer> timers = new LinkedList<Timer>();
    List<Assertion> assertions = new LinkedList<Assertion>();
    LinkedList<PostProcessor> posts = new LinkedList<PostProcessor>();
    LinkedList<PreProcessor> pres = new LinkedList<PreProcessor>();
    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);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:27,代码来源:TestCompiler.java


示例5: initilizeElement

import org.apache.jmeter.control.TransactionController; //导入依赖的package包/类
@Override
public TestElement initilizeElement() {
	TransactionController ele = new TransactionController();
	this.baseElement(ele, "Transaction Controller");
	
	ele.setGenerateParentSample(false);
	ele.setIncludeTimers(false);
	
	return ele;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:11,代码来源:TransactionControllerInitializer.java


示例6: configureTransactionSampler

import org.apache.jmeter.control.TransactionController; //导入依赖的package包/类
/**
 * Configures Transaction Sampler from SamplePackage extracted from Test plan and returns it
 * @param transactionSampler {@link TransactionSampler}
 * @return {@link SamplePackage}
 */
public SamplePackage configureTransactionSampler(TransactionSampler transactionSampler) {
    TransactionController controller = transactionSampler.getTransactionController();
    SamplePackage pack = transactionControllerConfigMap.get(controller);
    pack.setSampler(transactionSampler);
    return pack;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:12,代码来源:TestCompiler.java


示例7: subtractNode

import org.apache.jmeter.control.TransactionController; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void subtractNode() {
    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.size() > 0) {
        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) {
            LOG.warn("Unexpected duplicate for " + parent.getClass().getName() + " and " + child.getClass().getName());
        }
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:39,代码来源:TestCompiler.java


示例8: findMainNodesAndTrees

import org.apache.jmeter.control.TransactionController; //导入依赖的package包/类
private void findMainNodesAndTrees(HashTree hashTree)
{
    hashTree.traverse(new HashTreeTraverser()
    {
        @Override
        public void addNode(Object node, HashTree subTree)
        {
            System.out.println("Node: " + node.toString());

            if (node instanceof Arguments && ((Arguments)node).getName().equalsIgnoreCase("UDV"))
            {
                vars = (Arguments)node;
            }

            if (node instanceof TransactionController)
            {
                transactionControllerSubTree = subTree;
            }
        }

        @Override
        public void processPath()
        {
        }

        @Override
        public void subtractNode()
        {
        }
    });
}
 
开发者ID:d0k1,项目名称:jsflight,代码行数:32,代码来源:JMeterRecorder.java


示例9: modifyTestElement

import org.apache.jmeter.control.TransactionController; //导入依赖的package包/类
@Override
public void modifyTestElement(TestElement el) {
    configureTestElement(el);
    ((TransactionController) el).setParent(parent.isSelected());
    TransactionController tc = ((TransactionController) el);
    tc.setParent(parent.isSelected());
    tc.setIncludeTimers(includeTimers.isSelected());
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:9,代码来源:TransactionControllerGui.java


示例10: subtractNode

import org.apache.jmeter.control.TransactionController; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void subtractNode() {
    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.size() > 0) {
        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 (!IS_USE_STATIC_SET && 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) {
            LOG.warn("Unexpected duplicate for " + parent.getClass().getName() + " and " + child.getClass().getName());
        }
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:39,代码来源:TestCompiler.java


示例11: testNestedTransactionControllers

import org.apache.jmeter.control.TransactionController; //导入依赖的package包/类
@Test
public void testNestedTransactionControllers() throws Exception {
    JMeterContextService.getContext().setVariables(new JMeterVariables());


    TestSampleListener listener = new TestSampleListener();

    // top WSC
    WeightedSwitchController topWSC = new WeightedSwitchController();
    PowerTableModel topPTM = new PowerTableModel(new String[]{"name", WeightedSwitchController.WEIGHTS}, new Class[]{String.class, String.class});
    topPTM.addRow(new String[]{"ex1", "10"});
    topPTM.addRow(new String[]{"ex2", "20"});
    topWSC.setData(topPTM);


    // first child: transaction controller
    TransactionController ex1 = new TransactionController();
    ex1.setName("ex1");
    DebugSampler example1_1 = new DebugSampler();
    example1_1.setName("example1_1");
    DebugSampler example1_2 = new DebugSampler();
    example1_2.setName("example1_2");

    // second child: transaction controller
    TransactionController ex2 = new TransactionController();
    ex2.setName("ex2");
    DebugSampler example2_1 = new DebugSampler();
    example2_1.setName("example2_1");
    DebugSampler example2_2 = new DebugSampler();
    example2_2.setName("example2_2");

    // main loop
    LoopController loop = new LoopController();
    loop.setLoops(60);
    loop.setContinueForever(false);

    // test tree
    ListedHashTree hashTree = new ListedHashTree();
    hashTree.add(loop);
    hashTree.add(loop, topWSC);
    hashTree.add(topWSC, listener);
    hashTree.add(topWSC, ex1);
    hashTree.add(ex1, example1_1);
    hashTree.add(ex1, example1_2);
    hashTree.add(ex1, listener);
    hashTree.add(topWSC, ex2);
    hashTree.add(ex2, example2_1);
    hashTree.add(ex2, example2_2);
    hashTree.add(ex2, listener);

    TestCompiler compiler = new TestCompiler(hashTree);
    hashTree.traverse(compiler);

    ThreadGroup threadGroup = new ThreadGroup();
    threadGroup.setNumThreads(1);

    ListenerNotifier notifier = new ListenerNotifier();

    JMeterThread thread = new JMeterThread(hashTree, threadGroup, notifier);
    thread.setThreadGroup(threadGroup);
    thread.setOnErrorStopThread(true);
    thread.run();

    Map<String, Integer> totalResults = new HashMap<>();
    for (SampleEvent event : listener.events) {
        String label = event.getResult().getSampleLabel();
        if (totalResults.containsKey(label)) {
            totalResults.put(label, totalResults.get(label) + 1);
        } else {
            totalResults.put(label, 1);
        }
    }

    assertEquals(120, listener.events.size());
    assertEquals(20, (int) totalResults.get("example1_1"));
    assertEquals(40, (int) totalResults.get("example2_1"));
    assertEquals(20, (int) totalResults.get("ex1")); // transaction result
    assertEquals(40, (int) totalResults.get("ex2")); // transaction result
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:80,代码来源:WeightedSwitchControllerTest.java


示例12: createTestElement

import org.apache.jmeter.control.TransactionController; //导入依赖的package包/类
@Override
public TestElement createTestElement() {
    TransactionController lc = new TransactionController();
    configureTestElement(lc);
    return lc;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:7,代码来源:TransactionControllerGui.java


示例13: configure

import org.apache.jmeter.control.TransactionController; //导入依赖的package包/类
@Override
public void configure(TestElement el) {
    super.configure(el);
    parent.setSelected(((TransactionController) el).isParent());
    includeTimers.setSelected(((TransactionController) el).isIncludeTimers());
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:7,代码来源:TransactionControllerGui.java



注:本文中的org.apache.jmeter.control.TransactionController类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PatientAlertEDischargeVoAssembler类代码示例发布时间:2022-05-15
下一篇:
Java TimeUnit类代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap