woolfel     2004/01/13 20:31:49

  Modified:    src/protocol/http/org/apache/jmeter/protocol/http/sampler
                        WebServiceSampler.java
  Log:
  refactored a bit and made it so the sampler only checks if JMeter
  was started in NonGui mode. In Gui mode it doesn't make sense to
  automatically override the proxy that is already in the test plan.
  
  peter lin
  
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.9       +35 -20    
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java
  
  Index: WebServiceSampler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- WebServiceSampler.java    14 Jan 2004 04:05:20 -0000      1.8
  +++ WebServiceSampler.java    14 Jan 2004 04:31:49 -0000      1.9
  @@ -340,16 +340,7 @@
         * @return
         */     
        public String getProxyHost(){
  -             // we check to see the host is set
  -             String host = this.getPropertyAsString(PROXY_HOST);
  -             if (host == null || host.length() == 0){
  -                     // it's not set, lets check if the user passed
  -                     // proxy host and port from command line
  -                     if (System.getProperty("http.proxyHost") != null){
  -                             host = System.getProperty("http.proxyHost");
  -                             this.setProxyHost(host);
  -                     }
  -             }
  +             this.checkProxy();
                return this.getPropertyAsString(PROXY_HOST);
        }
   
  @@ -366,16 +357,40 @@
         * @return
         */     
        public int getProxyPort(){
  -             String port = this.getPropertyAsString(PROXY_PORT);
  -             if (port == null || port.length() == 0){
  -                     // it's not set, lets check if the user passed
  -                     // proxy host and port from command line
  -                     if (System.getProperty("http.proxyPort") != null){
  -                             port = System.getProperty("http.proxyPort");
  -                             this.setProxyPort(port);
  -                     }
  -             }
  +             this.checkProxy();
                return this.getPropertyAsInt(PROXY_PORT);
  +     }
  +     
  +     /**
  +      * The method will check to see if JMeter was started
  +      * in NonGui mode. If it was, it will try to pick up
  +      * the proxy host and port values if they were passed
  +      * to JMeter.java.
  +      */
  +     public void checkProxy(){
  +             if (System.getProperty("JMeter.NonGui") != null &&
  +                     System.getProperty("JMeter.NonGui").equals("true")){
  +                             this.setUseProxy(true);
  +                             // we check to see if the proxy host and port are set
  +                             String port = this.getPropertyAsString(PROXY_PORT);
  +                             String host = this.getPropertyAsString(PROXY_HOST);
  +                             if (host == null || host.length() == 0){
  +                                     // it's not set, lets check if the user passed
  +                                     // proxy host and port from command line
  +                                     if (System.getProperty("http.proxyHost") != 
null){
  +                                             host = 
System.getProperty("http.proxyHost");
  +                                             this.setProxyHost(host);
  +                                     }
  +                             }
  +                             if (port == null || port.length() == 0){
  +                                     // it's not set, lets check if the user passed
  +                                     // proxy host and port from command line
  +                                     if (System.getProperty("http.proxyPort") != 
null){
  +                                             port = 
System.getProperty("http.proxyPort");
  +                                             this.setProxyPort(port);
  +                                     }
  +                             }
  +                     }
        }
        
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to