Search in sources :

Example 6 with ArtifactPlans

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));
}
Also used : ArtifactPlans(com.thoughtworks.go.config.ArtifactPlans) ArtifactPlan(com.thoughtworks.go.config.ArtifactPlan) TestArtifactPlan(com.thoughtworks.go.config.TestArtifactPlan) Test(org.junit.Test)

Example 7 with ArtifactPlans

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")));
}
Also used : ArtifactPlans(com.thoughtworks.go.config.ArtifactPlans) ArtifactPlan(com.thoughtworks.go.config.ArtifactPlan) TestArtifactPlan(com.thoughtworks.go.config.TestArtifactPlan) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) TestArtifactPlan(com.thoughtworks.go.config.TestArtifactPlan) Test(org.junit.Test)

Example 8 with ArtifactPlans

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));
}
Also used : ArtifactPlans(com.thoughtworks.go.config.ArtifactPlans) ArtifactPlan(com.thoughtworks.go.config.ArtifactPlan) TestArtifactPlan(com.thoughtworks.go.config.TestArtifactPlan) Test(org.junit.Test)

Aggregations

ArtifactPlan (com.thoughtworks.go.config.ArtifactPlan)8 ArtifactPlans (com.thoughtworks.go.config.ArtifactPlans)8 TestArtifactPlan (com.thoughtworks.go.config.TestArtifactPlan)8 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2