jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1850562 - in /jmeter/trunk: src/core/org/apache/jmeter/JMeter.java src/core/org/apache/jmeter/NewDriver.java xdocs/changes.xml
Date Sun, 06 Jan 2019 14:47:32 GMT
Author: pmouawad
Date: Sun Jan  6 14:47:32 2019
New Revision: 1850562

URL: http://svn.apache.org/viewvc?rev=1850562&view=rev
Log:
Bug 61486 - Make jmeter-server and non GUI mode run headless
Bugzilla Id: 61486

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
    jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java?rev=1850562&r1=1850561&r2=1850562&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/JMeter.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/JMeter.java Sun Jan  6 14:47:32 2019
@@ -476,6 +476,7 @@ public class JMeter implements JMeterPlu
                 log.info("os.arch={}", System.getProperty("os.arch"));//$NON-NLS-1$ //$NON-NLS-2$
                 log.info("os.version={}", System.getProperty("os.version"));//$NON-NLS-1$
//$NON-NLS-2$
                 log.info("file.encoding={}", System.getProperty("file.encoding"));//$NON-NLS-1$
//$NON-NLS-2$
+                log.info("java.awt.headless={}", System.getProperty("java.awt.headless"));//$NON-NLS-1$
//$NON-NLS-2$
                 log.info("Max memory     ={}", Runtime.getRuntime().maxMemory());
                 log.info("Available Processors ={}", Runtime.getRuntime().availableProcessors());
                 log.info("Default Locale={}", Locale.getDefault().getDisplayName());

Modified: jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java?rev=1850562&r1=1850561&r2=1850562&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java Sun Jan  6 14:47:32 2019
@@ -51,6 +51,8 @@ public final class NewDriver {
     private static final String JAVA_CLASS_PATH = "java.class.path";// $NON-NLS-1$
 
     private static final String JMETER_LOGFILE_SYSTEM_PROPERTY = "jmeter.logfile";// $NON-NLS-1$
+
+    private static final String HEADLESS_MODE_PROPERTY = "java.awt.headless";// $NON-NLS-1$
     /** The class loader to use for loading JMeter classes. */
     private static final DynamicClassLoader loader;
 
@@ -237,9 +239,14 @@ public final class NewDriver {
         } else {
             Thread.currentThread().setContextClassLoader(loader);
 
+            
             setLoggingProperties(args);
 
             try {
+                // Only set property if it has not been set explicitely 
+                if(System.getProperty(HEADLESS_MODE_PROPERTY) == null && shouldBeHeadless(args))
{
+                    System.setProperty(HEADLESS_MODE_PROPERTY, "true");
+                }
                 Class<?> initialClass = loader.loadClass("org.apache.jmeter.JMeter");//
$NON-NLS-1$
                 Object instance = initialClass.getDeclaredConstructor().newInstance();
                 Method startup = initialClass.getMethod("start", new Class[] { new String[0].getClass()
});// $NON-NLS-1$
@@ -297,10 +304,18 @@ public final class NewDriver {
         }
     }
 
+    private static boolean shouldBeHeadless(String[] args) {
+        for (String arg : args) {
+            if("-n".equals(arg) || "-s".equals(arg)) {
+                return true;
+            }
+        }
+        return false;
+    }
     /*
      * Find command line argument option value by the id and name.
      */
-    private static String getCommandLineArgument(String [] args, int id, String name) {
+    private static String getCommandLineArgument(String[] args, int id, String name) {
         final String shortArgName = "-" + ((char) id);// $NON-NLS-1$
         final String longArgName = "--" + name;// $NON-NLS-1$
 

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1850562&r1=1850561&r2=1850562&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sun Jan  6 14:47:32 2019
@@ -131,6 +131,7 @@ of previous time slot as a base. Startin
     <li><bug>62870</bug>Templates : Add ability to provide parameters.
Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
     <li><bug>62829</bug>Allow specifying Proxy server scheme for HTTP request
sampler, Advanced tab and command line option. Contributed by Hitesh Patel (hitesh.h.patel
at gmail.com)</li>
     <li><bug>59633</bug>Menus <code>Save Test Plan as</code>,
<code>Save as Test Fragment</code> and <code>Save Selection as ...</code>
should use a new file name in File Dialog</li>
+    <li><bug>61486</bug>Make jmeter-server and non GUI mode run headless</li>
 </ul>
 
 <ch_section>Non-functional changes</ch_section>



Mime
View raw message