use of com.thoughtworks.go.config.ArtifactPlans in project gocd by gocd.
the class ArtifactPlansTest method shouldClearAllArtifactsWhenTheMapIsNull.
@Test
public void shouldClearAllArtifactsWhenTheMapIsNull() {
ArtifactPlans artifactPlans = new ArtifactPlans();
artifactPlans.add(new ArtifactPlan("src", "dest"));
artifactPlans.setConfigAttributes(null);
assertThat(artifactPlans.size(), is(0));
}
use of com.thoughtworks.go.config.ArtifactPlans in project gocd by gocd.
the class ArtifactPlansTest method setConfigAttributes_shouldIgnoreEmptySourceAndDest.
@Test
public void setConfigAttributes_shouldIgnoreEmptySourceAndDest() {
HashMap<String, String> artifactPlan1 = new HashMap<>();
artifactPlan1.put(SRC, "blah");
artifactPlan1.put(DEST, "something");
artifactPlan1.put("artifactTypeValue", TestArtifactPlan.TEST_PLAN_DISPLAY_NAME);
HashMap<String, String> artifactPlan2 = new HashMap<>();
artifactPlan2.put(SRC, "blah2");
artifactPlan2.put(DEST, "something2");
artifactPlan2.put("artifactTypeValue", ArtifactPlan.ARTIFACT_PLAN_DISPLAY_NAME);
HashMap<String, String> artifactPlan3 = new HashMap<>();
artifactPlan3.put(SRC, "");
artifactPlan3.put(DEST, "");
artifactPlan3.put("artifactTypeValue", ArtifactPlan.ARTIFACT_PLAN_DISPLAY_NAME);
List<HashMap> artifactPlansList = new ArrayList<>();
artifactPlansList.add(artifactPlan1);
artifactPlansList.add(artifactPlan3);
artifactPlansList.add(artifactPlan2);
ArtifactPlans artifactPlans = new ArtifactPlans();
artifactPlans.setConfigAttributes(artifactPlansList);
assertThat(artifactPlans.size(), is(2));
TestArtifactPlan plan = new TestArtifactPlan();
plan.setSrc("blah");
plan.setDest("something");
assertThat(artifactPlans.get(0), is(plan));
assertThat(artifactPlans.get(1), is(new ArtifactPlan("blah2", "something2")));
}
use of com.thoughtworks.go.config.ArtifactPlans in project gocd by gocd.
the class ArtifactPlansTest method shouldAddDuplicatedArtifactSoThatValidationKicksIn.
@Test
public void shouldAddDuplicatedArtifactSoThatValidationKicksIn() throws Exception {
final ArtifactPlans artifactPlans = new ArtifactPlans();
assertThat(artifactPlans.size(), is(0));
artifactPlans.add(new ArtifactPlan("src", "dest"));
artifactPlans.add(new ArtifactPlan("src", "dest"));
assertThat(artifactPlans.size(), is(2));
}
Aggregations