|
Apache JMeter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jmeter.util.JMeterUtils
public class JMeterUtils
This class contains the static utility methods used by JMeter.
Field Summary | |
---|---|
static java.lang.String |
RES_KEY_PFX
|
Constructor Summary | |
---|---|
JMeterUtils()
|
Method Summary | |
---|---|
static void |
addLocaleChangeListener(LocaleChangeListener listener)
|
static javax.swing.JButton |
createButton(java.lang.String name,
java.awt.event.ActionListener listener)
Create a button with the netscape style |
static javax.swing.JButton |
createSimpleButton(java.lang.String name,
java.awt.event.ActionListener listener)
Create a button with the netscape style |
static java.io.File |
findFile(java.lang.String fileName)
Find a file in the current directory or in the JMeter bin directory. |
static int |
findInArray(java.lang.String[] array,
java.lang.String value)
Finds a string in an array of strings and returns the |
static java.util.Hashtable |
getAlias(java.util.Properties properties)
Creates the vector of alias strings. |
static java.util.Vector |
getControllers(java.util.Properties properties)
Creates a vector of SampleController plugins. |
static java.util.Hashtable |
getHashtable(java.util.Properties properties,
java.lang.String name)
Creates a table of strings for all the properties that start with a common prefix. |
static javax.swing.ImageIcon |
getImage(java.lang.String name)
This looks for the requested image in the classpath under org.apache.jmeter.images. |
static javax.swing.ImageIcon |
getImage(java.lang.String name,
java.lang.String description)
This looks for the requested image in the classpath under org.apache.jmeter.images. |
static java.lang.String |
getJMeterBinDir()
Get the JMeter bin directory - does not include the trailing separator. |
static java.lang.String |
getJMeterCopyright()
Gets the JMeter copyright. |
static java.lang.String |
getJMeterHome()
Get the JMeter home directory - does not include the trailing separator. |
static java.util.Properties |
getJMeterProperties()
This gets the currently defined appProperties. |
static java.lang.String |
getJMeterVersion()
Gets the JMeter Version. |
static java.util.Locale |
getLocale()
Gets the current locale. |
static java.lang.String |
getLocaleString(java.lang.String locale)
Get the locale name as a resource. |
static java.lang.String |
getLocalHostFullName()
Returns the cached result from calling InetAddress.getLocalHost().getCanonicalHostName() |
static java.lang.String |
getLocalHostIP()
Returns the cached result from calling InetAddress.getLocalHost().getHostAddress() |
static java.lang.String |
getLocalHostName()
Returns the cached result from calling InetAddress.getLocalHost().getHostName() |
static Perl5Matcher |
getMatcher()
Gets Perl5Matcher for this thread. |
static Pattern |
getPattern(java.lang.String expression)
Get a compiled expression from the pattern cache (READ_ONLY). |
static Pattern |
getPattern(java.lang.String expression,
int options)
Get a compiled expression from the pattern cache. |
static PatternCacheLRU |
getPatternCache()
|
static boolean |
getPropDefault(java.lang.String propName,
boolean defaultVal)
Get a boolean value with default if not present. |
static int |
getPropDefault(java.lang.String propName,
int defaultVal)
Get a int value with default if not present. |
static long |
getPropDefault(java.lang.String propName,
long defaultVal)
Get a long value with default if not present. |
static java.lang.String |
getPropDefault(java.lang.String propName,
java.lang.String defaultVal)
Get a String value with default if not present. |
static java.util.Properties |
getProperties(java.lang.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. |
static java.lang.String |
getProperty(java.lang.String propName)
Get the value of a JMeter property. |
static int |
getRandomInt(int r)
Provide random numbers |
static java.lang.String |
getResourceFileAsText(java.lang.String name)
|
static java.lang.String |
getResString(java.lang.String key)
Gets the resource string for this key. |
static java.lang.String |
getResString(java.lang.String key,
java.lang.String defaultValue)
Deprecated. Only intended for use in development; use getResString(String) normally |
static java.lang.String[] |
getSearchPaths()
|
static java.lang.String[] |
getTestSamples(java.util.Properties properties,
java.lang.String name)
Create a string of class names for a particular SamplerController |
static java.util.Vector |
getTimers(java.util.Properties properties)
Creates the vector of Timers plugins. |
static java.util.Vector |
getVector(java.util.Properties properties,
java.lang.String name)
Creates a vector of strings for all the properties that start with a common prefix. |
static java.util.Vector |
getVisualizers(java.util.Properties properties)
Creates the vector of visualizer plugins. |
static org.xml.sax.XMLReader |
getXMLParser()
Create an instance of an org.xml.sax.Parser based on the default props. |
void |
initializeProperties(java.lang.String file)
Your implementation will be handed the filename that was provided to AllTests as a configuration file. |
static void |
initLocale()
Initialise the JMeter Locale |
static void |
initLogging()
Initialise JMeter logging |
static java.lang.Object |
instantiate(java.lang.String className,
java.lang.String impls)
Instatiate an object and guarantee its class. |
static java.util.Vector |
instantiate(java.util.Vector v,
java.lang.String className)
Instantiate a vector of classes |
static boolean |
isExpertMode()
Determine whether we are in 'expert' mode. |
static void |
loadJMeterProperties(java.lang.String file)
Load the JMeter properties file; if not found, then default to "org/apache/jmeter/jmeter.properties" from the classpath c.f. loadProperties |
static java.util.Properties |
loadProperties(java.lang.String file)
This method loads a property file that may reside in the user space, or in the classpath |
static void |
removeLocaleChangeListener(LocaleChangeListener listener)
|
static void |
reportErrorToUser(java.lang.String errorMsg)
Report an error through a dialog box. |
static void |
reportErrorToUser(java.lang.String errorMsg,
java.lang.String titleMsg)
Report an error through a dialog box. |
static void |
selJComboBoxItem(java.util.Properties properties,
javax.swing.JComboBox combo,
java.util.Vector namVec,
java.lang.String name)
Sets the selection of the JComboBox to the Object 'name' from the list in namVec. |
static void |
setJMeterHome(java.lang.String home)
|
static void |
setLocale(java.util.Locale loc)
Changes the current locale: re-reads resource strings and notifies listeners. |
static java.lang.Object |
setProperty(java.lang.String propName,
java.lang.String propValue)
Set a String value |
static java.util.Vector |
tokenize(java.lang.String string,
java.lang.String separator)
Tokenize a string into a vector of tokens |
static java.lang.String |
unsplit(java.lang.Object[] splittee,
java.lang.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. |
static java.lang.String |
unsplit(java.lang.Object[] splittee,
java.lang.Object splitChar,
java.lang.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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String RES_KEY_PFX
Constructor Detail |
---|
public JMeterUtils()
Method Detail |
---|
public static Perl5Matcher getMatcher()
public static java.util.Properties getProperties(java.lang.String file)
file
- the file to load
public static void initLogging()
public static void initLocale()
public static void loadJMeterProperties(java.lang.String file)
public static java.util.Properties loadProperties(java.lang.String file)
file
- the file to load
public static PatternCacheLRU getPatternCache()
public static Pattern getPattern(java.lang.String expression)
expression
-
org.apache.oro.text.regex.MalformedPatternException
- (Runtime)
This should be caught for expressions that may vary (e.g. user input)public static Pattern getPattern(java.lang.String expression, int options)
expression
- REoptions
- e.g. READ_ONLY_MASK
org.apache.oro.text.regex.MalformedPatternException
- (Runtime)
This should be caught for expressions that may vary (e.g. user input)public void initializeProperties(java.lang.String file)
UnitTestManager
initializeProperties
in interface UnitTestManager
public static java.lang.String[] getSearchPaths()
public static int getRandomInt(int r)
r
- -
the upper bound (exclusive)public static void setLocale(java.util.Locale loc)
loc
- -
new localepublic static java.util.Locale getLocale()
public static void addLocaleChangeListener(LocaleChangeListener listener)
public static void removeLocaleChangeListener(LocaleChangeListener listener)
public static java.lang.String getResString(java.lang.String key)
key
- the key in the resource file
public static java.lang.String getResString(java.lang.String key, java.lang.String defaultValue)
key
- the key in the resource filedefaultValue
- -
the default value
public static java.lang.String getLocaleString(java.lang.String locale)
locale
- name
public static java.util.Properties getJMeterProperties()
getProperties(String)
method is called.
public static javax.swing.ImageIcon getImage(java.lang.String name)
name
- Description of Parameter
public static javax.swing.ImageIcon getImage(java.lang.String name, java.lang.String description)
name
- the name of the imagedescription
- the description of the image
public static java.lang.String getResourceFileAsText(java.lang.String name)
public static java.util.Vector getTimers(java.util.Properties properties)
properties
- Description of Parameter
public static java.util.Vector getVisualizers(java.util.Properties properties)
properties
- Description of Parameter
public static java.util.Vector getControllers(java.util.Properties properties)
properties
- The properties with information about the samplers
public static java.lang.String[] getTestSamples(java.util.Properties properties, java.lang.String name)
properties
- The properties with info about the samples.name
- The name of the sampler controller.
public static org.xml.sax.XMLReader getXMLParser()
public static java.util.Hashtable getAlias(java.util.Properties properties)
properties
- Description of Parameter
public static java.util.Vector getVector(java.util.Properties properties, java.lang.String name)
properties
- Description of Parametername
- Description of Parameter
public static java.util.Hashtable getHashtable(java.util.Properties properties, java.lang.String name)
properties
- Description of Parametername
- Description of Parameter
public static int getPropDefault(java.lang.String propName, int defaultVal)
propName
- the name of the property.defaultVal
- the default value.
public static boolean getPropDefault(java.lang.String propName, boolean defaultVal)
propName
- the name of the property.defaultVal
- the default value.
public static long getPropDefault(java.lang.String propName, long defaultVal)
propName
- the name of the property.defaultVal
- the default value.
public static java.lang.String getPropDefault(java.lang.String propName, java.lang.String defaultVal)
propName
- the name of the property.defaultVal
- the default value.
public static java.lang.String getProperty(java.lang.String propName)
propName
- the name of the property.
public static java.lang.Object setProperty(java.lang.String propName, java.lang.String propValue)
propName
- the name of the property.propValue
- the value of the property
public static void selJComboBoxItem(java.util.Properties properties, javax.swing.JComboBox combo, java.util.Vector namVec, java.lang.String name)
public static java.lang.Object instantiate(java.lang.String className, java.lang.String impls)
className
- The name of the class to instantiate.impls
- The name of the class it subclases.
public static java.util.Vector instantiate(java.util.Vector v, java.lang.String className)
v
- Description of ParameterclassName
- Description of Parameter
public static java.util.Vector tokenize(java.lang.String string, java.lang.String separator)
string
- Description of Parameterseparator
- Description of Parameter
public static javax.swing.JButton createButton(java.lang.String name, java.awt.event.ActionListener listener)
name
- Description of Parameterlistener
- Description of Parameter
public static javax.swing.JButton createSimpleButton(java.lang.String name, java.awt.event.ActionListener listener)
name
- Description of Parameterlistener
- Description of Parameter
public static void reportErrorToUser(java.lang.String errorMsg)
errorMsg
- - the error message.public static void reportErrorToUser(java.lang.String errorMsg, java.lang.String titleMsg)
errorMsg
- - the error message.titleMsg
- - title stringpublic static int findInArray(java.lang.String[] array, java.lang.String value)
array
- Array of strings.value
- String to compare to array values.
public static java.lang.String unsplit(java.lang.Object[] splittee, java.lang.Object splitChar)
splittee
- Array of Objects to be concatenated.splitChar
- Object to unsplit the strings with.
public static java.lang.String unsplit(java.lang.Object[] splittee, java.lang.Object splitChar, java.lang.String def)
splittee
- Array of Objects to be concatenated.splitChar
- Object to unsplit the strings with.def
- Default value to replace null values in array.
public static java.lang.String getJMeterHome()
public static java.lang.String getJMeterBinDir()
public static void setJMeterHome(java.lang.String home)
public static java.lang.String getJMeterVersion()
public static java.lang.String getJMeterCopyright()
public static boolean isExpertMode()
public static java.io.File findFile(java.lang.String fileName)
fileName
-
public static java.lang.String getLocalHostIP()
public static java.lang.String getLocalHostName()
public static java.lang.String getLocalHostFullName()
|
Apache JMeter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |