You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by ms...@apache.org on 2002/07/12 04:05:50 UTC
cvs commit: jakarta-jmeter/src_1/org/apache/jmeter/util ClassFinder.java JMeterUtils.java
mstover1 2002/07/11 19:05:50
Modified: . build.xml
bin jmeter.properties
src_1/org/apache/jmeter JMeter.java NewDriver.java
src_1/org/apache/jmeter/engine StandardJMeterEngine.java
src_1/org/apache/jmeter/junit AllTests.java
src_1/org/apache/jmeter/resources messages_ja.properties
src_1/org/apache/jmeter/testelement TestPlan.java
src_1/org/apache/jmeter/util ClassFinder.java
JMeterUtils.java
Added: src_1/org/apache/jmeter/engine PreCompiler.java
Log:
New Function implementations
patch for Japanese message file
patch for JMeter startup in foreign directory
Revision Changes Path
1.63 +0 -1 jakarta-jmeter/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-jmeter/build.xml,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- build.xml 11 Jul 2002 00:26:51 -0000 1.62
+++ build.xml 12 Jul 2002 02:05:49 -0000 1.63
@@ -24,7 +24,6 @@
<path id="testClasspath">
<path refid="classpath"/>
- <pathelement location="./bin/ApacheJMeter.jar"/>
<pathelement location="./lib/ext/ApacheJMeter_core.jar"/>
</path>
1.39 +1 -1 jakarta-jmeter/bin/jmeter.properties
Index: jmeter.properties
===================================================================
RCS file: /home/cvs/jakarta-jmeter/bin/jmeter.properties,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- jmeter.properties 23 May 2002 15:47:03 -0000 1.38
+++ jmeter.properties 12 Jul 2002 02:05:49 -0000 1.39
@@ -2,7 +2,7 @@
# Apache JMeter Property file
################################################################################
#Paths to search for classes (";" must be the separator)
-search_paths=../lib/ext
+search_paths=lib/ext
# Netscape HTTP Cookie file
cookies=cookies
1.4 +3 -2 jakarta-jmeter/src_1/org/apache/jmeter/JMeter.java
Index: JMeter.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/JMeter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JMeter.java 13 Jun 2002 00:45:15 -0000 1.3
+++ JMeter.java 12 Jul 2002 02:05:49 -0000 1.4
@@ -191,9 +191,10 @@
if (parser.getArgumentById(PROPFILE_OPT) != null) {
JMeterUtils.getProperties(parser.getArgumentById(PROPFILE_OPT).getArgument());
} else {
- JMeterUtils.getProperties(
- System.getProperty("user.dir") + File.separator + "jmeter.properties");
+ JMeterUtils.getProperties(NewDriver.getJMeterDir() +
+ File.separator + "bin" + File.separator + "jmeter.properties");
}
+ JMeterUtils.setJMeterHome(NewDriver.getJMeterDir());
}
public void startServer() {
1.10 +49 -38 jakarta-jmeter/src_1/org/apache/jmeter/NewDriver.java
Index: NewDriver.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/NewDriver.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- NewDriver.java 11 Jul 2002 00:26:52 -0000 1.9
+++ NewDriver.java 12 Jul 2002 02:05:49 -0000 1.10
@@ -56,15 +56,15 @@
import java.io.File;
import java.io.FilenameFilter;
+import java.io.IOException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.LinkedList;
import java.util.List;
+import java.util.StringTokenizer;
-import sun.security.krb5.internal.i;
-import sun.security.krb5.internal.crypto.e;
@@ -80,53 +80,55 @@
public class NewDriver
{
private static URLClassLoader loader;
+ private static String jmDir;
static {
List jars = new LinkedList();
- String jmDir = System.getProperty("user.dir")+File.separator+"..";
- File libDir = new File(jmDir+File.separator+"lib");
- File extDir = new File(jmDir+File.separator+"lib"+File.separator+"ext");
- File[] libJars = libDir.listFiles(new FilenameFilter() {
- public boolean accept(File dir,String name) {
- if(name.endsWith(".jar"))
- return true;
- return false;
- }});
- File[] extJars = extDir.listFiles(new FilenameFilter() {
+ String cp = System.getProperty("java.class.path");
+
+ //Find JMeter home dir
+ StringTokenizer tok = new StringTokenizer(cp, File.pathSeparator);
+ if (tok.countTokens() == 1) {
+ File jar = new File(tok.nextToken());
+ try {
+ jmDir = jar.getCanonicalFile().getParentFile().getParent();
+ } catch (IOException e) {
+ }
+ }
+ else
+ {
+ File userDir = new File(System.getProperty("user.dir"));
+ jmDir = userDir.getAbsoluteFile().getParent();
+ }
+
+ StringBuffer classpath = new StringBuffer();
+ File[] libDirs = new File[]{new File(jmDir+File.separator+"lib"),
+ new File(jmDir+File.separator+"lib"+File.separator+"ext")};
+ for(int a = 0;a < libDirs.length;a++)
+ {
+ File[] libJars = libDirs[a].listFiles(new FilenameFilter() {
public boolean accept(File dir,String name) {
if(name.endsWith(".jar"))
return true;
return false;
}});
- StringBuffer classpath = new StringBuffer();
- for(int i = 0;i < libJars.length;i++)
- {
- try
+ for(int i = 0;i < libJars.length;i++)
{
- jars.add(new URL("file","",libJars[i].getPath()));
- classpath.append(System.getProperty("path.separator"));
- classpath.append(libJars[i].getPath());
- }
- catch(MalformedURLException e)
- {
- e.printStackTrace();
- }
- }
- for(int i = 0;i < extJars.length;i++)
- {
- try
- {
- jars.add(new URL("file","",extJars[i].getPath()));
- classpath.append(System.getProperty("path.separator"));
- classpath.append(extJars[i].getPath());
- }
- catch(MalformedURLException e)
- {
- e.printStackTrace();
+ try
+ {
+ jars.add(new URL("file","",libJars[i].getPath()));
+ classpath.append(System.getProperty("path.separator"));
+ classpath.append(libJars[i].getPath());
+ }
+ catch(MalformedURLException e)
+ {
+ e.printStackTrace();
+ }
}
}
+
System.setProperty("java.class.path",System.getProperty("java.class.path")+classpath.toString());
loader = new URLClassLoader((URL[])jars.toArray(new URL[0]));
try {
@@ -147,6 +149,11 @@
}
}
+ public static String getJMeterDir()
+ {
+ return jmDir;
+ }
+
private NewDriver(String[] args)
{
@@ -160,8 +167,12 @@
public static void main(String[] args)
{
Thread.currentThread().setContextClassLoader(loader);
- System.setProperty("log4j.configuration",System.getProperty("user.dir")+
- File.separator+"log4j.conf");
+ if (System.getProperty("log4j.configuration") == null)
+ {
+ File conf = new File(jmDir, "bin" + File.separator + "log4j.conf");
+ System.setProperty("log4j.configuration", "file:" + conf);
+ }
+
try {
Class JMeter = loader.loadClass("org.apache.jmeter.JMeter");
Object instance = JMeter.newInstance();
1.12 +9 -2 jakarta-jmeter/src_1/org/apache/jmeter/engine/StandardJMeterEngine.java
Index: StandardJMeterEngine.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/engine/StandardJMeterEngine.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- StandardJMeterEngine.java 13 Jun 2002 00:45:16 -0000 1.11
+++ StandardJMeterEngine.java 12 Jul 2002 02:05:49 -0000 1.12
@@ -108,6 +108,12 @@
{
return test;
}
+
+ protected void compileTree()
+ {
+ PreCompiler compiler = new PreCompiler();
+ getTestTree().traverse(compiler);
+ }
/************************************************************
* !ToDo (Method description)
@@ -118,6 +124,7 @@
{
System.out.println("Running the test!");
running = true;
+ compileTree();
SearchByClass searcher = new SearchByClass(ThreadGroup.class);
testListeners = new SearchByClass(TestListener.class);
setMode();
1.1 jakarta-jmeter/src_1/org/apache/jmeter/engine/PreCompiler.java
Index: PreCompiler.java
===================================================================
package org.apache.jmeter.engine;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import org.apache.jmeter.protocol.all.modifier.CompoundFunction;
import org.apache.jmeter.protocol.all.modifier.InvalidVariableException;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.testelement.TestPlan;
import org.apache.jmeter.util.ListedHashTree;
import org.apache.jmeter.util.ListedHashTreeVisitor;
/**
* @author mstover
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
*/
public class PreCompiler implements ListedHashTreeVisitor {
private Map userDefinedVariables;
private CompoundFunction masterFunction = new CompoundFunction();
private boolean testValid = true;
public PreCompiler()
{
}
/**
* @see ListedHashTreeVisitor#addNode(Object, ListedHashTree)
*/
public void addNode(Object node, ListedHashTree subTree) {
if(node instanceof TestPlan)
{
masterFunction.setUserDefinedVariables(((TestPlan)node).getUserDefinedValues());
}
if(node instanceof TestElement)
{
replaceValues((TestElement)node);
}
}
/**
* @see ListedHashTreeVisitor#subtractNode()
*/
public void subtractNode() {
}
/**
* @see ListedHashTreeVisitor#processPath()
*/
public void processPath() {
}
private void replaceValues(TestElement el)
{
Iterator iter = el.getPropertyNames().iterator();
while(iter.hasNext())
{
String propName = (String)iter.next();
Object propValue = el.getProperty(propName);
if(propValue instanceof String)
{
Object newValue = getNewValue((String)propValue);
el.setProperty(propName,newValue);
}
else if(propValue instanceof TestElement)
{
replaceValues((TestElement)propValue);
}
else if(propValue instanceof Collection)
{
el.setProperty(propName,replaceValues((Collection)propValue));
}
}
}
private Object getNewValue(String propValue)
{
Object newValue = propValue;
masterFunction.clear();
try {
masterFunction.setParameters((String)propValue);
} catch(InvalidVariableException e) {
testValid = false;
}
if(masterFunction.hasFunction())
{
newValue = masterFunction.getFunction();
}
else if(masterFunction.hasStatics())
{
newValue = masterFunction.getStaticSubstitution();
}
return newValue;
}
private Collection replaceValues(Collection values)
{
Collection newColl = null;
try {
newColl = (Collection)values.getClass().newInstance();
} catch(Exception e) {
e.printStackTrace();
return values;
}
Iterator iter = values.iterator();
while(iter.hasNext())
{
Object val = iter.next();
if(val instanceof TestElement)
{
replaceValues((TestElement)val);
}
else if(val instanceof String)
{
val = getNewValue((String)val);
}
else if(val instanceof Collection)
{
val = replaceValues((Collection)val);
}
newColl.add(val);
}
return newColl;
}
}
1.3 +2 -1 jakarta-jmeter/src_1/org/apache/jmeter/junit/AllTests.java
Index: AllTests.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/junit/AllTests.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AllTests.java 29 Apr 2002 17:08:09 -0000 1.2
+++ AllTests.java 12 Jul 2002 02:05:49 -0000 1.3
@@ -90,6 +90,7 @@
System.exit(0);
}
JMeterUtils.getProperties(args[0]);
+ JMeterUtils.setJMeterHome(new File(System.getProperty("user.dir")).getParent());
// end : added - 11 July 2001
try
{
1.22 +31 -24 jakarta-jmeter/src_1/org/apache/jmeter/resources/messages_ja.properties
Index: messages_ja.properties
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/resources/messages_ja.properties,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- messages_ja.properties 11 Jul 2002 00:57:15 -0000 1.21
+++ messages_ja.properties 12 Jul 2002 02:05:49 -0000 1.22
@@ -3,7 +3,7 @@
save=\u4fdd\u5b58
save_all=\u5168\u3066\u4fdd\u5b58
load=\u8aad\u8fbc
-open=\u958b\u304f
+open=\u958B\u304F...
edit=\u7de8\u96c6
exit=\u7d42\u4e86
start=\u958b\u59cb
@@ -17,16 +17,16 @@
appearance=\u30eb\u30c3\u30af&\u30d5\u30a3\u30fc\u30eb
sslManager=SSL \u30de\u30cd\u30fc\u30b8\u30e3
pkcs12_desc=PKCS 12 Key (*.p12)
-ssl_error_title=Key Store Problem
+ssl_error_title=\u30AD\u30FC\u30B9\u30C8\u30A2\u30A8\u30E9\u30FC
ssl_pass_prompt=\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002
-ssl_pass_title=KeyStore Password
+ssl_pass_title=\u30AD\u30FC\u30B9\u30C8\u30A2\u30D1\u30B9\u30EF\u30FC\u30C9
ssl_alias_prompt=\u3042\u306a\u305f\u306e\u5b9a\u7fa9\u6e08\u307f\u30a8\u30a4\u30ea\u30a2\u30b9\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002
ssl_alias_select=\u30c6\u30b9\u30c8\u306e\u305f\u3081\u306e\u3042\u306a\u305f\u306e\u30a8\u30a4\u30ea\u30a2\u30b9\u3092\u9078\u629e\u3057\u3066\u4e0b\u3055\u3044\u3002
-ssl_alias_title=Client Alias
+ssl_alias_title=\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\u30A8\u30A4\u30EA\u30A2\u30B9
help=\u30d8\u30eb\u30d7
about=Apache JMeter \u306b\u3064\u3044\u3066
remote_start=\u958b\u59cb(\u30ea\u30e2\u30fc\u30c8)
-remote_start=\u505c\u6b62(\u30ea\u30e2\u30fc\u30c8)
+remote_start=\u958B\u59CB(\u30EA\u30E2\u30FC\u30C8)
root=\u30eb\u30fc\u30c8
test_plan=\u30c6\u30b9\u30c8\u30d7\u30e9\u30f3
workbench=\u30ef\u30fc\u30af\u30d9\u30f3\u30c1
@@ -41,9 +41,9 @@
port=\u30dd\u30fc\u30c8
path=\u30d1\u30b9
follow_redirects=Follow redirects [TO-DO]
-method=\u30e1\u30bd\u30c3\u30c9
+method=\u30E1\u30BD\u30C3\u30C9:
default_parameters=\u30c7\u30d5\u30a9\u30eb\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf
-name=\u540d\u524d
+name=\u540D\u524D:
value=\u5024
secure=\u30bb\u30ad\u30e5\u30a2
expiration=\u671f\u9650
@@ -51,13 +51,29 @@
password=\u30d1\u30b9\u30ef\u30fc\u30c9
number_of_threads=\u30b9\u30ec\u30c3\u30c9\u6570
infinite=\u7121\u9650\u30eb\u30fc\u30d7
-iterator_num=\u30eb\u30fc\u30d7\u56de\u6570
+iterator_num=\u30EB\u30FC\u30D7\u56DE\u6570:
add_value=\u5024\u306e\u8ffd\u52a0
paramtable=\u30ea\u30af\u30a8\u30b9\u30c8\u3067\u9001\u308b\u30d1\u30e9\u30e1\u30fc\u30bf
upload=\u30d5\u30a1\u30a4\u30eb\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9
field_name=\u30d5\u30a3\u30fc\u30eb\u30c9\u540d
looping_control=\u30eb\u30fc\u30d7\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb
browse=\u53c2\u7167
+html_parameter_mask=HTML\u30D1\u30E9\u30E1\u30FC\u30BF\u30DE\u30B9\u30AF
+increment=\u30A4\u30F3\u30AF\u30EA\u30E1\u30F3\u30C8
+id_prefix=ID\u63A5\u982D\u8F9E
+lower_bound=\u4E0B\u9650
+upper_bound=\u4E0A\u9650
+menu_modifiers=\u4FEE\u98FE
+jndi_method_remote_parms=\u30EA\u30E2\u30FC\u30C8\u30E1\u30BD\u30C3\u30C9\u30D1\u30E9\u30E1\u30FC\u30BF
+jndi_method_remote_name=\u30EA\u30E2\u30FC\u30C8\u30E1\u30BD\u30C3\u30C9\u540D
+jndi_method_remote_interface_list=\u30EA\u30E2\u30FC\u30C8\u30A4\u30F3\u30BF\u30FC\u30D5\u30A7\u30A4\u30B9
+jndi_method_home_parms=\u30DB\u30FC\u30E0\u30E1\u30BD\u30C3\u30C9\u30D1\u30E9\u30E1\u30FC\u30BF
+jndi_method_home_name=\u30DB\u30FC\u30E0\u30E1\u30BD\u30C3\u30C9\u540D
+remote_stop=\u505C\u6B62(\u30EA\u30E2\u30FC\u30C8)
+paste_insert=\u30DA\u30FC\u30B9\u30C8(\u633F\u5165)
+paste_add=\u30DA\u30FC\u30B9\u30C8(\u8FFD\u52A0)
+cut=\u30AB\u30C3\u30C8
+copy=\u30B3\u30D4\u30FC
view_graph_tree_title=\u7D50\u679C\u3092\u30B0\u30E9\u30D5\u3068\u30C4\u30EA\u30FC\u3067\u8868\u793A
menu_assertions=\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3
menu_config_element=\u5404\u7A2E\u8A2D\u5B9A
@@ -73,7 +89,7 @@
mimetype=Mime\u30bf\u30a4\u30d7
patterns_to_include=\u633f\u5165\u3059\u308b\u30d1\u30bf\u30fc\u30f3
patterns_to_exclude=\u9664\u5916\u3059\u308b\u30d1\u30bf\u30fc\u30f3
-add_pattern=\u30d1\u30bf\u30fc\u30f3\u8ffd\u52a0
+add_pattern=\u30D1\u30BF\u30FC\u30F3\u8FFD\u52A0:
ramp_up=Ramp-Up \u671f\u9593 (\u79d2):
constant_timer_title=\u5B9A\u6570\u30BF\u30A4\u30DE
constant_timer_delay=\u30b9\u30ec\u30c3\u30c9\u9045\u5ef6\u6642\u9593 (\u30df\u30ea\u79d2):
@@ -99,10 +115,10 @@
graph_results_data=\u30c7\u30fc\u30bf
graph_results_average=\u5e73\u5747
graph_results_deviation=\u504f\u5dee
-graph_results_no_samples=No of Samples
+graph_results_no_samples=\u30B5\u30F3\u30D7\u30EB\u306A\u3057
graph_results_ms=ms
-graph_results_latest_sample=Latest Sample
-graph_choose_graphs=Graphs to Display
+graph_results_latest_sample=\u6700\u65B0\u306E\u30B5\u30F3\u30D7\u30EB
+graph_choose_graphs=\u8868\u793A\u3059\u308B\u30B0\u30E9\u30D5
spline_visualizer_title=\u30b9\u30d7\u30e9\u30a4\u30f3\u30d3\u30b8\u30e5\u30a2\u30e9\u30a4\u30b6
spline_visualizer_maximum=\u6700\u5927
spline_visualizer_minimum=\u6700\u5c0f
@@ -189,18 +205,9 @@
jndi_method_button_reflect=\u30ea\u30d5\u30ec\u30af\u30b7\u30e7\u30f3
jndi_method_button_invoke=\u547c\u3073\u51fa\u3057
uniform_timer_memo=\u4E00\u69D8\u306B\u30E9\u30F3\u30C0\u30E0\u306A\u9045\u5EF6\u3092\u8FFD\u52A0
-insert_parent=Insert Parent
-copy=Copy
-cut=Cut
-paste_insert=Paste As Insert
-paste=Paste
+insert_parent=\u4E0A\u306E\u968E\u5C64\u306B\u633F\u5165
url=URL
-success?=Success?
-html_parameter_mask=HTML Parameter Mask
-id_prefix=ID Prefix
-lower_bound=Lower Bound
-upper_bound=Upper Bound
-increment=Increment
+success?=\u6210\u529F?
id_suffix=ID Suffix
url_multipart_config_title=HTTP Multipart Request Defaults
view_results_in_table=View Results in Table
@@ -211,7 +218,7 @@
file_already_in_use=That file is already in use
busy_testing=I'm busy testing, please stop the test before changing settings
http_user_parameter_modifier=HTTP User Parameter Modifier
-user_param_mod_help_note=(Do not change this. Instead, modify the file of that name in JMeter's /bin directory)
+user_param_mod_help_note=(\u5909\u66F4\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002\u5909\u66F4\u3059\u308B\u5834\u5408\u306F\u3001JMeter\u306E/bin\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u3042\u308B\u540C\u76DF\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u4FEE\u6B63\u3057\u3066\u304F\u3060\u3055\u3044\u3002)
filename=File Name
cancel_exit_to_save=There are test items that have not been saved. Do you wish to save before exiting?
cancel_new_to_save=There are test items that have not been saved. Do you wish to save before clearing the test plan?
1.7 +13 -1 jakarta-jmeter/src_1/org/apache/jmeter/testelement/TestPlan.java
Index: TestPlan.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/testelement/TestPlan.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestPlan.java 13 Jun 2002 00:45:17 -0000 1.6
+++ TestPlan.java 12 Jul 2002 02:05:49 -0000 1.7
@@ -1,8 +1,10 @@
package org.apache.jmeter.testelement;
import java.io.Serializable;
import java.util.Collection;
+import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import org.apache.jmeter.config.ConfigElement;
import org.apache.jmeter.threads.ThreadGroup;
@@ -28,6 +30,7 @@
private List configs = new LinkedList();
private static List itemsCanAdd = new LinkedList();
private static TestPlan plan;
+ private Map userDefinedVariables = new HashMap();
static
{
@@ -65,7 +68,16 @@
{
setName(name);
setProperty(THREAD_GROUPS, threadGroups);
-
+ }
+
+ public void addParameter(String name,String value)
+ {
+ userDefinedVariables.put(name,value);
+ }
+
+ public Map getUserDefinedValues()
+ {
+ return userDefinedVariables;
}
/****************************************
1.6 +48 -39 jakarta-jmeter/src_1/org/apache/jmeter/util/ClassFinder.java
Index: ClassFinder.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/util/ClassFinder.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ClassFinder.java 23 May 2002 15:47:07 -0000 1.5
+++ ClassFinder.java 12 Jul 2002 02:05:49 -0000 1.6
@@ -106,12 +106,25 @@
*/
package org.apache.jmeter.util;
-import java.util.*;
-import java.util.zip.*;
-import java.io.*;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
import junit.framework.TestCase;
-import org.apache.log4j.*;
+import org.apache.jmeter.NewDriver;
+import org.apache.log4j.Category;
/************************************************************
* This class finds classes that implement one or more specified interfaces.
@@ -134,45 +147,30 @@
Category.getInstance(ClassFinder.class.getName());
private ClassFinder() {}
// static only
- /************************************************************
-
- * Convenience method for <code>findClassesThatExtend(Class[], boolean)</code>
-
- * with the option to include inner classes in the search set to false
-
- *
-
- *@param superClasses Description of Parameter
-
- *@return ArrayList containing discovered classes.
-
- *@exception IOException
-
- *@exception ClassNotFoundException
+ /************************************************************
+ * Convenience method for <code>findClassesThatExtend(Class[], boolean)</code>
+ * with the option to include inner classes in the search set to false
+ *
+ *@param superClasses Description of Parameter
+ *@return ArrayList containing discovered classes.
+ *@exception IOException
+ *@exception ClassNotFoundException
***********************************************************/
public static List findClassesThatExtend(Class[] superClasses)
throws IOException, ClassNotFoundException {
return findClassesThatExtend(superClasses, false);
}
- /************************************************************
-
- * Find classes in the provided path(s)/jar(s) that extend the class(es).
-
- *
-
- *@param superClasses Description of Parameter
-
- *@param innerClasses indicate whether to include inner classes
-
- * in the search
-
- *@return ArrayList containing discovered classes.
+ /************************************************************
+ * Find classes in the provided path(s)/jar(s) that extend the class(es).
+ *
+ *@param superClasses Description of Parameter
+ *@param innerClasses indicate whether to include inner classes
+ * in the search
+ *@return ArrayList containing discovered classes.
*@exception IOException
-
- *@exception ClassNotFoundException
-
+ *@exception ClassNotFoundException
***********************************************************/
private static String[] addJarsInPath(String[] paths) {
Set fullList = new HashSet();
@@ -197,17 +195,28 @@
}
return (String[]) fullList.toArray(new String[0]);
}
+
public static List findClassesThatExtend(
Class[] superClasses,
boolean innerClasses)
- throws IOException, ClassNotFoundException {
+ throws IOException, ClassNotFoundException
+ {
List listPaths = null;
ArrayList listClasses = null;
List listSuperClasses = null;
String[] strPathsOrJars =
JMeterUtils.split(
- JMeterUtils.getPropDefault("search_paths", ".;ApacheJMeter_core.jar"),
+ JMeterUtils.getPropDefault("search_paths", "lib/ext"),
";");
+ // paths are relative to jmDir - convert to absolutec
+ for (int i = 0; i < strPathsOrJars.length; i++) {
+ File file = new File(strPathsOrJars[i]);
+ if (!file.isAbsolute()) {
+ file = new File(JMeterUtils.getJMeterHome(),
+ strPathsOrJars[i]);
+ strPathsOrJars[i] = file.getPath();
+ }
+ }
strPathsOrJars = addJarsInPath(strPathsOrJars);
if (catClass.isDebugEnabled()) {
for (int k = 0; k < strPathsOrJars.length; k++) {
1.11 +13 -2 jakarta-jmeter/src_1/org/apache/jmeter/util/JMeterUtils.java
Index: JMeterUtils.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/util/JMeterUtils.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- JMeterUtils.java 11 Jul 2002 00:57:15 -0000 1.10
+++ JMeterUtils.java 12 Jul 2002 02:05:49 -0000 1.11
@@ -974,6 +974,17 @@
return retVal.toString();
}
// End Method
+
+ public static String getJMeterHome()
+ {
+ return jmDir;
+ }
+
+ public static void setJMeterHome(String home)
+ {
+ jmDir = home;
+ }
+ private static String jmDir;
/**
@@ -982,6 +993,6 @@
*/
public static String getJMeterVersion()
{
- return "@VERSION@";
+ return "1.7.1";
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>