You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2019/08/04 10:53:51 UTC
[maven-dependency-plugin] 01/01: [MDEP-655] - The unpack
integration test fails intermittent.
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch MDEP-655
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git
commit 27d8ce45768c7ca7ec8f711e1c86d1e0c17a0c6e
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun Aug 4 12:53:42 2019 +0200
[MDEP-655] - The unpack integration test fails intermittent.
---
.../fromConfiguration/TestUnpackMojo.java | 23 ++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackMojo.java
index 5a27484..52656b3 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackMojo.java
@@ -21,6 +21,7 @@ package org.apache.maven.plugins.dependency.fromConfiguration;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -527,6 +528,12 @@ public class TestUnpackMojo
assertUnpacked( item, true );
}
+ /**
+ * The following code has been modified to prevent the
+ * JDK bug which is described in detail
+ * https://bugs.openjdk.java.net/browse/JDK-8177809
+ *
+ */
public void testUnpackOverWriteIfNewer()
throws Exception
{
@@ -567,16 +574,24 @@ public class TestUnpackMojo
displayFile( "unpackedFile", unpackedFile );
displayFile( "artifact ", artifact.getFile() );
displayFile( "marker ", marker );
+
+ long markerLastModifiedMillis = Files.getLastModifiedTime( marker.toPath() ).toMillis();
+ long unpackedFileLastModifiedMillis = Files.getLastModifiedTime( unpackedFile.toPath() ).toMillis();
+
System.out.println( "marker.lastModified() = " + marker.lastModified() );
System.out.println( "unpackedFile.lastModified() = " + unpackedFile.lastModified() );
- assertTrue( "unpackedFile '" + unpackedFile + "' lastModified() == " + marker.lastModified()
- + ": should be different", marker.lastModified() != unpackedFile.lastModified() );
+ System.out.println( "markerLastModifiedMillis = " + markerLastModifiedMillis );
+ System.out.println( "unpackedFileLastModifiedMillis = " + unpackedFileLastModifiedMillis );
+
+ assertTrue( "unpackedFile '" + unpackedFile + "' lastModified() == " + markerLastModifiedMillis
+ + ": should be different", markerLastModifiedMillis != unpackedFileLastModifiedMillis );
}
- private void displayFile( String description, File file )
+ private void displayFile(String description, File file) throws IOException
{
+ long toMillis = Files.getLastModifiedTime( file.toPath() ).toMillis();
System.out.println( description + ' ' + DateFormatUtils.ISO_DATETIME_FORMAT.format( file.lastModified() ) + ' '
- + file.getPath().substring( getBasedir().length() ) );
+ + file.getPath().substring( getBasedir().length() ) );
}
public void assertUnpacked( ArtifactItem item, boolean overWrite )