use of org.kie.workbench.common.forms.jbpm.service.shared.documents.DocumentUploadChunk in project kie-wb-common by kiegroup.
the class UploadedDocumentServiceImplTest method testMergeWithError.
@Test
public void testMergeWithError() throws Exception {
doThrow(new RuntimeException("Exception")).when(storage).merge(any());
DocumentUploadChunk chunk = new DocumentUploadChunk(DOC_ID, DOC_NAME, 0, 1, Base64.getEncoder().encodeToString(PART_1.getBytes()));
DocumentUploadResponse response = uploadedDocumentService.uploadContent(chunk);
validateResponse(response, DocumentUploadResponse.DocumentUploadState.FINISH, false);
}
use of org.kie.workbench.common.forms.jbpm.service.shared.documents.DocumentUploadChunk in project kie-wb-common by kiegroup.
the class UploadedDocumentServiceImplTest method testAbortUpload.
@Test
public void testAbortUpload() {
DocumentUploadChunk chunk = new DocumentUploadChunk(DOC_ID, DOC_NAME, 0, 3, Base64.getEncoder().encodeToString(PART_1.getBytes()));
DocumentUploadResponse response = uploadedDocumentService.uploadContent(chunk);
validateResponse(response, DocumentUploadResponse.DocumentUploadState.UPLOADING, true);
DocumentUploadSession session = uploadedDocumentService.getUploadSessions().get(DOC_ID);
Assertions.assertThat(session).isNotNull();
Assertions.assertThat(session.getChunks()).isNotNull().hasSize(1).containsExactly(chunk);
checkParts(1);
uploadedDocumentService.removeContent(DOC_ID);
assertEquals(DocumentUploadSession.State.ABORTED, session.getState());
}
Aggregations