Search in sources :

Example 6 with UniverseSpec

use of org.jboss.galleon.universe.UniverseSpec 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 7 with UniverseSpec

use of org.jboss.galleon.universe.UniverseSpec 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 8 with UniverseSpec

use of org.jboss.galleon.universe.UniverseSpec in project galleon by wildfly.

the class FeaturePackLocationStringTestCase method testProducerUniverseFactoryFromString.

@Test
public void testProducerUniverseFactoryFromString() throws Exception {
    final FeaturePackLocation parsedSrc = FeaturePackLocation.fromString("producer@factory");
    Assert.assertNotNull(parsedSrc);
    Assert.assertEquals(new UniverseSpec("factory"), parsedSrc.getUniverse());
    Assert.assertEquals("producer", parsedSrc.getProducerName());
    Assert.assertNull(parsedSrc.getChannelName());
    Assert.assertNull(parsedSrc.getFrequency());
    Assert.assertNull(parsedSrc.getBuild());
}
Also used : FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) UniverseSpec(org.jboss.galleon.universe.UniverseSpec) Test(org.junit.Test)

Example 9 with UniverseSpec

use of org.jboss.galleon.universe.UniverseSpec in project galleon by wildfly.

the class FeaturePackLocationStringTestCase method testProducerWithoutUniverseToString.

@Test
public void testProducerWithoutUniverseToString() throws Exception {
    final ProducerSpec producer = new FeaturePackLocation(new UniverseSpec("factory", null), "producer", "channel", "frequency", "build").getProducer();
    Assert.assertEquals("producer@factory", producer.toString());
}
Also used : ProducerSpec(org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) UniverseSpec(org.jboss.galleon.universe.UniverseSpec) Test(org.junit.Test)

Example 10 with UniverseSpec

use of org.jboss.galleon.universe.UniverseSpec in project galleon by wildfly.

the class FeaturePackLocationStringTestCase method testProducerWithUniverseLocationToString.

@Test
public void testProducerWithUniverseLocationToString() throws Exception {
    final ProducerSpec producer = new FeaturePackLocation(new UniverseSpec("factory", "location"), "producer", "channel", "frequency", "build").getProducer();
    Assert.assertEquals("producer@factory(location)", producer.toString());
}
Also used : ProducerSpec(org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) UniverseSpec(org.jboss.galleon.universe.UniverseSpec) Test(org.junit.Test)

Aggregations

UniverseSpec (org.jboss.galleon.universe.UniverseSpec)29 FeaturePackLocation (org.jboss.galleon.universe.FeaturePackLocation)18 Test (org.junit.Test)14 ProvisioningException (org.jboss.galleon.ProvisioningException)6 ProvisioningManager (org.jboss.galleon.ProvisioningManager)4 ProvisioningConfig (org.jboss.galleon.config.ProvisioningConfig)4 ProducerSpec (org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec)4 Path (java.nio.file.Path)3 ChannelSpec (org.jboss.galleon.universe.FeaturePackLocation.ChannelSpec)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 ProvisioningDescriptionException (org.jboss.galleon.ProvisioningDescriptionException)2 CommandExecutionException (org.jboss.galleon.cli.CommandExecutionException)2 UniverseVisitor (org.jboss.galleon.cli.UniverseManager.UniverseVisitor)2 Table (org.jboss.galleon.cli.cmd.Table)2 Producer (org.jboss.galleon.universe.Producer)2 IOException (java.io.IOException)1 Comparator (java.util.Comparator)1