You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jakarta.apache.org by se...@apache.org on 2010/05/21 21:24:14 UTC

svn commit: r947135 - in /jakarta/jmeter/trunk: src/components/org/apache/jmeter/control/IncludeController.java xdocs/changes.xml xdocs/usermanual/component_reference.xml

Author: sebb
Date: Fri May 21 19:24:13 2010
New Revision: 947135

URL: http://svn.apache.org/viewvc?rev=947135&view=rev
Log:
Bug 43389 - Allow Include files to be found relative to the current JMX file

Modified:
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/IncludeController.java
    jakarta/jmeter/trunk/xdocs/changes.xml
    jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml

Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/IncludeController.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/IncludeController.java?rev=947135&r1=947134&r2=947135&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/IncludeController.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/IncludeController.java Fri May 21 19:24:13 2010
@@ -18,14 +18,17 @@
 
 package org.apache.jmeter.control;
 
+import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.Iterator;
 import java.util.LinkedList;
 
 import org.apache.jmeter.gui.tree.JMeterTreeNode;
 import org.apache.jmeter.save.SaveService;
+import org.apache.jmeter.services.FileServer;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.collections.HashTree;
@@ -116,8 +119,20 @@ public class IncludeController extends G
         HashTree tree = null;
         if (includePath != null && includePath.length() > 0) {
             try {
-                String file=prefix+includePath;
-                log.info("loadIncludedElements -- try to load included module: "+file);
+                String fileName=prefix+includePath;
+                File file = new File(fileName);
+                final String absolutePath = file.getAbsolutePath();
+                log.info("loadIncludedElements -- try to load included module: "+absolutePath);
+                if(!file.exists() && !file.isAbsolute()){
+                    log.info("loadIncludedElements -failed for: "+absolutePath);
+                    file = new File(FileServer.getFileServer().getBaseDir(), includePath);
+                    log.info("loadIncludedElements -Attempting to read it from: "+absolutePath);
+                    if(!file.exists()){
+                        log.error("loadIncludedElements -failed for: "+absolutePath);
+                        throw new IOException("loadIncludedElements -failed for: "+absolutePath);
+                    }
+                }
+                
                 reader = new FileInputStream(file);
                 tree = SaveService.loadTree(reader);
                 removeDisabledItems(tree);

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=947135&r1=947134&r2=947135&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Fri May 21 19:24:13 2010
@@ -176,6 +176,7 @@ This does not affect existing test plans
 <li>Bug 47909 - TransactionController should sum the latency</li>
 <li>Bug 41418 - Exclude timer duration from Transaction Controller runtime in report</li>
 <li>Bug 48749 - Allowing custom Thread Groups</li>
+<li>Bug 43389 - Allow Include files to be found relative to the current JMX file</li>
 </ul>
 
 <h3>Listeners</h3>

Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=947135&r1=947134&r2=947135&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Fri May 21 19:24:13 2010
@@ -1874,6 +1874,10 @@ This element does not support variables/
 However, if the property <b>includecontroller.prefix</b> is defined, 
 the contents are used to prefix the pathname.
 </note>
+<p>
+If the file cannot be found at the location given by prefix+filename, then the controller
+attempts to open the fileName relative to the JMX launch directory (versions of JMeter after 2.3.4).
+</p>
 </description>
 <properties>
 	<property name="Filename" required="Yes">The file to include.</property>



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