use of com.google.startupos.common.repo.Protos.Commit in project startup-os by google.
the class CodeReviewServiceGetDiffFilesTest method testGetDiffFiles_whenFileIsModifiedAndNewFileIsAdded.
@Test
public void testGetDiffFiles_whenFileIsModifiedAndNewFileIsAdded() {
writeFile("new_file_content");
writeFile("new_file.txt", "file content");
final String lastCommitId = repo.commit(repo.getUncommittedFiles(), COMMIT_MESSAGE).getId();
Commit lastCommit = Commit.newBuilder().setId(lastCommitId).addFile(File.newBuilder().setFilename("new_file.txt").setWorkspace("ws1").setRepoId(REPO_ID).setCommitId(lastCommitId).setFilenameWithRepo("startup-os/new_file.txt").build()).addFile(File.newBuilder().setFilename("test_file.txt").setWorkspace("ws1").setRepoId(REPO_ID).setCommitId(lastCommitId).setAction(File.Action.MODIFY).setFilenameWithRepo("startup-os/test_file.txt").build()).build();
assertEquals(getExpectedResponseAddingCommit(lastCommit), getResponse());
}
use of com.google.startupos.common.repo.Protos.Commit in project startup-os by google.
the class CodeReviewServiceGetDiffFilesTest method testGetDiffFiles_whenNewFileIsAdded.
@Test
public void testGetDiffFiles_whenNewFileIsAdded() {
writeFile("new_file.txt", "file content");
final String lastCommitId = repo.commit(repo.getUncommittedFiles(), COMMIT_MESSAGE).getId();
Commit lastCommit = Commit.newBuilder().setId(lastCommitId).addFile(File.newBuilder().setFilename("new_file.txt").setWorkspace("ws1").setRepoId(REPO_ID).setCommitId(lastCommitId).setFilenameWithRepo("startup-os/new_file.txt").build()).build();
assertEquals(getExpectedResponseAddingCommit(lastCommit), getResponse());
}
use of com.google.startupos.common.repo.Protos.Commit in project startup-os by google.
the class CodeReviewServiceGetDiffFilesTest method testGetDiffFiles_whenFileIsDeletedAndNewFileIsAdded.
@Test
public void testGetDiffFiles_whenFileIsDeletedAndNewFileIsAdded() throws IOException {
writeFile("new_file.txt", "file content");
fileUtils.deleteFileOrDirectoryIfExists(fileUtils.joinPaths(getWorkspaceFolder(TEST_WORKSPACE), "startup-os", TEST_FILE));
final String lastCommitId = repo.commit(repo.getUncommittedFiles(), COMMIT_MESSAGE).getId();
Commit lastCommit = Commit.newBuilder().setId(lastCommitId).addFile(File.newBuilder().setFilename("new_file.txt").setWorkspace("ws1").setRepoId(REPO_ID).setCommitId(lastCommitId).setFilenameWithRepo("startup-os/new_file.txt").build()).addFile(File.newBuilder().setFilename("test_file.txt").setWorkspace("ws1").setRepoId(REPO_ID).setCommitId(lastCommitId).setAction(File.Action.DELETE).setFilenameWithRepo("startup-os/test_file.txt").build()).build();
assertEquals(getExpectedResponseAddingCommit(lastCommit), getResponse());
}
use of com.google.startupos.common.repo.Protos.Commit in project startup-os by google.
the class CodeReviewServiceGetDiffFilesTest method testGetDiffFiles_whenNewFileIsDeleted.
@Test
public void testGetDiffFiles_whenNewFileIsDeleted() throws IOException {
fileUtils.deleteFileOrDirectoryIfExists(fileUtils.joinPaths(getWorkspaceFolder(TEST_WORKSPACE), "startup-os", TEST_FILE));
final String lastCommitId = repo.commit(repo.getUncommittedFiles(), COMMIT_MESSAGE).getId();
Commit lastCommit = Commit.newBuilder().setId(lastCommitId).addFile(File.newBuilder().setFilename("test_file.txt").setWorkspace("ws1").setRepoId(REPO_ID).setCommitId(lastCommitId).setAction(File.Action.DELETE).setFilenameWithRepo("startup-os/test_file.txt").build()).build();
assertEquals(getExpectedResponseAddingCommit(lastCommit), getResponse());
}
Aggregations