Search in sources :

Example 16 with MavenUniverseException

use of org.jboss.galleon.universe.maven.MavenUniverseException in project galleon by wildfly.

the class MavenUniverseLocationTestCase method testUniverseVersion.

@Test
public void testUniverseVersion() throws Exception {
    final MavenArtifact universeArt = new MavenArtifact().setGroupId(GROUP_ID).setArtifactId("universe1-artifact").setVersion("1.0.0.Final");
    Path path = resolver.resolve(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5/alpha"));
    Assert.assertEquals(fpArt.getArtifactFileName(), path.getFileName().toString());
    try {
        universeArt.setPath(null);
        resolver.resolve(FeaturePackLocation.fromString("producer2@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5/alpha"));
        Assert.fail("producer2 is not in this universe version");
    } catch (MavenUniverseException e) {
        Assert.assertEquals(MavenErrors.producerNotFound("producer2").getLocalizedMessage(), e.getLocalizedMessage());
    }
    universeArt.setPath(null);
    universeArt.setVersion("1.0.1.Final");
    path = resolver.resolve(FeaturePackLocation.fromString("producer2@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5/alpha"));
    Assert.assertEquals(fpArt.getArtifactFileName(), path.getFileName().toString());
}
Also used : Path(java.nio.file.Path) MavenArtifact(org.jboss.galleon.universe.maven.MavenArtifact) MavenUniverseException(org.jboss.galleon.universe.maven.MavenUniverseException) Test(org.junit.Test)

Aggregations

MavenUniverseException (org.jboss.galleon.universe.maven.MavenUniverseException)16 Path (java.nio.file.Path)6 MavenArtifact (org.jboss.galleon.universe.maven.MavenArtifact)6 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)4 InstallationException (org.eclipse.aether.installation.InstallationException)3 VersionRangeResolutionException (org.eclipse.aether.resolution.VersionRangeResolutionException)3 MavenArtifactRepositoryManager (org.jboss.galleon.maven.plugin.util.MavenArtifactRepositoryManager)3 MavenLatestVersionNotAvailableException (org.jboss.galleon.universe.maven.MavenLatestVersionNotAvailableException)3 MavenProducer (org.jboss.galleon.universe.maven.MavenProducer)3 Test (org.junit.Test)3 HashSet (java.util.HashSet)2 DefaultArtifact (org.eclipse.aether.artifact.DefaultArtifact)2 MavenProducerInstaller (org.jboss.galleon.universe.maven.MavenProducerInstaller)2 MavenUniverseInstaller (org.jboss.galleon.universe.maven.MavenUniverseInstaller)2 IOException (java.io.IOException)1 Iterator (java.util.Iterator)1 NoSuchElementException (java.util.NoSuchElementException)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 InstallRequest (org.eclipse.aether.installation.InstallRequest)1 ArtifactRequest (org.eclipse.aether.resolution.ArtifactRequest)1