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 2016/05/07 13:30:14 UTC
[21/50] [abbrv] maven-aether git commit: Stabilized tests
Stabilized tests
Project: http://git-wip-us.apache.org/repos/asf/maven-aether/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-aether/commit/27fa3092
Tree: http://git-wip-us.apache.org/repos/asf/maven-aether/tree/27fa3092
Diff: http://git-wip-us.apache.org/repos/asf/maven-aether/diff/27fa3092
Branch: refs/heads/ant-tasks
Commit: 27fa30923486f8c2336c8db87a2a792cf2477c5a
Parents: 27ac080
Author: Benjamin Bentmann <be...@sonatype.com>
Authored: Sat Apr 5 10:06:08 2014 +0200
Committer: Benjamin Bentmann <be...@sonatype.com>
Committed: Sat Apr 5 10:06:08 2014 +0200
----------------------------------------------------------------------
.../java/org/eclipse/aether/ant/DeployTest.java | 27 +++++++++++---------
1 file changed, 15 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27fa3092/src/test/java/org/eclipse/aether/ant/DeployTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/eclipse/aether/ant/DeployTest.java b/src/test/java/org/eclipse/aether/ant/DeployTest.java
index ad68651..f0ce232 100644
--- a/src/test/java/org/eclipse/aether/ant/DeployTest.java
+++ b/src/test/java/org/eclipse/aether/ant/DeployTest.java
@@ -26,33 +26,36 @@ public class DeployTest
public void testDeployGlobalPom()
{
+ long min = System.currentTimeMillis();
executeTarget( "testDeployGlobalPom" );
- long tstamp = System.currentTimeMillis();
+ long max = System.currentTimeMillis();
assertLogContaining( "Uploading" );
- assertUpdatedFile( tstamp, distRepoDir, "test/dummy/0.1-SNAPSHOT/maven-metadata.xml" );
+ assertUpdatedFile( min, max, distRepoDir, "test/dummy/0.1-SNAPSHOT/maven-metadata.xml" );
}
public void testDeployOverrideGlobalPom()
{
+ long min = System.currentTimeMillis();
executeTarget( "testDeployOverrideGlobalPom" );
- long tstamp = System.currentTimeMillis();
+ long max = System.currentTimeMillis();
assertLogContaining( "Uploading" );
- assertUpdatedFile( tstamp, distRepoDir, "test/other/0.1-SNAPSHOT/maven-metadata.xml" );
+ assertUpdatedFile( min, max, distRepoDir, "test/other/0.1-SNAPSHOT/maven-metadata.xml" );
}
public void testDeployOverrideGlobalPomByRef()
{
- long tstamp = System.currentTimeMillis();
+ long min = System.currentTimeMillis();
executeTarget( "testDeployOverrideGlobalPomByRef" );
+ long max = System.currentTimeMillis();
assertLogContaining( "Uploading" );
- assertUpdatedFile( tstamp, distRepoDir, "test/dummy/0.1-SNAPSHOT/maven-metadata.xml" );
- assertUpdatedFile( tstamp, distRepoDir, "test/other/0.1-SNAPSHOT/maven-metadata.xml" );
+ assertUpdatedFile( min, max, distRepoDir, "test/dummy/0.1-SNAPSHOT/maven-metadata.xml" );
+ assertUpdatedFile( min, max, distRepoDir, "test/other/0.1-SNAPSHOT/maven-metadata.xml" );
}
public void testDeployAttachedArtifact()
@@ -67,13 +70,13 @@ public class DeployTest
hasItemInArray( endsWith( "-ant.xml" ) ) );
}
- private void assertUpdatedFile( long tstamp, File repoPath, String path )
+ private void assertUpdatedFile( long min, long max, File repoPath, String path )
{
File file = new File( repoPath, path );
+ min = (min / 1000) * 1000;
+ max = ((max + 999) / 1000) * 1000;
assertThat( "File does not exist in default repo: " + file.getAbsolutePath(), file.exists() );
- assertThat( "Files were not updated for 1s before/after timestamp",
- file.lastModified(),
- allOf( greaterThanOrEqualTo( ( ( tstamp - 500 ) / 1000 ) * 1000 ),
- lessThanOrEqualTo( tstamp + 2000 ) ) );
+ assertThat( "Files were not updated for 1s before/after timestamp", file.lastModified(),
+ allOf( greaterThanOrEqualTo( min ), lessThanOrEqualTo( max ) ) );
}
}