From a25fb61136ba34be7e661bb7a2fc90b4d89071ad Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Fri, 13 Jun 2014 10:26:55 -0400 Subject: [PATCH] IT for MNG-5452: ${maven.build.timestamp} should use UTC instead of local timezone (or be configurable) --- ...enITmng5452MavenBuildTimestampUTCTest.java | 56 +++++++++++++++++++ .../pom.xml | 18 ++++++ .../src/main/resources/filtered.properties | 1 + 3 files changed, 75 insertions(+) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5452MavenBuildTimestampUTCTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-5452-maven-build-timestamp-utc/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-5452-maven-build-timestamp-utc/src/main/resources/filtered.properties diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5452MavenBuildTimestampUTCTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5452MavenBuildTimestampUTCTest.java new file mode 100644 index 0000000000..089fc52af1 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5452MavenBuildTimestampUTCTest.java @@ -0,0 +1,56 @@ +package org.apache.maven.it; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.List; +import java.util.Properties; + +import org.apache.maven.it.util.ResourceExtractor; + +/** + * This is a test set for MNG-4091 + * Make sure that the maven.build.timestamp is in UTC. + */ +public class MavenITmng5452MavenBuildTimestampUTCTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng5452MavenBuildTimestampUTCTest() + { + super( "[3.2.2-SNAPSHOT,)" ); + } + + public void testMavenBuildTimestampIsUsingUTC() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5452-maven-build-timestamp-utc" ); + + Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + verifier.executeGoal( "process-resources" ); + // + // We have a timestamp format = yyyyMMdd:HHmm:z, where the final element is the timezone which should be UTC + // + Properties filteredProperties = verifier.loadProperties( "target/classes/filtered.properties" ); + String timestamp = filteredProperties.getProperty( "timestamp" ); + assertNotNull( timestamp ); + assertTrue( timestamp.endsWith( "UTC" ) ); + } +} diff --git a/its/core-it-suite/src/test/resources/mng-5452-maven-build-timestamp-utc/pom.xml b/its/core-it-suite/src/test/resources/mng-5452-maven-build-timestamp-utc/pom.xml new file mode 100644 index 0000000000..dff880207b --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5452-maven-build-timestamp-utc/pom.xml @@ -0,0 +1,18 @@ + + 4.0.0 + scratch + scratch + 0.0.1-SNAPSHOT + + ${maven.build.timestamp} + yyyyMMdd:HHmm:z + + + + + src/main/resources + true + + + + \ No newline at end of file diff --git a/its/core-it-suite/src/test/resources/mng-5452-maven-build-timestamp-utc/src/main/resources/filtered.properties b/its/core-it-suite/src/test/resources/mng-5452-maven-build-timestamp-utc/src/main/resources/filtered.properties new file mode 100644 index 0000000000..d1c1df1d5b --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5452-maven-build-timestamp-utc/src/main/resources/filtered.properties @@ -0,0 +1 @@ +timestamp=${timestamp}