use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.
the class ArtifactPlanTest method validate_shouldFailIfSourceIsEmpty.
@Test
public void validate_shouldFailIfSourceIsEmpty() {
ArtifactPlan artifactPlan = new ArtifactPlan(null, "bar");
artifactPlan.validate(ConfigSaveValidationContext.forChain(new JobConfig("jobname")));
assertThat(artifactPlan.errors().on(ArtifactPlan.SRC), is("Job 'jobname' has an artifact with an empty source"));
}
use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.
the class ArtifactPlanTest method shouldProvideAppendFilePathToDestWhenUsingDoubleStart.
@Test
public void shouldProvideAppendFilePathToDestWhenUsingDoubleStart() {
ArtifactPlan artifactPlan = new ArtifactPlan("**/*/a.log", "logs");
assertThat(artifactPlan.destURL(new File("pipelines/pipelineA"), new File("pipelines/pipelineA/test/a/b/a.log")), is("logs/test/a/b"));
}
use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.
the class PipelineBeanTest method shouldReturnArtifact.
@Test
public void shouldReturnArtifact() throws Exception {
String[] src = new String[] { "log/log.xml", "logoutput/log.xml" };
String[] dest = new String[] { "test/test1", "" };
String[] type = new String[] { "artifact", "test" };
PipelineBean bean = new PipelineBean("", null, "ant", "build.xml", "clean", src, dest, type, null, null);
ArtifactPlans artifactPlans = bean.getArtifactPlans();
ArtifactPlan artifactPlan = artifactPlans.get(0);
assertThat(artifactPlan.getSrc(), is("log/log.xml"));
assertThat(artifactPlan.getDest(), is("test/test1"));
assertThat(artifactPlan, is(instanceOf(ArtifactPlan.class)));
}
use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.
the class PipelineBeanTest method shouldReturnTestArtifact.
@Test
public void shouldReturnTestArtifact() throws Exception {
String[] src = new String[] { "log/log.xml", "logoutput/log.xml" };
String[] dest = new String[] { "test/test1", "" };
String[] type = new String[] { "artifact", "test" };
PipelineBean bean = new PipelineBean("", null, "ant", "build.xml", "clean", src, dest, type, null, null);
ArtifactPlans artifactPlans = bean.getArtifactPlans();
ArtifactPlan artifactPlan = artifactPlans.get(1);
assertThat(artifactPlan.getSrc(), is("logoutput/log.xml"));
assertThat(artifactPlan.getDest(), is(""));
assertThat(artifactPlan, is(instanceOf(TestArtifactPlan.class)));
}
use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.
the class PipelineBean method getArtifactPlans.
public ArtifactPlans getArtifactPlans() {
ArtifactPlans artifactPlans = new ArtifactPlans();
for (int i = 0; i < src.length; i++) {
if (isBlank(src[i])) {
continue;
}
ArtifactPlan plan;
if (StringUtils.equals(type[i], "test")) {
plan = new TestArtifactPlan();
} else {
plan = new ArtifactPlan();
}
plan.setSrc(defaultString(src[i]));
plan.setDest(defaultString(dest[i]));
artifactPlans.add(plan);
}
return artifactPlans;
}
Aggregations