Search in sources :

Example 76 with CollectionProperty

use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.

the class JMeterPluginsUtilsTest method testCollectionPropertyToTableModelRows.

@Test
public void testCollectionPropertyToTableModelRows() {
    System.out.println("collectionPropertyToTableModelRows");
    String propname = "prop";
    PowerTableModel modelSrc = getTestModel();
    CollectionProperty propExp = JMeterPluginsUtils.tableModelRowsToCollectionProperty(modelSrc, propname);
    PowerTableModel modelDst = getTestModel();
    modelDst.clearData();
    JMeterPluginsUtils.collectionPropertyToTableModelRows(propExp, modelDst);
    CollectionProperty propRes = JMeterPluginsUtils.tableModelRowsToCollectionProperty(modelDst, propname);
    assertEquals(propExp.toString(), propRes.toString());
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) PowerTableModel(org.apache.jmeter.gui.util.PowerTableModel) Test(org.junit.Test)

Example 77 with CollectionProperty

use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.

the class JMeterPluginsUtilsTest method testTableModelRowsToCollectionProperty.

@Test
public void testTableModelRowsToCollectionProperty() {
    System.out.println("tableModelRowsToCollectionProperty");
    PowerTableModel model = getTestModel();
    String propname = "prop";
    CollectionProperty result = JMeterPluginsUtils.tableModelRowsToCollectionProperty(model, propname);
    assertEquals(2, result.size());
    assertEquals("[[1, 2], [3, 4]]", result.toString());
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) PowerTableModel(org.apache.jmeter.gui.util.PowerTableModel) Test(org.junit.Test)

Example 78 with CollectionProperty

use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter by apache.

the class TestAuthManager method testFile.

@Test
public void testFile() throws Exception {
    AuthManager am = new AuthManager();
    CollectionProperty ao = am.getAuthObjects();
    assertEquals(0, ao.size());
    am.addFile(findTestPath("testfiles/TestAuth.txt"));
    assertEquals(9, ao.size());
    Authorization at;
    at = am.getAuthForURL(new URL("http://a.b.c/"));
    assertEquals("login", at.getUser());
    assertEquals("password", at.getPass());
    // same as above
    at = am.getAuthForURL(new URL("http://a.b.c:80/"));
    assertEquals("login", at.getUser());
    assertEquals("password", at.getPass());
    // not same
    at = am.getAuthForURL(new URL("http://a.b.c:443/"));
    assertNull(at);
    at = am.getAuthForURL(new URL("http://a.b.c/1"));
    assertEquals("login1", at.getUser());
    assertEquals("password1", at.getPass());
    assertEquals("", at.getDomain());
    assertEquals("", at.getRealm());
    at = am.getAuthForURL(new URL("http://d.e.f/"));
    assertEquals("user", at.getUser());
    assertEquals("pass", at.getPass());
    assertEquals("domain", at.getDomain());
    assertEquals("realm", at.getRealm());
    at = am.getAuthForURL(new URL("https://j.k.l/"));
    assertEquals("jkl", at.getUser());
    assertEquals("pass", at.getPass());
    at = am.getAuthForURL(new URL("https://j.k.l:443/"));
    assertEquals("jkl", at.getUser());
    assertEquals("pass", at.getPass());
    at = am.getAuthForURL(new URL("https://l.m.n/"));
    assertEquals("lmn443", at.getUser());
    assertEquals("pass", at.getPass());
    at = am.getAuthForURL(new URL("https://l.m.n:443/"));
    assertEquals("lmn443", at.getUser());
    assertEquals("pass", at.getPass());
    at = am.getAuthForURL(new URL("https://l.m.n:8443/"));
    assertEquals("lmn8443", at.getUser());
    assertEquals("pass", at.getPass());
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) URL(java.net.URL) Test(org.junit.jupiter.api.Test)

Example 79 with CollectionProperty

use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter by apache.

the class HTTPFileArgs method asArray.

/**
 * Get the current arguments as an array.
 *
 * @return an array of file arguments
 */
public HTTPFileArg[] asArray() {
    CollectionProperty props = getHTTPFileArgsCollection();
    final int size = props.size();
    HTTPFileArg[] args = new HTTPFileArg[size];
    for (int i = 0; i < size; i++) {
        args[i] = (HTTPFileArg) props.get(i).getObjectValue();
    }
    return args;
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty)

Example 80 with CollectionProperty

use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter by apache.

the class HTTPFileArgs method clear.

/**
 * Clear the files.
 */
@Override
public void clear() {
    super.clear();
    setProperty(new CollectionProperty(HTTP_FILE_ARGS, new ArrayList<HTTPFileArg>()));
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) ArrayList(java.util.ArrayList)

Aggregations

CollectionProperty (org.apache.jmeter.testelement.property.CollectionProperty)91 JMeterProperty (org.apache.jmeter.testelement.property.JMeterProperty)29 ArrayList (java.util.ArrayList)19 NullProperty (org.apache.jmeter.testelement.property.NullProperty)13 Test (org.junit.Test)11 PropertyIterator (org.apache.jmeter.testelement.property.PropertyIterator)8 Test (org.junit.jupiter.api.Test)7 IOException (java.io.IOException)5 List (java.util.List)4 StringProperty (org.apache.jmeter.testelement.property.StringProperty)4 File (java.io.File)3 Argument (org.apache.jmeter.config.Argument)3 PowerTableModel (org.apache.jmeter.gui.util.PowerTableModel)3 TestPlan (org.apache.jmeter.testelement.TestPlan)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 Field (java.lang.reflect.Field)2 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 UnknownHostException (java.net.UnknownHostException)2 LinkedList (java.util.LinkedList)2