Examples of UrlConfig


Examples of org.apache.jmeter.protocol.http.config.UrlConfig

    assertTrue(!config.getUrl().toString().equals(newUrl));
  }

  public void testFailSimpleParse1() throws Exception
  {
    UrlConfig config = makeUrlConfig(".*index.*param2=.+1");
    URL context = new URL("http://www.apache.org/subdir/previous.html");
    String responseText = "<html><head><title>Test page</title></head><body>" +
        "<a href=\"/home/index.html?param1=value1\">Goto index page</a></body></html>";
    Entry entry = new Entry();
    entry.addConfigElement(config);
    SampleResult result = new SampleResult();
    result.putValue(SampleResult.TEXT_RESPONSE,responseText.getBytes());
    result.putValue(HTTPSampler.URL,context);
    parser.modifyEntry(entry, result);
    String newUrl = ((UrlConfig)entry.getConfigElement(UrlConfig.class)).getUrl().toString();
    assertEquals(config.getUrl().toString(),newUrl);
  }
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

    assertEquals(config.getUrl().toString(),newUrl);
  }

  public void testFailSimpleParse2() throws Exception
  {
    UrlConfig config = makeUrlConfig(".*login\\.html");
    URL context = new URL("http://www.apache.org/subdir/previous.html");
    String responseText = "<html><head><title>Test page</title></head><body>" +
        "<a href=\"/home/index.html?param1=value1\">Goto index page</a></body></html>";
    Entry entry = new Entry();
    entry.addConfigElement(config);
    SampleResult result = new SampleResult();
    result.putValue(SampleResult.TEXT_RESPONSE,responseText.getBytes());
    result.putValue(HTTPSampler.URL,context);
    parser.modifyEntry(entry, result);
    String newUrl = ((UrlConfig)entry.getConfigElement(UrlConfig.class)).getUrl().toString();
    this.assertTrue(!"http://www.apache.org:80/home/index.html?param1=value1".equals(newUrl));
    assertEquals(config.getUrl().toString(),newUrl);
  }
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

   *
   *@exception  Exception  Description of Exception
   ***********************************************************/
  public void testSimpleFormParse() throws Exception
  {
    UrlConfig config = makeUrlConfig(".*index.html");
    config.addArgument("test","g.*");
    config.setMethod(UrlConfig.POST);
    URL context = new URL("http://www.apache.org/subdir/previous.html");
    Entry entry = new Entry();
    entry.addConfigElement(config);
    String responseText = "<html><head><title>Test page</title></head><body>" +
        "<form action=\"index.html\" method=\"POST\"><input type=\"checkbox\" name=\"test\""+
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

    assertEquals("test=goto",((UrlConfig)entry.getConfigElement(UrlConfig.class)).getQueryString());
  }

  private UrlConfig makeUrlConfig(String path)
  {
    UrlConfig config = new UrlConfig();
    config.setDomain("www.apache.org");
    config.setMethod(config.GET);
    config.setPath(path);
    config.setPort(80);
    config.setProtocol("http");
    return config;
  }
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

    args.addArgument("password","pass");

    args.addArgument("action","login");

    config = new UrlConfig();

    config.setName("Full Config");

    config.putProperty(config.DOMAIN,"www.lazer.com");

    config.putProperty(config.PATH,"login.jsp");

    config.putProperty(config.METHOD,config.POST);

    config.putProperty(config.ARGUMENTS,args);



    defaultConfig = new UrlConfig();

    defaultConfig.setName("default");

    defaultConfig.putProperty(config.DOMAIN,"www.xerox.com");

    defaultConfig.putProperty(config.PATH,"default.html");



    partialConfig = new UrlConfig();

    partialConfig.putProperty(config.PATH,"main.jsp");

    partialConfig.putProperty(config.METHOD,config.GET);
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

    }
  }

  private UrlConfig getDefaultUrl()
  {
    UrlConfig def = new UrlConfig();
    def.putProperty(def.DOMAIN, "www.xerox.com");
    def.putProperty(def.PATH, "index.html");
    def.putProperty(def.METHOD, def.GET);
    return def;
  }
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

    return def;
  }

  private UrlConfig getUrl_2()
  {
    UrlConfig con = new UrlConfig();
    con.putProperty(con.PATH, "login.jsp");
    con.putProperty(con.METHOD, con.POST);
    Arguments args = new Arguments();
    args.addArgument("username", "mstover");
    args.addArgument("password", "pass");
    args.addArgument("action", "login");
    con.putProperty(con.ARGUMENTS, args);
    return con;
  }
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

    engine.runTest();
  }

  private SamplerController createTestSample(String url) throws MalformedURLException
  {
    UrlConfig config = new UrlConfig();
    URL u = new URL(url);
    config.setName(u.toString());
    config.putProperty(UrlConfig.METHOD, UrlConfig.GET);
    config.putProperty(UrlConfig.DOMAIN, u.getHost());
    config.putProperty(UrlConfig.PATH, u.getFile());
    SamplerController test = new HttpTestSample();
    test.addConfigElement(config);
    return test;
  }
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

  private SampleResult sample(Entry e, boolean redirected)
  {
    long time;
    HttpURLConnection conn;
    SampleResult res = new SampleResult();
    UrlConfig url = (UrlConfig)e.getConfigElement(UrlConfig.class);
    URL u = null;
    try
    {
      u = url.getUrl();
      System.out.println("Sampling url: "+u);
      res.putValue(Sampler.SAMPLE_LABEL, u.toString());
      conn = (HttpURLConnection)u.openConnection();
      conn.setFollowRedirects(false);
      conn.setRequestMethod((String)url.getProperty(UrlConfig.METHOD));
      setConnectionCookie(conn, u, (CookieManager)e.getConfigElement(CookieManager.class));
      setConnectionAuthorization(conn, u, (AuthManager)e.getConfigElement(AuthManager.class));
      // if POSTing data, write data to output stream
      if (!redirected && url.getProperty(UrlConfig.METHOD).equals(UrlConfig.POST))
      {
        sendPostData(conn, url);
      }
      time = System.currentTimeMillis();
      conn.connect();
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

    if(entryIrrelevant(entry))
    {
      return;
    }
    parsedConfigs = new LinkedList();
    UrlConfig config = (UrlConfig)entry.getConfigElement(
           org.apache.jmeter.protocol.http.config.UrlConfig.class);
    parseResponse(currentResponse);
    Iterator iter = parsedConfigs.iterator();
    while (iter.hasNext())
    {
      UrlConfig item = (UrlConfig)iter.next();
      if(item.getDomain().equals(config.getDomain()) &&
          item.getPath().equals(config.getPath()))
      {
        //modifyEntry(entry,item);
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.