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 2009/01/30 21:01:36 UTC

svn commit: r739397 - in /maven/core-integration-testing/trunk/core-it-suite/src/test: java/org/apache/maven/it/IntegrationTestSuite.java java/org/apache/maven/it/MavenITmng3951AbsolutePathsTest.java resources/mng-3951/ resources/mng-3951/pom.xml

Author: bentmann
Date: Fri Jan 30 20:01:36 2009
New Revision: 739397

URL: http://svn.apache.org/viewvc?rev=739397&view=rev
Log:
[MNG-3951] Hide drive-relative paths from plugins

o Added IT

Added:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3951AbsolutePathsTest.java   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3951/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3951/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=739397&r1=739396&r2=739397&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 Jan 30 20:01:36 2009
@@ -102,6 +102,7 @@
         suite.addTestSuite( MavenITmng3970DepResolutionFromProfileReposTest.class );
         suite.addTestSuite( MavenITmng3955EffectiveSettingsTest.class );
         suite.addTestSuite( MavenITmng3953AuthenticatedDeploymentTest.class );
+        suite.addTestSuite( MavenITmng3951AbsolutePathsTest.class );
         suite.addTestSuite( MavenITmng3948ParentResolutionFromProfileReposTest.class );
         suite.addTestSuite( MavenITmng3947PluginDefaultExecutionConfigTest.class );
         suite.addTestSuite( MavenITmng3944BasedirInterpolationTest.class );

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3951AbsolutePathsTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3951AbsolutePathsTest.java?rev=739397&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3951AbsolutePathsTest.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3951AbsolutePathsTest.java Fri Jan 30 20:01:36 2009
@@ -0,0 +1,84 @@
+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-3951">MNG-3951</a>.
+ * 
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public class MavenITmng3951AbsolutePathsTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng3951AbsolutePathsTest()
+    {
+        super( "(2.0.10,2.1.0-M1),(2.1.0-M1,)" );
+    }
+
+    /**
+     * Test that the paths retrieved from the core are always absolute, in particular the drive-relative paths on
+     * Windows must be properly resolved.
+     */
+    public void testitMNG3951()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3951" );
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+
+        /*
+         * Cut off anything before the first file separator from the local repo path. This is harmless on a Unix-like
+         * filesystem but will make the path drive-relative on Windows so we can check how Maven handles it.
+         */
+        String repoDir = new File( verifier.localRepo ).getAbsolutePath();
+        verifier.setLocalRepo( repoDir.substring( repoDir.indexOf( File.separator ) ) );
+
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
+        verifier.executeGoal( "validate" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+
+        verifier.assertFilePresent( "target/path.properties" );
+        Properties props = verifier.loadProperties( "target/path.properties" );
+        assertEquals( new File( testDir, "tmp" ).getAbsolutePath(), props.getProperty( "fileParams.0" ) );
+        assertEquals( new File( getRoot( testDir ), "tmp" ).getAbsolutePath(), props.getProperty( "fileParams.1" ) );
+        assertEquals( repoDir, props.getProperty( "stringParams.0" ) );
+    }
+
+    private static File getRoot( File path )
+    {
+        File root = path;
+        for ( File dir = path; dir != null; dir = dir.getParentFile() )
+        {
+            root = dir;
+        }
+        return root;
+    }
+
+}

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

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

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3951/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3951/pom.xml?rev=739397&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3951/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3951/pom.xml Fri Jan 30 20:01:36 2009
@@ -0,0 +1,67 @@
+<?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.mng3951</groupId>
+  <artifactId>test</artifactId>
+  <version>0.1</version>
+
+  <name>Maven Integration Test :: MNG-3951</name> 
+  <description>
+    Test that the paths retrieved from the core are always absolute, in particular the drive-relative paths on
+    Windows must be properly resolved.
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-configuration</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <configuration>
+          <propertiesFile>target/path.properties</propertiesFile>
+          <stringParams>
+            <!-- test raw path/string values -->
+            <stringParam>${settings.localRepository}</stringParam>
+            <stringParam>${maven.home}</stringParam>
+          </stringParams>
+          <fileParams>
+            <!-- test translation of project-relative paths -->
+            <fileParam>tmp</fileParam>
+            <!-- test translation of absolute (*nix) or drive-relative (Windows) paths -->
+            <fileParam>/tmp</fileParam>
+          </fileParams>
+        </configuration>
+        <executions>
+          <execution>
+            <id>test</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>config</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

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

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