Package org.jboss.shrinkwrap.resolver.api.maven

Examples of org.jboss.shrinkwrap.resolver.api.maven.MavenResolvedArtifact


        // given
        final String artifactCanonicalForm = "org.jboss.shrinkwrap.test:test-deps-a:jar:1.0.0";
        final MavenCoordinate originalCoordinate = MavenCoordinates.createCoordinate(artifactCanonicalForm);

        // when
        final MavenResolvedArtifact resolvedArtifact = Maven.resolver().loadPomFromFile("target/poms/test-parent.xml")
                .resolve(artifactCanonicalForm).withoutTransitivity().asSingleResolvedArtifact();

        // then
        new ValidationUtil("test-deps-a-1.0.0.jar").validate(resolvedArtifact.as(File.class));

        assertEquals("jar", resolvedArtifact.getExtension());
        assertEquals("1.0.0", resolvedArtifact.getResolvedVersion());
        assertEquals(false, resolvedArtifact.isSnapshotVersion());
        assertEquals("jar", resolvedArtifact.getExtension());
        assertEquals(false, resolvedArtifact.isOptional());
        assertEquals(originalCoordinate, resolvedArtifact.getCoordinate());
    }
View Full Code Here


                .withoutTransitivity().asResolvedArtifact();

        // then
        assertEquals("MavenResolvedArtifact list should have one element", 1, resolvedArtifactInfos.length);

        final MavenResolvedArtifact resolvedArtifact = resolvedArtifactInfos[0];
        assertEquals("Resolved artifact should have children", 2, resolvedArtifact.getDependencies().length);

        new ValidationUtil("test-dependency-1.0.0.jar").validate(resolvedArtifact.as(File.class));

        assertEquals("jar", resolvedArtifact.getExtension());
        assertEquals("1.0.0", resolvedArtifact.getResolvedVersion());
        assertEquals(false, resolvedArtifact.isSnapshotVersion());
        assertEquals("jar", resolvedArtifact.getExtension());
        assertEquals(false, resolvedArtifact.isOptional());
        assertEquals(originalCoordinate, resolvedArtifact.getCoordinate());

        final MavenArtifactInfo child1 = resolvedArtifact.getDependencies()[0];
        assertEquals("jar", child1.getExtension());
        assertEquals("1.0.0", child1.getResolvedVersion());
        assertEquals(false, child1.isSnapshotVersion());
        assertEquals("jar", child1.getExtension());
        assertEquals(false, child1.isOptional());
        assertEquals(child1Coordinate, child1.getCoordinate());
        assertEquals(ScopeType.COMPILE, child1.getScope());

        final MavenArtifactInfo child2 = resolvedArtifact.getDependencies()[1];
        assertEquals("jar", child2.getExtension());
        assertEquals("1.0.0", child2.getResolvedVersion());
        assertEquals(false, child2.isSnapshotVersion());
        assertEquals("jar", child2.getExtension());
        assertEquals(false, child2.isOptional());
View Full Code Here

                }).asResolvedArtifact();

        // then
        assertEquals("MavenResolvedArtifact list should have two elements", 2, resolvedArtifactInfos.length);

        final MavenResolvedArtifact resolvedArtifact = resolvedArtifactInfos[0];
        assertEquals("Resolved artifact should have one child", 1, resolvedArtifact.getDependencies().length);

        new ValidationUtil("test-deps-optional-1.0.0.jar").validate(resolvedArtifact.as(File.class));

        assertEquals("jar", resolvedArtifact.getExtension());
        assertEquals("1.0.0", resolvedArtifact.getResolvedVersion());
        assertEquals(false, resolvedArtifact.isSnapshotVersion());
        assertEquals("jar", resolvedArtifact.getExtension());
        assertEquals(false, resolvedArtifact.isOptional());
        assertEquals(originalCoordinate, resolvedArtifact.getCoordinate());

        final MavenArtifactInfo child1 = resolvedArtifact.getDependencies()[0];
        assertEquals("jar", child1.getExtension());
        assertEquals("1.0.0", child1.getResolvedVersion());
        assertEquals(false, child1.isSnapshotVersion());
        assertEquals("jar", child1.getExtension());
        assertEquals(true, child1.isOptional());
View Full Code Here

    }

    // SHRINKRES-182
    @Test
    public void resolveEjbFromCentral() {
        MavenResolvedArtifact ejb = Maven.resolver().resolve("org.wicketstuff:javaee-inject-example-ejb:ejb:6.15.0")
                .withoutTransitivity()
                .asSingleResolvedArtifact();

        Assert.assertThat(ejb, not(nullValue()));
        Assert.assertThat(ejb.asFile(), not(nullValue()));
        Assert.assertThat(ejb.getExtension(), is("jar"));
        Assert.assertThat(ejb.getCoordinate().getPackaging(), is(PackagingType.EJB));
    }
View Full Code Here

    }

    // SHRINKRES-182
    @Test
    public void resolveEjbFromLocalRepository() {
        MavenResolvedArtifact ejb = Maven.configureResolver().fromFile(TEST_REPOSITORY_ENABLED_SETTINGS)
                .resolve("org.jboss.shrinkwrap.test:test-ejb:ejb:1.0.0")
                .withoutTransitivity()
                .asSingleResolvedArtifact();

        Assert.assertThat(ejb, not(nullValue()));
        Assert.assertThat(ejb.asFile(), not(nullValue()));
        Assert.assertThat(ejb.getExtension(), is("jar"));
        Assert.assertThat(ejb.getCoordinate().getPackaging(), is(PackagingType.EJB));
    }
View Full Code Here

    }

    // SHRINKRES-182
    @Test
    public void resolveEjbFromPom() {
        MavenResolvedArtifact ejb = Maven.configureResolver().fromFile(TEST_REPOSITORY_ENABLED_SETTINGS)
                .loadPomFromFile("target/poms/test-deps-ejb.xml")
                .importCompileAndRuntimeDependencies()
                .resolve().withTransitivity().asSingleResolvedArtifact();

        Assert.assertThat(ejb, not(nullValue()));
        Assert.assertThat(ejb.asFile(), not(nullValue()));
        Assert.assertThat(ejb.getExtension(), is("jar"));
        Assert.assertThat(ejb.getCoordinate().getPackaging(), is(PackagingType.EJB));
        new ValidationUtil("test-ejb").validate(ejb.asFile());

    }
View Full Code Here

     * SHRINKRES-27
     */
    @Test
    @SuppressWarnings("unused")
    public void dependencyInfo() {
        final MavenResolvedArtifact longhand = Resolvers.use(MavenResolverSystem.class).resolve("G:A:V").withoutTransitivity()
                .asSingle(MavenResolvedArtifact.class);

        final MavenResolvedArtifact shortcut = Maven.resolver().resolve("G:A:V").withoutTransitivity()
                .asSingle(MavenResolvedArtifact.class);
        final MavenCoordinate coordinate = shortcut.getCoordinate();
        final String groupId = coordinate.getGroupId();
        final String artifactId = coordinate.getArtifactId();
        final String version = coordinate.getVersion();
        final String resolvedVersion = shortcut.getResolvedVersion();
        final String type = coordinate.getType().toString();
        final boolean isSnapshot = shortcut.isSnapshotVersion();
        final String classifier = coordinate.getClassifier();
        final File file = shortcut.asFile();
        final File file2 = shortcut.as(File.class);
        final InputStream in = shortcut.as(InputStream.class);
        final InputStream in2 = shortcut.as(InputStream.class);
        final JavaArchive archive = shortcut.as(JavaArchive.class);
    }
View Full Code Here

    // SHRINKRES-162
    @Test
    public void testClassifierAndTestJarTypeMetadat() throws Exception {

        MavenResolvedArtifact artifact = Maven.configureResolver().fromFile("target/settings/profiles/settings.xml")
                .loadPomFromFile("target/poms/test-tests-classifier.xml")
                .resolve("org.jboss.shrinkwrap.test:test-dependency-with-test-jar:test-jar:tests:1.0.0")
                .withoutTransitivity()
                .asSingleResolvedArtifact();

        new ValidationUtil("test-dependency-with-test-jar").validate(artifact.asFile());

        Assert.assertEquals("jar", artifact.getExtension());
        Assert.assertEquals("tests", artifact.getCoordinate().getClassifier());
        Assert.assertEquals(PackagingType.TEST_JAR, artifact.getCoordinate().getPackaging());
    }
View Full Code Here

    public void resolveProvidedDependency() throws Exception {
        final String coordinates = "org.jboss.xnio:xnio-api:jar:3.1.0.Beta7";

        final MavenStrategyStage mss = Maven.configureResolver().fromFile(SETTINGS_XML).resolve(coordinates);
        final MavenFormatStage mfs = mss.using(STRATEGY);
        final MavenResolvedArtifact info = mfs.asSingleResolvedArtifact();
        Assert.assertNotNull(info);
        final MavenArtifactInfo[] dependencies = info.getDependencies();
        Assert.assertNotNull(dependencies);
        // http://search.maven.org/remotecontent?filepath=org/jboss/xnio/xnio-api/3.1.0.Beta7/xnio-api-3.1.0.Beta7.pom
        // there should be org.jboss.logging:jboss-logging and org.jboss.logmanager:jboss-logmanager as provided
        Assert.assertTrue(dependencies.length == 2);
    }
View Full Code Here

        final String expectedVersion = "2.0.0-alpha-5";

        // Resolve an this project's current artifact (a different version) classpath (such that the ClassPathWorkspaceReader
        // picks it up)
        final MavenResolvedArtifact artifact = Maven.resolver().loadPomFromFile("pom.xml")
                .resolve("org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven:" + expectedVersion)
                .withoutTransitivity().asSingleResolvedArtifact();

        final String resolvedFilename = artifact.asFile().getName();

        Assert.assertTrue("Incorrect version was resolved", resolvedFilename.contains(expectedVersion));
    }
View Full Code Here

TOP

Related Classes of org.jboss.shrinkwrap.resolver.api.maven.MavenResolvedArtifact

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.