Search in sources :

Example 1 with MavenUniverse

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

the class MavenUniverseInstallTestCase method testMain.

@Test
public void testMain() throws Exception {
    final MavenUniverseInstaller universeInstaller = new MavenUniverseInstaller(repo, universeArtifact);
    universeInstaller.addProducer("producer1", GROUP_ID, "producer1", "[1.0.0,2.0.0)");
    universeInstaller.addProducer("producer2", GROUP_ID, "producer2", "[3.0.0,4.0.0)");
    universeInstaller.install();
    universeArtifact.setPath(null);
    final MavenUniverse universe = new MavenUniverse(repo, universeArtifact);
    Assert.assertTrue(universe.hasProducer("producer1"));
    MavenProducer producer = universe.getProducer("producer1");
    Assert.assertEquals(GROUP_ID, producer.getArtifact().getGroupId());
    Assert.assertEquals("producer1", producer.getArtifact().getArtifactId());
    Assert.assertEquals("[1.0.0,2.0.0)", producer.getArtifact().getVersionRange());
    producer = universe.getProducer("producer2");
    Assert.assertEquals(GROUP_ID, producer.getArtifact().getGroupId());
    Assert.assertEquals("producer2", producer.getArtifact().getArtifactId());
    Assert.assertEquals("[3.0.0,4.0.0)", producer.getArtifact().getVersionRange());
    Assert.assertTrue(universe.hasProducer("producer2"));
    Assert.assertFalse(universe.hasProducer("producerN"));
    try {
        universe.getProducer("producerN");
    } catch (MavenUniverseException e) {
        Assert.assertEquals(MavenErrors.producerNotFound("producerN").getLocalizedMessage(), e.getLocalizedMessage());
    }
    Assert.assertEquals(2, universe.getProducers().size());
}
Also used : MavenUniverse(org.jboss.galleon.universe.maven.MavenUniverse) MavenUniverseInstaller(org.jboss.galleon.universe.maven.MavenUniverseInstaller) MavenProducer(org.jboss.galleon.universe.maven.MavenProducer) MavenUniverseException(org.jboss.galleon.universe.maven.MavenUniverseException) Test(org.junit.Test)

Example 2 with MavenUniverse

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

the class MavenUniverseExtendAndInstallTestCase method testMain.

@Test
public void testMain() throws Exception {
    MavenUniverseInstaller universeInstaller = new MavenUniverseInstaller(repo, universe100Artifact);
    universeInstaller.addProducer("producer1", GROUP_ID, "producer1", "[1.0.0,2.0.0)");
    universeInstaller.addProducer("producer2", GROUP_ID, "producer2", "[3.0.0,4.0.0)");
    universeInstaller.install();
    universeInstaller = new MavenUniverseInstaller(repo, universe101Artifact);
    universeInstaller.extendUniverse(universe100Artifact);
    universeInstaller.addProducer("producer3", GROUP_ID, "producer3", "[2.0.0,3.0.0)");
    universeInstaller.removeProducer("producer2");
    universeInstaller.install();
    universe101Artifact.setPath(null);
    final MavenUniverse universe = new MavenUniverse(repo, universe101Artifact);
    Assert.assertTrue(universe.hasProducer("producer1"));
    MavenProducer producer = universe.getProducer("producer1");
    Assert.assertEquals(GROUP_ID, producer.getArtifact().getGroupId());
    Assert.assertEquals("producer1", producer.getArtifact().getArtifactId());
    Assert.assertEquals("[1.0.0,2.0.0)", producer.getArtifact().getVersionRange());
    Assert.assertFalse(universe.hasProducer("producer2"));
    Assert.assertEquals(2, universe.getProducers().size());
    Assert.assertTrue(universe.hasProducer("producer3"));
    producer = universe.getProducer("producer3");
    Assert.assertEquals(GROUP_ID, producer.getArtifact().getGroupId());
    Assert.assertEquals("producer3", producer.getArtifact().getArtifactId());
    Assert.assertEquals("[2.0.0,3.0.0)", producer.getArtifact().getVersionRange());
}
Also used : MavenUniverse(org.jboss.galleon.universe.maven.MavenUniverse) MavenUniverseInstaller(org.jboss.galleon.universe.maven.MavenUniverseInstaller) MavenProducer(org.jboss.galleon.universe.maven.MavenProducer) Test(org.junit.Test)

Aggregations

MavenProducer (org.jboss.galleon.universe.maven.MavenProducer)2 MavenUniverse (org.jboss.galleon.universe.maven.MavenUniverse)2 MavenUniverseInstaller (org.jboss.galleon.universe.maven.MavenUniverseInstaller)2 Test (org.junit.Test)2 MavenUniverseException (org.jboss.galleon.universe.maven.MavenUniverseException)1