Search in sources :

Example 6 with PromotionStatus

use of org.jfrog.build.api.release.PromotionStatus in project build-info by JFrogDev.

the class PromotionStatusTest method testConstructor.

public void testConstructor() {
    PromotionStatus promotionStatus = new PromotionStatus(Promotion.ROLLED_BACK, "momo", "popo", "koko", "jojo", "bobo");
    assertEquals(promotionStatus.getStatus(), Promotion.ROLLED_BACK, "Unexpected status.");
    assertEquals(promotionStatus.getComment(), "momo", "Unexpected comment.");
    assertEquals(promotionStatus.getRepository(), "popo", "Unexpected repository.");
    assertEquals(promotionStatus.getTimestamp(), "koko", "Unexpected timestamp.");
    assertEquals(promotionStatus.getUser(), "jojo", "Unexpected user.");
    assertEquals(promotionStatus.getCiUser(), "bobo", "Unexpected user.");
}
Also used : PromotionStatus(org.jfrog.build.api.release.PromotionStatus)

Example 7 with PromotionStatus

use of org.jfrog.build.api.release.PromotionStatus in project build-info by JFrogDev.

the class ArtifactoryBuildInfoClientTest method sendBuildInfoTest.

/**
 * Send build info to artifactory, receive it and compare.
 */
@Test
public void sendBuildInfoTest() throws IOException {
    final String BUILD_NAME = "ArtifactoryBuildInfoClientTest";
    final String BUILD_NUMBER = "13";
    final Date STARTED = new Date();
    final List<Vcs> VCS = Lists.newArrayList(new Vcs("foo", "1"), new Vcs("bar", "2"), new Vcs("baz", "3"));
    final List<MatrixParameter> RUN_PARAMETERS = Lists.newArrayList(new MatrixParameter("a", "b"), new MatrixParameter("c", "d"));
    final Module module = new Module();
    module.setId("foo");
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Build.STARTED_FORMAT);
    final List<PromotionStatus> STATUSES = Lists.newArrayList(new PromotionStatus("a", "b", "c", simpleDateFormat.format(STARTED), "e", "f"));
    BuildInfoBuilder buildInfoBuilder = new BuildInfoBuilder(BUILD_NAME).number(BUILD_NUMBER).buildAgent(new BuildAgent("agent11", "11")).agent(new Agent("agent22", "22")).startedDate(STARTED).durationMillis(100).principal("foo").artifactoryPrincipal(getUsername()).artifactoryPluginVersion("2.3.1").url(getUrl()).parentName("baz").parentNumber("10").vcs(VCS).licenseControl(new LicenseControl(false)).buildRetention(new BuildRetention(true)).buildRunParameters(RUN_PARAMETERS).modules(Lists.newArrayList(module)).statuses(STATUSES).issues(new Issues());
    Build buildInfoToSend = buildInfoBuilder.build();
    // Publish build info
    buildInfoClient.sendBuildInfo(buildInfoToSend);
    // Get build info
    Build receivedBuildInfo = buildInfoClient.getBuildInfo(BUILD_NAME, BUILD_NUMBER);
    // Compare
    Assert.assertEquals(buildInfoClient.toJsonString(buildInfoToSend), buildInfoClient.toJsonString(receivedBuildInfo));
}
Also used : Date(java.util.Date) BuildInfoBuilder(org.jfrog.build.api.builder.BuildInfoBuilder) PromotionStatus(org.jfrog.build.api.release.PromotionStatus) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.testng.annotations.Test)

Example 8 with PromotionStatus

use of org.jfrog.build.api.release.PromotionStatus in project build-info by JFrogDev.

the class PromotionStatusBuilderTest method testNormalValues.

public void testNormalValues() {
    PromotionStatusBuilder builderPromotion = new PromotionStatusBuilder(Promotion.ROLLED_BACK).comment("momo").repository("popo").timestamp("koko").user("jojo").ciUser("bobo");
    PromotionStatus promotionStatus = builderPromotion.build();
    assertEquals(promotionStatus.getStatus(), Promotion.ROLLED_BACK, "Unexpected status.");
    assertEquals(promotionStatus.getComment(), "momo", "Unexpected comment.");
    assertEquals(promotionStatus.getRepository(), "popo", "Unexpected repository.");
    assertEquals(promotionStatus.getTimestamp(), "koko", "Unexpected timestamp.");
    assertEquals(promotionStatus.getUser(), "jojo", "Unexpected user.");
    assertEquals(promotionStatus.getCiUser(), "bobo", "Unexpected ci user.");
    Date date = new Date();
    String expectedTimeStamp = new SimpleDateFormat(Build.STARTED_FORMAT).format(date);
    builderPromotion.timestampDate(date);
    promotionStatus = builderPromotion.build();
    assertEquals(promotionStatus.getTimestamp(), expectedTimeStamp, "Unexpected timestamp.");
}
Also used : PromotionStatus(org.jfrog.build.api.release.PromotionStatus) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Aggregations

PromotionStatus (org.jfrog.build.api.release.PromotionStatus)8 Date (java.util.Date)5 SimpleDateFormat (java.text.SimpleDateFormat)2 Properties (java.util.Properties)1 BuildInfoBuilder (org.jfrog.build.api.builder.BuildInfoBuilder)1 PromotionStatusBuilder (org.jfrog.build.api.builder.PromotionStatusBuilder)1 BuildDependencyBuilder (org.jfrog.build.api.builder.dependency.BuildDependencyBuilder)1 BuildDependency (org.jfrog.build.api.dependency.BuildDependency)1 Test (org.testng.annotations.Test)1