Search in sources :

Example 1 with CompoundVariable

use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.

the class CSVReadFunctionTest method setCSVReadParams.

// Create the CSVRead function and set its parameters.
private static CSVRead setCSVReadParams(String p1, String p2) throws Exception {
    CSVRead cr = new CSVRead();
    Collection<CompoundVariable> parms = new LinkedList<>();
    if (p1 != null) {
        parms.add(new CompoundVariable(p1));
    }
    if (p2 != null) {
        parms.add(new CompoundVariable(p2));
    }
    cr.setParameters(parms);
    return cr;
}
Also used : CompoundVariable(org.apache.jmeter.engine.util.CompoundVariable) LinkedList(java.util.LinkedList)

Example 2 with CompoundVariable

use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.

the class PackageTest method setCSVReadParams.

// Create the CSVRead function and set its parameters.
private static CSVRead setCSVReadParams(String p1, String p2) throws Exception {
    CSVRead cr = new CSVRead();
    Collection<CompoundVariable> parms = new LinkedList<>();
    if (p1 != null) {
        parms.add(new CompoundVariable(p1));
    }
    if (p2 != null) {
        parms.add(new CompoundVariable(p2));
    }
    cr.setParameters(parms);
    return cr;
}
Also used : CompoundVariable(org.apache.jmeter.engine.util.CompoundVariable) LinkedList(java.util.LinkedList)

Example 3 with CompoundVariable

use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.

the class StringFromFileFunctionTest method SFFParams.

// Create the StringFromFile function and set its parameters.
private static StringFromFile SFFParams(String p1, String p2, String p3, String p4) throws Exception {
    StringFromFile sff = new StringFromFile();
    Collection<CompoundVariable> parms = new LinkedList<>();
    if (p1 != null) {
        parms.add(new CompoundVariable(p1));
    }
    if (p2 != null) {
        parms.add(new CompoundVariable(p2));
    }
    if (p3 != null) {
        parms.add(new CompoundVariable(p3));
    }
    if (p4 != null) {
        parms.add(new CompoundVariable(p4));
    }
    sff.setParameters(parms);
    return sff;
}
Also used : CompoundVariable(org.apache.jmeter.engine.util.CompoundVariable) LinkedList(java.util.LinkedList)

Example 4 with CompoundVariable

use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter-plugins by undera.

the class SubstringTest method testSetParameters.

/**
 * Test of setParameters method, of class Substring.
 */
@Test
public void testSetParameters() throws Exception {
    System.out.println("setParameters");
    Collection<CompoundVariable> parameters = new ArrayList<CompoundVariable>();
    parameters.add(new CompoundVariable("test string"));
    parameters.add(new CompoundVariable("0"));
    parameters.add(new CompoundVariable("1"));
    Substring instance = new Substring();
    instance.setParameters(parameters);
    instance.execute(null, null);
}
Also used : CompoundVariable(org.apache.jmeter.engine.util.CompoundVariable) ArrayList(java.util.ArrayList)

Example 5 with CompoundVariable

use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter-plugins by undera.

the class SubstringTest method testExecute.

/**
 * Test of execute method, of class Substring.
 */
@Test
public void testExecute() throws Exception {
    System.out.println("execute 1");
    Collection<CompoundVariable> parameters = new ArrayList<CompoundVariable>();
    parameters.add(new CompoundVariable("test string"));
    parameters.add(new CompoundVariable("5"));
    parameters.add(new CompoundVariable("8"));
    parameters.add(new CompoundVariable("var"));
    Substring instance = new Substring();
    instance.setParameters(parameters);
    String expResult = "str";
    String result = instance.execute(null, null);
    Assert.assertEquals(expResult, result);
}
Also used : CompoundVariable(org.apache.jmeter.engine.util.CompoundVariable) ArrayList(java.util.ArrayList)

Aggregations

CompoundVariable (org.apache.jmeter.engine.util.CompoundVariable)189 Test (org.junit.jupiter.api.Test)107 ArrayList (java.util.ArrayList)31 JMeterVariables (org.apache.jmeter.threads.JMeterVariables)27 JMeterSerialTest (org.apache.jorphan.test.JMeterSerialTest)20 SampleResult (org.apache.jmeter.samplers.SampleResult)19 Sampler (org.apache.jmeter.samplers.Sampler)19 LinkedList (java.util.LinkedList)14 JMeterContext (org.apache.jmeter.threads.JMeterContext)10 LocalDateTime (java.time.LocalDateTime)6 File (java.io.File)5 IOException (java.io.IOException)4 DateTimeFormatter (java.time.format.DateTimeFormatter)4 Test (org.junit.Test)4 LocalDate (java.time.LocalDate)3 HashMap (java.util.HashMap)2 ReplaceStringWithFunctions (org.apache.jmeter.engine.util.ReplaceStringWithFunctions)2 TestSampler (org.apache.jmeter.junit.stubs.TestSampler)2 JMeterProperty (org.apache.jmeter.testelement.property.JMeterProperty)2 StringProperty (org.apache.jmeter.testelement.property.StringProperty)2