mirror of https://github.com/apache/maven.git
[MNG-5907] org.apache.maven.repository.internal.RemoteSnapshotMetadataTest fails starting at midnight
This commit is contained in:
parent
b711de57dc
commit
316298e529
|
@ -41,9 +41,9 @@ import org.eclipse.aether.artifact.Artifact;
|
||||||
final class RemoteSnapshotMetadata
|
final class RemoteSnapshotMetadata
|
||||||
extends MavenSnapshotMetadata
|
extends MavenSnapshotMetadata
|
||||||
{
|
{
|
||||||
private static final String DEFAULT_SNAPSHOT_TIMESTAMP_FORMAT = "yyyyMMdd.HHmmss";
|
public static final String DEFAULT_SNAPSHOT_TIMESTAMP_FORMAT = "yyyyMMdd.HHmmss";
|
||||||
|
|
||||||
private static final TimeZone DEFAULT_SNAPSHOT_TIME_ZONE = TimeZone.getTimeZone( "Etc/UTC" );
|
public static final TimeZone DEFAULT_SNAPSHOT_TIME_ZONE = TimeZone.getTimeZone( "Etc/UTC" );
|
||||||
|
|
||||||
private final Map<String, SnapshotVersion> versions = new LinkedHashMap<>();
|
private final Map<String, SnapshotVersion> versions = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
|
|
@ -49,13 +49,14 @@ public class RemoteSnapshotMetadataTest
|
||||||
@After
|
@After
|
||||||
public void restoreLocale()
|
public void restoreLocale()
|
||||||
{
|
{
|
||||||
Locale.setDefault(defaultLocale);
|
Locale.setDefault( defaultLocale );
|
||||||
}
|
}
|
||||||
|
|
||||||
static String gregorianDate()
|
static String gregorianDate()
|
||||||
{
|
{
|
||||||
SimpleDateFormat df = new SimpleDateFormat( "yyyyMMdd" );
|
SimpleDateFormat df = new SimpleDateFormat( "yyyyMMdd" );
|
||||||
df.setCalendar(new GregorianCalendar());
|
df.setCalendar( new GregorianCalendar() );
|
||||||
|
df.setTimeZone( RemoteSnapshotMetadata.DEFAULT_SNAPSHOT_TIME_ZONE );
|
||||||
return df.format( new Date() );
|
return df.format( new Date() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ public class RemoteSnapshotMetadataTest
|
||||||
|
|
||||||
RemoteSnapshotMetadata metadata = new RemoteSnapshotMetadata(
|
RemoteSnapshotMetadata metadata = new RemoteSnapshotMetadata(
|
||||||
new DefaultArtifact( "a:b:1-SNAPSHOT" ), false);
|
new DefaultArtifact( "a:b:1-SNAPSHOT" ), false);
|
||||||
metadata.merge(new Metadata());
|
metadata.merge( new Metadata() );
|
||||||
|
|
||||||
String dateAfter = gregorianDate();
|
String dateAfter = gregorianDate();
|
||||||
|
|
||||||
|
@ -76,6 +77,6 @@ public class RemoteSnapshotMetadataTest
|
||||||
/* Allow for this test running across midnight */
|
/* Allow for this test running across midnight */
|
||||||
Set<String> expected = new HashSet<String>( Arrays.asList( dateBefore, dateAfter ) );
|
Set<String> expected = new HashSet<String>( Arrays.asList( dateBefore, dateAfter ) );
|
||||||
assertTrue( "Expected " + datePart + " to be in " + expected,
|
assertTrue( "Expected " + datePart + " to be in " + expected,
|
||||||
expected.contains(datePart) );
|
expected.contains( datePart ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue