Search in sources :

Example 16 with File

use of com.google.startupos.common.repo.Protos.File in project startup-os by google.

the class CodeReviewServiceTextDiffTest method testTextDiff_committedAndWorkspaceNotExists.

// Committed, workspace doesn't exist
@Test(expected = StatusRuntimeException.class)
public void testTextDiff_committedAndWorkspaceNotExists() {
    File file = File.newBuilder().setRepoId("startup-os").setWorkspace("non-existing-workspace").setCommitId(testFileCommitId).setFilename(TEST_FILE).build();
    getResponse(file);
}
Also used : File(com.google.startupos.common.repo.Protos.File) Test(org.junit.Test)

Example 17 with File

use of com.google.startupos.common.repo.Protos.File in project startup-os by google.

the class CodeReviewServiceTextDiffTest method testTextDiff_committedAndWorkspaceExists.

// Committed, workspace exists
@Test
public void testTextDiff_committedAndWorkspaceExists() {
    File file = File.newBuilder().setRepoId("startup-os").setWorkspace(TEST_WORKSPACE).setCommitId(testFileCommitId).setFilename(TEST_FILE).build();
    TextDiffResponse response = getResponse(file);
    assertEquals(getExpectedResponse(TEST_FILE_CONTENTS), response);
}
Also used : TextDiffResponse(com.google.startupos.tools.reviewer.local_server.service.Protos.TextDiffResponse) File(com.google.startupos.common.repo.Protos.File) Test(org.junit.Test)

Example 18 with File

use of com.google.startupos.common.repo.Protos.File in project startup-os by google.

the class CodeReviewServiceTextDiffTest method testTextDiff_committedAndWorkspaceNotExists_pushed.

// Committed, workspace doesn't exist (pushed)
@Test
public void testTextDiff_committedAndWorkspaceNotExists_pushed() {
    File file = File.newBuilder().setRepoId("startup-os").setWorkspace("non-existing-workspace").setCommitId(fileInHeadCommitId).setFilename(FILE_IN_HEAD).build();
    TextDiffResponse response = getResponse(file);
    assertEquals(getExpectedResponse(TEST_FILE_CONTENTS), response);
}
Also used : TextDiffResponse(com.google.startupos.tools.reviewer.local_server.service.Protos.TextDiffResponse) File(com.google.startupos.common.repo.Protos.File) Test(org.junit.Test)

Example 19 with File

use of com.google.startupos.common.repo.Protos.File in project startup-os by google.

the class CodeReviewServiceTextDiffTest method testTextDiff_fileInHead.

// File in head
@Test
public void testTextDiff_fileInHead() {
    File file = File.newBuilder().setRepoId("startup-os").setCommitId(fileInHeadCommitId).setFilename(FILE_IN_HEAD).build();
    TextDiffResponse response = getResponse(file);
    assertEquals(getExpectedResponse(TEST_FILE_CONTENTS), response);
}
Also used : TextDiffResponse(com.google.startupos.tools.reviewer.local_server.service.Protos.TextDiffResponse) File(com.google.startupos.common.repo.Protos.File) Test(org.junit.Test)

Aggregations

File (com.google.startupos.common.repo.Protos.File)19 Test (org.junit.Test)11 TextDiffResponse (com.google.startupos.tools.reviewer.local_server.service.Protos.TextDiffResponse)9 Commit (com.google.startupos.common.repo.Protos.Commit)4 Repo (com.google.startupos.common.repo.Repo)3 ImmutableList (com.google.common.collect.ImmutableList)2 IOException (java.io.IOException)2 GitRepo (com.google.startupos.common.repo.GitRepo)1 DiffFilesResponse (com.google.startupos.tools.reviewer.local_server.service.Protos.DiffFilesResponse)1