use of org.jboss.galleon.universe.UniverseResolver 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()));
}
}
use of org.jboss.galleon.universe.UniverseResolver in project galleon by wildfly.
the class MavenUniverseFeaturePackCreatorTestCase method testMain.
@Test
public void testMain() throws Exception {
final UniverseResolver universeResolver = UniverseResolver.builder().addArtifactResolver(SimplisticMavenRepoManager.getInstance(repoHome)).build();
Path path = universeResolver.resolve(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + "(universe.maven.test:maven-universe1:[1.0,2.0-alpha)):1.0"));
Assert.assertEquals("feature-pack1-1.0.0.Final.zip", path.getFileName().toString());
}
Aggregations