Skip to content

Commit

Permalink
SHRINKRES-261 When multiple settings.xml files are merged then all
Browse files Browse the repository at this point in the history
profiles activated by default are taken; modified testcase to verify
that settings.xml files are used correctly
  • Loading branch information
MatousJobanek committed Jan 4, 2017
1 parent 3630e34 commit 34584a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ public List<Profile> getActiveProfiles(Collection<Profile> profiles, ProfileActi
if (p.getId() != null && context.getActiveProfileIds().contains(id)
&& !context.getInactiveProfileIds().contains(id)) {
activeProfiles.add(p);
continue;
}
if (p.getActivation() != null && p.getActivation().isActiveByDefault()
&& !context.getInactiveProfileIds().contains(p.getId())) {
activeProfiles.add(p);
break;
continue;
}
for (ProfileActivator activator : activators) {
if (activator.isActive(p, context, problems)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
package org.jboss.shrinkwrap.resolver.impl.maven.bootstrap;

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;
import org.jboss.shrinkwrap.resolver.api.NoResolvedResultException;
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import org.jboss.shrinkwrap.resolver.impl.maven.util.ValidationUtil;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

Expand All @@ -43,6 +46,12 @@ public static void initialize() {
// will be used!
}

@Before
public void cleanLocalRepos() throws IOException {
FileUtils.deleteDirectory(new File("target/profile-repository"));
FileUtils.deleteDirectory(new File("target/syspropertyrepo"));
}

@Test
public void overrideUserSettings() {
System.setProperty(MavenSettingsBuilder.ALT_USER_SETTINGS_XML_LOCATION, SETTINGS_XML_PATH);
Expand All @@ -58,8 +67,7 @@ public void overrideUserSettings() {

@Test
public void overrideGlobalSettings() {
System.setProperty(MavenSettingsBuilder.ALT_GLOBAL_SETTINGS_XML_LOCATION,
"target/settings/profiles/settings.xml");
System.setProperty(MavenSettingsBuilder.ALT_GLOBAL_SETTINGS_XML_LOCATION, SETTINGS_XML_PATH);

File[] files = Maven.resolver().resolve("org.jboss.shrinkwrap.test:test-deps-c:1.0.0").withTransitivity()
.as(File.class);
Expand Down

0 comments on commit 34584a0

Please sign in to comment.