use of com.thoughtworks.go.domain.materials.Modification in project gocd by gocd.
the class HgModificationSplitterTest method shouldBeAbleToParseModifications.
@Test
public void shouldBeAbleToParseModifications() throws Exception {
ConsoleResult result = new ConsoleResult(0, Arrays.asList(("<changeset>\n" + "<node>ca3ebb67f527c0ad7ed26b789056823d8b9af23f</node>\n" + "<author>cruise</author>\n" + "<date>Tue, 09 Dec 2008 18:56:14 +0800</date>\n" + "<desc>test</desc>\n" + "<files>\n" + "<modified>\n" + "<file>end2end/file</file>\n" + "</modified>\n" + "<added>\n" + "<file>end2end/file</file>\n" + "</added>\n" + "<deleted>\n" + "</deleted>\n" + "</files>\n" + "</changeset>").split("\n")), new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
HgModificationSplitter splitter = new HgModificationSplitter(result);
List<Modification> list = splitter.modifications();
assertThat(list.size(), is(1));
assertThat(list.get(0).getModifiedTime(), is(new DateTime("2008-12-09T18:56:14+08:00").toDate()));
}
use of com.thoughtworks.go.domain.materials.Modification in project gocd by gocd.
the class P4CommandTestBase method shouldGetChangesSinceARevision.
@Test
public void shouldGetChangesSinceARevision() throws Exception {
List<Modification> output = p4.changesSince(new StringRevision("1"));
assertThat(output.size(), is(3));
assertThat(output.get(0).getRevision(), is("4"));
assertThat(output.get(1).getRevision(), is("3"));
assertThat(output.get(2).getRevision(), is("2"));
}
use of com.thoughtworks.go.domain.materials.Modification in project gocd by gocd.
the class P4CommandTestBase method shouldReturnEmptyModificationListWhenP4OutputIsEmpty.
@Test
public void shouldReturnEmptyModificationListWhenP4OutputIsEmpty() throws Exception {
P4Material anotherMaterial = p4Fixture.material(EMPTY_VIEW);
List<Modification> materialRevisions = anotherMaterial.latestModification(clientFolder, new TestSubprocessExecutionContext());
assertThat(materialRevisions.size(), is(0));
List<Modification> mods = anotherMaterial.modificationsSince(clientFolder, new StringRevision("1"), new TestSubprocessExecutionContext());
assertThat(mods.size(), is(0));
}
use of com.thoughtworks.go.domain.materials.Modification in project gocd by gocd.
the class GitCommandTest method shouldRetrieveLatestModificationFromBranch.
@Test
public void shouldRetrieveLatestModificationFromBranch() throws Exception {
GitTestRepo branchedRepo = GitTestRepo.testRepoAtBranch(GIT_FOO_BRANCH_BUNDLE, BRANCH);
GitCommand branchedGit = new GitCommand(null, createTempWorkingDirectory(), BRANCH, false, new HashMap<>(), null);
branchedGit.clone(inMemoryConsumer(), branchedRepo.projectRepositoryUrl());
Modification mod = branchedGit.latestModification().get(0);
assertThat(mod.getUserName(), is("Chris Turner <cturner@thoughtworks.com>"));
assertThat(mod.getComment(), is("Started foo branch"));
assertThat(mod.getModifiedTime(), is(parseRFC822("Tue, 05 Feb 2009 14:28:08 -0800")));
assertThat(mod.getRevision(), is("b4fa7271c3cef91822f7fa502b999b2eab2a380d"));
List<ModifiedFile> files = mod.getModifiedFiles();
assertThat(files.size(), is(1));
assertThat(files.get(0).getFileName(), is("first.txt"));
assertThat(files.get(0).getAction(), is(ModifiedAction.modified));
}
use of com.thoughtworks.go.domain.materials.Modification in project gocd by gocd.
the class GitCommandTest method shouldIncludeNewChangesInModificationCheck.
@Test
public void shouldIncludeNewChangesInModificationCheck() throws Exception {
String originalNode = git.latestModification().get(0).getRevision();
File testingFile = checkInNewRemoteFile();
Modification modification = git.latestModification().get(0);
assertThat(modification.getRevision(), is(not(originalNode)));
assertThat(modification.getComment(), is("New checkin of " + testingFile.getName()));
assertThat(modification.getModifiedFiles().size(), is(1));
assertThat(modification.getModifiedFiles().get(0).getFileName(), is(testingFile.getName()));
}
Aggregations