You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by "quantranhong1999 (via GitHub)" <gi...@apache.org> on 2023/09/12 06:09:22 UTC

[GitHub] [james-project] quantranhong1999 commented on a diff in pull request #1722: JAMES-3925 Fix case cleanup upload remove just uploaded

quantranhong1999 commented on code in PR #1722:
URL: https://github.com/apache/james-project/pull/1722#discussion_r1322470346


##########
server/data/data-jmap/src/test/scala/org/apache/james/jmap/api/upload/UploadServiceContract.scala:
##########
@@ -69,6 +69,24 @@ trait UploadServiceContract {
       .isEqualTo(10L)
   }
 
+  @Test
+  def uploadShouldNotCleanJustUploadedFile(): Unit = {
+    // given UPLOAD_QUOTA_LIMIT = 100bytes
+
+    // upload 50 bytes
+    val uploadId50 = SMono.fromPublisher(testee.upload(asInputStream(new String(new Array[Byte](50), java.nio.charset.StandardCharsets.UTF_8)), CONTENT_TYPE, BOB))
+      .block().uploadId
+
+    // upload 70 bytes
+    val uploadId70 = SMono.fromPublisher(testee.upload(asInputStream(new String(new Array[Byte](70), java.nio.charset.StandardCharsets.UTF_8)), CONTENT_TYPE, BOB))
+      .block().uploadId
+
+    assertThat(SMono(testee.retrieve(uploadId70, BOB)).block().uploadId)
+      .isEqualTo(uploadId70)
+    assertThatThrownBy(() => SMono(testee.retrieve(uploadId50, BOB)).block().uploadId)
+      .isInstanceOf(classOf[UploadNotFoundException])

Review Comment:
   Should this be in awaiting assertion? (cleanup is async)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org