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