You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2024/02/16 02:26:30 UTC

(james-project) 04/04: JAMES-2586 Fix contract test NotificationRegistryContract::registerShouldNotPersistWhenExpiryDateIsPresent

This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch postgresql
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 24947d762bbc1add2fdd1fb38c273fb9744fb28f
Author: Quan Tran <hq...@linagora.com>
AuthorDate: Wed Feb 7 16:42:53 2024 +0700

    JAMES-2586 Fix contract test NotificationRegistryContract::registerShouldNotPersistWhenExpiryDateIsPresent
    
    The scenario was not really as same as the test name.
---
 .../org/apache/james/vacation/api/NotificationRegistryContract.java     | 2 +-
 .../apache/james/vacation/cassandra/CassandraNotificationRegistry.java  | 2 +-
 .../org/apache/james/vacation/memory/MemoryNotificationRegistry.java    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/server/data/data-api/src/test/java/org/apache/james/vacation/api/NotificationRegistryContract.java b/server/data/data-api/src/test/java/org/apache/james/vacation/api/NotificationRegistryContract.java
index 4742d9bd90..e6e9781149 100644
--- a/server/data/data-api/src/test/java/org/apache/james/vacation/api/NotificationRegistryContract.java
+++ b/server/data/data-api/src/test/java/org/apache/james/vacation/api/NotificationRegistryContract.java
@@ -98,6 +98,6 @@ public interface NotificationRegistryContract {
 
         notificationRegistry().register(ACCOUNT_ID, recipientId(), Optional.of(ZONED_DATE_TIME)).block();
 
-        assertThat(notificationRegistry().isRegistered(ACCOUNT_ID, recipientId()).block()).isTrue();
+        assertThat(notificationRegistry().isRegistered(ACCOUNT_ID, recipientId()).block()).isFalse();
     }
 }
diff --git a/server/data/data-cassandra/src/main/java/org/apache/james/vacation/cassandra/CassandraNotificationRegistry.java b/server/data/data-cassandra/src/main/java/org/apache/james/vacation/cassandra/CassandraNotificationRegistry.java
index 5471061322..6aff1d95b5 100644
--- a/server/data/data-cassandra/src/main/java/org/apache/james/vacation/cassandra/CassandraNotificationRegistry.java
+++ b/server/data/data-cassandra/src/main/java/org/apache/james/vacation/cassandra/CassandraNotificationRegistry.java
@@ -71,6 +71,6 @@ public class CassandraNotificationRegistry implements NotificationRegistry {
     }
 
     private boolean isValid(Optional<Integer> waitDelay) {
-        return waitDelay.isEmpty() || waitDelay.get() >= 0;
+        return waitDelay.isEmpty() || waitDelay.get() > 0;
     }
 }
diff --git a/server/data/data-memory/src/main/java/org/apache/james/vacation/memory/MemoryNotificationRegistry.java b/server/data/data-memory/src/main/java/org/apache/james/vacation/memory/MemoryNotificationRegistry.java
index 8ffe39a2ae..f3dd4005ab 100644
--- a/server/data/data-memory/src/main/java/org/apache/james/vacation/memory/MemoryNotificationRegistry.java
+++ b/server/data/data-memory/src/main/java/org/apache/james/vacation/memory/MemoryNotificationRegistry.java
@@ -84,7 +84,7 @@ public class MemoryNotificationRegistry implements NotificationRegistry {
     }
 
     private boolean isStrictlyBefore(ZonedDateTime currentTime, ZonedDateTime registrationEnd) {
-        return ! currentTime.isAfter(registrationEnd);
+        return currentTime.isBefore(registrationEnd);
     }
 
     @Override


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