use of org.commonjava.maven.atlas.ident.ref.ProjectVersionRef in project galley by Commonjava.
the class PomPeekTest method findGAVInheritedFromParentWithGroupAndVersionOverrideAtTop.
@Test
public void findGAVInheritedFromParentWithGroupAndVersionOverrideAtTop() throws Exception {
final File pom = getResourceFile(BASE + "inherited-gav-with-group-override-at-top.pom");
final PomPeek peek = new PomPeek(pom);
final ProjectVersionRef key = peek.getKey();
assertThat(key, notNullValue());
assertThat(key.getGroupId(), equalTo("a-different-test-group"));
assertThat(key.getArtifactId(), equalTo("inherited-gav-with-group-override-at-top"));
assertThat(key.getVersionString(), equalTo("1"));
}
use of org.commonjava.maven.atlas.ident.ref.ProjectVersionRef in project galley by Commonjava.
the class PomPeekTest method findGAVInheritedFromParentWithVersionOverrideAtTop.
@Test
public void findGAVInheritedFromParentWithVersionOverrideAtTop() {
final File pom = getResourceFile(BASE + "inherited-gav-with-override-at-top.pom");
final PomPeek peek = new PomPeek(pom);
assertThat(peek.getKey(), notNullValue());
final ProjectVersionRef key = peek.getKey();
assertThat(key.getGroupId(), equalTo("test"));
assertThat(key.getArtifactId(), equalTo("inherited-gav-with-override-at-top"));
assertThat(key.getVersionString(), equalTo("2"));
}
use of org.commonjava.maven.atlas.ident.ref.ProjectVersionRef in project galley by Commonjava.
the class PomPeekTest method findGAVInheritedFromParentAtTop.
@Test
public void findGAVInheritedFromParentAtTop() {
final File pom = getResourceFile(BASE + "inherited-gav-at-top.pom");
final PomPeek peek = new PomPeek(pom);
assertThat(peek.getKey(), notNullValue());
final ProjectVersionRef key = peek.getKey();
assertThat(key.getGroupId(), equalTo("test"));
assertThat(key.getArtifactId(), equalTo("inherited-gav-at-top"));
assertThat(key.getVersionString(), equalTo("1"));
}
use of org.commonjava.maven.atlas.ident.ref.ProjectVersionRef in project indy by Commonjava.
the class AbstractSkimFunctionalTest method loadPom.
protected PomRef loadPom(final String name, final Map<String, String> substitutions) {
try {
final InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(name + ".pom");
String pom = IOUtils.toString(stream);
IOUtils.closeQuietly(stream);
for (final Map.Entry<String, String> entry : substitutions.entrySet()) {
pom = pom.replace("@" + entry.getKey() + "@", entry.getValue());
}
final PomPeek peek = new PomPeek(pom, false);
final ProjectVersionRef gav = peek.getKey();
final String path = String.format("%s/%s/%s/%s-%s.pom", gav.getGroupId().replace('.', '/'), gav.getArtifactId(), gav.getVersionString(), gav.getArtifactId(), gav.getVersionString());
return new PomRef(pom, path);
} catch (final Exception e) {
e.printStackTrace();
fail("Failed to read POM from: " + name);
}
return null;
}
use of org.commonjava.maven.atlas.ident.ref.ProjectVersionRef in project indy by Commonjava.
the class HttpProxyTest method loadPom.
protected PomRef loadPom(final String name, final Map<String, String> substitutions) {
try {
final String resource = name.endsWith(".pom") ? name : name + ".pom";
logger.info("Loading POM: {}", resource);
final InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
String pom = IOUtils.toString(stream);
IOUtils.closeQuietly(stream);
for (final Map.Entry<String, String> entry : substitutions.entrySet()) {
pom = pom.replace("@" + entry.getKey() + "@", entry.getValue());
}
final PomPeek peek = new PomPeek(pom, false);
final ProjectVersionRef gav = peek.getKey();
final String path = String.format("%s/%s/%s/%s-%s.pom", gav.getGroupId().replace('.', '/'), gav.getArtifactId(), gav.getVersionString(), gav.getArtifactId(), gav.getVersionString());
return new PomRef(pom, path);
} catch (final Exception e) {
e.printStackTrace();
fail("Failed to read POM from: " + name);
}
return null;
}
Aggregations