You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2015/06/13 23:32:18 UTC

svn commit: r1685335 - in /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler: HTTPHC3Impl.java HTTPHC4Impl.java HttpClientDefaultParameters.java

Author: pmouawad
Date: Sat Jun 13 21:32:18 2015
New Revision: 1685335

URL: http://svn.apache.org/r1685335
Log:
Bug 57956 - The hc.parameters reference in jmeter.properties doesn't work when JMeter is not started in bin
Rollback and fix differently.
Bugzilla Id: 57956

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java?rev=1685335&r1=1685334&r2=1685335&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java Sat Jun 13 21:32:18 2015
@@ -64,7 +64,6 @@ import org.apache.commons.httpclient.par
 import org.apache.commons.httpclient.params.HttpParams;
 import org.apache.commons.httpclient.protocol.Protocol;
 import org.apache.commons.io.input.CountingInputStream;
-import org.apache.jmeter.NewDriver;
 import org.apache.jmeter.protocol.http.control.AuthManager;
 import org.apache.jmeter.protocol.http.control.Authorization;
 import org.apache.jmeter.protocol.http.control.CacheManager;
@@ -137,10 +136,7 @@ public class HTTPHC3Impl extends HTTPHCA
         // Process Commons HttpClient parameters file
         String file=JMeterUtils.getProperty("httpclient.parameters.file"); // $NON-NLS-1$
         if (file != null) {
-            log.info("Loading httpclient parameters file from:"+file);
-            HttpClientDefaultParameters.load(NewDriver.getJMeterDir() + File.separator
-                    + "bin" + File.separator // $NON-NLS-1$
-                    + file, params);
+            HttpClientDefaultParameters.load(file, params);
         }
 
         // If the pre-emptive parameter is undefined, then we can set it as needed

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1685335&r1=1685334&r2=1685335&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java Sat Jun 13 21:32:18 2015
@@ -105,7 +105,6 @@ import org.apache.http.protocol.BasicHtt
 import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
-import org.apache.jmeter.NewDriver;
 import org.apache.jmeter.protocol.http.control.AuthManager;
 import org.apache.jmeter.protocol.http.control.CacheManager;
 import org.apache.jmeter.protocol.http.control.CookieManager;
@@ -214,10 +213,7 @@ public class HTTPHC4Impl extends HTTPHCA
         // Process Apache HttpClient parameters file
         String file=JMeterUtils.getProperty("hc.parameters.file"); // $NON-NLS-1$
         if (file != null) {
-            log.info("Loading hc parameters file from:"+file);
-            HttpClientDefaultParameters.load(NewDriver.getJMeterDir() + File.separator
-                    + "bin" + File.separator // $NON-NLS-1$
-                    + file, DEFAULT_HTTP_PARAMS);
+            HttpClientDefaultParameters.load(file, DEFAULT_HTTP_PARAMS);
         }
 
         // Set up HTTP scheme override if necessary

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java?rev=1685335&r1=1685334&r2=1685335&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java Sat Jun 13 21:32:18 2015
@@ -27,6 +27,7 @@ import java.io.InputStream;
 import java.util.Map;
 import java.util.Properties;
 
+import org.apache.jmeter.NewDriver;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.jorphan.util.JOrphanUtils;
 import org.apache.log.Logger;
@@ -104,8 +105,18 @@ public class HttpClientDefaultParameters
     }
 
     private static void load(String file, GenericHttpParams params){
-        log.info("Reading httpclient parameters from "+file);
-        File f = new File(file);
+        log.info("Trying httpclient parameters from "+file);
+        File f = new File(file);        
+        if(! (f.exists() && f.canRead())) {
+            f = new File(NewDriver.getJMeterDir() + File.separator
+                    + "bin" + File.separator + file); // $NON-NLS-1$
+            log.info(file + " httpclient parameters does not exist, trying "+f.getAbsolutePath());
+            if(! (f.exists() && f.canRead())) {
+                log.error("Cannot parameters file for HttpClient:"+ file);
+                return;
+            }
+        }
+        log.info("Reading httpclient parameters from "+f.getAbsolutePath());
         InputStream is = null;
         Properties props = new Properties();
         try {