Package org.apache.jmeter.protocol.http.sampler

Examples of org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase$ASyncSample


        public void testGrabSessionId() throws Exception {
      String html = "location: http://server.com/index.html" + "?session_id=jfdkjdkf%20jddkfdfjkdjfdf%22;";
      response = new SampleResult();
      response.setResponseData(html.getBytes());
      mod.setArgumentName("session_id");
      HTTPSamplerBase sampler = createSampler();
      sampler.addArgument("session_id", "adfasdfdsafasdfasd");
      context.setCurrentSampler(sampler);
      context.setPreviousResult(response);
      mod.process();
      Arguments args = sampler.getArguments();
      assertEquals("jfdkjdkf jddkfdfjkdjfdf\"", ((Argument) args.getArguments().get(0).getObjectValue())
          .getValue());
      assertEquals("http://server.com/index.html?" + "session_id=jfdkjdkf+jddkfdfjkdjfdf%22", sampler.toString());
    }
View Full Code Here


    public void testGrabSessionId2() throws Exception {
      String html = "<a href=\"http://server.com/index.html?" + "session_id=jfdkjdkfjddkfdfjkdjfdf\">";
      response = new SampleResult();
      response.setResponseData(html.getBytes());
      mod.setArgumentName("session_id");
      HTTPSamplerBase sampler = createSampler();
      context.setCurrentSampler(sampler);
      context.setPreviousResult(response);
      mod.process();
      Arguments args = sampler.getArguments();
      assertEquals("jfdkjdkfjddkfdfjkdjfdf", ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
    }
View Full Code Here

      Arguments args = sampler.getArguments();
      assertEquals("jfdkjdkfjddkfdfjkdjfdf", ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
    }

    private HTTPSamplerBase createSampler() {
      HTTPSamplerBase sampler = new HTTPNullSampler();
      sampler.setDomain("server.com");
      sampler.setPath("index.html");
      sampler.setMethod(HTTPSamplerBase.GET);
      sampler.setProtocol("http");
      return sampler;
    }
View Full Code Here

    public void testGrabSessionId3() throws Exception {
      String html = "href='index.html?session_id=jfdkjdkfjddkfdfjkdjfdf'";
      response = new SampleResult();
      response.setResponseData(html.getBytes());
      mod.setArgumentName("session_id");
      HTTPSamplerBase sampler = createSampler();
      context.setCurrentSampler(sampler);
      context.setPreviousResult(response);
      mod.process();
      Arguments args = sampler.getArguments();
      assertEquals("jfdkjdkfjddkfdfjkdjfdf", ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
    }
View Full Code Here

    public void testGrabSessionIdEndedInTab() throws Exception {
      String html = "href='index.html?session_id=jfdkjdkfjddkfdfjkdjfdf\t";
      response = new SampleResult();
      response.setResponseData(html.getBytes());
      mod.setArgumentName("session_id");
      HTTPSamplerBase sampler = createSampler();
      context.setCurrentSampler(sampler);
      context.setPreviousResult(response);
      mod.process();
      Arguments args = sampler.getArguments();
      assertEquals("jfdkjdkfjddkfdfjkdjfdf", ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
    }
View Full Code Here

      response = new SampleResult();
      response.setResponseData(html.getBytes());
      mod.setArgumentName("%24sid%24");
      mod.setPathExtension(true);
      mod.setPathExtensionNoEquals(true);
      HTTPSamplerBase sampler = createSampler();
      context.setCurrentSampler(sampler);
      context.setPreviousResult(response);
      mod.process();
      // Arguments args = sampler.getArguments();
      assertEquals("index.html;%24sid%24KQNq3AAADQZoEQAxlkX8uQV5bjqVBPbT", sampler.getPath());
    }
View Full Code Here

        public void testGrabSessionId5() throws Exception {
      String html = "location: http://server.com/index.html" + "?session[33]=jfdkjdkf%20jddkfdfjkdjfdf%22;";
      response = new SampleResult();
      response.setResponseData(html.getBytes());
      mod.setArgumentName("session[33]");
      HTTPSamplerBase sampler = createSampler();
      sampler.addArgument("session[33]", "adfasdfdsafasdfasd");
      context.setCurrentSampler(sampler);
      context.setPreviousResult(response);
      mod.process();
      Arguments args = sampler.getArguments();
      assertEquals("jfdkjdkf jddkfdfjkdjfdf\"", ((Argument) args.getArguments().get(0).getObjectValue())
          .getValue());
      assertEquals("http://server.com/index.html?session%5B33%5D=jfdkjdkf+jddkfdfjkdjfdf%22", sampler.toString());
    }
View Full Code Here

        response.setResponseData(html[i].getBytes());
                URLRewritingModifier newMod = new URLRewritingModifier();
        newMod.setThreadContext(context);
        newMod.setArgumentName("sid");
        newMod.setPathExtension(false);
        HTTPSamplerBase sampler = createSampler();
        context.setCurrentSampler(sampler);
        context.setPreviousResult(response);
        newMod.process();
        Arguments args = sampler.getArguments();
        assertEquals("For case i=" + i, "myId",
                        ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
      }
    }
View Full Code Here

      String html =
          "<a href=\"#\" onclick=\"$(\'frame\').src=\'/index?param1=bla&sessionid=xyzxyzxyz\\'";
      response = new SampleResult();
      response.setResponseData(html.getBytes());
      mod.setArgumentName("sessionid");
      HTTPSamplerBase sampler = createSampler();
      sampler.addArgument("sessionid", "xyzxyzxyz");
      context.setCurrentSampler(sampler);
      context.setPreviousResult(response);
      mod.process();
      Arguments args = sampler.getArguments();
      assertEquals("xyzxyzxyz", ((Argument) args.getArguments().get(0).getObjectValue())
          .getValue());
    }
View Full Code Here

            newMod.setArgumentName("sid");
            newMod.setPathExtension(false);
            for (int i = 0; i < html.length; i++) {
                response = new SampleResult();
                response.setResponseData(html[i].getBytes());
                HTTPSamplerBase sampler = createSampler();
                context.setCurrentSampler(sampler);
                context.setPreviousResult(response);
                newMod.process();
                Arguments args = sampler.getArguments();
                assertEquals("For case i=" + i, "myId",
                        ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase$ASyncSample

Copyright © 2018 www.massapicom. 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.