Search in sources :

Example 1 with Promotion

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

the class PromotionTest method testConstructor.

public void testConstructor() {
    Set<String> scopes = new HashSet<>();
    Map<String, Collection<String>> properties = new HashMap<>();
    Promotion promotion = new Promotion(Promotion.ROLLED_BACK, "comment", "ciUser", "timestamp", true, "targetRepo", "sourceRepo", false, true, false, scopes, properties, false);
    assertEquals(promotion.getStatus(), Promotion.ROLLED_BACK, "Unexpected status.");
    assertEquals(promotion.getComment(), "comment", "Unexpected comment.");
    assertEquals(promotion.getCiUser(), "ciUser", "Unexpected ci user.");
    assertEquals(promotion.getTimestamp(), "timestamp", "Unexpected timestamp.");
    assertTrue(promotion.isDryRun(), "Unexpected dry run state.");
    assertEquals(promotion.getTargetRepo(), "targetRepo", "Unexpected target repo.");
    assertEquals(promotion.getSourceRepo(), "sourceRepo", "Unexpected source repo.");
    assertFalse(promotion.isCopy(), "Unexpected copy state.");
    assertTrue(promotion.isArtifacts(), "Unexpected artifacts state.");
    assertFalse(promotion.isDependencies(), "Unexpected dependencies state.");
    assertEquals(promotion.getScopes(), scopes, "Unexpected scopes.");
    assertEquals(promotion.getProperties(), properties, "Unexpected properties.");
    assertFalse(promotion.isFailFast(), "Unexpected fail-fast state.");
}
Also used : HashMap(java.util.HashMap) Collection(java.util.Collection) Promotion(org.jfrog.build.api.release.Promotion) HashSet(java.util.HashSet)

Example 2 with Promotion

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

the class ArtifactoryManagerTest method stageBuild.

private void stageBuild(String project) throws IOException {
    Promotion promotion = new PromotionBuilder().build();
    artifactoryManager.stageBuild(BUILD_NAME, BUILD_NUMBER, project, promotion);
}
Also used : PromotionBuilder(org.jfrog.build.api.builder.PromotionBuilder) Promotion(org.jfrog.build.api.release.Promotion)

Example 3 with Promotion

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

the class PromotionTest method testTimestampDateGetters.

public void testTimestampDateGetters() {
    SimpleDateFormat format = new SimpleDateFormat(Build.STARTED_FORMAT);
    Date timestampDate = new Date();
    Promotion promotion = new Promotion(null, null, null, format.format(timestampDate), true, null, null, true, true, true, null, null, false);
    assertEquals(promotion.getTimestampDate(), timestampDate, "Unexpected timestamp date.");
}
Also used : Promotion(org.jfrog.build.api.release.Promotion) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 4 with Promotion

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

the class PromotionTest method testSetters.

public void testSetters() {
    Set<String> scopes = new HashSet<>();
    Map<String, Collection<String>> properties = new HashMap<>();
    Promotion promotion = new Promotion();
    promotion.setStatus(Promotion.ROLLED_BACK);
    promotion.setComment("comment");
    promotion.setCiUser("ciUser");
    promotion.setTimestamp("timestamp");
    promotion.setDryRun(true);
    promotion.setTargetRepo("targetRepo");
    promotion.setSourceRepo("sourceRepo");
    promotion.setCopy(false);
    promotion.setArtifacts(true);
    promotion.setDependencies(false);
    promotion.setScopes(scopes);
    promotion.setProperties(properties);
    promotion.setFailFast(false);
    assertEquals(promotion.getStatus(), Promotion.ROLLED_BACK, "Unexpected status.");
    assertEquals(promotion.getComment(), "comment", "Unexpected comment.");
    assertEquals(promotion.getCiUser(), "ciUser", "Unexpected ci user.");
    assertEquals(promotion.getTimestamp(), "timestamp", "Unexpected timestamp.");
    assertTrue(promotion.isDryRun(), "Unexpected dry run state.");
    assertEquals(promotion.getTargetRepo(), "targetRepo", "Unexpected target repo.");
    assertEquals(promotion.getSourceRepo(), "sourceRepo", "Unexpected source repo.");
    assertFalse(promotion.isCopy(), "Unexpected copy state.");
    assertTrue(promotion.isArtifacts(), "Unexpected artifacts state.");
    assertFalse(promotion.isDependencies(), "Unexpected dependencies state.");
    assertEquals(promotion.getScopes(), scopes, "Unexpected scopes.");
    assertEquals(promotion.getProperties(), properties, "Unexpected properties.");
    assertFalse(promotion.isFailFast(), "Unexpected fail-fast state.");
}
Also used : HashMap(java.util.HashMap) Collection(java.util.Collection) Promotion(org.jfrog.build.api.release.Promotion) HashSet(java.util.HashSet)

Example 5 with Promotion

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

the class PromotionTest method testNullTimestampDateGetter.

public void testNullTimestampDateGetter() {
    Promotion promotion = new Promotion(null, null, null, null, true, null, null, true, true, true, null, null, false);
    assertNull(promotion.getTimestampDate(), "No timestamp was set. Should have received null");
}
Also used : Promotion(org.jfrog.build.api.release.Promotion)

Aggregations

Promotion (org.jfrog.build.api.release.Promotion)15 Collection (java.util.Collection)4 HashMap (java.util.HashMap)4 HashSet (java.util.HashSet)4 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 PromotionBuilder (org.jfrog.build.api.builder.PromotionBuilder)1