Author: fbricon
Date: 2012-08-21 08:56:34 -0400 (Tue, 21 Aug 2012)
New Revision: 43129
Added:
trunk/maven/tests/org.jboss.tools.maven.profiles.test/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/.classpath
trunk/maven/tests/org.jboss.tools.maven.profiles.test/.project
trunk/maven/tests/org.jboss.tools.maven.profiles.test/.settings/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/.settings/org.eclipse.jdt.core.prefs
trunk/maven/tests/org.jboss.tools.maven.profiles.test/.settings/org.eclipse.m2e.core.prefs
trunk/maven/tests/org.jboss.tools.maven.profiles.test/META-INF/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/META-INF/MANIFEST.MF
trunk/maven/tests/org.jboss.tools.maven.profiles.test/build.properties
trunk/maven/tests/org.jboss.tools.maven.profiles.test/plugin_customization.ini
trunk/maven/tests/org.jboss.tools.maven.profiles.test/pom.xml
trunk/maven/tests/org.jboss.tools.maven.profiles.test/projects/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/projects/12442/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/projects/12442/pom.xml
trunk/maven/tests/org.jboss.tools.maven.profiles.test/settings.xml
trunk/maven/tests/org.jboss.tools.maven.profiles.test/src/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/src/org/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/src/org/jboss/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/src/org/jboss/tools/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/src/org/jboss/tools/maven/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/src/org/jboss/tools/maven/profiles/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/src/org/jboss/tools/maven/profiles/tests/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/src/org/jboss/tools/maven/profiles/tests/AbstractMavenProfileTest.java
trunk/maven/tests/org.jboss.tools.maven.profiles.test/src/org/jboss/tools/maven/profiles/tests/MavenProfileManagerTest.java
trunk/maven/tests/org.jboss.tools.maven.profiles.test/testrepo/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/testrepo/foo/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/testrepo/foo/bar/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/testrepo/foo/bar/parent-pom/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/testrepo/foo/bar/parent-pom/0.0.1/
trunk/maven/tests/org.jboss.tools.maven.profiles.test/testrepo/foo/bar/parent-pom/0.0.1/parent-pom-0.0.1.pom
Modified:
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/internal/profiles/ProfileManager.java
trunk/maven/tests/pom.xml
Log:
JBIDE-12442 : use project defined repositories to resolve parent hierarchy
Modified:
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/internal/profiles/ProfileManager.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/internal/profiles/ProfileManager.java 2012-08-21
10:54:10 UTC (rev 43128)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/internal/profiles/ProfileManager.java 2012-08-21
12:56:34 UTC (rev 43129)
@@ -12,13 +12,17 @@
import java.util.Set;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.Model;
import org.apache.maven.model.Parent;
import org.apache.maven.model.Profile;
+import org.apache.maven.model.Repository;
import org.apache.maven.project.MavenProject;
+import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.settings.Settings;
import org.apache.maven.settings.SettingsUtils;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.util.StringUtils;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
@@ -26,11 +30,14 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.embedder.IMaven;
+import org.eclipse.m2e.core.internal.MavenPluginActivator;
+import org.eclipse.m2e.core.internal.NoSuchComponentException;
import org.eclipse.m2e.core.project.IMavenProjectFacade;
import org.eclipse.m2e.core.project.IProjectConfigurationManager;
import org.eclipse.m2e.core.project.MavenUpdateRequest;
import org.eclipse.m2e.core.project.ResolverConfiguration;
import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.maven.profiles.core.MavenProfilesCoreActivator;
import org.jboss.tools.maven.profiles.core.profiles.IProfileManager;
import org.jboss.tools.maven.profiles.core.profiles.ProfileState;
import org.jboss.tools.maven.profiles.core.profiles.ProfileStatus;
@@ -235,7 +242,14 @@
models.add(projectModel);
Parent p = projectModel.getParent();
if (p != null) {
- Model parentModel = resolvePomModel(p.getGroupId(), p.getArtifactId(), p.getVersion(),
monitor);
+
+ IMaven maven = MavenPlugin.getMaven();
+
+ List<ArtifactRepository> repositories = new
ArrayList<ArtifactRepository>();
+ repositories.addAll(getProjectRepositories(projectModel));
+ repositories.addAll(maven.getArtifactRepositories());
+
+ Model parentModel = resolvePomModel(p.getGroupId(), p.getArtifactId(), p.getVersion(),
repositories, monitor);
if (parentModel != null) {
getModelHierarchy(models, parentModel, monitor);
}
@@ -243,7 +257,35 @@
return models;
}
- private Model resolvePomModel(String groupId, String artifactId, String version,
IProgressMonitor monitor)
+ private List<ArtifactRepository> getProjectRepositories(Model projectModel) {
+ List<ArtifactRepository> repos = new ArrayList<ArtifactRepository>();
+ List<Repository> modelRepos = projectModel.getRepositories();
+ if (modelRepos != null && !modelRepos.isEmpty()) {
+ RepositorySystem repositorySystem = getRepositorySystem();
+ for (Repository modelRepo : modelRepos) {
+ ArtifactRepository ar;
+ try {
+ ar = repositorySystem.buildArtifactRepository(modelRepo);
+ if (ar != null) {
+ repos.add(ar);
+ }
+ } catch (InvalidRepositoryException e) {
+ MavenProfilesCoreActivator.log(e);
+ }
+ }
+ }
+ return repos;
+ }
+
+ private RepositorySystem getRepositorySystem() {
+ try {
+ return
MavenPluginActivator.getDefault().getPlexusContainer().lookup(RepositorySystem.class);
+ } catch (ComponentLookupException e) {
+ throw new NoSuchComponentException(e);
+ }
+ }
+
+ private Model resolvePomModel(String groupId, String artifactId, String version,
List<ArtifactRepository> repositories, IProgressMonitor monitor)
throws CoreException {
monitor.subTask(NLS.bind("Resolving {0}:{1}:{2}", new Object[] { groupId,
artifactId, version}));
@@ -254,7 +296,6 @@
return facade.getMavenProject(monitor).getModel();
}
- List<ArtifactRepository> repositories = maven.getArtifactRepositories();
Artifact artifact = maven.resolve(groupId, artifactId, version, "pom",
null, repositories, monitor); //$NON-NLS-1$
File file = artifact.getFile();
if(file == null) {
Added: trunk/maven/tests/org.jboss.tools.maven.profiles.test/.classpath
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.profiles.test/.classpath
(rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.profiles.test/.classpath 2012-08-21 12:56:34
UTC (rev 43129)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: trunk/maven/tests/org.jboss.tools.maven.profiles.test/.project
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.profiles.test/.project
(rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.profiles.test/.project 2012-08-21 12:56:34 UTC
(rev 43129)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.maven.configurators.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/maven/tests/org.jboss.tools.maven.profiles.test/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.profiles.test/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.profiles.test/.settings/org.eclipse.jdt.core.prefs 2012-08-21
12:56:34 UTC (rev 43129)
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Added:
trunk/maven/tests/org.jboss.tools.maven.profiles.test/.settings/org.eclipse.m2e.core.prefs
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.profiles.test/.settings/org.eclipse.m2e.core.prefs
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.profiles.test/.settings/org.eclipse.m2e.core.prefs 2012-08-21
12:56:34 UTC (rev 43129)
@@ -0,0 +1,5 @@
+#Mon Nov 28 08:59:23 CET 2011
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
Added: trunk/maven/tests/org.jboss.tools.maven.profiles.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.profiles.test/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.profiles.test/META-INF/MANIFEST.MF 2012-08-21
12:56:34 UTC (rev 43129)
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: JBoss Maven Profile Management Tests
+Bundle-SymbolicName: org.jboss.tools.maven.profiles.test;singleton:=true
+Bundle-Version: 1.4.0.qualifier
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.apache.log4j,
+ org.junit4,
+ org.jboss.tools.maven.profiles.core,
+ org.jboss.tools.common,
+ org.jboss.tools.tests,
+ org.eclipse.m2e.launching,
+ org.eclipse.m2e.tests.common,
+ org.eclipse.ui.ide
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Eclipse-RegisterBuddy: org.apache.log4j
+
Added: trunk/maven/tests/org.jboss.tools.maven.profiles.test/build.properties
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.profiles.test/build.properties
(rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.profiles.test/build.properties 2012-08-21
12:56:34 UTC (rev 43129)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/maven/tests/org.jboss.tools.maven.profiles.test/plugin_customization.ini
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.profiles.test/plugin_customization.ini
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.profiles.test/plugin_customization.ini 2012-08-21
12:56:34 UTC (rev 43129)
@@ -0,0 +1,2 @@
+org.eclipse.m2e.core/eclipse.m2.updateIndexes=false
+org.jboss.tools.central/showJBossCentralOnStartup=false
\ No newline at end of file
Added: trunk/maven/tests/org.jboss.tools.maven.profiles.test/pom.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.profiles.test/pom.xml
(rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.profiles.test/pom.xml 2012-08-21 12:56:34 UTC
(rev 43129)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools.maven</groupId>
+ <artifactId>tests</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.maven.tests</groupId>
+ <artifactId>org.jboss.tools.maven.profiles.test</artifactId>
+
+ <packaging>eclipse-test-plugin</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tychoVersion}</version>
+ <configuration>
+ <useUIThread>false</useUIThread>
+ <useUIHarness>true</useUIHarness>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Added: trunk/maven/tests/org.jboss.tools.maven.profiles.test/projects/12442/pom.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.profiles.test/projects/12442/pom.xml
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.profiles.test/projects/12442/pom.xml 2012-08-21
12:56:34 UTC (rev 43129)
@@ -0,0 +1,17 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>foo.bar</groupId>
+ <artifactId>parent-pom</artifactId>
+ <version>0.0.1</version>
+ </parent>
+ <artifactId>12442</artifactId>
+ <repositories>
+ <repository>
+ <id>testrepo</id>
+ <url>file:testrepo</url>
+ <snapshots><enabled>true</enabled></snapshots>
+ <releases><enabled>true</enabled></releases>
+ </repository>
+ </repositories>
+</project>
\ No newline at end of file
Added: trunk/maven/tests/org.jboss.tools.maven.profiles.test/settings.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.profiles.test/settings.xml
(rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.profiles.test/settings.xml 2012-08-21 12:56:34
UTC (rev 43129)
@@ -0,0 +1,19 @@
+<settings>
+ <profiles>
+ <profile>
+ <id>activebydefault-settings-profile</id>
+
<activation><activeByDefault>true</activeByDefault></activation>
+ </profile>
+ <profile>
+ <id>inactive-settings-profile</id>
+ </profile>
+ <profile>
+ <id>active-settings-profile</id>
+ </profile>
+ </profiles>
+
+ <activeProfiles>
+ <activeProfile>active-settings-profile</activeProfile>
+ </activeProfiles>
+
+</settings>
Added:
trunk/maven/tests/org.jboss.tools.maven.profiles.test/src/org/jboss/tools/maven/profiles/tests/AbstractMavenProfileTest.java
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.profiles.test/src/org/jboss/tools/maven/profiles/tests/AbstractMavenProfileTest.java
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.profiles.test/src/org/jboss/tools/maven/profiles/tests/AbstractMavenProfileTest.java 2012-08-21
12:56:34 UTC (rev 43129)
@@ -0,0 +1,97 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.profiles.tests;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.eclipse.m2e.core.project.IProjectConfigurationManager;
+import org.eclipse.m2e.core.project.ResolverConfiguration;
+import org.eclipse.m2e.tests.common.AbstractMavenProjectTestCase;
+import org.jboss.tools.common.util.FileUtil;
+import org.jboss.tools.maven.profiles.core.MavenProfilesCoreActivator;
+import org.jboss.tools.maven.profiles.core.profiles.IProfileManager;
+
+public abstract class AbstractMavenProfileTest extends AbstractMavenProjectTestCase {
+
+ protected IProfileManager profileManager;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ profileManager = MavenProfilesCoreActivator.getDefault().getProfileManager();
+ }
+
+ protected IMavenProjectFacade getFacade(IProject project) {
+ return MavenPlugin.getMavenProjectRegistry().create(project, monitor);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ profileManager = null;
+ super.tearDown();
+ }
+
+ protected String toString(File file) {
+ return FileUtil.readFile(file);
+ }
+
+ protected String toString(IFile file) {
+ return FileUtil.getContentFromEditorOrFile(file);
+ }
+
+ /**
+ * Replace the project pom.xml with a new one, triggers new build
+ *
+ * @param project
+ * @param newPomName
+ * @throws Exception
+ */
+ protected void updateProject(IProject project, String newPomName) throws Exception {
+ updateProject(project, newPomName, -1);
+ }
+
+ /**
+ * Replace the project pom.xml with a new one, triggers new build, wait for
+ * waitTime milliseconds.
+ *
+ * @param project
+ * @param newPomName
+ * @param waitTime
+ * @throws Exception
+ */
+ protected void updateProject(IProject project, String newPomName, int waitTime) throws
Exception {
+
+ if (newPomName != null) {
+ copyContent(project, newPomName, "pom.xml");
+ }
+ IProjectConfigurationManager configurationManager =
MavenPlugin.getProjectConfigurationManager();
+ ResolverConfiguration configuration = new ResolverConfiguration();
+ configurationManager.enableMavenNature(project, configuration, monitor);
+ configurationManager.updateProjectConfiguration(project, monitor);
+ waitForJobsToComplete(monitor);
+
+ project.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
+ if (waitTime > 0) {
+ Thread.sleep(waitTime);
+ }
+ waitForJobsToComplete(monitor);
+ }
+
+ protected void updateProject(IProject project) throws Exception {
+ updateProject(project, null, -1);
+ }
+
+}
Added:
trunk/maven/tests/org.jboss.tools.maven.profiles.test/src/org/jboss/tools/maven/profiles/tests/MavenProfileManagerTest.java
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.profiles.test/src/org/jboss/tools/maven/profiles/tests/MavenProfileManagerTest.java
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.profiles.test/src/org/jboss/tools/maven/profiles/tests/MavenProfileManagerTest.java 2012-08-21
12:56:34 UTC (rev 43129)
@@ -0,0 +1,59 @@
+/*************************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.profiles.tests;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.jboss.tools.maven.profiles.core.profiles.ProfileState;
+import org.jboss.tools.maven.profiles.core.profiles.ProfileStatus;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+@SuppressWarnings("restriction")
+public class MavenProfileManagerTest extends AbstractMavenProfileTest {
+
+ @Test
+ public void testJBIDE12442_parentFromRemote() throws Exception {
+ String pomPath = "projects/12442/pom.xml";
+ IProject project = importProject(pomPath);
+ waitForJobsToComplete();
+ assertNotNull(pomPath+" could not be imported", project);
+
+ IMavenProjectFacade facade = getFacade(project);
+ List<ProfileStatus> profiles = profileManager.getProfilesStatuses(facade,
monitor);
+ assertEquals(profiles.toString(), 5, profiles.size());
+ for (ProfileStatus p : profiles) {
+ String pid = p.getId();
+ if ("other-parent-profile".equals(pid)) {
+ assertFalse(p.isAutoActive());//parent profile activation is not inherited
+ assertEquals(ProfileState.Inactive, p.getActivationState());
+ } else if ("inactive-settings-profile".equals(pid)) {
+ assertFalse(p.isAutoActive());
+ assertEquals(ProfileState.Inactive, p.getActivationState());
+ } else if ("active-settings-profile".equals(pid)) {
+ assertTrue(p.isAutoActive());
+ assertEquals(ProfileState.Active, p.getActivationState());
+ } else if ("activebydefault-settings-profile".equals(pid)) {
+ assertTrue(p.isAutoActive());
+ assertEquals(ProfileState.Active, p.getActivationState());
+ } else if ("parent-profile".equals(pid)) {
+ assertFalse(p.isAutoActive());
+ assertEquals(ProfileState.Inactive, p.getActivationState());
+ } else {
+ fail("Unexpected profile "+pid);
+ }
+ }
+
+ }
+
+}
Added:
trunk/maven/tests/org.jboss.tools.maven.profiles.test/testrepo/foo/bar/parent-pom/0.0.1/parent-pom-0.0.1.pom
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.profiles.test/testrepo/foo/bar/parent-pom/0.0.1/parent-pom-0.0.1.pom
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.profiles.test/testrepo/foo/bar/parent-pom/0.0.1/parent-pom-0.0.1.pom 2012-08-21
12:56:34 UTC (rev 43129)
@@ -0,0 +1,18 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>foo.bar</groupId>
+ <artifactId>parent-pom</artifactId>
+ <version>0.0.1</version>
+ <packaging>pom</packaging>
+ <profiles>
+ <profile>
+ <id>parent-profile</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ </profile>
+ <profile>
+ <id>other-parent-profile</id>
+ </profile>
+ </profiles>
+</project>
\ No newline at end of file
Modified: trunk/maven/tests/pom.xml
===================================================================
--- trunk/maven/tests/pom.xml 2012-08-21 10:54:10 UTC (rev 43128)
+++ trunk/maven/tests/pom.xml 2012-08-21 12:56:34 UTC (rev 43129)
@@ -14,6 +14,7 @@
<packaging>pom</packaging>
<modules>
<module>org.jboss.tools.maven.configurators.tests</module>
+ <module>org.jboss.tools.maven.profiles.test</module>
<module>org.jboss.tools.maven.ui.bot.test</module>
</modules>