You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2022/01/12 03:24:27 UTC
[GitHub] [james-project] Arsnael commented on a change in pull request #831: JAMES-3687 Demonstrate issues with deletes of delayed mails
Arsnael commented on a change in pull request #831:
URL: https://github.com/apache/james-project/pull/831#discussion_r782682458
##########
File path: server/queue/queue-api/src/test/java/org/apache/james/queue/api/DelayedManageableMailQueueContract.java
##########
@@ -70,6 +72,61 @@ default void delayedMessagesShouldBeCleared() throws Exception {
assertThat(getManageableMailQueue().getSize()).isEqualTo(0L);
}
+ @Test
+ default void delayedEmailsShouldBeDeleted() throws Exception {
+ getManageableMailQueue().enQueue(defaultMail()
+ .name("abc")
+ .build(),
+ 5L,
+ TimeUnit.SECONDS);
+ // The queue being FIFO a second email can serve as a wait condition
+ getManageableMailQueue().enQueue(defaultMail()
+ .name("def")
+ .build(),
+ 5L,
+ TimeUnit.SECONDS);
+
+ getManageableMailQueue().remove(ManageableMailQueue.Type.Name, "abc");
+
+ ArrayList<String> names = new ArrayList<>();
+ Flux.from(getManageableMailQueue().deQueue())
+ .subscribeOn(Schedulers.elastic())
+ .subscribe(item -> names.add(item.getMail().getName()));
+
+ Awaitility.await().untilAsserted(() -> assertThat(names).contains("def"));
+ assertThat(names).containsExactly("def");
+ }
+
+ @Test
+ default void delayedEmailsShouldBeDeletedWhenMixedWithOtherEmails() throws Exception {
+ getManageableMailQueue().enQueue(defaultMail()
+ .name("abc")
+ .build(),
+ 5L,
+ TimeUnit.SECONDS);
+
+ getManageableMailQueue().remove(ManageableMailQueue.Type.Name, "abc");
+
+ // The newer email
+ getManageableMailQueue().enQueue(defaultMail()
+ .name("def")
+ .build());
+ // The queue being FIFO a third email can serve as a wait condition
+ getManageableMailQueue().enQueue(defaultMail()
+ .name("ghi")
+ .build(),
+ 5L,
+ TimeUnit.SECONDS);
+
+ ArrayList<String> names = new ArrayList<>();
+ Flux.from(getManageableMailQueue().deQueue())
+ .subscribeOn(Schedulers.elastic())
+ .subscribe(item -> names.add(item.getMail().getName()));
+
+ Awaitility.await().untilAsserted(() -> assertThat(names).contains("ghi"));
Review comment:
indent
##########
File path: server/queue/queue-api/src/test/java/org/apache/james/queue/api/DelayedManageableMailQueueContract.java
##########
@@ -70,6 +72,61 @@ default void delayedMessagesShouldBeCleared() throws Exception {
assertThat(getManageableMailQueue().getSize()).isEqualTo(0L);
}
+ @Test
+ default void delayedEmailsShouldBeDeleted() throws Exception {
+ getManageableMailQueue().enQueue(defaultMail()
+ .name("abc")
+ .build(),
+ 5L,
+ TimeUnit.SECONDS);
+ // The queue being FIFO a second email can serve as a wait condition
+ getManageableMailQueue().enQueue(defaultMail()
+ .name("def")
+ .build(),
+ 5L,
+ TimeUnit.SECONDS);
+
+ getManageableMailQueue().remove(ManageableMailQueue.Type.Name, "abc");
+
+ ArrayList<String> names = new ArrayList<>();
+ Flux.from(getManageableMailQueue().deQueue())
+ .subscribeOn(Schedulers.elastic())
+ .subscribe(item -> names.add(item.getMail().getName()));
+
+ Awaitility.await().untilAsserted(() -> assertThat(names).contains("def"));
Review comment:
indent
--
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