You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wagon-commits@maven.apache.org by br...@apache.org on 2005/02/09 07:17:43 UTC

cvs commit: maven-wagon/wagon-provider-test/src/main/java/org/apache/maven/wagon WagonTestCase.java

brett       2005/02/08 22:17:43

  Modified:    wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh
                        ScpWagon.java
               wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh
                        ScpWagonTest.java
                        ScpWagonWithSshPrivateKeySearchTest.java
               wagon-provider-api/src/main/java/org/apache/maven/wagon/authentication
                        AuthenticationInfo.java
               wagon-provider-api/src/main/java/org/apache/maven/wagon/repository
                        Repository.java
               wagon-provider-api/src/main/java/org/apache/maven/wagon
                        WagonUtils.java
               wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication
                        AuthenticationInfoTest.java
               wagon-provider-api/src/test/java/org/apache/maven/wagon/repository
                        RepositoryTest.java
               wagon-provider-test/src/main/java/org/apache/maven/wagon
                        WagonTestCase.java
  Added:       wagon-provider-api/src/main/java/org/apache/maven/wagon/repository
                        RepositoryPermissions.java
               wagon-provider-api/src/test/java/org/apache/maven/wagon/repository
                        RepositoryPermissionsTest.java
  Log:
  moving repository permissions settings to a separate class - they don't belong in authentication info
  
  Revision  Changes    Path
  1.8       +6 -5      maven-wagon/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java
  
  Index: ScpWagon.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ScpWagon.java	9 Feb 2005 05:27:22 -0000	1.7
  +++ ScpWagon.java	9 Feb 2005 06:17:43 -0000	1.8
  @@ -29,6 +29,7 @@
   import org.apache.maven.wagon.ResourceDoesNotExistException;
   import org.apache.maven.wagon.TransferFailedException;
   import org.apache.maven.wagon.WagonConstants;
  +import org.apache.maven.wagon.repository.RepositoryPermissions;
   import org.apache.maven.wagon.resource.Resource;
   import org.apache.maven.wagon.events.TransferEvent;
   import org.apache.maven.wagon.authentication.AuthenticationException;
  @@ -312,15 +313,15 @@
               throw new TransferFailedException( msg, e );
           }
   
  -        AuthenticationInfo authInfo = getRepository().getAuthenticationInfo();
  +        RepositoryPermissions permissions = getRepository().getPermissions();
   
  -        if ( authInfo != null && authInfo.getGroup() != null )
  +        if ( permissions != null && permissions.getGroup() != null )
           {
  -            String chgrpCmd = "chgrp " + authInfo.getGroup() + " " + basedir + "/" + resourceName + "\n";
  +            String chgrpCmd = "chgrp " + permissions.getGroup() + " " + basedir + "/" + resourceName + "\n";
   
               executeCommand( chgrpCmd );
   
  -            // Need to change the mode as well.
  +            // TODO [BP]: Need to change the mode as well.
   
           }
   
  
  
  
  1.5       +1 -5      maven-wagon/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/ScpWagonTest.java
  
  Index: ScpWagonTest.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/ScpWagonTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ScpWagonTest.java	7 Dec 2004 12:27:52 -0000	1.4
  +++ ScpWagonTest.java	9 Feb 2005 06:17:43 -0000	1.5
  @@ -62,10 +62,6 @@
               authInfo.setPassphrase( "" );
           }
   
  -        // TODO: set file mode, directory file mode
  -
  -        authInfo.setGroup( userName );
  -
           return authInfo;
       }
   
  
  
  
  1.4       +1 -3      maven-wagon/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.java
  
  Index: ScpWagonWithSshPrivateKeySearchTest.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ScpWagonWithSshPrivateKeySearchTest.java	26 Oct 2004 18:52:30 -0000	1.3
  +++ ScpWagonWithSshPrivateKeySearchTest.java	9 Feb 2005 06:17:43 -0000	1.4
  @@ -53,8 +53,6 @@
   
           authInfo.setPassphrase( "" );
   
  -        authInfo.setGroup( userName );
  -
           return authInfo;
       }
   
  
  
  
  1.6       +1 -78     maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/authentication/AuthenticationInfo.java
  
  Index: AuthenticationInfo.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/authentication/AuthenticationInfo.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AuthenticationInfo.java	15 Dec 2004 11:29:45 -0000	1.5
  +++ AuthenticationInfo.java	9 Feb 2005 06:17:43 -0000	1.6
  @@ -23,12 +23,8 @@
    * This class holds the set of properties used when instance of the <code>Wagon</code>
    * will use during login opreration.
    *
  - * @todo group, mode and directory mode do not belong here - they are repository info.
  - *
    * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
    * @version $Id$
  - *
  - * @todo michal: I added fileMode,directoryMode as it was uses in test classes. I am not sure why we need them.
    */
   public class AuthenticationInfo implements Serializable
   {
  @@ -39,15 +35,6 @@
       /** Password associated with the login */
       private String password;
   
  -    /** Repository group name. */
  -    private String group;
  -
  -    /** Repository directory mode. Modes can be in either textual (ugo+rx) or octal (755) form. */
  -    private String directoryMode;
  -
  -    /** Repository file mode. Modes can be in either textual (ugo+rx) or octal (644) form. */
  -    private String fileMode;
  -
       /** Passphrase of the user's private key file */
       private String passphrase;
   
  @@ -97,70 +84,6 @@
       }
   
       /**
  -     * Get the repository group name to which an artifact will belong to after
  -     * deployemnt. Not all protolcols permit the changing of the artifact
  -     * group.
  -     * 
  -     * @return repository group name
  -     */
  -    public String getGroup()
  -    {
  -        return group;
  -    }
  -
  -    /**
  -     * Set the repository group name for the deployed artifact.
  -     * 
  -     * @param group repository group for deployed artifacts
  -     */
  -    public void setGroup( final String group )
  -    {
  -        this.group = group;
  -    }
  -
  -    /**
  -     * Get the repository directory mode to which an artifact will belong to after
  -     * deployment. Not all protolcols permit the changing of the mode.
  -     * 
  -     * @return mode
  -     */
  -    public String getDirectoryMode()
  -    {
  -        return directoryMode;
  -    }
  -
  -    /**
  -     * Set the repository directory mode for the deployed artifact.
  -     * 
  -     * @param directoryMode repository directory mode for deployed artifacts
  -     */
  -    public void setDirectoryMode( final String directoryMode )
  -    {
  -        this.directoryMode = directoryMode;
  -    }
  -
  -    /**
  -     * Get the repository file mode to which an artifact will belong to after
  -     * deployment. Not all protolcols permit the changing of the artifact mode.
  -     * 
  -     * @return repository group name
  -     */
  -    public String getFileMode()
  -    {
  -        return fileMode;
  -    }
  -
  -    /**
  -     * Set the repository file mode for the deployed artifact.
  -     * 
  -     * @param fileMode repository file mode for deployed artifacts
  -     */
  -    public void setFileMode( final String fileMode )
  -    {
  -        this.fileMode = fileMode;
  -    }
  -
  -    /**
        * Get the user's password which is used when connecting to the repository.
        * 
        * @return password of user
  
  
  
  1.9       +13 -1     maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/repository/Repository.java
  
  Index: Repository.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/repository/Repository.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Repository.java	8 Feb 2005 06:42:32 -0000	1.8
  +++ Repository.java	9 Feb 2005 06:17:43 -0000	1.9
  @@ -48,6 +48,8 @@
   
       private String url;
   
  +    private RepositoryPermissions permissions;
  +
       private AuthenticationInfo authenticationInfo;
   
   
  @@ -181,4 +183,14 @@
       {
           return protocol;
       }
  +
  +    public RepositoryPermissions getPermissions()
  +    {
  +        return permissions;
  +    }
  +
  +    public void setPermissions( RepositoryPermissions permissions )
  +    {
  +        this.permissions = permissions;
  +    }
   }
  
  
  
  1.1                  maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/repository/RepositoryPermissions.java
  
  Index: RepositoryPermissions.java
  ===================================================================
  package org.apache.maven.wagon.repository;
  
  /* ====================================================================
   *   Copyright 2001-2005 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   * ====================================================================
   */
  
  /**
   * Describes the permissions to set on files uploaded to the repository.
   *
   * @author Brett Porter
   * @version $Id: RepositoryPermissions.java,v 1.1 2005/02/09 06:17:43 brett Exp $
   */
  public class RepositoryPermissions
  {
      /**
       * Repository group name.
       */
      private String group;
  
      /**
       * Repository directory mode. Modes can be in either textual (ugo+rx) or octal (755) form.
       */
      private String directoryMode;
  
      /**
       * Repository file mode. Modes can be in either textual (ugo+rx) or octal (644) form.
       */
      private String fileMode;
  
      /**
       * Get the repository directory mode to which an artifact will belong to after
       * deployment. Not all protolcols permit the changing of the mode.
       *
       * @return mode
       */
      public String getDirectoryMode()
      {
          return directoryMode;
      }
  
      /**
       * Set the repository directory mode for the deployed artifact.
       *
       * @param directoryMode repository directory mode for deployed artifacts
       */
      public void setDirectoryMode( final String directoryMode )
      {
          this.directoryMode = directoryMode;
      }
  
      /**
       * Get the repository file mode to which an artifact will belong to after
       * deployment. Not all protolcols permit the changing of the artifact mode.
       *
       * @return repository group name
       */
      public String getFileMode()
      {
          return fileMode;
      }
  
      /**
       * Set the repository file mode for the deployed artifact.
       *
       * @param fileMode repository file mode for deployed artifacts
       */
      public void setFileMode( final String fileMode )
      {
          this.fileMode = fileMode;
      }
  
      /**
       * Get the repository group name to which an artifact will belong to after
       * deployemnt. Not all protolcols permit the changing of the artifact
       * group.
       *
       * @return repository group name
       */
      public String getGroup()
      {
          return group;
      }
  
      /**
       * Set the repository group name for the deployed artifact.
       *
       * @param group repository group for deployed artifacts
       */
      public void setGroup( final String group )
      {
          this.group = group;
      }
  
  }
  
  
  
  1.12      +4 -2      maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/WagonUtils.java
  
  Index: WagonUtils.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/WagonUtils.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- WagonUtils.java	15 Dec 2004 11:29:45 -0000	1.11
  +++ WagonUtils.java	9 Feb 2005 06:17:43 -0000	1.12
  @@ -152,6 +152,8 @@
   
       public static AuthenticationInfo getAuthInfo()
       {
  +        // TODO: not used presently?
  +
           AuthenticationInfo authInfo = new AuthenticationInfo();
   
           String userName = getUserName();
  @@ -169,7 +171,7 @@
   
           // TODO: what about modes?
   
  -        authInfo.setGroup( getUserGroup() );
  +//        authInfo.setGroup( getUserGroup() );
   
           return authInfo;
       }
  
  
  
  1.4       +1 -14     maven-wagon/wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication/AuthenticationInfoTest.java
  
  Index: AuthenticationInfoTest.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication/AuthenticationInfoTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AuthenticationInfoTest.java	7 Dec 2004 11:41:37 -0000	1.3
  +++ AuthenticationInfoTest.java	9 Feb 2005 06:17:43 -0000	1.4
  @@ -60,19 +60,6 @@
           assertEquals( "password", authenticationInfo.getPassword() );
   
   
  -        authenticationInfo.setDirectoryMode( "directoryMode" );
  -
  -        assertEquals( "directoryMode", authenticationInfo.getDirectoryMode() );
  -
  -        authenticationInfo.setFileMode( "fileMode" );
  -
  -        assertEquals( "fileMode", authenticationInfo.getFileMode() );
  -
  -        authenticationInfo.setGroup( "group" );
  -
  -        assertEquals( "group", authenticationInfo.getGroup() );
  -
  -
           authenticationInfo.setPassphrase( "passphrase" );
   
           assertEquals( "passphrase", authenticationInfo.getPassphrase() );
  
  
  
  1.4       +1 -1      maven-wagon/wagon-provider-api/src/test/java/org/apache/maven/wagon/repository/RepositoryTest.java
  
  
  
  
  1.1                  maven-wagon/wagon-provider-api/src/test/java/org/apache/maven/wagon/repository/RepositoryPermissionsTest.java
  
  Index: RepositoryPermissionsTest.java
  ===================================================================
  package org.apache.maven.wagon.repository;
  
  /* ====================================================================
   *   Copyright 2001-2005 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   * ====================================================================
   */
  
  import junit.framework.TestCase;
  
  /**
   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
   * @version $Id: RepositoryPermissionsTest.java,v 1.1 2005/02/09 06:17:43 brett Exp $
   * @todo test defaults
   */
  public class RepositoryPermissionsTest
      extends TestCase
  {
      public RepositoryPermissionsTest( final String name )
      {
          super( name );
      }
  
      public void setUp()
          throws Exception
      {
          super.setUp();
      }
  
      public void tearDown()
          throws Exception
      {
          super.tearDown();
      }
  
      public void testAuthenticationInfoProperties()
      {
          final RepositoryPermissions repositoryPermissions = new RepositoryPermissions();
  
          repositoryPermissions.setDirectoryMode( "directoryMode" );
  
          assertEquals( "directoryMode", repositoryPermissions.getDirectoryMode() );
  
          repositoryPermissions.setFileMode( "fileMode" );
  
          assertEquals( "fileMode", repositoryPermissions.getFileMode() );
  
          repositoryPermissions.setGroup( "group" );
  
          assertEquals( "group", repositoryPermissions.getGroup() );
  
      }
  }
  
  
  
  1.2       +9 -1      maven-wagon/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java
  
  Index: WagonTestCase.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WagonTestCase.java	10 Aug 2004 20:34:45 -0000	1.1
  +++ WagonTestCase.java	9 Feb 2005 06:17:43 -0000	1.2
  @@ -24,6 +24,7 @@
   import org.apache.maven.wagon.observers.ChecksumObserver;
   import org.apache.maven.wagon.observers.Debug;
   import org.apache.maven.wagon.repository.Repository;
  +import org.apache.maven.wagon.repository.RepositoryPermissions;
   
   import org.codehaus.plexus.PlexusTestCase;
   import org.codehaus.plexus.util.FileUtils;
  @@ -98,6 +99,8 @@
   
           testRepository.setAuthenticationInfo( getAuthInfo() );
   
  +        testRepository.setPermissions( getPermissions() );
  +
           // ----------------------------------------------------------------------
           // Create a test local repository.
           // ----------------------------------------------------------------------
  @@ -141,6 +144,11 @@
           return new AuthenticationInfo();
       }
   
  +    protected RepositoryPermissions getPermissions()
  +    {
  +        return new RepositoryPermissions();
  +    }
  +
       protected Wagon getWagon()
           throws Exception
       {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: wagon-cvs-unsubscribe@maven.apache.org
For additional commands, e-mail: wagon-cvs-help@maven.apache.org