Home » jakarta-jmeter-2.3.4_src » org.apache.jmeter.util » [javadoc | source]
org.apache.jmeter.util
public class: JMeterUtils [javadoc | source]
java.lang.Object
   org.apache.jmeter.util.JMeterUtils

All Implemented Interfaces:
    org.apache.jorphan.test.UnitTestManager

This class contains the static utility methods used by JMeter.
Field Summary
public static final  String RES_KEY_PFX     
Method from org.apache.jmeter.util.JMeterUtils Summary:
addLocaleChangeListener,   createButton,   createSimpleButton,   findFile,   findInArray,   getAlias,   getControllers,   getHashtable,   getImage,   getImage,   getJMeterBinDir,   getJMeterCopyright,   getJMeterHome,   getJMeterProperties,   getJMeterVersion,   getLocalHostFullName,   getLocalHostIP,   getLocalHostName,   getLocale,   getLocaleString,   getMatcher,   getPattern,   getPattern,   getPatternCache,   getPropDefault,   getPropDefault,   getPropDefault,   getPropDefault,   getProperties,   getProperty,   getRandomInt,   getResString,   getResString,   getResourceFileAsText,   getSearchPaths,   getTestSamples,   getTimers,   getVector,   getVisualizers,   getXMLParser,   initLocale,   initLogging,   initializeProperties,   instantiate,   instantiate,   isExpertMode,   loadJMeterProperties,   loadProperties,   removeLocaleChangeListener,   reportErrorToUser,   reportErrorToUser,   selJComboBoxItem,   setJMeterHome,   setLocale,   setProperty,   tokenize,   unsplit,   unsplit
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.jmeter.util.JMeterUtils Detail:
 public static  void addLocaleChangeListener(LocaleChangeListener listener) 
 public static JButton createButton(String name,
    ActionListener listener) 
    Create a button with the netscape style
 public static JButton createSimpleButton(String name,
    ActionListener listener) 
    Create a button with the netscape style
 public static File findFile(String fileName) 
    Find a file in the current directory or in the JMeter bin directory.
 public static int findInArray(String[] array,
    String value) 
    Finds a string in an array of strings and returns the
 public static Hashtable getAlias(Properties properties) 
    Creates the vector of alias strings.
 public static Vector getControllers(Properties properties) 
    Creates a vector of SampleController plugins.
 public static Hashtable getHashtable(Properties properties,
    String name) 
    Creates a table of strings for all the properties that start with a common prefix.
 public static ImageIcon getImage(String name) 
    This looks for the requested image in the classpath under org.apache.jmeter.images.
 public static ImageIcon getImage(String name,
    String description) 
    This looks for the requested image in the classpath under org.apache.jmeter.images. , and also sets the description of the image, which is useful if the icon is going to be placed on the clipboard.
 public static String getJMeterBinDir() 
    Get the JMeter bin directory - does not include the trailing separator.
 public static String getJMeterCopyright() 
    Gets the JMeter copyright.
 public static String getJMeterHome() 
    Get the JMeter home directory - does not include the trailing separator.
 public static Properties getJMeterProperties() 
    This gets the currently defined appProperties. It can only be called after the #getProperties(String) method is called.
 public static String getJMeterVersion() 
    Gets the JMeter Version.
 public static synchronized String getLocalHostFullName() 
    Returns the cached result from calling InetAddress.getLocalHost().getCanonicalHostName()
 public static synchronized String getLocalHostIP() 
    Returns the cached result from calling InetAddress.getLocalHost().getHostAddress()
 public static synchronized String getLocalHostName() 
    Returns the cached result from calling InetAddress.getLocalHost().getHostName()
 public static Locale getLocale() 
    Gets the current locale.
 public static String getLocaleString(String locale) 
    Get the locale name as a resource. Does not log an error if the resource does not exist. This is needed to support additional locales, as they won't be in existing messages files.
 public static Perl5Matcher getMatcher() 
    Gets Perl5Matcher for this thread.
 public static Pattern getPattern(String expression) 
    Get a compiled expression from the pattern cache (READ_ONLY).
 public static Pattern getPattern(String expression,
    int options) 
    Get a compiled expression from the pattern cache.
 public static PatternCacheLRU getPatternCache() 
 public static int getPropDefault(String propName,
    int defaultVal) 
    Get a int value with default if not present.
 public static boolean getPropDefault(String propName,
    boolean defaultVal) 
    Get a boolean value with default if not present.
 public static long getPropDefault(String propName,
    long defaultVal) 
    Get a long value with default if not present.
 public static String getPropDefault(String propName,
    String defaultVal) 
    Get a String value with default if not present.
 public static Properties getProperties(String file) 
    This method is used by the init method to load the property file that may even reside in the user space, or in the classpath under org.apache.jmeter.jmeter.properties. The method also initialises logging and sets up the default Locale TODO - perhaps remove? [still used
 public static String getProperty(String propName) 
    Get the value of a JMeter property.
 public static int getRandomInt(int r) 
    Provide random numbers
 public static String getResString(String key) 
    Gets the resource string for this key. If the resource is not found, a warning is logged
 public static String getResString(String key,
    String defaultValue) 
Deprecated! Only - intended for use in development; use getResString(String) normally

    Gets the resource string for this key. If the resource is not found, a warning is logged
 public static String getResourceFileAsText(String name) 
 public static String[] getSearchPaths() 
 public static String[] getTestSamples(Properties properties,
    String name) 
    Create a string of class names for a particular SamplerController
 public static Vector getTimers(Properties properties) 
    Creates the vector of Timers plugins.
 public static Vector getVector(Properties properties,
    String name) 
    Creates a vector of strings for all the properties that start with a common prefix.
 public static Vector getVisualizers(Properties properties) 
    Creates the vector of visualizer plugins.
 public static XMLReader getXMLParser() 
    Create an instance of an org.xml.sax.Parser based on the default props.
 public static  void initLocale() 
    Initialise the JMeter Locale
 public static  void initLogging() 
    Initialise JMeter logging
 public  void initializeProperties(String file) 
 public static Object instantiate(String className,
    String impls) 
    Instatiate an object and guarantee its class.
 public static Vector instantiate(Vector v,
    String className) 
    Instantiate a vector of classes
 public static boolean isExpertMode() 
    Determine whether we are in 'expert' mode. Certain features may be hidden from user's view unless in expert mode.
 public static  void loadJMeterProperties(String file) 
    Load the JMeter properties file; if not found, then default to "org/apache/jmeter/jmeter.properties" from the classpath c.f. loadProperties
 public static Properties loadProperties(String file) 
    This method loads a property file that may reside in the user space, or in the classpath
 public static  void removeLocaleChangeListener(LocaleChangeListener listener) 
 public static  void reportErrorToUser(String errorMsg) 
    Report an error through a dialog box. Title defaults to "error_title" resource string
 public static  void reportErrorToUser(String errorMsg,
    String titleMsg) 
    Report an error through a dialog box.
 public static  void selJComboBoxItem(Properties properties,
    JComboBox combo,
    Vector namVec,
    String name) 
    Sets the selection of the JComboBox to the Object 'name' from the list in namVec.
 public static  void setJMeterHome(String home) 
 public static  void setLocale(Locale loc) 
    Changes the current locale: re-reads resource strings and notifies listeners.
 public static Object setProperty(String propName,
    String propValue) 
    Set a String value
 public static Vector tokenize(String string,
    String separator) 
    Tokenize a string into a vector of tokens
 public static String unsplit(Object[] splittee,
    Object splitChar) 
    Takes an array of strings and a tokenizer character, and returns a string of all the strings concatenated with the tokenizer string in between each one.
 public static String unsplit(Object[] splittee,
    Object splitChar,
    String def) 
    Takes an array of strings and a tokenizer character, and returns a string of all the strings concatenated with the tokenizer string in between each one.