use of com.thoughtworks.go.domain.materials.Modification in project gocd by gocd.
the class PipelineInstanceModelTest method shouldGetCurrentRevisionForMaterialByName.
@Test
public void shouldGetCurrentRevisionForMaterialByName() {
MaterialRevisions revisions = new MaterialRevisions();
HgMaterial material = MaterialsMother.hgMaterial();
SvnMaterial svnMaterial = MaterialsMother.svnMaterial();
material.setName(new CaseInsensitiveString("hg_material"));
revisions.addRevision(svnMaterial, new Modification(new Date(), "1024", "MOCK_LABEL-12", null));
revisions.addRevision(material, HG_MATERIAL_MODIFICATION);
BuildCause buildCause = BuildCause.createWithModifications(revisions, "");
PipelineInstanceModel model = PipelineInstanceModel.createPipeline("pipeline", -1, "label", buildCause, new StageInstanceModels());
assertThat(model.getCurrentRevision("hg_material").getRevision(), is("a087402bd2a7828a130c1bdf43f2d9ef8f48fd46"));
}
use of com.thoughtworks.go.domain.materials.Modification in project gocd by gocd.
the class SvnLogXmlParserTest method shouldGetAllModifiedFilesUnderRootPath.
@Test
public void shouldGetAllModifiedFilesUnderRootPath() {
SvnLogXmlParser parser = new SvnLogXmlParser();
List<Modification> materialRevisions = parser.parse(MULTIPLE_FILES, "", new SAXBuilder());
Modification mod = materialRevisions.get(0);
List<ModifiedFile> files = mod.getModifiedFiles();
assertThat(files.size(), is(2));
ModifiedFile file = files.get(0);
assertThat(file.getFileName(), is("/trunk/revision3.txt"));
assertThat(file.getAction(), is(ModifiedAction.added));
file = files.get(1);
assertThat(file.getFileName(), is("/branch/1.1/readme.txt"));
assertThat(file.getAction(), is(ModifiedAction.deleted));
}
use of com.thoughtworks.go.domain.materials.Modification in project gocd by gocd.
the class SvnLogXmlParserTest method shouldParse.
@Test
public void shouldParse() throws ParseException {
SvnLogXmlParser parser = new SvnLogXmlParser();
List<Modification> materialRevisions = parser.parse(XML, "", new SAXBuilder());
assertThat(materialRevisions.size(), is(1));
Modification mod = materialRevisions.get(0);
assertThat(mod.getRevision(), is("3"));
assertThat(mod.getUserName(), is("cceuser"));
assertThat(mod.getModifiedTime(), is(convertDate("2008-03-11T07:52:41.162075Z")));
assertThat(mod.getComment(), is("[Liyanhui & Gabbar] Checked in new file for test"));
List<ModifiedFile> files = mod.getModifiedFiles();
assertThat(files.size(), is(1));
ModifiedFile file = files.get(0);
assertThat(file.getFileName(), is("/trunk/revision3.txt"));
assertThat(file.getAction(), is(ModifiedAction.added));
}
use of com.thoughtworks.go.domain.materials.Modification in project gocd by gocd.
the class SvnLogXmlParserTest method shouldFilterModifiedFilesByPath.
@Test
public void shouldFilterModifiedFilesByPath() {
SvnLogXmlParser parser = new SvnLogXmlParser();
List<Modification> materialRevisions = parser.parse(MULTIPLE_FILES, "/branch", new SAXBuilder());
Modification mod = materialRevisions.get(0);
List<ModifiedFile> files = mod.getModifiedFiles();
assertThat(files.size(), is(1));
ModifiedFile file = files.get(0);
assertThat(file.getFileName(), is("/branch/1.1/readme.txt"));
assertThat(file.getAction(), is(ModifiedAction.deleted));
}
use of com.thoughtworks.go.domain.materials.Modification in project gocd by gocd.
the class SvnLogXmlParserTest method shouldParseSvnLogContainingNullComments.
@Test
public void shouldParseSvnLogContainingNullComments() throws IOException {
String xml;
try (InputStream stream = getClass().getResourceAsStream("jemstep_svn_log.xml")) {
xml = IOUtils.toString(stream, UTF_8);
}
SvnLogXmlParser parser = new SvnLogXmlParser();
List<Modification> revisions = parser.parse(xml, "", new SAXBuilder());
assertThat(revisions.size(), is(43));
Modification modWithoutComment = null;
for (Modification revision : revisions) {
if (revision.getRevision().equals("7815")) {
modWithoutComment = revision;
}
}
assertThat(modWithoutComment.getComment(), is(nullValue()));
}
Aggregations