use of com.thoughtworks.go.plugin.access.configrepo.contract.material.CRGitMaterial in project gocd by gocd.
the class CRPipelineTest method shouldCheckMissingDestinationDirectoryWhenManySCMs.
@Test
public void shouldCheckMissingDestinationDirectoryWhenManySCMs() {
CRPipeline p = new CRPipeline();
p.setName("pipe4");
CRGitMaterial simpleGit1 = new CRGitMaterial();
simpleGit1.setUrl("url1");
CRGitMaterial simpleGit2 = new CRGitMaterial();
simpleGit2.setUrl("url2");
p.addMaterial(simpleGit1);
p.addMaterial(simpleGit2);
ErrorCollection errors = new ErrorCollection();
p.getErrors(errors, "TEST");
String fullError = errors.getErrorsAsText();
assertThat(fullError, contains("Pipeline pipe4; Git material"));
assertThat(fullError, contains("Material must have destination directory when there are many SCM materials"));
}
use of com.thoughtworks.go.plugin.access.configrepo.contract.material.CRGitMaterial in project gocd by gocd.
the class CRPipelineTest method shouldCheckErrorsInMaterials.
@Test
public void shouldCheckErrorsInMaterials() {
CRPipeline p = new CRPipeline();
p.setName("pipe4");
CRGitMaterial invalidGit = new CRGitMaterial("gitMaterial1", "dir1", false, true, null, "feature12", false, "externals", "tools");
p.addMaterial(invalidGit);
// plugin may voluntarily set this
p.setLocation("pipe4.json");
ErrorCollection errors = new ErrorCollection();
p.getErrors(errors, "TEST");
String fullError = errors.getErrorsAsText();
assertThat(fullError, contains("Pipeline pipe4; Git material"));
assertThat(fullError, contains("Missing field 'url'"));
}
use of com.thoughtworks.go.plugin.access.configrepo.contract.material.CRGitMaterial in project gocd by gocd.
the class CRPipelineTest method shouldHandlePolymorphismWhenDeserializingJobs.
@Test
public void shouldHandlePolymorphismWhenDeserializingJobs() {
String json = gson.toJson(pipe1);
CRPipeline deserializedValue = gson.fromJson(json, CRPipeline.class);
CRMaterial git = deserializedValue.getMaterialByName("gitMaterial1");
assertThat(git instanceof CRGitMaterial, is(true));
assertThat(((CRGitMaterial) git).getBranch(), is("feature12"));
}
Aggregations