Search in sources :

Example 76 with RestResponse

use of com.google.gerrit.acceptance.RestResponse in project gerrit by GerritCodeReview.

the class RevisionIT method contentOfParent.

@Test
public void contentOfParent() throws Exception {
    String parentContent = "parent content";
    PushOneCommit.Result parent = createChange("Parent change", FILE_NAME, parentContent);
    parent.assertOkStatus();
    gApi.changes().id(parent.getChangeId()).current().review(ReviewInput.approve());
    gApi.changes().id(parent.getChangeId()).current().submit();
    PushOneCommit.Result child = createChange("Child change", FILE_NAME, FILE_CONTENT);
    child.assertOkStatus();
    assertContent(child, FILE_NAME, FILE_CONTENT);
    RestResponse response = adminRestSession.get("/changes/" + child.getChangeId() + "/revisions/current/files/" + FILE_NAME + "/content?parent=1");
    response.assertOK();
    assertThat(new String(Base64.decode(response.getEntityContent()), UTF_8)).isEqualTo(parentContent);
}
Also used : RestResponse(com.google.gerrit.acceptance.RestResponse) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 77 with RestResponse

use of com.google.gerrit.acceptance.RestResponse in project gerrit by GerritCodeReview.

the class SetParentIT method setParentForAllProjects_Conflict.

@Test
public void setParentForAllProjects_Conflict() throws Exception {
    RestResponse r = adminRestSession.put("/projects/" + allProjects.get() + "/parent", newParentInput(project.get()));
    r.assertConflict();
    r.consume();
}
Also used : RestResponse(com.google.gerrit.acceptance.RestResponse) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 78 with RestResponse

use of com.google.gerrit.acceptance.RestResponse in project gerrit by GerritCodeReview.

the class CreateProjectIT method createProjectHttp.

@Test
public void createProjectHttp() throws Exception {
    String newProjectName = name("newProject");
    RestResponse r = adminRestSession.put("/projects/" + newProjectName);
    r.assertCreated();
    ProjectInfo p = newGson().fromJson(r.getReader(), ProjectInfo.class);
    assertThat(p.name).isEqualTo(newProjectName);
    ProjectState projectState = projectCache.get(new Project.NameKey(newProjectName));
    assertThat(projectState).isNotNull();
    assertProjectInfo(projectState.getProject(), p);
    assertHead(newProjectName, "refs/heads/master");
}
Also used : Project(com.google.gerrit.reviewdb.client.Project) RestResponse(com.google.gerrit.acceptance.RestResponse) ProjectAssert.assertProjectInfo(com.google.gerrit.acceptance.rest.project.ProjectAssert.assertProjectInfo) ProjectInfo(com.google.gerrit.extensions.common.ProjectInfo) ProjectState(com.google.gerrit.server.project.ProjectState) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 79 with RestResponse

use of com.google.gerrit.acceptance.RestResponse in project gerrit by GerritCodeReview.

the class GarbageCollectionIT method POST.

private RestResponse POST(String endPoint) throws Exception {
    RestResponse r = adminRestSession.post(endPoint);
    r.consume();
    return r;
}
Also used : RestResponse(com.google.gerrit.acceptance.RestResponse)

Aggregations

RestResponse (com.google.gerrit.acceptance.RestResponse)79 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)67 Test (org.junit.Test)67 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)17 TypeToken (com.google.gson.reflect.TypeToken)15 ReviewInput (com.google.gerrit.extensions.api.changes.ReviewInput)9 CacheInfo (com.google.gerrit.server.config.ListCaches.CacheInfo)6 TaskInfo (com.google.gerrit.server.config.ListTasks.TaskInfo)6 ReviewResult (com.google.gerrit.extensions.api.changes.ReviewResult)5 ChangeInfo (com.google.gerrit.extensions.common.ChangeInfo)5 Result (com.google.gerrit.acceptance.PushOneCommit.Result)4 AccountExternalIdInfo (com.google.gerrit.extensions.common.AccountExternalIdInfo)4 LabelInfo (com.google.gerrit.extensions.common.LabelInfo)4 ArrayList (java.util.ArrayList)4 ApprovalInfo (com.google.gerrit.extensions.common.ApprovalInfo)3 Truth.assertThat (com.google.common.truth.Truth.assertThat)2 TestProjectInput (com.google.gerrit.acceptance.TestProjectInput)2 EmailInput (com.google.gerrit.extensions.api.accounts.EmailInput)2 AddReviewerInput (com.google.gerrit.extensions.api.changes.AddReviewerInput)2 PublishChangeEditInput (com.google.gerrit.extensions.api.changes.PublishChangeEditInput)2