Author: pgier
Date: Sun Jul 17 13:18:31 2011
New Revision: 1147598

URL: http://svn.apache.org/viewvc?rev=1147598&view=rev
Log:
[MNG-4112] Add test for new properties "maven.version" and "maven.build.version"

Added:
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4112MavenVersionPropertyTest.java
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4112/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4112/pom.xml
   (with props)
Modified:
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java

Modified: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java?rev=1147598&r1=1147597&r2=1147598&view=diff
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
 (original)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
 Sun Jul 17 13:18:31 2011
@@ -276,6 +276,7 @@ public class IntegrationTestSuite
         suite.addTestSuite( MavenITmng4129PluginExecutionInheritanceTest.class 
);
         suite.addTestSuite( MavenITmng4126ParentProfilesXmlTest.class );
         suite.addTestSuite( MavenITmng4116UndecodedUrlsTest.class );
+        suite.addTestSuite( MavenITmng4112MavenVersionPropertyTest.class );
         suite.addTestSuite( 
MavenITmng4107InterpolationUsesDominantProfileSourceTest.class );
         suite.addTestSuite( 
MavenITmng4106InterpolationUsesDominantProfileTest.class );
         suite.addTestSuite( 
MavenITmng4102InheritedPropertyInterpolationTest.class );

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4112MavenVersionPropertyTest.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4112MavenVersionPropertyTest.java?rev=1147598&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4112MavenVersionPropertyTest.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4112MavenVersionPropertyTest.java
 Sun Jul 17 13:18:31 2011
@@ -0,0 +1,61 @@
+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.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+import java.io.FileReader;
+import java.util.Properties;
+
+public class MavenITmng4112MavenVersionPropertyTest
+    extends AbstractMavenIntegrationTestCase
+{
+    public MavenITmng4112MavenVersionPropertyTest()
+    {
+        super( "(3.0.3,)" );
+    }
+
+    /**
+     * Test simple POM interpolation
+     */
+    public void testitMNG4112()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-4112" );
+        Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
+        verifier.executeGoal( "package" );
+
+        Properties props = verifier.loadProperties( "target/build.properties" 
);
+
+        String testMavenVersion = props.getProperty( "maven.version" );
+        assertFalse( testMavenVersion.contains( "$" ) );
+
+        String testMavenBuildVersion = props.getProperty( 
"maven.build.version" );
+        assertTrue( testMavenBuildVersion.contains( testMavenVersion ) );
+
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+    }
+
+}

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4112MavenVersionPropertyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4112MavenVersionPropertyTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4112/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4112/pom.xml?rev=1147598&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4112/pom.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4112/pom.xml
 Sun Jul 17 13:18:31 2011
@@ -0,0 +1,35 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <name>Maven Integration Test :: MNG-4112</name> 
+  <groupId>org.apache.maven.its.mgn4112</groupId>
+  <artifactId>maven-it-mng4112</artifactId>
+  <description>Test for ${maven.version} property</description>
+  <packaging>pom</packaging>
+  <version>1.0</version>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <tasks>
+                <mkdir dir="${project.build.directory}"/>
+                <echo file="${project.build.directory}/build.properties"
+                      message="maven.version = 
${maven.version}${line.separator}"/>
+                <echo file="${project.build.directory}/build.properties"
+                      append="true"
+                      message="maven.build.version = 
${maven.build.version}${line.separator}"/>
+              </tasks>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4112/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4112/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision


Reply via email to