Examples of TestPlan


Examples of org.apache.jmeter.testelement.TestPlan

        }

        /** {@inheritDoc} */
        @Override
        public void setUp() {
            variables = new TestPlan();
            variables.addParameter("server", "jakarta.apache.org");
            variables.addParameter("username", "jack");
            // The following used to be jacks_password, but the Arguments class uses
            // HashMap for which the order is not defined.
            variables.addParameter("password", "his_password");
View Full Code Here

Examples of org.apache.jmeter.testelement.TestPlan

        public void testReverseReplacement() throws Exception {
            ValueReplacer replacer = new ValueReplacer(variables);
            assertTrue(variables.getUserDefinedVariables().containsKey("server"));
            assertTrue(replacer.containsKey("server"));
            TestElement element = new TestPlan();
            element.setProperty(new StringProperty("domain", "jakarta.apache.org"));
            List<Object> argsin = new ArrayList<Object>();
            argsin.add("username is jack");
            argsin.add("his_password");
            element.setProperty(new CollectionProperty("args", argsin));
            replacer.reverseReplace(element);
            assertEquals("${server}", element.getPropertyAsString("domain"));
            @SuppressWarnings("unchecked")
            List<JMeterProperty> args = (List<JMeterProperty>) element.getProperty("args").getObjectValue();
            assertEquals("username is ${username}", args.get(0).getStringValue());
            assertEquals("${password}", args.get(1).getStringValue());
        }
View Full Code Here

Examples of org.apache.jmeter.testelement.TestPlan

     *            Sampler node in where we will add the timers
     * @param deltaT
     *            Time interval from the previous request
     */
    private void addTimers(JMeterTreeModel model, JMeterTreeNode node, long deltaT) {
        TestPlan variables = new TestPlan();
        variables.addParameter("T", Long.toString(deltaT)); // $NON-NLS-1$
        ValueReplacer replacer = new ValueReplacer(variables);
        JMeterTreeNode mySelf = model.getNodeOf(this);
        Enumeration<JMeterTreeNode> children = mySelf.children();
        while (children.hasMoreElements()) {
            JMeterTreeNode templateNode = children.nextElement();
View Full Code Here

Examples of org.apache.jmeter.testelement.TestPlan

                        }
                    }

                    // Special case for the TestPlan's Arguments sub-element:
                    if (element instanceof TestPlan) {
                        TestPlan tp = (TestPlan) element;
                        Arguments args = tp.getArguments();
                        if (myClass.isInstance(args)) {
                            if (ascending) {
                                elements.addFirst(args);
                            } else {
                                elements.add(args);
View Full Code Here

Examples of org.apache.jmeter.testelement.TestPlan

    private void addTimers(
        JMeterTreeModel model,
        JMeterTreeNode node,
        long deltaT)
    {
        TestPlan variables= new TestPlan();
        variables.addParameter("T", Long.toString(deltaT));
        ValueReplacer replacer= new ValueReplacer(variables);
        JMeterTreeNode mySelf= model.getNodeOf(this);
        Enumeration children= mySelf.children();
        while (children.hasMoreElements())
        {
View Full Code Here

Examples of org.apache.jmeter.testelement.TestPlan

            super(name);
        }

        public void setUp()
        {
            variables = new TestPlan();
            variables.addParameter("server", "jakarta.apache.org");
            variables.addParameter("username", "jack");
            variables.addParameter("password", "jacks_password");
            variables.addParameter("regex", ".*");
            JMeterVariables vars = new JMeterVariables();
View Full Code Here

Examples of org.apache.jmeter.testelement.TestPlan

        {
            ValueReplacer replacer = new ValueReplacer(variables);
            assertTrue(
                variables.getUserDefinedVariables().containsKey("server"));
            assertTrue(replacer.variables.containsKey("server"));
            TestElement element = new TestPlan();
            element.setProperty(
                new StringProperty("domain", "jakarta.apache.org"));
            List args = new ArrayList();
            args.add("username is jack");
            args.add("jacks_password");
            element.setProperty(new CollectionProperty("args", args));
            replacer.reverseReplace(element);
            assertEquals("${server}", element.getPropertyAsString("domain"));
            args = (List) element.getProperty("args").getObjectValue();
            assertEquals(
                "${password}",
                ((JMeterProperty) args.get(1)).getStringValue());
        }
View Full Code Here

Examples of org.apache.jmeter.testelement.TestPlan

            ListedHashTree original = new ListedHashTree();
            GenericController controller = new GenericController();
            controller.setName("controller");
            Arguments args = new Arguments();
            args.setName("args");
            TestPlan plan = new TestPlan();
            plan.addParameter("server", "jakarta");
            original.add(controller, args);
            original.add(plan);
            ResultCollector listener = new ResultCollector();
            listener.setName("Collector");
            original.add(controller, listener);
            TreeCloner cloner = new TreeCloner();
            original.traverse(cloner);
            ListedHashTree newTree = cloner.getClonedTree();
            assertTrue(original != newTree);
            assertEquals(original.size(), newTree.size());
            assertEquals(
                original.getTree(original.getArray()[0]).size(),
                newTree.getTree(newTree.getArray()[0]).size());
            assertTrue(original.getArray()[0] != newTree.getArray()[0]);
            assertEquals(
                ((GenericController) original.getArray()[0]).getName(),
                ((GenericController) newTree.getArray()[0]).getName());
            assertSame(
                original.getTree(original.getArray()[0]).getArray()[1],
                newTree.getTree(newTree.getArray()[0]).getArray()[1]);
            TestPlan clonedTestPlan = (TestPlan) newTree.getArray()[1];
            clonedTestPlan.setRunningVersion(true);
            clonedTestPlan.recoverRunningVersion();
            assertTrue(
                !plan
                    .getProperty(TestPlan.USER_DEFINED_VARIABLES)
                    .isRunningVersion());
            assertTrue(
                clonedTestPlan
                    .getProperty(TestPlan.USER_DEFINED_VARIABLES)
                    .isRunningVersion());
            Arguments vars =
                (Arguments) plan
                    .getProperty(TestPlan.USER_DEFINED_VARIABLES)
                    .getObjectValue();
            PropertyIterator iter =
                ((CollectionProperty) vars.getProperty(Arguments.ARGUMENTS))
                    .iterator();
            while (iter.hasNext())
            {
                JMeterProperty argProp = iter.next();               
                assertTrue(!argProp.isRunningVersion());
                assertTrue(argProp.getObjectValue() instanceof Argument);
                Argument arg = (Argument)argProp.getObjectValue();
                arg.setValue("yahoo");
                assertEquals("yahoo",arg.getValue());
            }
            vars =
                (Arguments) clonedTestPlan
                    .getProperty(TestPlan.USER_DEFINED_VARIABLES)
                    .getObjectValue();
            iter = vars.propertyIterator();
            while (iter.hasNext())
            {
View Full Code Here

Examples of org.apache.jmeter.testelement.TestPlan

    }

    /* Implements JMeterGUIComponent.createTestElement() */
    public TestElement createTestElement()
    {
        TestPlan tp = new TestPlan();
        modifyTestElement(tp);
        return tp;
    }
View Full Code Here

Examples of org.apache.jmeter.testelement.TestPlan

    public void modifyTestElement(TestElement plan)
    {
        super.configureTestElement(plan);
        if (plan instanceof TestPlan)
        {
            TestPlan tp = (TestPlan) plan;
            tp.setFunctionalMode(functionalMode.isSelected());
            tp.setSerialized(serializedMode.isSelected());
            tp.setUserDefinedVariables(
                (Arguments) argsPanel.createTestElement());
      tp.setProperty(TestPlan.COMMENTS,commentPanel.getText());
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.