use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class P4CommandTestBase method shouldReturnEmptyModificationListWhenP4OutputIsEmpty.
@Test
void shouldReturnEmptyModificationListWhenP4OutputIsEmpty() {
P4Material anotherMaterial = p4Fixture.material(EMPTY_VIEW);
List<Modification> materialRevisions = anotherMaterial.latestModification(clientFolder, new TestSubprocessExecutionContext());
assertThat(materialRevisions.size()).isEqualTo(0);
List<Modification> mods = anotherMaterial.modificationsSince(clientFolder, new StringRevision("1"), new TestSubprocessExecutionContext());
assertThat(mods.size()).isEqualTo(0);
}
use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class P4CommandTestBase method shouldGetChangesSinceARevision.
@Test
void shouldGetChangesSinceARevision() {
List<Modification> output = p4.changesSince(new StringRevision("1"));
assertThat(output.size()).isEqualTo(3);
assertThat(output.get(0).getRevision()).isEqualTo("4");
assertThat(output.get(1).getRevision()).isEqualTo("3");
assertThat(output.get(2).getRevision()).isEqualTo("2");
}
use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class MaterialRevisionTest method shouldDetectLatestRevision.
@Test
public void shouldDetectLatestRevision() throws Exception {
MaterialRevision materialRevision = new MaterialRevision(hgMaterial, modification("3"), modification("2"), modification("1"));
assertThat(materialRevision.getRevision(), is(new StringRevision("3")));
}
use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class GitMaterialTest method shouldBeAbleToConvertToJson.
@Test
void shouldBeAbleToConvertToJson() {
Map<String, Object> json = new LinkedHashMap<>();
final GitMaterial git = new GitMaterial("http://0.0.0.0");
git.toJson(json, new StringRevision("123"));
JsonValue jsonValue = from(json);
assertThat(jsonValue.getString("scmType")).isEqualTo("Git");
assertThat(new File(jsonValue.getString("location"))).isEqualTo(new File(git.getUrl()));
assertThat(jsonValue.getString("action")).isEqualTo("Modified");
}
use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class GitMaterialShallowCloneTest method updateToANewRevisionShouldNotResultInUnshallowing.
@Test
void updateToANewRevisionShouldNotResultInUnshallowing() throws IOException {
GitMaterial material = new GitMaterial(repo.projectRepositoryUrl(), true);
material.updateTo(inMemoryConsumer(), workingDir, new RevisionContext(REVISION_4, REVISION_4, 1), context());
assertThat(localRepoFor(material).isShallow()).isTrue();
List<Modification> modifications = repo.addFileAndPush("newfile", "add new file");
StringRevision newRevision = new StringRevision(modifications.get(0).getRevision());
material.updateTo(inMemoryConsumer(), workingDir, new RevisionContext(newRevision, newRevision, 1), context());
assertThat(new File(workingDir, "newfile").exists()).isTrue();
assertThat(localRepoFor(material).isShallow()).isTrue();
}
Aggregations