Search in sources :

Example 6 with ProvisioningConfig

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);
}
Also used : ProvisioningConfig(org.jboss.galleon.config.ProvisioningConfig) Test(org.junit.Test)

Example 7 with ProvisioningConfig

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());
}
Also used : ProvisioningConfig(org.jboss.galleon.config.ProvisioningConfig) ProvisioningManager(org.jboss.galleon.ProvisioningManager) UniverseSpec(org.jboss.galleon.universe.UniverseSpec) Test(org.junit.Test)

Example 8 with ProvisioningConfig

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());
}
Also used : ProvisioningConfig(org.jboss.galleon.config.ProvisioningConfig) ProvisioningManager(org.jboss.galleon.ProvisioningManager) UniverseSpec(org.jboss.galleon.universe.UniverseSpec) Test(org.junit.Test)

Example 9 with ProvisioningConfig

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;
}
Also used : ProvisioningConfig(org.jboss.galleon.config.ProvisioningConfig) ProvisioningRuntime(org.jboss.galleon.runtime.ProvisioningRuntime) FeaturePackConfig(org.jboss.galleon.config.FeaturePackConfig)

Example 10 with ProvisioningConfig

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);
    }
}
Also used : ProvisioningConfig(org.jboss.galleon.config.ProvisioningConfig) FeaturePackRuntimeBuilder(org.jboss.galleon.runtime.FeaturePackRuntimeBuilder) UniverseSpec(org.jboss.galleon.universe.UniverseSpec)

Aggregations

ProvisioningConfig (org.jboss.galleon.config.ProvisioningConfig)47 Test (org.junit.Test)16 Path (java.nio.file.Path)15 FeaturePackConfig (org.jboss.galleon.config.FeaturePackConfig)12 ProvisioningException (org.jboss.galleon.ProvisioningException)10 IOException (java.io.IOException)8 ArrayList (java.util.ArrayList)6 ProvisioningManager (org.jboss.galleon.ProvisioningManager)6 CommandExecutionException (org.jboss.galleon.cli.CommandExecutionException)6 ConfigId (org.jboss.galleon.config.ConfigId)6 FeaturePackLocation (org.jboss.galleon.universe.FeaturePackLocation)6 CommandException (org.aesh.command.CommandException)5 ConfigModel (org.jboss.galleon.config.ConfigModel)5 HashMap (java.util.HashMap)4 FeaturePackLayout (org.jboss.galleon.layout.FeaturePackLayout)4 FeaturePackRuntimeBuilder (org.jboss.galleon.runtime.FeaturePackRuntimeBuilder)4 ProvisioningRuntime (org.jboss.galleon.runtime.ProvisioningRuntime)4 FPID (org.jboss.galleon.universe.FeaturePackLocation.FPID)4 UniverseSpec (org.jboss.galleon.universe.UniverseSpec)4 HashSet (java.util.HashSet)3