Search in sources :

Example 1 with TestArtifactConfig

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

Example 2 with TestArtifactConfig

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())));
}
Also used : PluggableArtifactConfig(com.thoughtworks.go.config.PluggableArtifactConfig) TestArtifactConfig(com.thoughtworks.go.config.TestArtifactConfig) PluggableArtifactConfig(com.thoughtworks.go.config.PluggableArtifactConfig) TestArtifactConfig(com.thoughtworks.go.config.TestArtifactConfig) ArtifactConfig(com.thoughtworks.go.config.ArtifactConfig) ArtifactConfigs(com.thoughtworks.go.config.ArtifactConfigs) Test(org.junit.Test)

Example 3 with TestArtifactConfig

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

Aggregations

ArtifactConfig (com.thoughtworks.go.config.ArtifactConfig)3 ArtifactConfigs (com.thoughtworks.go.config.ArtifactConfigs)3 PluggableArtifactConfig (com.thoughtworks.go.config.PluggableArtifactConfig)3 TestArtifactConfig (com.thoughtworks.go.config.TestArtifactConfig)3 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2