use of org.apache.jmeter.testelement.TestElement in project jmeter by apache.
the class AuthPanel method createTestElement.
@Override
public TestElement createTestElement() {
AuthManager authMan = tableModel.manager;
configureTestElement(authMan);
authMan.setClearEachIteration(clearEachIteration.isSelected());
return (TestElement) authMan.clone();
}
use of org.apache.jmeter.testelement.TestElement in project jmeter by apache.
the class TestValueReplacer method testReplace.
@Test
public void testReplace() throws Exception {
ValueReplacer replacer = new ValueReplacer();
replacer.setUserDefinedVariables(variables.getUserDefinedVariables());
TestElement element = new ConfigTestElement();
element.setProperty(new StringProperty("domain", "${server}"));
replacer.replaceValues(element);
element.setRunningVersion(true);
assertEquals("jakarta.apache.org", element.getPropertyAsString("domain"));
}
use of org.apache.jmeter.testelement.TestElement in project jmeter by apache.
the class TestValueReplacer method replaceWord.
private String replaceWord(String matchRegex, String testData) throws Exception {
TestPlan plan = new TestPlan();
plan.addParameter("domainMatcher", matchRegex);
ValueReplacer replacer = new ValueReplacer(plan);
TestElement element = new TestPlan();
element.setProperty(new StringProperty("mail", testData));
replacer.reverseReplace(element, true);
return element.getPropertyAsString("mail");
}
use of org.apache.jmeter.testelement.TestElement in project jmeter by apache.
the class TestValueReplacer method testOverlappingMatches.
@Test
public void testOverlappingMatches() throws Exception {
TestPlan plan = new TestPlan();
plan.addParameter("longMatch", "servername");
plan.addParameter("shortMatch", ".*");
ValueReplacer replacer = new ValueReplacer(plan);
TestElement element = new TestPlan();
element.setProperty(new StringProperty("domain", "servername.domain"));
replacer.reverseReplace(element, true);
String replacedDomain = element.getPropertyAsString("domain");
assertEquals("${${shortMatch}", replacedDomain);
}
use of org.apache.jmeter.testelement.TestElement in project jmeter by apache.
the class TestValueReplacer method testReverseReplacement.
@Test
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<>();
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());
}
Aggregations