Search in sources :

Example 1 with MavenUniverseInstaller

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

the class FeaturePackLocationResolverTestCase method doInit.

@Override
public void doInit() throws Exception {
    final MavenArtifact artifact = new MavenArtifact().setGroupId(GROUP_ID).setArtifactId(PRODUCER1_ARTIFACT_ID).setVersion("1.0.0.Final");
    MavenProducerInstaller producerInstaller = new MavenProducerInstaller("producer1", repo, artifact, FP_GROUP_ID, PRODUCER1_FP_ARTIFACT_ID);
    producerInstaller.addChannel("6", "[6.0-alpha,7.0-alpha)");
    producerInstaller.addChannel("5", "[5.0-alpha,6.0-alpha)");
    producerInstaller.addChannel("4", "[4.0-alpha,5.0-alpha)");
    producerInstaller.addFrequencies("alpha", "beta");
    producerInstaller.install();
    universeArt = new MavenArtifact().setGroupId(GROUP_ID).setArtifactId("universe1-artifact").setVersion("1.0.0.Final");
    final MavenUniverseInstaller universeInstaller = new MavenUniverseInstaller(repo, universeArt);
    universeInstaller.addProducer("producer1", GROUP_ID, PRODUCER1_ARTIFACT_ID, "[1.0.0,2.0.0)");
    universeInstaller.install();
    resolver = UniverseResolver.builder().addArtifactResolver(repo).build();
}
Also used : MavenProducerInstaller(org.jboss.galleon.universe.maven.MavenProducerInstaller) MavenUniverseInstaller(org.jboss.galleon.universe.maven.MavenUniverseInstaller) MavenArtifact(org.jboss.galleon.universe.maven.MavenArtifact)

Example 2 with MavenUniverseInstaller

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

the class ProducerRefreshOnNotFoundChannelTestCase method setupUniverse.

private void setupUniverse(SimplisticMavenRepoManager repo, String producer, int... channels) throws MavenUniverseException {
    final MavenUniverseInstaller universeInstaller = new MavenUniverseInstaller(repo, new MavenArtifact().setGroupId(GROUP_ID).setArtifactId("universe1-artifact").setVersion("1"));
    final MavenArtifact producerArtifact = new MavenArtifact().setGroupId(GROUP_ID).setArtifactId(producer).setVersion("1");
    final String producerFpArtifactId = producer + "-fp";
    MavenProducerInstaller producerInstaller = new MavenProducerInstaller(producer, repo, producerArtifact, GROUP_ID, producerFpArtifactId);
    for (int channel : channels) {
        producerInstaller.addChannel(Integer.toString(channel), "[" + channel + ".0-alpha," + (channel + 1) + ".0-alpha)");
    }
    producerInstaller.addFrequencies("alpha", "beta");
    producerInstaller.install();
    universeInstaller.addProducer(producer, GROUP_ID, producer, "[0,)");
    universeInstaller.install();
}
Also used : MavenUniverseInstaller(org.jboss.galleon.universe.maven.MavenUniverseInstaller) MavenProducerInstaller(org.jboss.galleon.universe.maven.MavenProducerInstaller) MavenArtifact(org.jboss.galleon.universe.maven.MavenArtifact)

Example 3 with MavenUniverseInstaller

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

the class UniverseRefreshOnNotFoundProducerTestCase method setupUniverse.

private void setupUniverse(SimplisticMavenRepoManager repo, String... producers) throws MavenUniverseException {
    final MavenUniverseInstaller universeInstaller = new MavenUniverseInstaller(repo, new MavenArtifact().setGroupId(GROUP_ID).setArtifactId("universe1-artifact").setVersion("1"));
    for (String producer : producers) {
        final MavenArtifact producerArtifact = new MavenArtifact().setGroupId(GROUP_ID).setArtifactId(producer).setVersion("1");
        final String producerFpArtifactId = producer + "-fp";
        MavenProducerInstaller producerInstaller = new MavenProducerInstaller(producer, repo, producerArtifact, GROUP_ID, producerFpArtifactId);
        producerInstaller.addChannel("1", "[1.0-alpha,2.0-alpha)");
        producerInstaller.addFrequencies("alpha", "beta");
        producerInstaller.install();
        universeInstaller.addProducer(producer, GROUP_ID, producer, "[0,)");
    }
    universeInstaller.install();
}
Also used : MavenUniverseInstaller(org.jboss.galleon.universe.maven.MavenUniverseInstaller) MavenProducerInstaller(org.jboss.galleon.universe.maven.MavenProducerInstaller) MavenArtifact(org.jboss.galleon.universe.maven.MavenArtifact)

Example 4 with MavenUniverseInstaller

use of org.jboss.galleon.universe.maven.MavenUniverseInstaller 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 5 with MavenUniverseInstaller

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

the class MavenUniverseLocationTestCase method doInit.

@Override
public void doInit() throws Exception {
    MavenArtifact artifact = new MavenArtifact().setGroupId(GROUP_ID).setArtifactId(PRODUCER1_ARTIFACT_ID).setVersion("1.0.0.Final");
    MavenProducerInstaller producerInstaller = new MavenProducerInstaller("producer1", repo, artifact, FP_GROUP_ID, PRODUCER1_FP_ARTIFACT_ID);
    producerInstaller.addChannel("5", "[5.0-alpha,6.0-alpha)");
    producerInstaller.addFrequencies("alpha", "beta");
    producerInstaller.install();
    artifact = new MavenArtifact().setGroupId(GROUP_ID).setArtifactId(PRODUCER2_ARTIFACT_ID).setVersion("1.0.0.Final");
    producerInstaller = new MavenProducerInstaller("producer2", repo, artifact, FP_GROUP_ID, PRODUCER1_FP_ARTIFACT_ID);
    producerInstaller.addChannel("5", "[5.0-alpha,6.0-alpha)");
    producerInstaller.addFrequencies("alpha", "beta");
    producerInstaller.install();
    MavenArtifact universeArt = new MavenArtifact().setGroupId(GROUP_ID).setArtifactId("universe1-artifact").setVersion("1.0.0.Final");
    MavenUniverseInstaller universeInstaller = new MavenUniverseInstaller(repo, universeArt);
    universeInstaller.addProducer("producer1", GROUP_ID, PRODUCER1_ARTIFACT_ID, "[1.0.0,2.0.0)");
    universeInstaller.install();
    universeArt = new MavenArtifact().setGroupId(GROUP_ID).setArtifactId("universe1-artifact").setVersion("1.0.1.Final");
    universeInstaller = new MavenUniverseInstaller(repo, universeArt);
    universeInstaller.addProducer("producer1", GROUP_ID, PRODUCER1_ARTIFACT_ID, "[1.0.0,2.0.0)");
    universeInstaller.addProducer("producer2", GROUP_ID, "producer2-artifact", "[1.0.0,2.0.0)");
    universeInstaller.install();
    resolver = UniverseResolver.builder().addArtifactResolver(repo).build();
    fpArt = new MavenArtifact().setGroupId(FP_GROUP_ID).setArtifactId(PRODUCER1_FP_ARTIFACT_ID).setExtension("zip").setVersion("5.1.0.Alpha1");
    FeaturePackCreator.getInstance().addArtifactResolver(repo).newFeaturePack(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5#5.1.0.Alpha1").getFPID()).getCreator().install();
}
Also used : MavenProducerInstaller(org.jboss.galleon.universe.maven.MavenProducerInstaller) MavenUniverseInstaller(org.jboss.galleon.universe.maven.MavenUniverseInstaller) MavenArtifact(org.jboss.galleon.universe.maven.MavenArtifact)

Aggregations

MavenUniverseInstaller (org.jboss.galleon.universe.maven.MavenUniverseInstaller)10 MavenArtifact (org.jboss.galleon.universe.maven.MavenArtifact)8 MavenProducerInstaller (org.jboss.galleon.universe.maven.MavenProducerInstaller)6 MavenProducer (org.jboss.galleon.universe.maven.MavenProducer)2 MavenUniverse (org.jboss.galleon.universe.maven.MavenUniverse)2 MavenUniverseException (org.jboss.galleon.universe.maven.MavenUniverseException)2 Test (org.junit.Test)2 HashSet (java.util.HashSet)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 MavenArtifactRepositoryManager (org.jboss.galleon.maven.plugin.util.MavenArtifactRepositoryManager)1 MavenProducerBase (org.jboss.galleon.universe.maven.MavenProducerBase)1