Search in sources :

Example 1 with PromotionStatus

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

the class BuildInfoBuilderTest method testBuilderAddMethod.

/**
 * Validates the build values after using the builder add methods
 */
public void testBuilderAddMethod() {
    Module module = new Module();
    module.setId("module-id");
    String propertyKey = "key";
    String propertyValue = "value";
    PromotionStatus promotionStatus = new PromotionStatusBuilder("momo").timestampDate(new Date()).build();
    Build build = new BuildInfoBuilder("test").number("4").started("test").addModule(module).addProperty(propertyKey, propertyValue).addStatus(promotionStatus).build();
    List<Module> modules = build.getModules();
    assertFalse(modules.isEmpty(), "A build module should have been added.");
    assertEquals(modules.get(0), module, "Unexpected build module.");
    assertTrue(build.getProperties().containsKey(propertyKey), "A build property should have been added.");
    assertEquals(build.getProperties().get(propertyKey), propertyValue, "Unexpected build property value.");
    List<PromotionStatus> statuses = build.getStatuses();
    assertFalse(statuses.isEmpty(), "Expected a status to be added.");
    assertEquals(statuses.get(0), promotionStatus, "Unexpected added status.");
}
Also used : PromotionStatus(org.jfrog.build.api.release.PromotionStatus) Date(java.util.Date)

Example 2 with PromotionStatus

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

the class BuildInfoMavenBuilderTest method testBuilderAddMethod.

/**
 * Validates the build values after using the builder add methods
 */
public void testBuilderAddMethod() {
    Module module = new Module();
    module.setId("module-id");
    String propertyKey = "key";
    String propertyValue = "value";
    PromotionStatus promotionStatus = new PromotionStatusBuilder("momo").timestampDate(new Date()).build();
    Build build = new BuildInfoBuilder("test").number("4").started("test").addModule(module).addProperty(propertyKey, propertyValue).addStatus(promotionStatus).build();
    List<Module> modules = build.getModules();
    assertFalse(modules.isEmpty(), "A build module should have been added.");
    assertEquals(modules.get(0), module, "Unexpected build module.");
    assertTrue(build.getProperties().containsKey(propertyKey), "A build property should have been added.");
    assertEquals(build.getProperties().get(propertyKey), propertyValue, "Unexpected build property value.");
    List<PromotionStatus> statuses = build.getStatuses();
    assertFalse(statuses.isEmpty(), "Expected a status to be added.");
    assertEquals(statuses.get(0), promotionStatus, "Unexpected added status.");
}
Also used : PromotionStatus(org.jfrog.build.api.release.PromotionStatus) Date(java.util.Date)

Example 3 with PromotionStatus

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

the class PromotionStatusBuilderTest method testDefaultValues.

public void testDefaultValues() {
    PromotionStatus promotionStatus = new PromotionStatusBuilder(Promotion.RELEASED).timestamp("bla").build();
    assertEquals(promotionStatus.getStatus(), Promotion.RELEASED, "Unexpected status type.");
    assertNull(promotionStatus.getComment(), "Expected null comment by default.");
    assertNull(promotionStatus.getRepository(), "Expected null repository by default.");
    assertNull(promotionStatus.getUser(), "Expected null user by default.");
    assertNull(promotionStatus.getCiUser(), "Expected null CI user by default.");
    assertEquals(promotionStatus.getTimestamp(), "bla", "Unexpected status timestamp.");
}
Also used : PromotionStatus(org.jfrog.build.api.release.PromotionStatus)

Example 4 with PromotionStatus

use of org.jfrog.build.api.release.PromotionStatus 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.");
}
Also used : PromotionStatusBuilder(org.jfrog.build.api.builder.PromotionStatusBuilder) PromotionStatus(org.jfrog.build.api.release.PromotionStatus)

Example 5 with PromotionStatus

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

the class BuildTest method testSetters.

/**
 * Validates the build values after using the build setters
 */
public void testSetters() {
    String version = "1.2.0";
    String name = "moo";
    String number = "15";
    BuildType buildType = GRADLE;
    Agent agent = new Agent("pop", "1.6");
    long durationMillis = 6L;
    String principal = "bob";
    String artifactoryPrincipal = "too";
    String artifactoryPluginVersion = "2.3.1";
    String url = "mitz";
    String parentName = "pooh";
    String parentNumber = "5";
    String vcsRevision = "2421";
    List<Module> modules = Lists.newArrayList();
    List<PromotionStatus> statuses = Lists.newArrayList();
    List<BuildDependency> buildDependencies = Arrays.asList(new BuildDependencyBuilder().name("foo").number("123").startedDate(new Date()).build(), new BuildDependencyBuilder().name("bar").number("456").startedDate(new Date()).build());
    Properties properties = new Properties();
    Build build = new Build();
    build.setVersion(version);
    build.setName(name);
    build.setNumber(number);
    build.setType(buildType);
    build.setAgent(agent);
    build.setDurationMillis(durationMillis);
    build.setPrincipal(principal);
    build.setArtifactoryPrincipal(artifactoryPrincipal);
    build.setArtifactoryPluginVersion(artifactoryPluginVersion);
    build.setUrl(url);
    build.setParentName(parentName);
    build.setParentNumber(parentNumber);
    build.setModules(modules);
    build.setStatuses(statuses);
    build.setProperties(properties);
    build.setVcsRevision(vcsRevision);
    build.setBuildDependencies(buildDependencies);
    assertEquals(build.getVersion(), version, "Unexpected build version.");
    assertEquals(build.getName(), name, "Unexpected build name.");
    assertEquals(build.getNumber(), number, "Unexpected build number.");
    assertEquals(build.getType(), buildType, "Unexpected build type.");
    assertEquals(build.getAgent(), agent, "Unexpected build agent.");
    assertEquals(build.getDurationMillis(), durationMillis, "Unexpected build duration millis.");
    assertEquals(build.getPrincipal(), principal, "Unexpected build principal.");
    assertEquals(build.getArtifactoryPrincipal(), artifactoryPrincipal, "Unexpected build artifactory principal.");
    assertEquals(build.getArtifactoryPluginVersion(), artifactoryPluginVersion, "Unexpected build artifactory principal.");
    assertEquals(build.getUrl(), url, "Unexpected build URL.");
    assertEquals(build.getParentName(), parentName, "Unexpected build parent build name.");
    assertEquals(build.getParentNumber(), parentNumber, "Unexpected build parent build number.");
    assertEquals(build.getVcsRevision(), vcsRevision, "Unexpected build vcs revision.");
    assertEquals(build.getModules(), modules, "Unexpected build modules.");
    assertTrue(build.getModules().isEmpty(), "Build modules list should not have been populated.");
    assertEquals(build.getStatuses(), statuses, "Unexpected build statuses.");
    assertTrue(build.getStatuses().isEmpty(), "Build statuses list should not have been populated.");
    assertEquals(build.getProperties(), properties, "Unexpected build properties.");
    assertTrue(build.getProperties().isEmpty(), "Build properties list should not have been populated.");
    assertEquals(build.getBuildDependencies(), buildDependencies, "Unexpected build dependencies list.");
}
Also used : BuildDependencyBuilder(org.jfrog.build.api.builder.dependency.BuildDependencyBuilder) Properties(java.util.Properties) BuildDependency(org.jfrog.build.api.dependency.BuildDependency) Date(java.util.Date) PromotionStatus(org.jfrog.build.api.release.PromotionStatus)

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