Search in sources :

Example 6 with Promotion

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

the class PromotionBuilderTest method testNormalValues.

public void testNormalValues() {
    Set<String> scopes = new HashSet<>();
    Map<String, Collection<String>> properties = new HashMap<>();
    Promotion promotion = new PromotionBuilder().status(Promotion.ROLLED_BACK).comment("comment").ciUser("ciUser").timestamp("timestamp").dryRun(true).targetRepo("targetRepo").sourceRepo("sourceRepo").copy(false).artifacts(true).dependencies(false).scopes(scopes).properties(properties).failFast(false).build();
    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 : Promotion(org.jfrog.build.api.release.Promotion)

Example 7 with Promotion

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

the class PromotionBuilderTest method testDefaultValues.

public void testDefaultValues() {
    Promotion promotion = new PromotionBuilder().build();
    assertNull(promotion.getStatus(), "Unexpected default status.");
    assertNull(promotion.getComment(), "Unexpected default comment.");
    assertNull(promotion.getCiUser(), "Unexpected default ci user.");
    assertNull(promotion.getTimestamp(), "Unexpected default timestamp.");
    assertFalse(promotion.isDryRun(), "Unexpected default dry run state.");
    assertNull(promotion.getTargetRepo(), "Unexpected default target repo.");
    assertNull(promotion.getSourceRepo(), "Unexpected default source repo.");
    assertFalse(promotion.isCopy(), "Unexpected default copy state.");
    assertTrue(promotion.isArtifacts(), "Unexpected default artifacts state.");
    assertFalse(promotion.isDependencies(), "Unexpected default dependencies state.");
    assertNull(promotion.getScopes(), "Unexpected default scopes.");
    assertNull(promotion.getProperties(), "Unexpected default properties.");
    assertTrue(promotion.isFailFast(), "Unexpected default fail-fast state.");
}
Also used : Promotion(org.jfrog.build.api.release.Promotion)

Example 8 with Promotion

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

the class PromotionBuilderTest method testAddScopesAndPropertiesToEmptyDefaults.

public void testAddScopesAndPropertiesToEmptyDefaults() {
    Promotion build = new PromotionBuilder().addProperty("momo", "popo").addScope("koko").build();
    Map<String, Collection<String>> properties = build.getProperties();
    Set<String> scopes = build.getScopes();
    assertNotNull(properties, "Properties multimap should have been created.");
    assertNotNull(scopes, "Scope set should have been created.");
    assertFalse(properties.isEmpty(), "Added properties should have been added.");
    assertFalse(scopes.isEmpty(), "Added scopes should have been added.");
    assertEquals(properties.get("momo").iterator().next(), "popo", "Unexpected properties value.");
    assertTrue(scopes.contains("koko"), "Unable to find expected scopes value.");
}
Also used : Promotion(org.jfrog.build.api.release.Promotion)

Example 9 with Promotion

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

the class PromotionBuilderTest method testAddScopesAndPropertiesToExistingCollections.

public void testAddScopesAndPropertiesToExistingCollections() {
    Set<String> initialScopes = CommonUtils.newHashSet("koko");
    Map<String, Collection<String>> initialProperties = new HashMap<>();
    initialProperties.put("momo", CommonUtils.newHashSet("popo"));
    Promotion build = new PromotionBuilder().properties(initialProperties).addProperty("jojo", "lolo").scopes(initialScopes).addScope("bobo").build();
    Map<String, Collection<String>> properties = build.getProperties();
    Set<String> scopes = build.getScopes();
    assertNotNull(properties, "Properties multimap should have been created.");
    assertNotNull(scopes, "Scope set should have been created.");
    assertFalse(properties.isEmpty(), "Added properties should have been added.");
    assertFalse(scopes.isEmpty(), "Added scopes should have been added.");
    assertEquals(properties.get("momo").iterator().next(), "popo", "Unexpected properties value.");
    assertEquals(properties.get("jojo").iterator().next(), "lolo", "Unexpected properties value.");
    assertTrue(scopes.contains("koko"), "Unable to find expected scopes value.");
    assertTrue(scopes.contains("bobo"), "Unable to find expected scopes value.");
}
Also used : Promotion(org.jfrog.build.api.release.Promotion)

Example 10 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)

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