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 se...@apache.org on 2006/05/31 20:13:29 UTC

svn commit: r410623 - in /jakarta/jmeter/branches/rel-2-1: bin/jmeter.properties src/core/org/apache/jmeter/JMeter.java xdocs/changes.xml xdocs/usermanual/get-started.xml

Author: sebb
Date: Wed May 31 11:13:29 2006
New Revision: 410623

URL: http://svn.apache.org/viewvc?rev=410623&view=rev
Log:
Automatically load properties from user.properties file

Modified:
    jakarta/jmeter/branches/rel-2-1/bin/jmeter.properties
    jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/JMeter.java
    jakarta/jmeter/branches/rel-2-1/xdocs/changes.xml
    jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/get-started.xml

Modified: jakarta/jmeter/branches/rel-2-1/bin/jmeter.properties
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-1/bin/jmeter.properties?rev=410623&r1=410622&r2=410623&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/bin/jmeter.properties (original)
+++ jakarta/jmeter/branches/rel-2-1/bin/jmeter.properties Wed May 31 11:13:29 2006
@@ -487,4 +487,8 @@
 #user.classpath=../classes;../jars/jar1.jar
 
 #Should JMeter expand the tree when loading a test plan?
-#onload.expandtree=false
\ No newline at end of file
+#onload.expandtree=false
+
+# Should JMeter automatically load properties from user.properties file?
+# (Uncomment to disable)
+#load.user_properties=false
\ No newline at end of file

Modified: jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/JMeter.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/JMeter.java?rev=410623&r1=410622&r2=410623&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/JMeter.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/JMeter.java Wed May 31 11:13:29 2006
@@ -430,28 +430,18 @@
 				} catch (IOException e) {
 					log.warn("Error loading additional property file: " + name, e);
                 } finally {
-                    if (fis != null) {
-                        try {
-                            fis.close();
-                        } catch (IOException e) {
-                        }
-                    }
+                	JOrphanUtils.closeQuietly(fis);
 				}
 				break;
             case SYSTEM_PROPFILE:
-                log.info("Setting System propertyies from file: " + name);
+                log.info("Setting System properties from file: " + name);
                 try {
                     fis = new FileInputStream(new File(name));
                     System.getProperties().load(fis);
                 } catch (IOException e) {
                     log.warn("Cannot find system property file "+e.getLocalizedMessage());
                 } finally {
-                    if (fis != null) {
-                        try {
-                            fis.close();
-                        } catch (IOException e) {
-                        }
-                    }
+                	JOrphanUtils.closeQuietly(fis);
                 }
                 break;
 			case SYSTEM_PROPERTY:
@@ -484,6 +474,24 @@
 			}
 		}
 
+		// Add local properties, if the file is found
+		if (JMeterUtils.getPropDefault("load.user_properties", true)){ //$NON-NLS-1$
+			final String name="user.properties"; //$NON-NLS-1$
+			FileInputStream fis=null;
+			try {
+                File file = new File(name);
+                if (file.canRead()){
+                	log.info("Loading user properties from: "+name);
+					fis = new FileInputStream(file);
+					jmeterProps.load(fis);
+                }
+			} catch (IOException e) {
+				log.warn("Error loading user property file: " + name, e);
+            } finally {
+            	JOrphanUtils.closeQuietly(fis);
+			}
+			
+		}
 	}
 
 	public void startServer() {

Modified: jakarta/jmeter/branches/rel-2-1/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-1/xdocs/changes.xml?rev=410623&r1=410622&r2=410623&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/xdocs/changes.xml (original)
+++ jakarta/jmeter/branches/rel-2-1/xdocs/changes.xml Wed May 31 11:13:29 2006
@@ -106,6 +106,7 @@
 <li>Bug 39652 - Allow truncation of labels on AxisGraph</li>
 <li>Allow use of htmlparser 1.6</li>
 <li>Bug 39656 - always use SOAP action if it is provided</li>
+<li>Automatically include properties from user.properties file</li>
 </ul>
 
 <h4>Bug fixes:</h4>

Modified: jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/get-started.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/get-started.xml?rev=410623&r1=410622&r2=410623&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/get-started.xml (original)
+++ jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/get-started.xml Wed May 31 11:13:29 2006
@@ -40,8 +40,7 @@
 </ul>
 </p>
 <note>
-Any additional jars need to be stored in the JMeter lib directory (or the appropriate JRE directory). 
-Make sure the file extension is .jar, not .zip, as JMeter only looks for .jar files.
+See the <a href="#classpath">JMeter Classpath</a> section for details on installing additional jars.
 </note>
 <p>Next, start JMeter and go through the <a href="build-test-plan.html">Building a Test Plan</a> section
 of the User Guide to familiarize yourself with JMeter basics (for example, adding and removing elements).</p>
@@ -125,8 +124,7 @@
 <p>Apache SOAP requires mail.jar and activation.jar. You need to download and copy these two jar files to your jmeter/lib directory. Once the files are in there, JMeter will automatically pick them up.</p>
 </subsection>
 <note>
-Any additional jars need to be stored in the JMeter lib directory (or the appropriate JRE directory). 
-Make sure the file extension is .jar, not .zip, as JMeter only looks for .jar files.
+See the <a href="#classpath">JMeter Classpath</a> section for details on installing additional jars.
 </note>
 </section>
 
@@ -311,9 +309,14 @@
 
 <section name="2.5 Configuring JMeter" anchor="configuring_jmeter">
 <p>If you wish to modify the properties with which JMeter runs you need to
-  either modify the jmeter.properties inside of the /bin directory or create
+  either modify the jmeter.properties in the /bin directory or create
   your own copy of the jmeter.properties and specify it in the command line.
   </p>
+  <note>
+  Note: since 2.1.2, you can define additional properties in the file <b>user.properties</b>.
+  This will be automatically loaded if it is found in the current directory.
+  To change this behaviour, define the jmeter property <b>load.user_properties=false</b>
+  </note>
   <properties>
 	<property name="ssl.provider">You can specify the class for your SSL
 	implementation.  If you are using the JSSE from sun, then it is:<br/>
@@ -321,8 +324,6 @@
 	using JDK1.4 or if you use JDK1.3 with the JSSE class jars in your JMeter classpath.</property>
 	<property name="xml.parser">You can specify an implementation as your XML
 	parser.  The default value is: org.apache.xerces.parsers.SAXParser</property>
-  <property name="user.dir">The directory JMeter will first go to for saving and
-	loading test scripts.</property>
   <property name="remote_hosts">Comma-delimited list of remote JMeter hosts.
 	If you are running JMeter in a distributed environment, list the machines where
   you have JMeter remote servers running.  This will allow you to control those
@@ -332,6 +333,15 @@
   customize your JMeter to show only those components you are interested in.
   You may list their classname or their class label (the string that appears
   in JMeter's UI) here, and they will no longer appear in the menus.</property>
+  <property name="search_paths">
+  List of paths (separated by ;) that JMeter will search for JMeter add-on classes;
+  for example additional samplers.
+  This is in addition to any jars found in the lib/ext directory.
+  </property>
+  <property name="user.classpath">
+  List of paths that JMeter will search for utility classes.
+  This is in addition to any jars found in the lib directory.
+  </property>
   </properties>
 <p><b>
 See also the comments in the jmeter.properties file for further information on other settings you can change.



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org