You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2008/11/07 19:39:49 UTC

svn commit: r712220 - in /maven/core-integration-testing/trunk/core-it-suite/src/test: java/org/apache/maven/it/ resources/mng-3822/

Author: bentmann
Date: Fri Nov  7 10:39:30 2008
New Revision: 712220

URL: http://svn.apache.org/viewvc?rev=712220&view=rev
Log:
[MNG-3822] POM interpolation does not use basedir-aligned build directories

o Added IT

Added:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3822BasedirAlignedInterpolationTest.java   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3822/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3822/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=712220&r1=712219&r2=712220&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 Fri Nov  7 10:39:30 2008
@@ -88,6 +88,7 @@
         // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
         // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
 
+        suite.addTestSuite( MavenITmng3822BasedirAlignedInterpolationTest.class );
         suite.addTestSuite( MavenITmng3821EqualPluginExecIdsTest.class );
         suite.addTestSuite( MavenITmng3818PluginDepPlexusUtilsTest.class );
         suite.addTestSuite( MavenITmng3813PluginClassPathOrderingTest.class );

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3822BasedirAlignedInterpolationTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3822BasedirAlignedInterpolationTest.java?rev=712220&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3822BasedirAlignedInterpolationTest.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3822BasedirAlignedInterpolationTest.java Fri Nov  7 10:39:30 2008
@@ -0,0 +1,78 @@
+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.util.Properties;
+
+/**
+ * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3822">MNG-3822</a>.
+ * 
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public class MavenITmng3822BasedirAlignedInterpolationTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng3822BasedirAlignedInterpolationTest()
+    {
+        super( "[2.1.0-M1,)");
+    }
+
+    /**
+     * Verify that POM interpolation uses basedir-aligned build directories.
+     */
+    public void testitMNG3822()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3822" );
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
+        verifier.executeGoal( "initialize" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+
+        Properties pomProps = verifier.loadProperties( "target/interpolated.properties" );
+        assertEquals( testDir, "src/main/java", pomProps.getProperty( "project.properties.buildMainSrc" ) );
+        assertEquals( testDir, "src/test/java", pomProps.getProperty( "project.properties.buildTestSrc" ) );
+        assertEquals( testDir, "src/main/scripts", pomProps.getProperty( "project.properties.buildScriptSrc" ) );
+        assertEquals( testDir, "target", pomProps.getProperty( "project.properties.buildOut" ) );
+        assertEquals( testDir, "target/classes", pomProps.getProperty( "project.properties.buildMainOut" ) );
+        assertEquals( testDir, "target/test-classes", pomProps.getProperty( "project.properties.buildTestOut" ) );
+        assertEquals( testDir, "target/site", pomProps.getProperty( "project.properties.siteOut" ) );
+    }
+
+    private void assertEquals( File testDir, String buildDir, String interpolatedPath )
+        throws Exception
+    {
+        File actual = new File( interpolatedPath );
+        File expected = new File( testDir, buildDir );
+
+        assertTrue( actual.isAbsolute() );
+        assertEquals( expected.getCanonicalFile(), actual.getCanonicalFile() );
+    }
+
+}

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

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

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3822/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3822/pom.xml?rev=712220&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3822/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3822/pom.xml Fri Nov  7 10:39:30 2008
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng3822</groupId>
+  <artifactId>test1</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>Maven Integration Test :: MNG-3822</name> 
+  <description>
+    Verify that POM interpolation uses basedir-aligned build directories.
+  </description>
+
+  <properties>
+    <!-- this is where we collect all the interpolated values for the POM dump -->
+    <buildMainSrc>${project.build.sourceDirectory}</buildMainSrc>
+    <buildTestSrc>${project.build.testSourceDirectory}</buildTestSrc>
+    <buildScriptSrc>${project.build.scriptSourceDirectory}</buildScriptSrc>
+    <buildOut>${project.build.directory}</buildOut>
+    <buildMainOut>${project.build.outputDirectory}</buildMainOut>
+    <buildTestOut>${project.build.testOutputDirectory}</buildTestOut>
+    <siteOut>${project.reporting.outputDirectory}</siteOut>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-expression</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <phase>initialize</phase>
+            <goals>
+              <goal>eval</goal>
+            </goals>
+            <configuration>
+              <outputFile>target/interpolated.properties</outputFile>
+              <expressions>
+                <expression>project/properties</expression>
+              </expressions>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+    <!--
+    NOTE: Deliberately set all build directories to relative paths to ensure they really need basedir alignment.
+    -->
+    <sourceDirectory>src/main/java</sourceDirectory>
+    <testSourceDirectory>src/test/java</testSourceDirectory>
+    <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
+    <directory>target</directory>
+    <outputDirectory>target/classes</outputDirectory>
+    <testOutputDirectory>target/test-classes</testOutputDirectory>
+  </build>
+
+  <reporting>
+    <outputDirectory>target/site</outputDirectory>
+  </reporting>
+</project>

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

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