From 1b5281b1a3e82a130ac59c75613dc1fdb2307887 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Sun, 31 Jan 2010 00:23:31 +0000 Subject: [PATCH] [MNG-4464] Improve handling of relative paths with backslashes o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@904928 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/it/IntegrationTestSuite.java | 1 + ...4PlatformIndependentFileSeparatorTest.java | 76 ++++++++++++++++ .../resources/mng-4464/aggregator/pom.xml | 48 ++++++++++ .../test/resources/mng-4464/parent/pom.xml | 35 ++++++++ .../src/test/resources/mng-4464/sub/pom.xml | 90 +++++++++++++++++++ 5 files changed, 250 insertions(+) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4464PlatformIndependentFileSeparatorTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-4464/aggregator/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-4464/parent/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-4464/sub/pom.xml diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java index 9488070d69..ef5595ec3e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java @@ -99,6 +99,7 @@ public class IntegrationTestSuite suite.addTestSuite( MavenITmng4470AuthenticatedDeploymentToProxyTest.class ); suite.addTestSuite( MavenITmng4469AuthenticatedDeploymentToCustomRepoTest.class ); suite.addTestSuite( MavenITmng4465PluginPrefixFromLocalCacheOfDownRepoTest.class ); + suite.addTestSuite( MavenITmng4464PlatformIndependentFileSeparatorTest.class ); suite.addTestSuite( MavenITmng4461ArtifactUploadMonitorTest.class ); suite.addTestSuite( MavenITmng4459InMemorySettingsKeptEncryptedTest.class ); suite.addTestSuite( MavenITmng4453PluginVersionFromLifecycleMappingTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4464PlatformIndependentFileSeparatorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4464PlatformIndependentFileSeparatorTest.java new file mode 100644 index 0000000000..6693e2d5d9 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4464PlatformIndependentFileSeparatorTest.java @@ -0,0 +1,76 @@ +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 MNG-4464. + * + * @author Benjamin Bentmann + */ +public class MavenITmng4464PlatformIndependentFileSeparatorTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng4464PlatformIndependentFileSeparatorTest() + { + super( "[3.0-alpha-7,)" ); + } + + /** + * Test that Maven recognizes both the forward and the backward slash as file separators, regardless of the + * underlying filesystem (i.e. even on Unix). + */ + public void testit() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4464" ); + + Verifier verifier = new Verifier( new File( testDir, "aggregator" ).getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "../sub/target" ); + verifier.deleteArtifacts( "org.apache.maven.its.mng4464" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + verifier.assertFilePresent( "../sub/target/path.properties" ); + Properties props = verifier.loadProperties( "../sub/target/path.properties" ); + assertPath( props, "project.build.resources.0.directory", "src/main/res" ); + assertPath( props, "project.build.testResources.0.directory", "src/test/res" ); + assertPath( props, "project.build.sourceDirectory", "src/main/j" ); + assertPath( props, "project.build.testSourceDirectory", "src/test/j" ); + assertPath( props, "project.build.directory", "target/it" ); + assertPath( props, "project.build.outputDirectory", "target/it/classes" ); + assertPath( props, "project.build.testOutputDirectory", "target/it/test-classes" ); + } + + private void assertPath( Properties props, String key, String path ) + { + String actual = props.getProperty( key, "" ); + assertTrue( actual, actual.endsWith( path.replace( '/', File.separatorChar ) ) ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-4464/aggregator/pom.xml b/its/core-it-suite/src/test/resources/mng-4464/aggregator/pom.xml new file mode 100644 index 0000000000..86fbfe996f --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4464/aggregator/pom.xml @@ -0,0 +1,48 @@ + + + + + + 4.0.0 + + + org.apache.maven.its.mng4464 + parent + 0.1 + + ..\parent + + + org.apache.maven.its.mng4464 + aggregator + 0.1 + pom + + Maven Integration Test :: MNG-4464 :: Aggregator + + Test that Maven recognizes both the forward and the backward slash as file separators, regardless of the + underlying filesystem (i.e. even on Unix). + + + + + ..\sub + + diff --git a/its/core-it-suite/src/test/resources/mng-4464/parent/pom.xml b/its/core-it-suite/src/test/resources/mng-4464/parent/pom.xml new file mode 100644 index 0000000000..fd505efdf0 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4464/parent/pom.xml @@ -0,0 +1,35 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4464 + parent + 0.1 + pom + + Maven Integration Test :: MNG-4464 + + Test that Maven recognizes both the forward and the backward slash as file separators, regardless of the + underlying filesystem (i.e. even on Unix). + + diff --git a/its/core-it-suite/src/test/resources/mng-4464/sub/pom.xml b/its/core-it-suite/src/test/resources/mng-4464/sub/pom.xml new file mode 100644 index 0000000000..b0cd17584b --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4464/sub/pom.xml @@ -0,0 +1,90 @@ + + + + + + 4.0.0 + + + org.apache.maven.its.mng4464 + parent + 0.1 + ../parent + + + org.apache.maven.its.mng4464 + sub + 0.1 + pom + + Maven Integration Test :: MNG-4464 :: Sub + + Test that Maven recognizes both the forward and the backward slash as file separators, regardless of the + underlying filesystem (i.e. even on Unix). + + + + + src\main\j + src\test\j + target\it + target\it\classes + target\it\test-classes + + + src\main\res + + + + + src\test\res + + + + + + org.apache.maven.its.plugins + maven-it-plugin-expression + 2.1-SNAPSHOT + + + validate + + eval + + + + target\path.properties + + project/build/sourceDirectory + project/build/testSourceDirectory + project/build/directory + project/build/outputDirectory + project/build/testOutputDirectory + project/build/resources/0/directory + project/build/testResources/0/directory + + + + + + + +