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 2009/04/23 04:30:38 UTC

svn commit: r767762 - /jakarta/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java

Author: sebb
Date: Thu Apr 23 02:30:38 2009
New Revision: 767762

URL: http://svn.apache.org/viewvc?rev=767762&view=rev
Log:
Add isNonGUI() method

Modified:
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java?rev=767762&r1=767761&r2=767762&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java Thu Apr 23 02:30:38 2009
@@ -91,6 +91,7 @@
 
     public static final String HTTP_PROXY_USER = "http.proxyUser"; // $NON-NLS-1$
 
+    public static final String JMETER_NON_GUI = "JMeter.NonGui"; // $NON-NLS-1$
 
     // If the -t flag is to "LAST", then the last loaded file (if any) is used
     private static final String USE_LAST_JMX = "LAST";
@@ -676,7 +677,7 @@
             throws IllegalUserActionException {
         // add a system property so samplers can check to see if JMeter
         // is running in NonGui mode
-        System.setProperty("JMeter.NonGui", "true");// $NON-NLS-1$
+        System.setProperty(JMETER_NON_GUI, "true");// $NON-NLS-1$
         JMeter driver = new JMeter();// TODO - why does it create a new instance?
         driver.remoteProps = this.remoteProps;
         driver.remoteStop = this.remoteStop;
@@ -1001,6 +1002,15 @@
         return new String[0][];
     }
 
+    /**
+     * Check if JMeter is running in non-GUI mode.
+     * 
+     * @return true if JMeter is running in non-GUI mode.
+     */
+    public static boolean isNonGUI(){
+        return "true".equals(System.getProperty(JMeter.JMETER_NON_GUI)); //$NON-NLS-1$
+    }
+
     private void logProperty(String prop){
         log.info(prop+"="+System.getProperty(prop));//$NON-NLS-1$
     }



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