use of com.thoughtworks.go.config.ArtifactConfig in project gocd by gocd.
the class ArtifactConfigsTest method shouldAddDuplicatedArtifactSoThatValidationKicksIn.
@Test
public void shouldAddDuplicatedArtifactSoThatValidationKicksIn() throws Exception {
final ArtifactConfigs artifactConfigs = new ArtifactConfigs();
assertThat(artifactConfigs.size(), is(0));
artifactConfigs.add(new ArtifactConfig("src", "dest"));
artifactConfigs.add(new ArtifactConfig("src", "dest"));
assertThat(artifactConfigs.size(), is(2));
}
use of com.thoughtworks.go.config.ArtifactConfig in project gocd by gocd.
the class ArtifactConfigsTest method shouldClearAllArtifactsWhenTheMapIsNull.
@Test
public void shouldClearAllArtifactsWhenTheMapIsNull() {
ArtifactConfigs artifactConfigs = new ArtifactConfigs();
artifactConfigs.add(new ArtifactConfig("src", "dest"));
artifactConfigs.setConfigAttributes(null);
assertThat(artifactConfigs.size(), is(0));
}
use of com.thoughtworks.go.config.ArtifactConfig in project gocd by gocd.
the class ArtifactConfigsTest method shouldLoadArtifactPlans.
@Test
public void shouldLoadArtifactPlans() {
HashMap<String, String> artifactPlan1 = new HashMap<>();
artifactPlan1.put(SRC, "blah");
artifactPlan1.put(DEST, "something");
artifactPlan1.put("artifactTypeValue", TestArtifactConfig.TEST_PLAN_DISPLAY_NAME);
HashMap<String, String> artifactPlan2 = new HashMap<>();
artifactPlan2.put(SRC, "blah2");
artifactPlan2.put(DEST, "something2");
artifactPlan2.put("artifactTypeValue", ArtifactConfig.ARTIFACT_PLAN_DISPLAY_NAME);
List<HashMap> artifactPlansList = new ArrayList<>();
artifactPlansList.add(artifactPlan1);
artifactPlansList.add(artifactPlan2);
ArtifactConfigs artifactConfigs = new ArtifactConfigs();
artifactConfigs.setConfigAttributes(artifactPlansList);
assertThat(artifactConfigs.size(), is(2));
TestArtifactConfig plan = new TestArtifactConfig();
plan.setSource("blah");
plan.setDestination("something");
assertThat(artifactConfigs.get(0), is(plan));
assertThat(artifactConfigs.get(1), is(new ArtifactConfig("blah2", "something2")));
}
use of com.thoughtworks.go.config.ArtifactConfig in project gocd by gocd.
the class ArtifactConfigsTest method shouldValidateTree.
@Test
public void shouldValidateTree() {
ArtifactConfigs artifactConfigs = new ArtifactConfigs();
artifactConfigs.add(new ArtifactConfig("src", "dest"));
artifactConfigs.add(new ArtifactConfig("src", "dest"));
artifactConfigs.add(new ArtifactConfig("src", "../a"));
artifactConfigs.validateTree(null);
assertThat(artifactConfigs.get(0).errors().on(ArtifactConfig.DEST), is("Duplicate artifacts defined."));
assertThat(artifactConfigs.get(0).errors().on(ArtifactConfig.SRC), is("Duplicate artifacts defined."));
assertThat(artifactConfigs.get(1).errors().on(ArtifactConfig.DEST), is("Duplicate artifacts defined."));
assertThat(artifactConfigs.get(1).errors().on(ArtifactConfig.SRC), is("Duplicate artifacts defined."));
assertThat(artifactConfigs.get(2).errors().on(ArtifactConfig.DEST), is("Invalid destination path. Destination path should match the pattern " + FilePathTypeValidator.PATH_PATTERN));
}
Aggregations