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 e42d58e10e..08e75ee23e 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 @@ -90,6 +90,7 @@ public class IntegrationTestSuite // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class ); // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng4007PlatformFileSeparatorTest.class ); suite.addTestSuite( MavenITmng4000MultiPluginExecutionsTest.class ); suite.addTestSuite( MavenITmng3998PluginExecutionConfigTest.class ); suite.addTestSuite( MavenITmng3983PluginResolutionFromProfileReposTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4007PlatformFileSeparatorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4007PlatformFileSeparatorTest.java new file mode 100644 index 0000000000..c5d961e3c4 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4007PlatformFileSeparatorTest.java @@ -0,0 +1,98 @@ +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-4007. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +public class MavenITmng4007PlatformFileSeparatorTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng4007PlatformFileSeparatorTest() + { + super(); + } + + /** + * Verify that paths to project directories use the platform-specific file separator. + */ + public void testitMNG4007() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4007" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + Properties modelProps = verifier.loadProperties( "target/model.properties" ); + + assertPath( modelProps.getProperty( "project.build.directory" ) ); + + assertPath( modelProps.getProperty( "project.build.outputDirectory" ) ); + + assertPath( modelProps.getProperty( "project.build.testOutputDirectory" ) ); + + assertPath( modelProps.getProperty( "project.build.sourceDirectory" ) ); + assertPath( modelProps.getProperty( "project.compileSourceRoots.0" ) ); + + assertPath( modelProps.getProperty( "project.build.testSourceDirectory" ) ); + assertPath( modelProps.getProperty( "project.testCompileSourceRoots.0" ) ); + + assertPath( modelProps.getProperty( "project.build.resources.0.directory" ) ); + + assertPath( modelProps.getProperty( "project.build.testResources.0.directory" ) ); + + assertPath( modelProps.getProperty( "project.build.filters.0" ) ); + + /* + * NOTE: The script source directory is deliberately excluded from the checks due to MNG-3741. + */ + + // FIXME: MNG-3877 + if ( matchesVersionRange( "(4,)" ) ) + { + assertPath( modelProps.getProperty( "project.reporting.outputDirectory" ) ); + } + } + + private void assertPath( String actual ) + { + /* + * NOTE: Whether the path is absolute is another issue (MNG-3877), we are only interested in the proper + * file separator here. + */ + assertEquals( new File( actual ).getPath(), actual ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-4007/pom.xml b/its/core-it-suite/src/test/resources/mng-4007/pom.xml new file mode 100644 index 0000000000..f21fce12b1 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4007/pom.xml @@ -0,0 +1,75 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3877 + test + 1.0 + jar + + Maven Integration Test :: MNG-3877 + + Verify that paths to project directories use the platform-specific file separator. + + + + + src/main/filters/it.properties + + + + + org.apache.maven.its.plugins + maven-it-plugin-expression + 2.1-SNAPSHOT + + target/model.properties + + project/build/directory + project/build/outputDirectory + project/build/testOutputDirectory + project/build/sourceDirectory + project/build/testSourceDirectory + project/build/scriptSourceDirectory + project/build/resources/0/directory + project/build/testResources/0/directory + project/build/filters/0 + project/reporting/outputDirectory + project/compileSourceRoots + project/testCompileSourceRoots + project/scriptSourceRoots + + + + + effective-model + validate + + eval + + + + + + +