use of org.commonjava.maven.galley.maven.parse.PomPeek 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.galley.maven.parse.PomPeek 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.galley.maven.parse.PomPeek 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;
}
use of org.commonjava.maven.galley.maven.parse.PomPeek in project indy by Commonjava.
the class AbstractHttproxFunctionalTest method loadPom.
protected PomRef loadPom(final String name, final Map<String, String> substitutions) {
try {
final InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(name.endsWith(".pom") ? name : 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;
}
Aggregations