blob: d6fc35f500fe13cca5cea55c32567351309f782e [file] [log] [blame]
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="https://issues.apache.org/jira/browse/MNG-3133">MNG-3133</a>.
*
* @author Benjamin Bentmann
*/
public class MavenITmng3133UrlNormalizationNotBeforeInterpolationTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng3133UrlNormalizationNotBeforeInterpolationTest()
{
super( "[3.0-beta-1,)" );
}
/**
* Verify that URL normalization does not happen before interpolation which would result in invalid
* inherited URLs for project layouts where the parent resides in a sibling directory of the child
* and expressions are used for the parent URLs ("${expression}/../foo" -> "foo").
*/
public void testit()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3133" );
Verifier verifier = newVerifier( new File( testDir, "child" ).getAbsolutePath() );
verifier.setAutoclean( false );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
Properties props = verifier.loadProperties( "target/url.properties" );
String url;
url = props.getProperty( "project.url" );
assertEquals( "http://server.org/child", url );
url = props.getProperty( "project.scm.url" );
assertEquals( "scm:svn:https://svn.org/child", url );
url = props.getProperty( "project.scm.connection" );
assertEquals( "scm:svn:https://svn.org/child", url );
url = props.getProperty( "project.scm.developerConnection" );
assertEquals( "scm:svn:https://svn.org/child", url );
url = props.getProperty( "project.distributionManagement.site.url" );
assertEquals( "dav://server.org/child", url );
url = props.getProperty( "project.properties.projectUrl" );
assertEquals( "http://server.org/child/it", url );
url = props.getProperty( "project.properties.projectScmUrl" );
assertEquals( "scm:svn:https://svn.org/child/it", url );
url = props.getProperty( "project.properties.projectScmConn" );
assertEquals( "scm:svn:https://svn.org/child/it", url );
url = props.getProperty( "project.properties.projectScmDevConn" );
assertEquals( "scm:svn:https://svn.org/child/it", url );
url = props.getProperty( "project.properties.projectDistSiteUrl" );
assertEquals( "dav://server.org/child/it", url );
}
}