use of com.thoughtworks.go.config.TestArtifactConfig in project gocd by gocd.
the class ArtifactConfigsTest 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", 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);
HashMap<String, String> artifactPlan3 = new HashMap<>();
artifactPlan3.put(SRC, "");
artifactPlan3.put(DEST, "");
artifactPlan3.put("artifactTypeValue", ArtifactConfig.ARTIFACT_PLAN_DISPLAY_NAME);
List<HashMap> artifactPlansList = new ArrayList<>();
artifactPlansList.add(artifactPlan1);
artifactPlansList.add(artifactPlan3);
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.TestArtifactConfig in project gocd by gocd.
the class ArtifactPlanTest method toArtifactPlans_shouldConvertArtifactConfigsToArtifactPlanList.
@Test
public void toArtifactPlans_shouldConvertArtifactConfigsToArtifactPlanList() {
final PluggableArtifactConfig artifactConfig = new PluggableArtifactConfig("id", "storeId", create("Foo", true, "Bar"));
final ArtifactConfigs artifactConfigs = new ArtifactConfigs(Arrays.asList(new ArtifactConfig("source", "destination"), new TestArtifactConfig("test-source", "test-destination"), artifactConfig));
final List<ArtifactPlan> artifactPlans = ArtifactPlan.toArtifactPlans(artifactConfigs);
assertThat(artifactPlans, containsInAnyOrder(new ArtifactPlan(ArtifactType.file, "source", "destination"), new ArtifactPlan(ArtifactType.unit, "test-source", "test-destination"), new ArtifactPlan(artifactConfig.toJSON())));
}
use of com.thoughtworks.go.config.TestArtifactConfig 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")));
}
Aggregations