use of org.jboss.galleon.config.ProvisioningConfig in project galleon by wildfly.
the class ProvisioningXmlExcludesIncludesTestCase method readIncludes.
@Test
public void readIncludes() throws Exception {
ProvisioningConfig found = validator.validateAndParse("xml/provisioning/include-package.xml");
ProvisioningConfig expected = ProvisioningConfig.builder().addFeaturePackDep(FeaturePackConfig.builder(FeaturePackLocation.fromString("fp1@maven(universe):0#0.0.1")).includePackage("p1").build()).addFeaturePackDep(FeaturePackConfig.builder(FeaturePackLocation.fromString("fp2@maven(universe):0#0.0.2")).includePackage("p2").includePackage("p3").build()).addFeaturePackDep(FeaturePackConfig.forLocation(FeaturePackLocation.fromString("fp3@maven(universe):0#0.0.3"))).build();
Assert.assertEquals(expected, found);
}
use of org.jboss.galleon.config.ProvisioningConfig in project galleon by wildfly.
the class ProvisioningManagerUniverseManagementTestCase method testAddRemoveUniverseToFreshDir.
@Test
public void testAddRemoveUniverseToFreshDir() throws Exception {
Assert.assertNull(getProvisioningConfig());
ProvisioningManager pm = ProvisioningManager.builder().setInstallationHome(home).build();
pm.addUniverse("universe1", new UniverseSpec("factory1", "location1"));
ProvisioningConfig config = getProvisioningConfig();
assertNotNull(config);
assertFalse(config.hasDefaultUniverse());
Map<String, UniverseSpec> universes = config.getUniverseNamedSpecs();
assertEquals(1, universes.size());
assertTrue(universes.containsKey("universe1"));
pm = ProvisioningManager.builder().setInstallationHome(home).build();
pm.addUniverse("universe2", new UniverseSpec("factory2", "location2"));
config = getProvisioningConfig();
assertNotNull(config);
assertFalse(config.hasDefaultUniverse());
universes = config.getUniverseNamedSpecs();
assertEquals(2, universes.size());
assertTrue(universes.containsKey("universe1"));
assertTrue(universes.containsKey("universe2"));
pm = ProvisioningManager.builder().setInstallationHome(home).build();
pm.removeUniverse("universe1");
config = getProvisioningConfig();
assertNotNull(config);
assertFalse(config.hasDefaultUniverse());
universes = config.getUniverseNamedSpecs();
assertEquals(1, universes.size());
assertTrue(universes.containsKey("universe2"));
pm = ProvisioningManager.builder().setInstallationHome(home).build();
pm.removeUniverse("universe2");
config = getProvisioningConfig();
assertFalse(config.hasDefaultUniverse());
assertTrue(config.getUniverseNamedSpecs().isEmpty());
}
use of org.jboss.galleon.config.ProvisioningConfig in project galleon by wildfly.
the class ProvisioningManagerUniverseManagementTestCase method testSetUnsetDefaultUniverseOnFreshDir.
@Test
public void testSetUnsetDefaultUniverseOnFreshDir() throws Exception {
Assert.assertNull(getProvisioningConfig());
ProvisioningManager pm = ProvisioningManager.builder().setInstallationHome(home).build();
pm.setDefaultUniverse(new UniverseSpec("factory1", "location1"));
ProvisioningConfig config = getProvisioningConfig();
assertNotNull(config);
Map<String, UniverseSpec> universes = config.getUniverseNamedSpecs();
assertEquals(0, universes.size());
assertTrue(config.hasDefaultUniverse());
assertEquals(new UniverseSpec("factory1", "location1"), config.getDefaultUniverse());
pm = ProvisioningManager.builder().setInstallationHome(home).build();
pm.setDefaultUniverse(new UniverseSpec("factory2", "location1"));
config = getProvisioningConfig();
assertNotNull(config);
universes = config.getUniverseNamedSpecs();
assertEquals(0, universes.size());
assertTrue(config.hasDefaultUniverse());
assertEquals(new UniverseSpec("factory2", "location1"), config.getDefaultUniverse());
pm = ProvisioningManager.builder().setInstallationHome(home).build();
pm.removeUniverse(null);
config = getProvisioningConfig();
assertNotNull(config);
universes = config.getUniverseNamedSpecs();
assertEquals(0, universes.size());
assertFalse(config.hasDefaultUniverse());
}
use of org.jboss.galleon.config.ProvisioningConfig in project galleon by wildfly.
the class FeatureContainers method buildFullRuntime.
private static ProvisioningRuntime buildFullRuntime(FPID fpid, PmSession pmSession) throws ProvisioningException {
FeaturePackConfig config = FeaturePackConfig.forLocation(fpid.getLocation());
ProvisioningConfig provisioning = ProvisioningConfig.builder().addFeaturePackDep(config).build();
ProvisioningRuntime runtime = ProvisioningRuntimeBuilder.newInstance(pmSession.getMessageWriter(false)).initLayout(pmSession.getLayoutFactory(), provisioning).build();
return runtime;
}
use of org.jboss.galleon.config.ProvisioningConfig in project galleon by wildfly.
the class ProvisioningManager method install.
public void install(FeaturePackConfig fpConfig, Map<String, String> options) throws ProvisioningException {
ProvisioningConfig config = getProvisioningConfig();
if (config == null) {
config = ProvisioningConfig.builder().build();
}
try (ProvisioningLayout<FeaturePackRuntimeBuilder> layout = getLayoutFactory().newConfigLayout(config, ProvisioningRuntimeBuilder.FP_RT_FACTORY, false)) {
final UniverseSpec configuredUniverse = getConfiguredUniverse(fpConfig.getLocation());
layout.install(configuredUniverse == null ? fpConfig : FeaturePackConfig.builder(fpConfig.getLocation().replaceUniverse(configuredUniverse)).init(fpConfig).build(), options);
doProvision(layout, getFsDiff(), false);
}
}
Aggregations