Search in sources :

Example 1 with MavenProducerInstaller

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

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

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

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

the class MavenProducerExtendAndInstallTestCase method testMain.

@Test
public void testMain() throws Exception {
    final String fpGroupId = "channel-group1";
    final String fpArtifactId = "channel-artifact1";
    MavenProducerInstaller producerInstaller = new MavenProducerInstaller("producer1", repo, producer100Artifact, fpGroupId, fpArtifactId);
    producerInstaller.addFrequencies("alpha", "beta");
    producerInstaller.addChannel("1.0", "[1.0.0,2.0.0)");
    producerInstaller.addChannel("2.0", "[2.0.0,3.0.0)", false, ".*-ext-[0-9][0-9]", ".*-ext-11");
    producerInstaller.install();
    producerInstaller = new MavenProducerInstaller("producer1", repo, producer101Artifact, producer100Artifact);
    producerInstaller.removeFrequency("beta");
    producerInstaller.addFrequency("cr");
    producerInstaller.addChannel("3.0", "[3.0.0,4.0.0)");
    producerInstaller.removeChannel("1.0");
    producerInstaller.install();
    producer101Artifact.setPath(null);
    MavenProducer producer = new MavenProducer("producer1", repo, producer101Artifact);
    Collection<String> frequencies = producer.getFrequencies();
    Assert.assertEquals(3, frequencies.size());
    Assert.assertTrue(frequencies.contains("alpha"));
    Assert.assertTrue(frequencies.contains("cr"));
    Assert.assertTrue(frequencies.contains("final"));
    MavenChannel channel = producer.getChannel("2.0");
    Assert.assertEquals(fpGroupId, channel.getFeaturePackGroupId());
    Assert.assertEquals(fpArtifactId, channel.getFeaturePackArtifactId());
    Assert.assertEquals("[2.0.0,3.0.0)", channel.getVersionRange());
    Assert.assertEquals(".*-ext-[0-9][0-9]", channel.getVersionIncludeRegex());
    Assert.assertEquals(".*-ext-11", channel.getVersionExcludeRegex());
    frequencies = channel.getFrequencies();
    Assert.assertEquals(3, frequencies.size());
    Assert.assertTrue(frequencies.contains("alpha"));
    Assert.assertTrue(frequencies.contains("cr"));
    Assert.assertTrue(frequencies.contains("final"));
    Assert.assertTrue(producer.hasChannel("2.0"));
    Assert.assertTrue(producer.hasChannel("3.0"));
    channel = producer.getChannel("3.0");
    Assert.assertEquals(fpGroupId, channel.getFeaturePackGroupId());
    Assert.assertEquals(fpArtifactId, channel.getFeaturePackArtifactId());
    Assert.assertEquals("[3.0.0,4.0.0)", channel.getVersionRange());
    frequencies = channel.getFrequencies();
    Assert.assertEquals(3, frequencies.size());
    Assert.assertTrue(frequencies.contains("alpha"));
    Assert.assertTrue(frequencies.contains("cr"));
    Assert.assertTrue(frequencies.contains("final"));
    Assert.assertFalse(producer.hasChannel("4.0"));
    Assert.assertEquals(2, producer.getChannels().size());
}
Also used : MavenProducerInstaller(org.jboss.galleon.universe.maven.MavenProducerInstaller) MavenProducer(org.jboss.galleon.universe.maven.MavenProducer) MavenChannel(org.jboss.galleon.universe.maven.MavenChannel) Test(org.junit.Test)

Example 5 with MavenProducerInstaller

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

the class MavenProducerInstallTestCase method testMain.

@Test
public void testMain() throws Exception {
    final String fpGroupId = "fp-group1";
    final String fpArtifactId = "fp-artifact1";
    final MavenProducerInstaller producerInstaller = new MavenProducerInstaller("producer1", repo, producerArtifact, fpGroupId, fpArtifactId);
    producerInstaller.addFrequencies("alpha", "beta");
    producerInstaller.addChannel("1.0", "[1.0.0,2.0.0)");
    producerInstaller.addChannel("2.0", "[2.0.0,3.0.0)", false, ".*-ext-[0-9][0-9]", ".*-ext-11");
    producerInstaller.install();
    producerArtifact.setPath(null);
    MavenProducer producer = new MavenProducer("producer1", repo, producerArtifact);
    Assert.assertEquals(fpGroupId, producer.getFeaturePackGroupId());
    Assert.assertEquals(fpArtifactId, producer.getFeaturePackArtifactId());
    Collection<String> frequencies = producer.getFrequencies();
    Assert.assertEquals(3, frequencies.size());
    Assert.assertTrue(frequencies.contains("alpha"));
    Assert.assertTrue(frequencies.contains("beta"));
    Assert.assertTrue(frequencies.contains("final"));
    Assert.assertTrue(producer.hasChannel("1.0"));
    MavenChannel channel = producer.getChannel("1.0");
    Assert.assertEquals(fpGroupId, channel.getFeaturePackGroupId());
    Assert.assertEquals(fpArtifactId, channel.getFeaturePackArtifactId());
    Assert.assertEquals("[1.0.0,2.0.0)", channel.getVersionRange());
    frequencies = channel.getFrequencies();
    Assert.assertEquals(3, frequencies.size());
    Assert.assertTrue(frequencies.contains("alpha"));
    Assert.assertTrue(frequencies.contains("beta"));
    Assert.assertTrue(frequencies.contains("final"));
    channel = producer.getChannel("2.0");
    Assert.assertEquals(fpGroupId, channel.getFeaturePackGroupId());
    Assert.assertEquals(fpArtifactId, channel.getFeaturePackArtifactId());
    Assert.assertEquals("[2.0.0,3.0.0)", channel.getVersionRange());
    Assert.assertEquals(".*-ext-[0-9][0-9]", channel.getVersionIncludeRegex());
    Assert.assertEquals(".*-ext-11", channel.getVersionExcludeRegex());
    frequencies = channel.getFrequencies();
    Assert.assertEquals(3, frequencies.size());
    Assert.assertTrue(frequencies.contains("alpha"));
    Assert.assertTrue(frequencies.contains("beta"));
    Assert.assertTrue(frequencies.contains("final"));
    Assert.assertTrue(producer.hasChannel("2.0"));
    Assert.assertFalse(producer.hasChannel("3.0"));
    try {
        producer.getChannel("3.0");
    } catch (MavenUniverseException e) {
        Assert.assertEquals(MavenErrors.channelNotFound(producer.getName(), "3.0").getLocalizedMessage(), e.getLocalizedMessage());
    }
    Assert.assertEquals(2, producer.getChannels().size());
}
Also used : MavenProducerInstaller(org.jboss.galleon.universe.maven.MavenProducerInstaller) MavenProducer(org.jboss.galleon.universe.maven.MavenProducer) MavenChannel(org.jboss.galleon.universe.maven.MavenChannel) MavenUniverseException(org.jboss.galleon.universe.maven.MavenUniverseException) Test(org.junit.Test)

Aggregations

MavenProducerInstaller (org.jboss.galleon.universe.maven.MavenProducerInstaller)13 MavenArtifact (org.jboss.galleon.universe.maven.MavenArtifact)11 MavenUniverseInstaller (org.jboss.galleon.universe.maven.MavenUniverseInstaller)6 MavenChannel (org.jboss.galleon.universe.maven.MavenChannel)2 MavenProducer (org.jboss.galleon.universe.maven.MavenProducer)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