use of org.jfrog.build.api.builder.PromotionStatusBuilder in project build-info by JFrogDev.
the class BuildTest method testStatusAddMethod.
public void testStatusAddMethod() {
Build build = new Build();
assertNull(build.getStatuses(), "Default status list should be null.");
PromotionStatus promotionStatus = new PromotionStatusBuilder(Promotion.RELEASED).repository("bla").timestamp("bla").user("bla").build();
build.addStatus(promotionStatus);
assertFalse(build.getStatuses().isEmpty(), "Status object should have been added.");
assertEquals(build.getStatuses().get(0), promotionStatus, "Unexpected status object.");
PromotionStatus anotherPromotionStatus = new PromotionStatusBuilder(Promotion.RELEASED).repository("bla").timestamp("bla").user("bla").build();
build.addStatus(anotherPromotionStatus);
assertEquals(build.getStatuses().size(), 2, "Second status object should have been added.");
assertEquals(build.getStatuses().get(1), anotherPromotionStatus, "Unexpected status object.");
}
use of org.jfrog.build.api.builder.PromotionStatusBuilder in project build-info by JFrogDev.
the class BuildInfoModelPropertyResolver method attachStagingIfNeeded.
private void attachStagingIfNeeded(ArtifactoryClientConfiguration clientConf, BuildInfoMavenBuilder builder) {
if (clientConf.info.isReleaseEnabled()) {
String stagingRepository = clientConf.publisher.getRepoKey();
String comment = clientConf.info.getReleaseComment();
if (comment == null) {
comment = "";
}
String buildStartedIso = clientConf.info.getBuildStarted();
Date buildStartDate;
try {
buildStartDate = new SimpleDateFormat(Build.STARTED_FORMAT).parse(buildStartedIso);
} catch (ParseException e) {
throw new IllegalArgumentException("Build start date format error: " + buildStartedIso, e);
}
builder.addStatus(new PromotionStatusBuilder(Promotion.STAGED).timestampDate(buildStartDate).comment(comment).repository(stagingRepository).ciUser(clientConf.info.getPrincipal()).user(clientConf.publisher.getUsername()).build());
}
}
Aggregations