Search in sources :

Example 1 with ProjectVersionRef

use of org.commonjava.maven.atlas.ident.ref.ProjectVersionRef in project galley by Commonjava.

the class MavenPomViewTest method artifactIdWithWhitespace.

@Test
public void artifactIdWithWhitespace() throws Exception {
    final MavenPomView pomView = loadPoms("pom-with-whitespace-artifactId.xml");
    final String aid = pomView.getArtifactId();
    final ProjectVersionRef pvr = pomView.asProjectVersionRef();
    assertThat(aid, equalTo("bar-project"));
    assertThat(pvr.getArtifactId(), equalTo("bar-project"));
}
Also used : ProjectVersionRef(org.commonjava.maven.atlas.ident.ref.ProjectVersionRef) SimpleProjectVersionRef(org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef) Test(org.junit.Test)

Example 2 with ProjectVersionRef

use of org.commonjava.maven.atlas.ident.ref.ProjectVersionRef in project galley by Commonjava.

the class MavenPomViewTest method buildExtension.

@Test
public void buildExtension() throws Exception {
    MavenPomView pomView = loadPoms("pom-with-build-ext.xml");
    List<ExtensionView> extensions = pomView.getBuildExtensions();
    assertThat(extensions, notNullValue());
    assertThat(extensions.size(), equalTo(1));
    assertThat(extensions.get(0).asProjectVersionRef(), equalTo((ProjectVersionRef) new SimpleProjectVersionRef("ext.group", "ext-artifact", "1.0")));
}
Also used : ProjectVersionRef(org.commonjava.maven.atlas.ident.ref.ProjectVersionRef) SimpleProjectVersionRef(org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef) SimpleProjectVersionRef(org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef) Test(org.junit.Test)

Example 3 with ProjectVersionRef

use of org.commonjava.maven.atlas.ident.ref.ProjectVersionRef in project galley by Commonjava.

the class MavenPomViewTest method groupIdFailOverToParent.

@Test
public void groupIdFailOverToParent() throws Exception {
    final MavenPomView pomView = loadPoms("pom-with-parent-groupId.xml", "simple-parent-pom.xml");
    final String gid = pomView.getGroupId();
    final ProjectVersionRef pvr = pomView.asProjectVersionRef();
    assertThat(gid, equalTo("org.foo"));
    assertThat(pvr.getGroupId(), equalTo("org.foo"));
}
Also used : ProjectVersionRef(org.commonjava.maven.atlas.ident.ref.ProjectVersionRef) SimpleProjectVersionRef(org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef) Test(org.junit.Test)

Example 4 with ProjectVersionRef

use of org.commonjava.maven.atlas.ident.ref.ProjectVersionRef in project galley by Commonjava.

the class MavenPomViewTest method profileBuildExtension.

@Test
public void profileBuildExtension() throws Exception {
    MavenPomView pomView = loadPoms(new String[] { "test" }, "pom-with-profile-build-ext.xml");
    List<ExtensionView> extensions = pomView.getBuildExtensions();
    assertThat(extensions, notNullValue());
    assertThat(extensions.size(), equalTo(1));
    assertThat(extensions.get(0).asProjectVersionRef(), equalTo((ProjectVersionRef) new SimpleProjectVersionRef("ext.group", "ext-artifact", "1.0")));
}
Also used : ProjectVersionRef(org.commonjava.maven.atlas.ident.ref.ProjectVersionRef) SimpleProjectVersionRef(org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef) SimpleProjectVersionRef(org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef) Test(org.junit.Test)

Example 5 with ProjectVersionRef

use of org.commonjava.maven.atlas.ident.ref.ProjectVersionRef in project galley by Commonjava.

the class XMLInfrastructureTest method parseParentRef.

@Test
public void parseParentRef() throws Exception {
    final Document doc = loadDocument("pom-with-parent.xml");
    final ProjectVersionRef parentRef = new XMLInfrastructure().getParentRef(doc);
    assertThat(parentRef, notNullValue());
}
Also used : ProjectVersionRef(org.commonjava.maven.atlas.ident.ref.ProjectVersionRef) Document(org.w3c.dom.Document) Test(org.junit.Test)

Aggregations

ProjectVersionRef (org.commonjava.maven.atlas.ident.ref.ProjectVersionRef)42 SimpleProjectVersionRef (org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef)22 Test (org.junit.Test)22 ConcreteResource (org.commonjava.maven.galley.model.ConcreteResource)12 TestDownload (org.commonjava.maven.galley.testing.core.transport.job.TestDownload)11 MavenPomView (org.commonjava.maven.galley.maven.model.view.MavenPomView)10 URI (java.net.URI)9 JoinString (org.commonjava.maven.atlas.ident.util.JoinString)9 GalleyMavenException (org.commonjava.maven.galley.maven.GalleyMavenException)9 Transfer (org.commonjava.maven.galley.model.Transfer)9 EventMetadata (org.commonjava.maven.galley.event.EventMetadata)8 PomPeek (org.commonjava.maven.galley.maven.parse.PomPeek)8 InvalidVersionSpecificationException (org.commonjava.maven.atlas.ident.version.InvalidVersionSpecificationException)6 Document (org.w3c.dom.Document)6 File (java.io.File)5 ArrayList (java.util.ArrayList)5 LinkedHashMap (java.util.LinkedHashMap)5 EProjectDirectRelationships (org.commonjava.maven.atlas.graph.model.EProjectDirectRelationships)5 InvalidRefException (org.commonjava.maven.atlas.ident.ref.InvalidRefException)5 PluginDependencyView (org.commonjava.maven.galley.maven.model.view.PluginDependencyView)5