Skip to content
Snippets Groups Projects
Commit 5c3ec67b authored by Jan Zickermann's avatar Jan Zickermann
Browse files

OZG-6748 KOP-2750 Use getContentStream

parent 1ed5b90d
No related branches found
No related tags found
No related merge requests found
...@@ -159,7 +159,7 @@ public class VorgangRemoteService { ...@@ -159,7 +159,7 @@ public class VorgangRemoteService {
} }
String uploadIncomingFile(IncomingFile incomingFile) { String uploadIncomingFile(IncomingFile incomingFile) {
var fileContentStream = incomingFile.getContentStreamForFinalRead(); var fileContentStream = incomingFile.getContentStream();
var resultFuture = GrpcFileUploadUtils.createSender(this::buildChunkRequest, fileContentStream, var resultFuture = GrpcFileUploadUtils.createSender(this::buildChunkRequest, fileContentStream,
this::buildCallStreamObserver) this::buildCallStreamObserver)
......
...@@ -431,6 +431,55 @@ class VorgangRemoteServiceTest { ...@@ -431,6 +431,55 @@ class VorgangRemoteServiceTest {
} }
} }
@DisplayName("update incoming file")
@Nested
class TestUpdateIncomingFile {
@Mock
private IncomingFile incomingFile;
@Mock
private InputStream inputStream;
@Mock
private GrpcUploadBinaryFileResponse response;
@Mock
private GrpcUploadBinaryFileRequest request;
@BeforeEach
void mock() {
doReturn(response).when(vorgangCreator).waitUntilFutureToComplete(any(), any());
when(incomingFile.getContentStream()).thenReturn(inputStream);
doReturn(request).when(vorgangCreator).buildMetaDataRequest(incomingFile);
}
@DisplayName("should call get content stream")
@Test
void shouldCallGetContentStream() {
vorgangCreator.uploadIncomingFile(incomingFile);
verify(incomingFile).getContentStream();
}
@DisplayName("should call build request with incoming file")
@Test
void shouldCallBuildRequestWithIncomingFile() {
vorgangCreator.uploadIncomingFile(incomingFile);
verify(vorgangCreator).buildMetaDataRequest(incomingFile);
}
@DisplayName("should call wait until future complete")
@Test
void shouldCallWaitUntilFutureComplete() {
vorgangCreator.uploadIncomingFile(incomingFile);
verify(vorgangCreator).waitUntilFutureToComplete(any(), eq(inputStream));
}
}
@Nested @Nested
class TestWaitUntilFutureToComplete { class TestWaitUntilFutureToComplete {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment