mstover1    2002/08/09 10:51:28

  Modified:    docs/usermanual get-started.html
               src_1/org/apache/jmeter JMeter.java
               xdocs/usermanual get-started.xml
  Added:       src_1/org/apache/jmeter ProxyAuthenticator.java
  Log:
  Enabling authentication to proxy server with username and password at startup
  
  Revision  Changes    Path
  1.19      +10 -2     jakarta-jmeter/docs/usermanual/get-started.html
  
  Index: get-started.html
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/docs/usermanual/get-started.html,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- get-started.html  6 Aug 2002 18:55:23 -0000       1.18
  +++ get-started.html  9 Aug 2002 17:51:28 -0000       1.19
  @@ -430,15 +430,23 @@
                                                </br>
                                                                        
   -P [proxy server port]
  +                                                                                    
         <br     >
  +                                             </br>
  +                                                                     
  +-u [username for proxy authentication - if required]
  +                                                                                    
         <br     >
  +                                             </br>
  +                                                                     
  +-a [password for proxy authentication - if required]
                                                </p>
                                                                                       
                                                                         <p      >
                                                                                       
         <b      >
                                                                Example
                                                </b>
  -                                                                     : jmeter -H 
my.proxy.server -P 8000
  +                                                                     : jmeter -H 
my.proxy.server -P 8000 -u username -a password
                                                </p>
                                                                                       
                                                                         <p      >
  -                                                             Alternatively, you can 
use --proxyHost and --proxyPort
  +                                                             Alternatively, you can 
use --proxyHost, --proxyPort, --username, and --password
                                                </p>
                                                                          </blockquote>
                </td></tr>
  
  
  
  1.5       +83 -1     jakarta-jmeter/src_1/org/apache/jmeter/JMeter.java
  
  Index: JMeter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/JMeter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JMeter.java       12 Jul 2002 02:05:49 -0000      1.4
  +++ JMeter.java       9 Aug 2002 17:51:28 -0000       1.5
  @@ -1,8 +1,63 @@
  -package org.apache.jmeter;
  +/*
  + * ====================================================================
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without
  + * modification, are permitted provided that the following conditions
  + * are met:
  + *
  + * 1. Redistributions of source code must retain the above copyright
  + * notice, this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright
  + * notice, this list of conditions and the following disclaimer in
  + * the documentation and/or other materials provided with the
  + * distribution.
  + *
  + * 3. The end-user documentation included with the redistribution,
  + * if any, must include the following acknowledgment:
  + * "This product includes software developed by the
  + * Apache Software Foundation (http://www.apache.org/)."
  + * Alternately, this acknowledgment may appear in the software itself,
  + * if and wherever such third-party acknowledgments normally appear.
  + *
  + * 4. The names "Apache" and "Apache Software Foundation" and
  + * "Apache JMeter" must not be used to endorse or promote products
  + * derived from this software without prior written permission. For
  + * written permission, please contact [EMAIL PROTECTED]
  + *
  + * 5. Products derived from this software may not be called "Apache",
  + * "Apache JMeter", nor may "Apache" appear in their name, without
  + * prior written permission of the Apache Software Foundation.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * ====================================================================
  + *
  + * This software consists of voluntary contributions made by many
  + * individuals on behalf of the Apache Software Foundation.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
  + package org.apache.jmeter;
   
   import java.awt.event.ActionEvent;
   import java.io.File;
   import java.io.FileInputStream;
  +import java.net.Authenticator;
   
   import org.apache.avalon.excalibur.cli.CLArgsParser;
   import org.apache.avalon.excalibur.cli.CLOption;
  @@ -41,6 +96,8 @@
        protected static final int SERVER_OPT = 's';
        protected static final int PROXY_HOST = 'H';
        protected static final int PROXY_PORT = 'P';
  +     protected static final int PROXY_USERNAME = 'u';
  +     protected static final int PROXY_PASSWORD = 'a';
   
        /**
         *  Define the understood options. Each CLOptionDescriptor contains:
  @@ -98,6 +155,16 @@
                                CLOptionDescriptor.ARGUMENT_REQUIRED,
                                PROXY_PORT,
                                "Set proxy server port for JMeter to use"),
  +                     new CLOptionDescriptor(
  +                             "username",
  +                             CLOptionDescriptor.ARGUMENT_REQUIRED,
  +                             PROXY_USERNAME,
  +                             "Set username for proxy server that JMeter is to use"),
  +                     new CLOptionDescriptor(
  +                             "password",
  +                             CLOptionDescriptor.ARGUMENT_REQUIRED,
  +                             PROXY_PASSWORD,
  +                             "Set password for proxy server that JMeter is to use"),
                        };
   
        public JMeter() {
  @@ -165,6 +232,21 @@
         * Sets a proxy server for the JVM if the command line arguments are specified.
         */
        private void setProxy(CLArgsParser parser) throws IllegalUserActionException {
  +             if(parser.getArgumentById(PROXY_USERNAME) != null)
  +             {
  +                     if(parser.getArgumentById(PROXY_PASSWORD) != null)
  +                     {
  +                             Authenticator.setDefault(new ProxyAuthenticator(
  +                                             
parser.getArgumentById(PROXY_USERNAME).getArgument(),
  +                                             
parser.getArgumentById(PROXY_PASSWORD).getArgument()));
  +                     }
  +                     else
  +                     {
  +                             Authenticator.setDefault(new ProxyAuthenticator(
  +                                             
parser.getArgumentById(PROXY_USERNAME).getArgument(),
  +                                             ""));
  +                     }
  +             }
                if (parser.getArgumentById(PROXY_HOST) != null
                        && parser.getArgumentById(PROXY_PORT) != null) {
                        System.setProperty(
  
  
  
  1.1                  jakarta-jmeter/src_1/org/apache/jmeter/ProxyAuthenticator.java
  
  Index: ProxyAuthenticator.java
  ===================================================================
  /*
   * ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   * notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   * notice, this list of conditions and the following disclaimer in
   * the documentation and/or other materials provided with the
   * distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   * if any, must include the following acknowledgment:
   * "This product includes software developed by the
   * Apache Software Foundation (http://www.apache.org/)."
   * Alternately, this acknowledgment may appear in the software itself,
   * if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   * "Apache JMeter" must not be used to endorse or promote products
   * derived from this software without prior written permission. For
   * written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   * "Apache JMeter", nor may "Apache" appear in their name, without
   * prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
   package org.apache.jmeter;
  
  import java.net.Authenticator;
  import java.net.PasswordAuthentication;
  
  /**
   * @author Dion MCMURTRIE
   *
   * Provides JMeter the ability to use proxy servers that require username and 
password
   */
  public class ProxyAuthenticator extends Authenticator {
  
      private String userName, password;
  
      protected PasswordAuthentication getPasswordAuthentication() {
          return new PasswordAuthentication(userName, password.toCharArray());
      }
  
      public ProxyAuthenticator(String userName, String password) {
          this.userName = userName;
          this.password = password;
      }
  }
  
  
  
  1.12      +5 -3      jakarta-jmeter/xdocs/usermanual/get-started.xml
  
  Index: get-started.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/xdocs/usermanual/get-started.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- get-started.xml   18 Jun 2002 01:01:15 -0000      1.11
  +++ get-started.xml   9 Aug 2002 17:51:28 -0000       1.12
  @@ -112,9 +112,11 @@
   the firewall/proxy server hostname and port number.  To do so, run the 
jmeter.bat/jmeter file
   from a command line with the following parameters:</p>
   <p>-H [proxy server hostname or ip address]<br/>
  --P [proxy server port]</p>
  -<p><b>Example</b>: jmeter -H my.proxy.server -P 8000</p>
  -<p>Alternatively, you can use --proxyHost and --proxyPort</p>
  +-P [proxy server port]<br/>
  +-u [username for proxy authentication - if required]<br/>
  +-a [password for proxy authentication - if required]</p>
  +<p><b>Example</b>: jmeter -H my.proxy.server -P 8000 -u username -a password</p>
  +<p>Alternatively, you can use --proxyHost, --proxyPort, --username, and 
--password</p>
   </subsection>
   
   <subsection name="2.4.3 Non-GUI Mode" anchor="non_gui">
  
  
  

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

Reply via email to