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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations