From 316298e529c08936562d707ef136dc2756f0f084 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sat, 10 Oct 2015 15:50:22 +0200 Subject: [PATCH] [MNG-5907] org.apache.maven.repository.internal.RemoteSnapshotMetadataTest fails starting at midnight --- .../repository/internal/RemoteSnapshotMetadata.java | 4 ++-- .../repository/internal/RemoteSnapshotMetadataTest.java | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java index 285d218f45..1e791d8a42 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java @@ -41,9 +41,9 @@ import org.eclipse.aether.artifact.Artifact; final class RemoteSnapshotMetadata 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 versions = new LinkedHashMap<>(); diff --git a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataTest.java b/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataTest.java index 3b3dcb0b95..278231f9f6 100644 --- a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataTest.java +++ b/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataTest.java @@ -49,13 +49,14 @@ public class RemoteSnapshotMetadataTest @After public void restoreLocale() { - Locale.setDefault(defaultLocale); + Locale.setDefault( defaultLocale ); } static String gregorianDate() { 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() ); } @@ -66,7 +67,7 @@ public class RemoteSnapshotMetadataTest RemoteSnapshotMetadata metadata = new RemoteSnapshotMetadata( new DefaultArtifact( "a:b:1-SNAPSHOT" ), false); - metadata.merge(new Metadata()); + metadata.merge( new Metadata() ); String dateAfter = gregorianDate(); @@ -76,6 +77,6 @@ public class RemoteSnapshotMetadataTest /* Allow for this test running across midnight */ Set expected = new HashSet( Arrays.asList( dateBefore, dateAfter ) ); assertTrue( "Expected " + datePart + " to be in " + expected, - expected.contains(datePart) ); + expected.contains( datePart ) ); } }