You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2011/03/26 10:35:34 UTC
svn commit: r1085674 -
/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestUnpackMojo.java
Author: hboutemy
Date: Sat Mar 26 09:35:33 2011
New Revision: 1085674
URL: http://svn.apache.org/viewvc?rev=1085674&view=rev
Log:
added output to investigate intermittently failing test
Modified:
maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestUnpackMojo.java
Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestUnpackMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestUnpackMojo.java?rev=1085674&r1=1085673&r2=1085674&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestUnpackMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestUnpackMojo.java Sat Mar 26 09:35:33 2011
@@ -25,6 +25,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.MojoExecutionException;
@@ -497,7 +498,7 @@ public class TestUnpackMojo
{
stubFactory.setCreateFiles( true );
Artifact artifact = stubFactory.getSnapshotArtifact();
- artifact.getFile().setLastModified( System.currentTimeMillis() - 2000 );
+ assertTrue( artifact.getFile().setLastModified( System.currentTimeMillis() - 2000 ) );
ArtifactItem item = new ArtifactItem( artifact );
@@ -514,21 +515,33 @@ public class TestUnpackMojo
// go back 10 more seconds for linux
time -= 10000;
// set to known value
- unpackedFile.setLastModified( time );
+ assertTrue( unpackedFile.setLastModified( time ) );
// set source to be newer
- artifact.getFile().setLastModified( time + 4000 );
+ assertTrue( artifact.getFile().setLastModified( time + 4000 ) );
// manually set markerfile (must match getMarkerFile in
// DefaultMarkerFileHandler)
File marker = new File( mojo.getMarkersDirectory(), artifact.getId().replace( ':', '-' ) + ".marker" );
- marker.setLastModified( time );
+ assertTrue( marker.setLastModified( time ) );
- assertTrue( time == unpackedFile.lastModified() );
- mojo.execute();
+ displayFile( "unpackedFile", unpackedFile );
+ displayFile( "artifact ", artifact.getFile() );
+ displayFile( "marker ", marker );
+ System.out.println( "mojo.execute()" );
+ mojo.execute();
+ displayFile( "unpackedFile", unpackedFile );
+ displayFile( "artifact ", artifact.getFile() );
+ displayFile( "marker ", marker );
assertTrue( "unpackedFile '" + unpackedFile + "' lastModified() == " + time + ": should be different",
time != unpackedFile.lastModified() );
}
+ private void displayFile( String description, File file )
+ {
+ System.out.println( description + ' ' + DateFormatUtils.ISO_DATETIME_FORMAT.format( file.lastModified() ) + ' '
+ + file.getPath().substring( getBasedir().length() ) );
+ }
+
public void assertUnpacked( ArtifactItem item, boolean overWrite )
throws InterruptedException, MojoExecutionException
{