From 5233029d4e420f7c58da29e5edb3af9038a2843b Mon Sep 17 00:00:00 2001 From: Britton Isbell Date: Mon, 30 Mar 2009 23:07:33 +0000 Subject: [PATCH] Test for setting profile properties. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@760229 13f79535-47bb-0310-9956-ffa450edef68 --- .../settings/PomConstructionWithSettingsTest.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java b/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java index d86b9123bb..8b239ab96d 100644 --- a/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java +++ b/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java @@ -3,6 +3,7 @@ package org.apache.maven.settings; import java.io.File; import java.io.IOException; import java.io.Reader; +import java.util.List; import org.apache.maven.artifact.repository.DefaultArtifactRepository; import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; @@ -39,10 +40,10 @@ public class PomConstructionWithSettingsTest mavenProjectBuilder = (DefaultMavenProjectBuilder) lookup( MavenProjectBuilder.class ); } - public void testA() throws Exception + public void testSettingsNoPom() throws Exception { PomTestWrapper pom = buildPom( "settings-no-pom" ); - System.out.println(pom.getDomainModel().asString()); + assertEquals( "local-profile-prop-value", pom.getValue( "properties/local-profile-prop" ) ); } private PomTestWrapper buildPom( String pomPath ) @@ -62,6 +63,16 @@ public class PomConstructionWithSettingsTest profileManager.addProfile( profile ); } + + List settingsActiveProfileIds = settings.getActiveProfiles(); + + if ( settingsActiveProfileIds != null ) + { + for ( String profileId : settingsActiveProfileIds ) + { + profileManager.getProfileActivationContext().setActive( profileId ); + } + } ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration(); config.setLocalRepository(new DefaultArtifactRepository("default", "", new DefaultRepositoryLayout()));