You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2014/06/16 02:20:56 UTC
git commit: Disable old timestamp test and create a new one for
3.2.2+ which is UTC and ISO conformant.
Repository: maven-integration-testing
Updated Branches:
refs/heads/master 184a469a6 -> 8b1812df2
Disable old timestamp test and create a new one for 3.2.2+ which is UTC and ISO conformant.
Project: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/commit/8b1812df
Tree: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/tree/8b1812df
Diff: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/diff/8b1812df
Branch: refs/heads/master
Commit: 8b1812df24d0f345bf78994b8631e6de2f91aefd
Parents: 184a469
Author: Jason van Zyl <ja...@tesla.io>
Authored: Sun Jun 15 20:20:09 2014 -0400
Committer: Jason van Zyl <ja...@tesla.io>
Committed: Sun Jun 15 20:20:09 2014 -0400
----------------------------------------------------------------------
.../apache/maven/it/IntegrationTestSuite.java | 3 +-
.../it/MavenITmng2562Timestamp322Test.java | 122 +++++++++++++++++++
.../maven/it/MavenITmng2562TimestampTest.java | 2 +-
3 files changed, 125 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/8b1812df/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
index ff18112..a7e6cc8 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
@@ -105,7 +105,8 @@ public class IntegrationTestSuite
// Tests that don't run stable and need to be fixed
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
-
+
+ suite.addTestSuite( MavenITmng2562Timestamp322Test.class );
suite.addTestSuite( MavenITmng2199ParentVersionRangeTest.class );
suite.addTestSuite( MavenITmng5640LifecycleParticipantAfterSessionEnd.class );
suite.addTestSuite( MavenITmng5639ImportScopePomResolutionTest.class );
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/8b1812df/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2562Timestamp322Test.java
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2562Timestamp322Test.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2562Timestamp322Test.java
new file mode 100644
index 0000000..dce74a4
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2562Timestamp322Test.java
@@ -0,0 +1,122 @@
+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 org.apache.maven.it.util.ResourceExtractor;
+import org.apache.maven.it.Verifier;
+
+import java.io.File;
+import java.util.Date;
+import java.util.Properties;
+import java.text.SimpleDateFormat;
+
+/**
+ * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-2562">MNG-2562</a>.
+ *
+ * @version $Id$
+ */
+public class MavenITmng2562Timestamp322Test
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng2562Timestamp322Test()
+ {
+ super( "[3.2.2-SNAPSHOT,)" ); // 3.2.2+ only as we changed the timestamp format
+ }
+
+ public void testitDefaultFormat()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2562/default" );
+
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "target" );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ Date now = new Date();
+
+ Properties props = verifier.loadProperties( "target/pom.properties" );
+
+ String timestamp1 = props.getProperty( "project.properties.timestamp1", "" );
+ assertTrue( timestamp1, timestamp1.matches( "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z" ) );
+ Date date = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss'Z'" ).parse( timestamp1 );
+ assertTrue( now + " vs " + date, Math.abs( now.getTime() - date.getTime() ) < 24 * 60 * 60 * 1000 );
+
+ String timestamp2 = props.getProperty( "project.properties.timestamp2", "" );
+ assertEquals( timestamp1, timestamp2 );
+ }
+
+ public void testitCustomFormat()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2562/custom" );
+
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "target" );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ Date now = new Date();
+
+ Properties props = verifier.loadProperties( "target/pom.properties" );
+
+ String timestamp1 = props.getProperty( "project.properties.timestamp", "" );
+ Date date = new SimpleDateFormat( "mm:HH dd-MM-yyyy" ).parse( timestamp1 );
+ assertTrue( now + " vs " + date, Math.abs( now.getTime() - date.getTime() ) < 24 * 60 * 60 * 1000 );
+ }
+
+ public void testitSameValueAcrossModules()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2562/reactor" );
+
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "target" );
+ verifier.deleteDirectory( "child-1/target" );
+ verifier.deleteDirectory( "child-2/target" );
+ verifier.deleteDirectory( "child-3/target" );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ Properties props = verifier.loadProperties( "target/pom.properties" );
+ String timestamp = props.getProperty( "project.properties.timestamp", "" );
+
+ Properties props1 = verifier.loadProperties( "child-1/target/pom.properties" );
+ String timestamp1 = props1.getProperty( "project.properties.timestamp", "" );
+
+ Properties props2 = verifier.loadProperties( "child-2/target/pom.properties" );
+ String timestamp2 = props2.getProperty( "project.properties.timestamp", "" );
+
+ Properties props3 = verifier.loadProperties( "child-3/target/pom.properties" );
+ String timestamp3 = props3.getProperty( "project.properties.timestamp", "" );
+
+ assertEquals( timestamp, timestamp1 );
+ assertEquals( timestamp, timestamp2 );
+ assertEquals( timestamp, timestamp3 );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/8b1812df/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2562TimestampTest.java
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2562TimestampTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2562TimestampTest.java
index bec8c8c..afbab57 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2562TimestampTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2562TimestampTest.java
@@ -38,7 +38,7 @@ public class MavenITmng2562TimestampTest
public MavenITmng2562TimestampTest()
{
- super( "[2.1.0-M1,)" ); // 2.1.0+ only
+ super( "[2.1.0-M1,3.2.2)" ); // 2.1.0+ only
}
public void testitDefaultFormat()