jvanzyl     2002/07/11 09:36:29

  Modified:    src/java/org/apache/maven/util HttpUtils.java
               src/plugins/clover plugin.jelly
  Log:
  o Applying patches sent by Emmanuel Venisse <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  1.5       +62 -1     
jakarta-turbine-maven/src/java/org/apache/maven/util/HttpUtils.java
  
  Index: HttpUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/util/HttpUtils.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- HttpUtils.java    5 Jul 2002 16:39:20 -0000       1.4
  +++ HttpUtils.java    11 Jul 2002 16:36:29 -0000      1.5
  @@ -64,7 +64,9 @@
   
   import java.net.URL;
   import java.net.URLConnection;
  +import java.net.Authenticator;
   import java.net.HttpURLConnection;
  +import java.net.PasswordAuthentication;
   
   import java.util.Date;
   
  @@ -78,6 +80,35 @@
   public class HttpUtils
   {
       /**
  +     * Use a proxy to bypass the firewall with or without authentication
  +     *
  +     * @param proxyHost Proxy Host (if proxy is required), or null
  +     * @param proxyPort Proxy Port (if proxy is required), or null
  +     * @param proxyUserName Proxy Username (if authentification is required), or 
null
  +     * @param proxyPassword Proxy Password (if authentification is required), or 
null
  +     */
  +    public static void useProxyUser(final String proxyHost, final String proxyPort,
  +        final String proxyUserName, final String proxyPassword)
  +    {
  +        if (proxyHost != null && proxyPort != null)
  +        {
  +            System.getProperties().put("proxySet", "true");
  +            System.getProperties().put("proxyHost", proxyHost);
  +            System.getProperties().put("proxyPort", proxyPort);
  +            
  +            if (proxyUserName != null)
  +            {
  +                Authenticator.setDefault(new Authenticator() {
  +                    protected PasswordAuthentication getPasswordAuthentication() {
  +                        return new PasswordAuthentication(proxyUserName,
  +                            proxyPassword == null ? new char[0] : 
proxyPassword.toCharArray());
  +                    }
  +                });
  +            }
  +        }
  +    }
  +    
  +    /**
        * Retrieve a remote file.  Returns true if the file was successfully
        * retrieved or if it is up to date (when the useTimestamp flag is set).
        * @param source the {@link URL} of the file to retrieve
  @@ -94,7 +125,8 @@
        */
       public static boolean getFile(URL source, File destinationFile, String file,
           boolean verbose, boolean ignoreErrors, boolean useTimestamp, 
  -        String uname, String pword)
  +        String uname, String pword,
  +        String proxyHost, String proxyPort, String proxyUserName, String 
proxyPassword)
       {
           boolean retrievedFile = false;
           try
  @@ -115,6 +147,9 @@
   
                   hasTimestamp = true;
               }
  +            
  +            //set proxy connection
  +            useProxyUser(proxyHost, proxyPort, proxyUserName, proxyPassword);
   
               //set up the URL connection
               URLConnection connection = source.openConnection();
  @@ -254,6 +289,32 @@
       }
   
   
  +    /**
  +     * Retrieve a remote file.  Returns true if the file was successfully
  +     * retrieved or if it is up to date (when the useTimestamp flag is set).
  +     * @param source the {@link URL} of the file to retrieve
  +     * @param destinationFile where to store it
  +     * @param file <strong>doesn't appear to be used</strong>
  +     * @param verbose the amount of logging to be displayed
  +     * @param ignoreErrors whether to ignore errors during I/O or throw an
  +     *      exception when they happen
  +     * @param useTimestamp whether to check the modified timestamp on the
  +     *      <code>destinationFile</code> against the remote <code>source</code>
  +     * @param uname the user name to use for basic authentication
  +     * @param pword the password to use for basic authentication
  +     * @return true if the retrieval succeeded, false otherwise
  +     * @deprecated 
  +     * @see 
#getFile(url,file,string,boolean,boolean,boolean,string,string,string,string,string,string)
  +     */
  +    public static boolean getFile(URL source, File destinationFile, String file,
  +        boolean verbose, boolean ignoreErrors, boolean useTimestamp, 
  +        String uname, String pword)
  +    {
  +        return getFile(source, destinationFile, file,
  +            verbose, ignoreErrors, useTimestamp, 
  +            uname, pword, null, null, null, null);
  +    }
  +        
       /**
        * set the timestamp of a named file to a specified time.
        *
  
  
  
  1.7       +8 -3      jakarta-turbine-maven/src/plugins/clover/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins/clover/plugin.jelly,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- plugin.jelly      8 Jul 2002 18:17:40 -0000       1.6
  +++ plugin.jelly      11 Jul 2002 16:36:29 -0000      1.7
  @@ -69,7 +69,7 @@
       description="Run unit tests with Clover"
       prereqs="clover:compile">
   
  -    <j:if test="${flags.sourceTestDirectory}">
  +    <j:if test="${unitTestSourcesPresent == 'true'}">
       
         <junit printSummary="yes" failureProperty="maven.test.failure"
             fork="${maven.junit.fork}" dir="${maven.junit.dir}">
  @@ -82,8 +82,13 @@
             <pathelement location="${maven.test.dest}"/>
           </classpath>
           <batchtest todir="${maven.test.reportsDirectory}">
  -          <fileset dir="${maven.unitTestSourceDirectory}">
  -            <patternset refid="maven.unit.test.set"/>
  +          <fileset dir="${pom.build.unitTestSourceDirectory}">
  +               <j:forEach var="pat" items="${pom.build.unitTest.includes}">
  +                 <include name="${pat}"/>
  +               </j:forEach>
  +               <j:forEach var="pat" items="${pom.build.unitTest.excludes}">
  +                 <exclude name="${pat}"/>
  +               </j:forEach>
             </fileset>
           </batchtest>
         </junit>
  
  
  

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

Reply via email to