Search in sources :

Example 91 with CompoundVariable

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

the class SplitFunctionTest method splitParams.

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

Example 92 with CompoundVariable

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

the class SumFunctionTest method checkSumNoVar.

// Perform a sum and check the results
private void checkSumNoVar(AbstractFunction func, String value, String[] addends) throws Exception {
    Collection<CompoundVariable> parms = new LinkedList<>();
    for (String addend : addends) {
        parms.add(new CompoundVariable(addend));
    }
    func.setParameters(parms);
    assertEquals(value, func.execute(null, null));
}
Also used : CompoundVariable(org.apache.jmeter.engine.util.CompoundVariable) LinkedList(java.util.LinkedList)

Example 93 with CompoundVariable

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

the class TestEscapeOroRegexpChars method testNOEscape.

@Test
public void testNOEscape() throws Exception {
    params.add(new CompoundVariable("toto1titi"));
    function.setParameters(params);
    String ret = function.execute(result, null);
    assertEquals("toto1titi", ret);
}
Also used : CompoundVariable(org.apache.jmeter.engine.util.CompoundVariable) Test(org.junit.Test)

Example 94 with CompoundVariable

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

the class TestEscapeOroRegexpChars method testEscapeSpace.

@Test
public void testEscapeSpace() throws Exception {
    params.add(new CompoundVariable("toto1 titi"));
    function.setParameters(params);
    String ret = function.execute(result, null);
    assertEquals("toto1\\ titi", ret);
}
Also used : CompoundVariable(org.apache.jmeter.engine.util.CompoundVariable) Test(org.junit.Test)

Example 95 with CompoundVariable

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

the class TestEscapeOroRegexpChars method testEscape.

@Test
public void testEscape() throws Exception {
    params.add(new CompoundVariable("toto(.+?)titi"));
    function.setParameters(params);
    String ret = function.execute(result, null);
    assertEquals("toto\\(\\.\\+\\?\\)titi", ret);
}
Also used : CompoundVariable(org.apache.jmeter.engine.util.CompoundVariable) Test(org.junit.Test)

Aggregations

CompoundVariable (org.apache.jmeter.engine.util.CompoundVariable)103 Test (org.junit.Test)77 JMeterVariables (org.apache.jmeter.threads.JMeterVariables)16 LinkedList (java.util.LinkedList)9 JMeterContext (org.apache.jmeter.threads.JMeterContext)7 File (java.io.File)4 IOException (java.io.IOException)3 LocalDateTime (java.time.LocalDateTime)3 HashMap (java.util.HashMap)2 ReplaceStringWithFunctions (org.apache.jmeter.engine.util.ReplaceStringWithFunctions)2 InvalidVariableException (org.apache.jmeter.functions.InvalidVariableException)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 JMeterStopThreadException (org.apache.jorphan.util.JMeterStopThreadException)2 BufferedReader (java.io.BufferedReader)1 FileReader (java.io.FileReader)1 DecimalFormat (java.text.DecimalFormat)1 LocalDate (java.time.LocalDate)1 ArrayList (java.util.ArrayList)1