Exemplo n.º 1
0
 public Arguments getDefaultParameters() {
   Arguments params = new Arguments();
   params.addArgument(LEVEL_PARAM_NAME, "${level}");
   params.addArgument(DU_PARAM_NAME, "${du}");
   params.addArgument(PARENTS_PARAM_NAME, "${parents}");
   return params;
 }
Exemplo n.º 2
0
 protected void printParameters(JavaSamplerContext context) {
   Arguments args = getDefaultParameters();
   logInfo("Parameters for sampler " + getClass().getName() + ":");
   for (String name : args.getArgumentsAsMap().keySet()) {
     logInfo(name + " = " + context.getParameter(name));
   }
 }
Exemplo n.º 3
0
 @Override
 public Arguments getDefaultParameters() {
   Arguments argu = new Arguments();
   argu.addArgument("da", "");
   argu.addArgument("db", "");
   return argu;
 }
Exemplo n.º 4
0
 private Arguments getUnclonedParameters() {
   stopTableEditing();
   @SuppressWarnings("unchecked") // only contains Argument (or HTTPArgument)
   Iterator<HTTPArgument> modelData = (Iterator<HTTPArgument>) tableModel.iterator();
   Arguments args = new Arguments();
   while (modelData.hasNext()) {
     HTTPArgument arg = modelData.next();
     args.addArgument(arg);
   }
   return args;
 }
Exemplo n.º 5
0
 public void testGrabSessionId3() throws Exception {
   String html = "href='index.html?session_id=jfdkjdkfjddkfdfjkdjfdf'";
   response = new SampleResult();
   response.setResponseData(html.getBytes());
   URLRewritingModifier mod = new URLRewritingModifier();
   mod.setArgumentName("session_id");
   HTTPSampler sampler = createSampler();
   context.setCurrentSampler(sampler);
   context.setPreviousResult(response);
   mod.process();
   Arguments args = sampler.getArguments();
   assertEquals(
       "jfdkjdkfjddkfdfjkdjfdf",
       ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
 }
Exemplo n.º 6
0
 /**
  * Provide a list of parameters which this test supports. Any parameter names and associated
  * values returned by this method will appear in the GUI by default so the user doesn't have to
  * remember the exact names. The user can add other parameters which are not listed here. If this
  * method returns null then no parameters will be listed. If the value for some parameter is null
  * then that parameter will be listed in the GUI with an empty value.
  *
  * @return a specification of the parameters used by this test which should be listed in the GUI,
  *     or null if no parameters should be listed.
  */
 @Override
 public Arguments getDefaultParameters() {
   Arguments params = new Arguments();
   params.addArgument(SLEEP_NAME, String.valueOf(DEFAULT_SLEEP_TIME));
   params.addArgument(MASK_NAME, DEFAULT_MASK_STRING);
   params.addArgument(LABEL_NAME, "");
   params.addArgument(RESPONSE_CODE_NAME, RESPONSE_CODE_DEFAULT);
   params.addArgument(RESPONSE_MESSAGE_NAME, RESPONSE_MESSAGE_DEFAULT);
   params.addArgument(SUCCESS_NAME, SUCCESS_DEFAULT);
   params.addArgument(SAMPLER_DATA_NAME, SAMPLER_DATA_DEFAULT);
   params.addArgument(RESULT_DATA_NAME, SAMPLER_DATA_DEFAULT);
   return params;
 }
  /**
   * @see
   *     org.apache.jmeter.protocol.http.proxy.SamplerCreator#populateSampler(org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase,
   *     org.apache.jmeter.protocol.http.proxy.HttpRequestHdr, java.util.Map, java.util.Map)
   */
  @Override
  public final void populateSampler(
      HTTPSamplerBase sampler,
      HttpRequestHdr request,
      Map<String, String> pageEncodings,
      Map<String, String> formEncodings)
      throws Exception {
    computeFromHeader(sampler, request, pageEncodings, formEncodings);

    computeFromPostBody(sampler, request);
    if (log.isDebugEnabled()) {
      log.debug("sampler path = " + sampler.getPath());
    }
    Arguments arguments = sampler.getArguments();
    if (arguments.getArgumentCount() == 1 && arguments.getArgument(0).getName().length() == 0) {
      sampler.setPostBodyRaw(true);
    }
  }
Exemplo n.º 8
0
 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());
   URLRewritingModifier mod = new URLRewritingModifier();
   mod.setArgumentName("session_id");
   HTTPSampler 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());
 }
Exemplo n.º 9
0
  public Arguments getDefaultParameters() {
    Arguments params = new Arguments();
    conf.setApiUri("tradeorder/cancel/v1");
    String confStr = gson.toJson(conf);
    String handMsg = gson.toJson(headMsg);
    params.addArgument("conf", confStr);
    params.addArgument("handMsg", handMsg);

    params.addArgument("orderSerial", "订单号,由商户生成");
    params.addArgument("accountSerial", "账户编号");
    params.addArgument("sourceApplySerial", "原基金公司订单编号");
    params.addArgument("tradePassword", "交易密码,特殊授权的商户可以不传该字段");
    params.addArgument("remark", "备注");
    return params;
  }
 public Arguments getDefaultParameters() {
   Arguments defaultParameters = new Arguments();
   defaultParameters.addArgument("indexfilesystem.path", "${indexfilesystem.path}");
   defaultParameters.addArgument("resultsDirectory", "${resultsDirectory}");
   return defaultParameters;
 }
Exemplo n.º 11
0
 @Override
 public Arguments getDefaultParameters() {
   Arguments args = new Arguments();
   args.addArgument(PARAM_STOP_ON_ERROR, "${stopOnError}");
   return args;
 }
Exemplo n.º 12
0
 @Override
 public TestElement createTestElement() {
   Arguments args = getUnclonedParameters();
   this.configureTestElement(args);
   return (TestElement) args.clone();
 }
Exemplo n.º 13
0
 /**
  * Convert the argument panel contents to an {@link Arguments} collection.
  *
  * @return a collection of {@link UPMPArgument} entries
  */
 public Arguments getParameters() {
   Arguments args = getUnclonedParameters();
   return (Arguments) args.clone();
 }
Exemplo n.º 14
0
 /**
  * Adds an argument to the list of arguments for this JavaConfig object. The {@link
  * org.apache.jmeter.protocol.java.sampler.JavaSamplerClient} implementation can access these
  * arguments through the {@link org.apache.jmeter.protocol.java.sampler.JavaSamplerContext}.
  *
  * @param name the name of the argument to be added
  * @param value the value of the argument to be added
  */
 public void addArgument(String name, String value) {
   Arguments args = this.getArguments();
   args.addArgument(name, value);
 }