use of com.google.gerrit.extensions.api.changes.FileContentInput in project gerrit by GerritCodeReview.
the class ChangeEditIT method invalidBase64UploadBinaryInChangeEditOneRequestRest.
@Test
public void invalidBase64UploadBinaryInChangeEditOneRequestRest() throws Exception {
FileContentInput in = new FileContentInput();
in.binary_content = CONTENT_BINARY_ENCODED_NEW3;
adminRestSession.put(urlEditFile(changeId, FILE_NAME), in).assertBadRequest();
}
use of com.google.gerrit.extensions.api.changes.FileContentInput in project gerrit by GerritCodeReview.
the class ChangeEditIT method createAndUploadBinaryInChangeEditOneRequestRest.
@Test
public void createAndUploadBinaryInChangeEditOneRequestRest() throws Exception {
FileContentInput in = new FileContentInput();
in.binary_content = CONTENT_BINARY_ENCODED_NEW;
adminRestSession.put(urlEditFile(changeId, FILE_NAME), in).assertNoContent();
ensureSameBytes(getFileContentOfEdit(changeId, FILE_NAME), CONTENT_BINARY_DECODED_NEW);
in.binary_content = CONTENT_BINARY_ENCODED_NEW2;
adminRestSession.put(urlEditFile(changeId, FILE_NAME), in).assertNoContent();
ensureSameBytes(getFileContentOfEdit(changeId, FILE_NAME), CONTENT_BINARY_DECODED_NEW2);
}
use of com.google.gerrit.extensions.api.changes.FileContentInput in project gerrit by GerritCodeReview.
the class ChangeEditIT method createAndChangeEditInOneRequestRest.
@Test
public void createAndChangeEditInOneRequestRest() throws Exception {
FileContentInput in = new FileContentInput();
in.content = RawInputUtil.create(CONTENT_NEW);
adminRestSession.putRaw(urlEditFile(changeId, FILE_NAME), in.content).assertNoContent();
ensureSameBytes(getFileContentOfEdit(changeId, FILE_NAME), CONTENT_NEW);
in.content = RawInputUtil.create(CONTENT_NEW2);
adminRestSession.putRaw(urlEditFile(changeId, FILE_NAME), in.content).assertNoContent();
ensureSameBytes(getFileContentOfEdit(changeId, FILE_NAME), CONTENT_NEW2);
}
use of com.google.gerrit.extensions.api.changes.FileContentInput in project gerrit by GerritCodeReview.
the class ChangeEditIT method changeEditNoContentProvidedRest.
@Test
public void changeEditNoContentProvidedRest() throws Exception {
createEmptyEditFor(changeId);
FileContentInput in = new FileContentInput();
in.binary_content = null;
adminRestSession.put(urlEditFile(changeId, FILE_NAME), in).assertBadRequest();
}
use of com.google.gerrit.extensions.api.changes.FileContentInput in project gerrit by GerritCodeReview.
the class ChangeEditIT method getFileContentRest.
@Test
public void getFileContentRest() throws Exception {
FileContentInput in = new FileContentInput();
in.content = RawInputUtil.create(CONTENT_NEW);
adminRestSession.putRaw(urlEditFile(changeId, FILE_NAME), in.content).assertNoContent();
gApi.changes().id(changeId).edit().modifyFile(FILE_NAME, RawInputUtil.create(CONTENT_NEW2));
RestResponse r = adminRestSession.getJsonAccept(urlEditFile(changeId, FILE_NAME));
r.assertOK();
assertThat(readContentFromJson(r)).isEqualTo(new String(CONTENT_NEW2, UTF_8));
r = adminRestSession.getJsonAccept(urlEditFile(changeId, FILE_NAME, true));
r.assertOK();
assertThat(readContentFromJson(r)).isEqualTo(new String(CONTENT_OLD, UTF_8));
}
Aggregations