Save This Page
Home » jakarta-jmeter-2.3.4_src » org.apache.jmeter.protocol.java.config » [javadoc | source]
    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *   http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    * Unless required by applicable law or agreed to in writing, software
   12    * distributed under the License is distributed on an "AS IS" BASIS,
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    * See the License for the specific language governing permissions and
   15    * limitations under the License.
   16    *
   17    */
   18   
   19   package org.apache.jmeter.protocol.java.config;
   20   
   21   import java.io.Serializable;
   22   
   23   import org.apache.jmeter.config.Arguments;
   24   import org.apache.jmeter.config.ConfigTestElement;
   25   import org.apache.jmeter.protocol.java.sampler.JavaSampler;
   26   import org.apache.jmeter.testelement.property.TestElementProperty;
   27   
   28   /**
   29    * The <code>JavaConfig</code> class contains the configuration data necessary
   30    * for the Java protocol. This data is used to configure a
   31    * {@link org.apache.jmeter.protocol.java.sampler.JavaSamplerClient} instance to
   32    * perform performance test samples.
   33    *
   34    * @version $Revision: 674365 $
   35    */
   36   public class JavaConfig extends ConfigTestElement implements Serializable {
   37   
   38       /**
   39        * Constructor for the JavaConfig object
   40        */
   41       public JavaConfig() {
   42           setArguments(new Arguments());
   43       }
   44   
   45       /**
   46        * Sets the class name attribute of the JavaConfig object. This is the class
   47        * name of the
   48        * {@link org.apache.jmeter.protocol.java.sampler.JavaSamplerClient}
   49        * implementation which will be used to execute the test.
   50        *
   51        * @param classname
   52        *            the new classname value
   53        */
   54       public void setClassname(String classname) {
   55           setProperty(JavaSampler.CLASSNAME, classname);
   56       }
   57   
   58       /**
   59        * Gets the class name attribute of the JavaConfig object. This is the class
   60        * name of the
   61        * {@link org.apache.jmeter.protocol.java.sampler.JavaSamplerClient}
   62        * implementation which will be used to execute the test.
   63        *
   64        * @return the classname value
   65        */
   66       public String getClassname() {
   67           return getPropertyAsString(JavaSampler.CLASSNAME);
   68       }
   69   
   70       /**
   71        * Adds an argument to the list of arguments for this JavaConfig object. The
   72        * {@link org.apache.jmeter.protocol.java.sampler.JavaSamplerClient}
   73        * implementation can access these arguments through the
   74        * {@link org.apache.jmeter.protocol.java.sampler.JavaSamplerContext}.
   75        *
   76        * @param name
   77        *            the name of the argument to be added
   78        * @param value
   79        *            the value of the argument to be added
   80        */
   81       public void addArgument(String name, String value) {
   82           Arguments args = this.getArguments();
   83           args.addArgument(name, value);
   84       }
   85   
   86       /**
   87        * Removes all of the arguments associated with this JavaConfig object.
   88        */
   89       public void removeArguments() {
   90           setProperty(new TestElementProperty(JavaSampler.ARGUMENTS, new Arguments()));
   91       }
   92   
   93       /**
   94        * Set all of the arguments for this JavaConfig object. This will replace
   95        * any previously added arguments. The
   96        * {@link org.apache.jmeter.protocol.java.sampler.JavaSamplerClient}
   97        * implementation can access these arguments through the
   98        * {@link org.apache.jmeter.protocol.java.sampler.JavaSamplerContext}.
   99        *
  100        * @param args
  101        *            the new arguments
  102        */
  103       public void setArguments(Arguments args) {
  104           setProperty(new TestElementProperty(JavaSampler.ARGUMENTS, args));
  105       }
  106   
  107       /**
  108        * Gets the arguments for this JavaConfig object. The
  109        * {@link org.apache.jmeter.protocol.java.sampler.JavaSamplerClient}
  110        * implementation can access these arguments through the
  111        * {@link org.apache.jmeter.protocol.java.sampler.JavaSamplerContext}.
  112        *
  113        * @return the arguments
  114        */
  115       public Arguments getArguments() {
  116           return (Arguments) getProperty(JavaSampler.ARGUMENTS).getObjectValue();
  117       }
  118   }

Save This Page
Home » jakarta-jmeter-2.3.4_src » org.apache.jmeter.protocol.java.config » [javadoc | source]