Search in sources :

Example 26 with FeaturePackLocation

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

the class FeaturePackLocationStringTestCase method testChannelWithoutFrequencyToString.

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

Example 27 with FeaturePackLocation

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

the class FeaturePackLocationStringTestCase method testMavenProducerWithUniverseLocationFromString.

@Test
public void testMavenProducerWithUniverseLocationFromString() throws Exception {
    final FeaturePackLocation parsedCoords = FeaturePackLocation.fromString("producer@maven(org.jboss.universe:jboss-universe:1.0.0.Final)");
    Assert.assertNotNull(parsedCoords);
    Assert.assertEquals("maven", parsedCoords.getUniverse().getFactory());
    Assert.assertEquals("org.jboss.universe:jboss-universe:1.0.0.Final", parsedCoords.getUniverse().getLocation());
    Assert.assertEquals("producer", parsedCoords.getProducerName());
    Assert.assertNull(parsedCoords.getChannelName());
    Assert.assertNull(parsedCoords.getFrequency());
    Assert.assertNull(parsedCoords.getBuild());
}
Also used : FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) Test(org.junit.Test)

Example 28 with FeaturePackLocation

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

the class FeaturePackLocationStringTestCase method testChannelWithUniverseLocationAndFrequencyFromString.

@Test
public void testChannelWithUniverseLocationAndFrequencyFromString() throws Exception {
    final FeaturePackLocation parsedCoords = FeaturePackLocation.fromString("producer@factory(location):channel/frequency");
    Assert.assertNotNull(parsedCoords);
    Assert.assertEquals("factory", parsedCoords.getUniverse().getFactory());
    Assert.assertEquals("location", parsedCoords.getUniverse().getLocation());
    Assert.assertEquals("producer", parsedCoords.getProducerName());
    Assert.assertEquals("channel", parsedCoords.getChannelName());
    Assert.assertEquals("frequency", parsedCoords.getFrequency());
    Assert.assertNull(parsedCoords.getBuild());
}
Also used : FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) Test(org.junit.Test)

Example 29 with FeaturePackLocation

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

the class FeaturePackDepsConfigBuilder method removeTransitiveDep.

@SuppressWarnings("unchecked")
public B removeTransitiveDep(FPID fpid) throws ProvisioningException {
    final FeaturePackLocation fpl = resolveUniverseSpec(fpid.getLocation());
    final ProducerSpec producer = fpl.getProducer();
    final FeaturePackConfig fpDep = transitiveDeps.get(producer);
    if (fpDep == null) {
        throw new ProvisioningException(Errors.unknownFeaturePack(fpid));
    }
    if (!fpDep.getLocation().equals(fpl)) {
        throw new ProvisioningException(Errors.unknownFeaturePack(fpid));
    }
    if (transitiveDeps.size() == 1) {
        transitiveDeps = Collections.emptyMap();
        return (B) this;
    } else {
        transitiveDeps = CollectionUtils.remove(transitiveDeps, producer);
    }
    updateOriginMappings(producer);
    return (B) this;
}
Also used : ProducerSpec(org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec) ProvisioningException(org.jboss.galleon.ProvisioningException) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation)

Example 30 with FeaturePackLocation

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

the class FeaturePackLocationResolverTestCase method testResolutionLocalPathInstalled.

@Test
public void testResolutionLocalPathInstalled() throws Exception {
    FeaturePackLocation fpl = FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5#5.0.0.Final");
    MavenArtifact artifact = new MavenArtifact().setGroupId(FP_GROUP_ID).setArtifactId(PRODUCER1_FP_ARTIFACT_ID).setExtension("zip").setVersion("5.0.0.Final");
    FeaturePackCreator.getInstance().addArtifactResolver(repo).newFeaturePack().setFPID(fpl.getFPID()).getCreator().install();
    Path path = resolver.resolve(fpl);
    Assert.assertEquals(artifact.getArtifactFileName(), path.getFileName().toString());
    Path externalPath = repoHome.resolve("external").resolve(path.getFileName().toString());
    IoUtils.copy(path, externalPath);
    IoUtils.recursiveDelete(path);
    try {
        resolver.resolve(fpl);
        Assert.fail(String.format("The %s artifact is still installed in the local repository", artifact.getCoordsAsString()));
    } catch (ProvisioningException e) {
    // Expected exception
    }
    UniverseResolver resolver = UniverseResolver.builder().addArtifactResolver(repo).addLocalFeaturePack(externalPath).build();
    try {
        path = resolver.resolve(fpl);
        Assert.assertEquals(artifact.getArtifactFileName(), path.getFileName().toString());
    } catch (ProvisioningException e) {
        Assert.fail(String.format("Cannot resolve %s artifact using a resolved with a local feature pack location", artifact.getCoordsAsString()));
    }
}
Also used : Path(java.nio.file.Path) ProvisioningException(org.jboss.galleon.ProvisioningException) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) UniverseResolver(org.jboss.galleon.universe.UniverseResolver) MavenArtifact(org.jboss.galleon.universe.maven.MavenArtifact) Test(org.junit.Test)

Aggregations

FeaturePackLocation (org.jboss.galleon.universe.FeaturePackLocation)111 Test (org.junit.Test)46 Path (java.nio.file.Path)23 ProvisioningException (org.jboss.galleon.ProvisioningException)18 UniverseSpec (org.jboss.galleon.universe.UniverseSpec)18 FeaturePackConfig (org.jboss.galleon.config.FeaturePackConfig)16 ArrayList (java.util.ArrayList)13 FPID (org.jboss.galleon.universe.FeaturePackLocation.FPID)13 FeaturePackCreator (org.jboss.galleon.creator.FeaturePackCreator)12 ProducerSpec (org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec)9 XMLStreamException (javax.xml.stream.XMLStreamException)8 ProvisioningConfig (org.jboss.galleon.config.ProvisioningConfig)8 IOException (java.io.IOException)7 CommandExecutionException (org.jboss.galleon.cli.CommandExecutionException)7 HashMap (java.util.HashMap)6 CommandException (org.aesh.command.CommandException)6 ProvisioningDescriptionException (org.jboss.galleon.ProvisioningDescriptionException)6 FeatureConfig (org.jboss.galleon.config.FeatureConfig)6 FeaturePackLayout (org.jboss.galleon.layout.FeaturePackLayout)6 Set (java.util.Set)5