use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.
the class ArtifactPlanTest method shouldErrorOutWhenDuplicateArtifactPlansExists.
@Test
public void shouldErrorOutWhenDuplicateArtifactPlansExists() {
List<ArtifactPlan> plans = new ArrayList<>();
ArtifactPlan existingPlan = new ArtifactPlan("src", "dest");
plans.add(existingPlan);
ArtifactPlan artifactPlan = new ArtifactPlan("src", "dest");
artifactPlan.validateUniqueness(plans);
assertThat(artifactPlan.errors().isEmpty(), is(false));
assertThat(artifactPlan.errors().on(ArtifactPlan.SRC), is("Duplicate artifacts defined."));
assertThat(artifactPlan.errors().on(ArtifactPlan.DEST), is("Duplicate artifacts defined."));
assertThat(existingPlan.errors().isEmpty(), is(false));
assertThat(existingPlan.errors().on(ArtifactPlan.SRC), is("Duplicate artifacts defined."));
assertThat(existingPlan.errors().on(ArtifactPlan.DEST), is("Duplicate artifacts defined."));
}
use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.
the class ArtifactPlanTest method shouldNormalizePath.
@Test
public void shouldNormalizePath() throws Exception {
ArtifactPlan artifactPlan = new ArtifactPlan("folder\\src", "folder\\dest");
assertThat(artifactPlan.getSrc(), is("folder/src"));
assertThat(artifactPlan.getDest(), is("folder/dest"));
}
use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.
the class ArtifactPlanTest method shouldProvideAppendFilePathToDestWhenPathMatchingAtTheRoot.
@Test
public void shouldProvideAppendFilePathToDestWhenPathMatchingAtTheRoot() {
ArtifactPlan artifactPlan = new ArtifactPlan("*.jar", "logs");
assertThat(artifactPlan.destURL(new File("pipelines/pipelineA"), new File("pipelines/pipelineA/a.jar")), is("logs"));
}
use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.
the class ArtifactPlanTest method shouldPublishArtifacts.
@Test
public void shouldPublishArtifacts() throws Exception {
final DefaultGoPublisher publisher = context.mock(DefaultGoPublisher.class);
final ArtifactPlan artifactPlan = new ArtifactPlan("src", "dest");
context.checking(new Expectations() {
{
one(publisher).upload(new File(testFolder, "src"), "dest");
}
});
artifactPlan.publish(publisher, testFolder);
context.assertIsSatisfied();
}
use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.
the class ArtifactPlanTest method validate_shouldFailIfDestDoesNotMatchAFilePattern.
@Test
public void validate_shouldFailIfDestDoesNotMatchAFilePattern() {
ArtifactPlan artifactPlan = new ArtifactPlan("foo/bar", "..");
artifactPlan.validate(null);
assertThat(artifactPlan.errors().on(ArtifactPlan.DEST), is("Invalid destination path. Destination path should match the pattern (([.]\\/)?[.][^. ]+)|([^. ].+[^. ])|([^. ][^. ])|([^. ])"));
}
Aggregations