You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Arik Kfir <ar...@gmail.com> on 2006/05/04 00:52:28 UTC

Re: svn commit: r399473 - /maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java

THANK YOU!!! I thought I was losing my mind....my .ssh dir kept
disappearing! I actually thought someone was hacking my station and stealing
my keys....


On 5/3/06, jdcasey@apache.org <jd...@apache.org> wrote:
>
> Author: jdcasey
> Date: Wed May  3 15:41:02 2006
> New Revision: 399473
>
> URL: http://svn.apache.org/viewcvs?rev=399473&view=rev
> Log:
> Fixing .ssh directory location in unit tests...it was ERASING
> existing/functional .ssh directories.
>
> Modified:
>
>     maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java
>
> Modified:
> maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java
> URL:
> http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java?rev=399473&r1=399472&r2=399473&view=diff
>
> ==============================================================================
> ---
> maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java
> (original)
> +++
> maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java
> Wed May  3 15:41:02 2006
> @@ -20,6 +20,7 @@
> import java.util.ArrayList;
> import java.util.Iterator;
> import java.util.List;
> +import java.util.Properties;
>
> import org.apache.maven.plugin.MojoExecutionException;
> import org.apache.maven.plugin.deploy.DeployMojo;
> @@ -375,6 +376,19 @@
>      public void testBasicDeployWithScpAsProtocol()
>          throws Exception
>      {
> +        String originalUserHome = System.getProperty( "user.home" );
> +
> +        // FIX THE DAMN user.home BEFORE YOU DELETE IT!!!
> +        File altHome = new File( getBasedir(), "target/ssh-user-home" );
> +        altHome.mkdirs();
> +
> +        System.out.println( "Testing user.home value for .ssh dir: " +
> altHome.getCanonicalPath() );
> +
> +        Properties props = System.getProperties();
> +        props.setProperty( "user.home", altHome.getCanonicalPath() );
> +
> +        System.setProperties( props );
> +
>          File testPom = new File( getBasedir(),
>
>                                   "target/test-classes/unit/basic-deploy-scp/plugin-
> config.xml" );
>
> @@ -396,7 +410,17 @@
>
>          artifact.setFile( file );
>
> -        File sshFile = new File( System.getProperty( "user.home" ),
> ".ssh" );
> +        String altUserHome = System.getProperty( "user.home" );
> +
> +        if ( altUserHome.equals( originalUserHome ) )
> +        {
> +            // this is *very* bad!
> +            throw new IllegalStateException( "Setting 'user.home' system
> property to alternate value did NOT work. Aborting test." );
> +        }
> +
> +        File sshFile = new File( altUserHome, ".ssh" );
> +
> +        System.out.println( "Testing .ssh dir: " +
> sshFile.getCanonicalPath() );
>
>          //delete first the .ssh folder if existing before executing the
> mojo
>          if( sshFile.exists() )
>
>
>


--
______________________________________
Cheers,
      Arik Kfir                                   arikkfir@gmail.com
      Linux user, number 415067 - http://counter.li.org/
      http://corleon.dnsalias.org