o Added UT to exhibit properties inheritance issue

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@757260 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-03-22 21:30:37 +00:00
parent 7d4a6c3ca7
commit 76f692cc5e
6 changed files with 91 additions and 5 deletions

View File

@ -373,7 +373,7 @@ public class DefaultMavenProjectBuilder
private Model inject( Profile profile, Model model ) throws IOException
{
return ProcessorContext.mergeProfileIntoModel( Arrays.asList(profile), model, false ).getModel();
return ProcessorContext.mergeProfilesIntoModel( Arrays.asList(profile), model, false ).getModel();
}
private MavenProject readModelFromLocalPath( String projectId, File pomFile, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories, ProjectBuilderConfiguration config )
@ -531,7 +531,7 @@ public class DefaultMavenProjectBuilder
{
ProfileContext profileContext1 = new ProfileContext( dm.getModel().getProfiles(), activeProfileIds,
inactiveProfileIds, properties );
profileModels.add(ProcessorContext.mergeProfileIntoModel( profileContext1.getActiveProfiles(), dm.getModel(),
profileModels.add(ProcessorContext.mergeProfilesIntoModel( profileContext1.getActiveProfiles(), dm.getModel(),
dm.isMostSpecialized() ));
}
else

View File

@ -71,7 +71,7 @@ public class ProcessorContext
ProjectUri.Build.Filters.filter,
ProjectUri.Reporting.outputDirectory ) ) );
public static PomClassicDomainModel mergeProfileIntoModel(Collection<Profile> profiles, Model model, boolean isMostSpecialized) throws IOException
public static PomClassicDomainModel mergeProfilesIntoModel(Collection<Profile> profiles, Model model, boolean isMostSpecialized) throws IOException
{
List<Model> profileModels = new ArrayList<Model>();
profileModels.add( model );

View File

@ -1180,6 +1180,18 @@ public class PomConstructionTest
}
//*/
/* FIXME
public void testPropertiesInheritance()
throws Exception
{
PomTestWrapper pom = buildPom( "properties-inheritance/sub" );
assertEquals( "parent-property", pom.getValue( "properties/parentProperty" ) );
assertEquals( "child-property", pom.getValue( "properties/childProperty" ) );
assertEquals( "child-override", pom.getValue( "properties/overriddenProperty" ) );
}
//*/
private void assertPathSuffixEquals( String expected, Object actual )
{

View File

@ -43,7 +43,7 @@ public class ProcessorContextTest extends PlexusTestCase
Profile profile = new Profile();
profile.setModules( Arrays.asList( "m1", "m2" ) );
PomClassicDomainModel m = ProcessorContext.mergeProfileIntoModel( Arrays.asList( profile ), model, false );
PomClassicDomainModel m = ProcessorContext.mergeProfilesIntoModel( Arrays.asList( profile ), model, false );
assertEquals(2, m.getModel().getModules().size());
}
@ -77,7 +77,7 @@ public class ProcessorContextTest extends PlexusTestCase
profile.setBuild( b);
PomClassicDomainModel m = ProcessorContext.mergeProfileIntoModel( Arrays.asList( profile ), model, false );
PomClassicDomainModel m = ProcessorContext.mergeProfilesIntoModel( Arrays.asList( profile ), model, false );
assertEquals(1, m.getModel().getBuild().getPluginManagement().getPlugins().size());
}

View File

@ -0,0 +1,34 @@
<?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.mng3843</groupId>
<artifactId>parent-1</artifactId>
<version>0.1</version>
<packaging>pom</packaging>
<properties>
<parentProperty>parent-property</parentProperty>
<overriddenProperty>parent-property</overriddenProperty>
</properties>
</project>

View File

@ -0,0 +1,40 @@
<?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>
<parent>
<groupId>org.apache.maven.its.mng3843</groupId>
<artifactId>parent-1</artifactId>
<version>0.1</version>
</parent>
<groupId>org.apache.maven.its.mng3843.child</groupId>
<artifactId>child-2</artifactId>
<version>0.2</version>
<packaging>jar</packaging>
<properties>
<childProperty>child-property</childProperty>
<overriddenProperty>child-override</overriddenProperty>
</properties>
</project>