use of org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef in project pom-manipulation-ext by release-engineering.
the class Project method modelKey.
public static ProjectVersionRef modelKey(final Model model) throws ManipulationException {
String g = model.getGroupId();
String v = model.getVersion();
if (g == null || v == null) {
final Parent p = model.getParent();
if (p == null) {
throw new ManipulationException("Invalid model: " + model + " Cannot find groupId and/or version!");
}
if (g == null) {
g = p.getGroupId();
}
if (v == null) {
v = p.getVersion();
}
}
final String a = model.getArtifactId();
return new SimpleProjectVersionRef(g, a, v);
}
use of org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef in project pom-manipulation-ext by release-engineering.
the class HttpErrorTranslatorTest method testTranslateVersionsWith404.
@Test
public void testTranslateVersionsWith404() {
List<ProjectVersionRef> gavs = new ArrayList<ProjectVersionRef>() {
{
add(new SimpleProjectVersionRef("com.example", "example", "1.0"));
add(new SimpleProjectVersionRef("org.commonjava", "example", "1.1"));
}
};
try {
versionTranslator.translateVersions(gavs);
fail("Failed to throw RestException when server failed to respond.");
} catch (RestException ex) {
// Pass
}
}
use of org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef in project pom-manipulation-ext by release-engineering.
the class RESTParametersVersionSuffixTest method testVerifySuffix.
@Test
public void testVerifySuffix() {
this.versionTranslator = new DefaultTranslator(mockServer.getUrl(), RestProtocol.PNC13, 0, Translator.CHUNK_SPLIT_COUNT, "", suffix);
List<ProjectVersionRef> gavs = new ArrayList<ProjectVersionRef>() {
{
add(new SimpleProjectVersionRef("com.example", "example", "1.0"));
}
};
versionTranslator.translateVersions(gavs);
assertTrue(suffix.equals(gavSchema.versionSuffix));
}
use of org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef in project pom-manipulation-ext by release-engineering.
the class RESTParametersVersionSuffixTest method testVerifyNoSuffix.
@Test
public void testVerifyNoSuffix() {
this.versionTranslator = new DefaultTranslator(mockServer.getUrl(), RestProtocol.PNC13, 0, Translator.CHUNK_SPLIT_COUNT, "", "");
List<ProjectVersionRef> gavs = new ArrayList<ProjectVersionRef>() {
{
add(new SimpleProjectVersionRef("com.example", "example", "1.0"));
}
};
versionTranslator.translateVersions(gavs);
assertTrue(gavSchema.versionSuffix == null);
}
use of org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef in project pom-manipulation-ext by release-engineering.
the class VersionTranslatorTest method testTranslateVersions.
@Test
public void testTranslateVersions() {
List<ProjectVersionRef> gavs = new ArrayList<ProjectVersionRef>() {
{
add(new SimpleProjectVersionRef("com.example", "example", "1.0"));
add(new SimpleProjectVersionRef("com.example", "example-dep", "2.0"));
add(new SimpleProjectVersionRef("org.commonjava", "example", "1.0"));
add(new SimpleProjectVersionRef("org.commonjava", "example", "1.1"));
}
};
Map<ProjectVersionRef, String> actualResult = versionTranslator.translateVersions(gavs);
Map<ProjectVersionRef, String> expectedResult = new HashMap<ProjectVersionRef, String>() {
{
put(new SimpleProjectVersionRef("com.example", "example", "1.0"), "1.0-redhat-1");
put(new SimpleProjectVersionRef("com.example", "example-dep", "2.0"), "2.0-redhat-1");
put(new SimpleProjectVersionRef("org.commonjava", "example", "1.0"), "1.0-redhat-1");
put(new SimpleProjectVersionRef("org.commonjava", "example", "1.1"), "1.1-redhat-1");
}
};
assertThat(actualResult, is(expectedResult));
}
Aggregations