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/12/26 16:44:29 UTC
svn commit: r729502 - in /maven/components/trunk/maven-project/src/test:
java/org/apache/maven/project/builder/ java/org/apache/maven/project/harness/
resources-project-builder/nested-build-dir-interpolation/
Author: bentmann
Date: Fri Dec 26 07:44:29 2008
New Revision: 729502
URL: http://svn.apache.org/viewvc?rev=729502&view=rev
Log:
o Created UT from MNG-3904
Added:
maven/components/trunk/maven-project/src/test/resources-project-builder/nested-build-dir-interpolation/ (with props)
maven/components/trunk/maven-project/src/test/resources-project-builder/nested-build-dir-interpolation/pom.xml (with props)
Modified:
maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java
maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java
Modified: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java?rev=729502&r1=729501&r2=729502&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java (original)
+++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java Fri Dec 26 07:44:29 2008
@@ -290,6 +290,18 @@
}
//*/
+ public void testInterpolationOfNestedBuildDirectories()
+ throws Exception
+ {
+ PomTestWrapper pom = buildPom( "nested-build-dir-interpolation" );
+ assertEquals( new File( pom.getBasedir(), "target/classes/dir0" ),
+ new File( (String) pom.getValue( "properties/dir0" ) ) );
+ assertEquals( new File( pom.getBasedir(), "src/test/dir1" ),
+ new File( (String) pom.getValue( "properties/dir1" ) ) );
+ assertEquals( new File( pom.getBasedir(), "target/site/dir2" ),
+ new File( (String) pom.getValue( "properties/dir2" ) ) );
+ }
+
private PomArtifactResolver artifactResolver( String basedir )
{
return new FileBasedPomArtifactResolver( new File( BASE_POM_DIR, basedir ) );
@@ -303,7 +315,7 @@
{
pomFile = new File( pomFile, "pom.xml" );
}
- return new PomTestWrapper( projectBuilder.buildModel( pomFile, null, pomArtifactResolver ) );
+ return new PomTestWrapper( pomFile, projectBuilder.buildModel( pomFile, null, pomArtifactResolver ) );
}
protected void assertModelEquals( PomTestWrapper pom, Object expected, String expression )
Modified: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java?rev=729502&r1=729501&r2=729502&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java (original)
+++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/harness/PomTestWrapper.java Fri Dec 26 07:44:29 2008
@@ -36,16 +36,25 @@
private PomClassicDomainModel domainModel;
+ private File pomFile;
+
private JXPathContext context;
public PomTestWrapper( PomClassicDomainModel domainModel )
throws IOException
{
+ this( null, domainModel );
+ }
+
+ public PomTestWrapper( File pomFile, PomClassicDomainModel domainModel )
+ throws IOException
+ {
if ( domainModel == null )
{
throw new IllegalArgumentException( "domainModel: null" );
}
this.domainModel = domainModel;
+ this.pomFile = pomFile;
context = JXPathContext.newContext( domainModel.getModel() );
}
@@ -78,6 +87,11 @@
return this.domainModel;
}
+ public File getBasedir()
+ {
+ return ( pomFile != null ) ? pomFile.getParentFile() : null;
+ }
+
public String getValueOfProjectUri( String projectUri, boolean withResolvedValue )
throws IOException
{
Propchange: maven/components/trunk/maven-project/src/test/resources-project-builder/nested-build-dir-interpolation/
------------------------------------------------------------------------------
bugtraq:label = Enter issue ID:
Propchange: maven/components/trunk/maven-project/src/test/resources-project-builder/nested-build-dir-interpolation/
------------------------------------------------------------------------------
bugtraq:message = Issue id: %BUGID%
Propchange: maven/components/trunk/maven-project/src/test/resources-project-builder/nested-build-dir-interpolation/
------------------------------------------------------------------------------
bugtraq:number = false
Propchange: maven/components/trunk/maven-project/src/test/resources-project-builder/nested-build-dir-interpolation/
------------------------------------------------------------------------------
bugtraq:url = http://jira.codehaus.org/browse/%BUGID%
Added: maven/components/trunk/maven-project/src/test/resources-project-builder/nested-build-dir-interpolation/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/resources-project-builder/nested-build-dir-interpolation/pom.xml?rev=729502&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/test/resources-project-builder/nested-build-dir-interpolation/pom.xml (added)
+++ maven/components/trunk/maven-project/src/test/resources-project-builder/nested-build-dir-interpolation/pom.xml Fri Dec 26 07:44:29 2008
@@ -0,0 +1,55 @@
+<?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.mng3904</groupId>
+ <artifactId>test</artifactId>
+ <version>0.1</version>
+ <packaging>jar</packaging>
+
+ <name>Maven Integration Test :: MNG-3904</name>
+ <description>
+ Test that properties which refer to build directories which in turn refer to other build directories are
+ properly interpolated.
+ </description>
+
+ <properties>
+ <!-- These are the properties of interest -->
+ <dir0>${project.build.outputDirectory}/dir0</dir0>
+ <dir1>${project.build.testSourceDirectory}/dir1</dir1>
+ <dir2>${project.reporting.outputDirectory}/dir2</dir2>
+ </properties>
+
+ <build>
+ <!-- Test properties which finally refer to ${project.basedir} -->
+ <directory>${project.basedir}/target</directory>
+ <outputDirectory>${project.build.directory}/classes</outputDirectory>
+ <!-- Test properties which finally refer to ${basedir} -->
+ <sourceDirectory>${basedir}/src</sourceDirectory>
+ <testSourceDirectory>${project.build.sourceDirectory}/test</testSourceDirectory>
+ </build>
+
+ <reporting>
+ <outputDirectory>${project.build.directory}/site</outputDirectory>
+ </reporting>
+</project>
Propchange: maven/components/trunk/maven-project/src/test/resources-project-builder/nested-build-dir-interpolation/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-project/src/test/resources-project-builder/nested-build-dir-interpolation/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision