Search in sources :

Example 6 with ArtifactConfig

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));
}
Also used : 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 7 with ArtifactConfig

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));
}
Also used : 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 8 with ArtifactConfig

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")));
}
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 9 with ArtifactConfig

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));
}
Also used : 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)

Aggregations

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