use of org.apache.jmeter.testelement.property.StringProperty in project jmeter by apache.
the class LDAPSampler method getBasicAttributes.
/**
* This will create the Basic Attributes for the In build TestCase for Add
* Test.
*
* @return the BasicAttributes
*/
private BasicAttributes getBasicAttributes() {
BasicAttributes basicattributes = new BasicAttributes();
//$NON-NLS-1$
BasicAttribute basicattribute = new BasicAttribute("objectclass");
//$NON-NLS-1$
basicattribute.add("top");
//$NON-NLS-1$
basicattribute.add("person");
//$NON-NLS-1$
basicattribute.add("organizationalPerson");
//$NON-NLS-1$
basicattribute.add("inetOrgPerson");
basicattributes.put(basicattribute);
//$NON-NLS-1$
String s1 = "User";
//$NON-NLS-1$
String s3 = "Test";
//$NON-NLS-1$
String s5 = "user";
//$NON-NLS-1$
String s6 = "test";
COUNTER.incrementAndGet();
//$NON-NLS-1$
basicattributes.put(new BasicAttribute("givenname", s1));
//$NON-NLS-1$
basicattributes.put(new BasicAttribute("sn", s3));
//$NON-NLS-1$ //$NON-NLS-2$
basicattributes.put(new BasicAttribute("cn", "TestUser" + COUNTER.get()));
//$NON-NLS-1$
basicattributes.put(new BasicAttribute("uid", s5));
//$NON-NLS-1$
basicattributes.put(new BasicAttribute("userpassword", s6));
//$NON-NLS-1$
setProperty(new StringProperty(ADD, "cn=TestUser" + COUNTER.get()));
return basicattributes;
}
use of org.apache.jmeter.testelement.property.StringProperty 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.property.StringProperty 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.property.StringProperty 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.property.StringProperty 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