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 2025/09/11 02:10:11 UTC
(james-project) branch master updated (458dcaa55d -> 612e60ade3)
This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
from 458dcaa55d [RemoteDelivery] Add an explicit option to trust all certs (#2788)
new ec4db92c8e JAMES-4143 Add JMAP StartWith Filter
new 548af735ae JAMES-4143 Add tests in JMAPFilteringTest
new dff72ede40 JAMES-4143 Update serialization/de-serialization tests
new 612e60ade3 JAMES 4143 Update tests to show that start-with filter is different from contains filter
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../james/jmap/cassandra/filtering/DTOTest.java | 6 ++-
.../src/test/resources/json/eventComplex-v2.json | 18 +++++++
.../src/test/resources/json/eventComplex-v3.json | 23 +++++++++
.../src/test/resources/json/eventComplex-v4.json | 27 ++++++++++
.../src/test/resources/json/eventComplex.json | 14 +++++
.../org/apache/james/jmap/api/filtering/Rule.java | 3 +-
.../api/filtering/FilteringManagementContract.java | 5 +-
.../james/jmap/api/filtering/RuleFixture.java | 20 ++++++++
.../james/jmap/mailet/filter/ContentMatcher.java | 6 +++
.../jmap/mailet/filter/JMAPFilteringTest.java | 59 ++++++++++++++++++++++
10 files changed, 176 insertions(+), 5 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
(james-project) 03/04: JAMES-4143 Update serialization/de-serialization tests
Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit dff72ede409332ffa871d46dbc12ea2f43d1d0f1
Author: Trung NGUYEN <qt...@linagora.com>
AuthorDate: Wed Sep 10 11:14:17 2025 +0200
JAMES-4143 Update serialization/de-serialization tests
---
.../james/jmap/cassandra/filtering/DTOTest.java | 6 +++--
.../src/test/resources/json/eventComplex-v2.json | 18 +++++++++++++++
.../src/test/resources/json/eventComplex-v3.json | 23 ++++++++++++++++++
.../src/test/resources/json/eventComplex-v4.json | 27 ++++++++++++++++++++++
.../src/test/resources/json/eventComplex.json | 14 +++++++++++
.../api/filtering/FilteringManagementContract.java | 5 ++--
.../james/jmap/api/filtering/RuleFixture.java | 20 ++++++++++++++++
7 files changed, 109 insertions(+), 4 deletions(-)
diff --git a/server/data/data-jmap-cassandra/src/test/java/org/apache/james/jmap/cassandra/filtering/DTOTest.java b/server/data/data-jmap-cassandra/src/test/java/org/apache/james/jmap/cassandra/filtering/DTOTest.java
index 32efb92c5b..fc0bfa9aa7 100644
--- a/server/data/data-jmap-cassandra/src/test/java/org/apache/james/jmap/cassandra/filtering/DTOTest.java
+++ b/server/data/data-jmap-cassandra/src/test/java/org/apache/james/jmap/cassandra/filtering/DTOTest.java
@@ -25,6 +25,8 @@ import static org.apache.james.jmap.api.filtering.FilteringRuleSetDefineDTOModul
import static org.apache.james.jmap.api.filtering.RuleFixture.RULE_1;
import static org.apache.james.jmap.api.filtering.RuleFixture.RULE_2;
import static org.apache.james.jmap.api.filtering.RuleFixture.RULE_4;
+import static org.apache.james.jmap.api.filtering.RuleFixture.RULE_CC;
+import static org.apache.james.jmap.api.filtering.RuleFixture.RULE_CC_2;
import static org.apache.james.jmap.api.filtering.RuleFixture.RULE_FROM;
import static org.apache.james.jmap.api.filtering.RuleFixture.RULE_FROM_2;
import static org.apache.james.jmap.api.filtering.RuleFixture.RULE_RECIPIENT;
@@ -75,7 +77,7 @@ class DTOTest {
static final RuleSetDefined COMPLEX_RULE = new RuleSetDefined(
new FilteringAggregateId(Username.of("Bart")),
EventId.first(),
- ImmutableList.of(RULE_FROM, RULE_RECIPIENT, RULE_SUBJECT, RULE_TO));
+ ImmutableList.of(RULE_CC, RULE_FROM, RULE_RECIPIENT, RULE_SUBJECT, RULE_TO));
static final IncrementalRuleChange INCREMENT = new IncrementalRuleChange(
new FilteringAggregateId(Username.of("Bart")),
EventId.first(),
@@ -91,7 +93,7 @@ class DTOTest {
static final RuleSetDefined COMPLEX_RULE_2 = new RuleSetDefined(
new FilteringAggregateId(Username.of("Bart")),
EventId.first(),
- ImmutableList.of(RULE_FROM_2, RULE_RECIPIENT_2, RULE_SUBJECT_2, RULE_TO_2));
+ ImmutableList.of(RULE_CC_2, RULE_FROM_2, RULE_RECIPIENT_2, RULE_SUBJECT_2, RULE_TO_2));
static final IncrementalRuleChange INCREMENT_2 = new IncrementalRuleChange(
new FilteringAggregateId(Username.of("Bart")),
EventId.first(),
diff --git a/server/data/data-jmap-cassandra/src/test/resources/json/eventComplex-v2.json b/server/data/data-jmap-cassandra/src/test/resources/json/eventComplex-v2.json
index 93b1c258eb..b9b6c83b5d 100644
--- a/server/data/data-jmap-cassandra/src/test/resources/json/eventComplex-v2.json
+++ b/server/data/data-jmap-cassandra/src/test/resources/json/eventComplex-v2.json
@@ -3,6 +3,24 @@
"eventId":0,
"aggregateId":"FilteringRule/bart",
"rules":[
+ {
+ "id":"id-cc",
+ "name":"a name",
+ "condition": {
+ "field": "cc",
+ "comparator": "start-with",
+ "value": "A value to match 5"
+ },
+ "action": {
+ "appendIn": {
+ "mailboxIds":["mbx1"]
+ },
+ "important":false,
+ "keyworkds":[],
+ "reject":false,
+ "seen":false
+ }
+ },
{
"id":"id-from",
"name":"a name",
diff --git a/server/data/data-jmap-cassandra/src/test/resources/json/eventComplex-v3.json b/server/data/data-jmap-cassandra/src/test/resources/json/eventComplex-v3.json
index 66cdae15f2..8a22c6d7fd 100644
--- a/server/data/data-jmap-cassandra/src/test/resources/json/eventComplex-v3.json
+++ b/server/data/data-jmap-cassandra/src/test/resources/json/eventComplex-v3.json
@@ -3,6 +3,29 @@
"eventId":0,
"aggregateId":"FilteringRule/bart",
"rules":[
+ {
+ "id":"id-cc",
+ "name":"a name",
+ "conditionGroup": {
+ "conditionCombiner": "AND",
+ "conditions": [
+ {
+ "field": "cc",
+ "comparator": "start-with",
+ "value": "A value to match 5"
+ }
+ ]
+ },
+ "action": {
+ "appendIn": {
+ "mailboxIds":["mbx1"]
+ },
+ "important":false,
+ "keyworkds":[],
+ "reject":false,
+ "seen":false
+ }
+ },
{
"id":"id-from",
"name":"a name",
diff --git a/server/data/data-jmap-cassandra/src/test/resources/json/eventComplex-v4.json b/server/data/data-jmap-cassandra/src/test/resources/json/eventComplex-v4.json
index 32b0b57aa3..1eb83c3c8b 100644
--- a/server/data/data-jmap-cassandra/src/test/resources/json/eventComplex-v4.json
+++ b/server/data/data-jmap-cassandra/src/test/resources/json/eventComplex-v4.json
@@ -3,6 +3,33 @@
"eventId":0,
"aggregateId":"FilteringRule/bart",
"rules":[
+ {
+ "id":"id-cc",
+ "name":"a name",
+ "conditionGroup": {
+ "conditionCombiner": "AND",
+ "conditions": [
+ {
+ "field": "cc",
+ "comparator": "start-with",
+ "value": "A value to match 5"
+ }
+ ]
+ },
+ "action": {
+ "appendIn": {
+ "mailboxIds":["id-01"]
+ },
+ "important":true,
+ "keyworkds":["abc"],
+ "reject":true,
+ "seen":true,
+ "forwardTo": {
+ "addresses": ["abc@example.com"],
+ "keepACopy": true
+ }
+ }
+ },
{
"id":"id-from",
"name":"a name",
diff --git a/server/data/data-jmap-cassandra/src/test/resources/json/eventComplex.json b/server/data/data-jmap-cassandra/src/test/resources/json/eventComplex.json
index 7371858916..0190fe4fe4 100644
--- a/server/data/data-jmap-cassandra/src/test/resources/json/eventComplex.json
+++ b/server/data/data-jmap-cassandra/src/test/resources/json/eventComplex.json
@@ -3,6 +3,20 @@
"eventId":0,
"aggregateId":"FilteringRule/bart",
"rules":[
+ {
+ "id":"id-cc",
+ "name":"a name",
+ "condition": {
+ "field": "cc",
+ "comparator": "start-with",
+ "value": "A value to match 5"
+ },
+ "action": {
+ "appendIn": {
+ "mailboxIds":["mbx1"]
+ }
+ }
+ },
{
"id":"id-from",
"name":"a name",
diff --git a/server/data/data-jmap/src/test/java/org/apache/james/jmap/api/filtering/FilteringManagementContract.java b/server/data/data-jmap/src/test/java/org/apache/james/jmap/api/filtering/FilteringManagementContract.java
index b61829bc5f..efcbb6d37c 100644
--- a/server/data/data-jmap/src/test/java/org/apache/james/jmap/api/filtering/FilteringManagementContract.java
+++ b/server/data/data-jmap/src/test/java/org/apache/james/jmap/api/filtering/FilteringManagementContract.java
@@ -21,6 +21,7 @@ package org.apache.james.jmap.api.filtering;
import static org.apache.james.jmap.api.filtering.RuleFixture.RULE_1;
import static org.apache.james.jmap.api.filtering.RuleFixture.RULE_2;
import static org.apache.james.jmap.api.filtering.RuleFixture.RULE_3;
+import static org.apache.james.jmap.api.filtering.RuleFixture.RULE_CC;
import static org.apache.james.jmap.api.filtering.RuleFixture.RULE_FROM;
import static org.apache.james.jmap.api.filtering.RuleFixture.RULE_RECIPIENT;
import static org.apache.james.jmap.api.filtering.RuleFixture.RULE_SUBJECT;
@@ -130,10 +131,10 @@ public interface FilteringManagementContract {
default void allFieldsAndComparatorShouldWellBeStored() {
FilteringManagement testee = instantiateFilteringManagement();
- Mono.from(testee.defineRulesForUser(USERNAME, Optional.empty(), RULE_FROM, RULE_RECIPIENT, RULE_SUBJECT, RULE_TO, RULE_1)).block();
+ Mono.from(testee.defineRulesForUser(USERNAME, Optional.empty(), RULE_FROM, RULE_RECIPIENT, RULE_SUBJECT, RULE_TO, RULE_CC, RULE_1)).block();
assertThat(Mono.from(testee.listRulesForUser(USERNAME)).block())
- .isEqualTo(new Rules(ImmutableList.of(RULE_FROM, RULE_RECIPIENT, RULE_SUBJECT, RULE_TO, RULE_1), new Version(0)));
+ .isEqualTo(new Rules(ImmutableList.of(RULE_FROM, RULE_RECIPIENT, RULE_SUBJECT, RULE_TO, RULE_CC, RULE_1), new Version(0)));
}
@Test
diff --git a/server/data/data-jmap/src/test/java/org/apache/james/jmap/api/filtering/RuleFixture.java b/server/data/data-jmap/src/test/java/org/apache/james/jmap/api/filtering/RuleFixture.java
index d57d82f978..da36eb27ab 100644
--- a/server/data/data-jmap/src/test/java/org/apache/james/jmap/api/filtering/RuleFixture.java
+++ b/server/data/data-jmap/src/test/java/org/apache/james/jmap/api/filtering/RuleFixture.java
@@ -101,6 +101,16 @@ public interface RuleFixture {
"A value to match 4"))
.build();
+ Rule RULE_CC = Rule.builder()
+ .id(Rule.Id.of("id-cc"))
+ .name(NAME)
+ .action(Rule.Action.of(Rule.Action.AppendInMailboxes.withMailboxIds("mbx1")))
+ .conditionGroup(Rule.Condition.of(
+ Rule.Condition.Field.CC,
+ Rule.Condition.Comparator.START_WITH,
+ "A value to match 5"))
+ .build();
+
Rule RULE_TO_2 = Rule.builder()
.id(Rule.Id.of("id-to"))
.name(NAME)
@@ -140,4 +150,14 @@ public interface RuleFixture {
Rule.Condition.Comparator.CONTAINS,
"A value to match 4"))
.build();
+
+ Rule RULE_CC_2 = Rule.builder()
+ .id(Rule.Id.of("id-cc"))
+ .name(NAME)
+ .action(ACTION_2)
+ .conditionGroup(Rule.Condition.of(
+ Rule.Condition.Field.CC,
+ Rule.Condition.Comparator.START_WITH,
+ "A value to match 5"))
+ .build();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
(james-project) 02/04: JAMES-4143 Add tests in JMAPFilteringTest
Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 548af735ae74fbecad2048627f062633e63d1f7b
Author: Trung NGUYEN <qt...@linagora.com>
AuthorDate: Wed Sep 10 11:06:14 2025 +0200
JAMES-4143 Add tests in JMAPFilteringTest
---
.../jmap/mailet/filter/JMAPFilteringTest.java | 53 ++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/server/protocols/jmap-rfc-8621/src/test/java/org/apache/james/jmap/mailet/filter/JMAPFilteringTest.java b/server/protocols/jmap-rfc-8621/src/test/java/org/apache/james/jmap/mailet/filter/JMAPFilteringTest.java
index eeea375ba0..3008166590 100644
--- a/server/protocols/jmap-rfc-8621/src/test/java/org/apache/james/jmap/mailet/filter/JMAPFilteringTest.java
+++ b/server/protocols/jmap-rfc-8621/src/test/java/org/apache/james/jmap/mailet/filter/JMAPFilteringTest.java
@@ -24,6 +24,7 @@ import static org.apache.james.jmap.api.filtering.Rule.Condition.Comparator.CONT
import static org.apache.james.jmap.api.filtering.Rule.Condition.Comparator.EXACTLY_EQUALS;
import static org.apache.james.jmap.api.filtering.Rule.Condition.Comparator.NOT_CONTAINS;
import static org.apache.james.jmap.api.filtering.Rule.Condition.Comparator.NOT_EXACTLY_EQUALS;
+import static org.apache.james.jmap.api.filtering.Rule.Condition.Comparator.START_WITH;
import static org.apache.james.jmap.api.filtering.Rule.Condition.Field.CC;
import static org.apache.james.jmap.api.filtering.Rule.Condition.Field.FROM;
import static org.apache.james.jmap.api.filtering.Rule.Condition.Field.RECIPIENT;
@@ -1129,4 +1130,56 @@ class JMAPFilteringTest {
assertThat(mail.getAttribute(RECIPIENT_1_USERNAME_ATTRIBUTE_NAME).isEmpty()).isTrue();
}
+
+ @Test
+ void startWithAddressMailMatched(JMAPFilteringTestSystem testSystem) throws Exception {
+ testSystem.defineRulesForRecipient1(
+ Rule.Condition.of(FROM, START_WITH, USER_1_ADDRESS.substring(0, 2))
+ );
+
+ FakeMail mail = testSystem.asMail(mimeMessageBuilder()
+ .addFrom(USER_1_FULL_ADDRESS));
+ testSystem.getJmapFiltering().service(mail);
+
+ assertThat(mail.getAttribute(RECIPIENT_1_USERNAME_ATTRIBUTE_NAME)).isNotEmpty();
+ }
+
+ @Test
+ void startWithAddressMailNotMatched(JMAPFilteringTestSystem testSystem) throws Exception {
+ testSystem.defineRulesForRecipient1(
+ Rule.Condition.of(FROM, START_WITH, "abcdef")
+ );
+
+ FakeMail mail = testSystem.asMail(mimeMessageBuilder()
+ .addFrom(USER_1_FULL_ADDRESS));
+ testSystem.getJmapFiltering().service(mail);
+
+ assertThat(mail.getAttribute(RECIPIENT_1_USERNAME_ATTRIBUTE_NAME)).isEmpty();
+ }
+
+ @Test
+ void startWithSubjectMatched(JMAPFilteringTestSystem testSystem) throws Exception {
+ testSystem.defineRulesForRecipient1(
+ Rule.Condition.of(SUBJECT, START_WITH, SCRAMBLED_SUBJECT.substring(0, 2))
+ );
+
+ FakeMail mail = testSystem.asMail(mimeMessageBuilder()
+ .addHeader(SUBJECT.asString(), SCRAMBLED_SUBJECT));
+ testSystem.getJmapFiltering().service(mail);
+
+ assertThat(mail.getAttribute(RECIPIENT_1_USERNAME_ATTRIBUTE_NAME)).isNotEmpty();
+ }
+
+ @Test
+ void startWithSubjectNotMatched(JMAPFilteringTestSystem testSystem) throws Exception {
+ testSystem.defineRulesForRecipient1(
+ Rule.Condition.of(SUBJECT, START_WITH, "abcdef")
+ );
+
+ FakeMail mail = testSystem.asMail(mimeMessageBuilder()
+ .addHeader(SUBJECT.asString(), SCRAMBLED_SUBJECT));
+ testSystem.getJmapFiltering().service(mail);
+
+ assertThat(mail.getAttribute(RECIPIENT_1_USERNAME_ATTRIBUTE_NAME)).isEmpty();
+ }
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
(james-project) 01/04: JAMES-4143 Add JMAP StartWith Filter
Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit ec4db92c8eb6ce96e7153431b1d50ccdaa546c29
Author: Trung NGUYEN <qt...@linagora.com>
AuthorDate: Mon Sep 8 18:30:28 2025 +0200
JAMES-4143 Add JMAP StartWith Filter
---
.../src/main/java/org/apache/james/jmap/api/filtering/Rule.java | 3 ++-
.../java/org/apache/james/jmap/mailet/filter/ContentMatcher.java | 6 ++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/filtering/Rule.java b/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/filtering/Rule.java
index 645c1705ad..234623f981 100644
--- a/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/filtering/Rule.java
+++ b/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/filtering/Rule.java
@@ -161,7 +161,8 @@ public class Rule {
CONTAINS("contains"),
NOT_CONTAINS("not-contains"),
EXACTLY_EQUALS("exactly-equals"),
- NOT_EXACTLY_EQUALS("not-exactly-equals");
+ NOT_EXACTLY_EQUALS("not-exactly-equals"),
+ START_WITH("start-with");
public static Optional<Comparator> find(String comparatorName) {
return Arrays.stream(values())
diff --git a/server/protocols/jmap-rfc-8621/src/main/java/org/apache/james/jmap/mailet/filter/ContentMatcher.java b/server/protocols/jmap-rfc-8621/src/main/java/org/apache/james/jmap/mailet/filter/ContentMatcher.java
index 3d30af8633..fd62f30215 100644
--- a/server/protocols/jmap-rfc-8621/src/main/java/org/apache/james/jmap/mailet/filter/ContentMatcher.java
+++ b/server/protocols/jmap-rfc-8621/src/main/java/org/apache/james/jmap/mailet/filter/ContentMatcher.java
@@ -94,18 +94,23 @@ public interface ContentMatcher {
ContentMatcher STRING_NOT_CONTAINS_MATCHER = negate(STRING_CONTAINS_MATCHER);
ContentMatcher STRING_EXACTLY_EQUALS_MATCHER = (contents, valueToMatch) -> contents.anyMatch(content -> StringUtils.equals(content, valueToMatch));
ContentMatcher STRING_NOT_EXACTLY_EQUALS_MATCHER = negate(STRING_EXACTLY_EQUALS_MATCHER);
+ ContentMatcher STRING_START_WITH_MATCHER = (contents, valueToMatch) -> contents.anyMatch(content -> content.startsWith(valueToMatch));
ContentMatcher ADDRESS_CONTAINS_MATCHER = (contents, valueToMatch) -> contents
.map(ContentMatcher::asAddressHeader)
.anyMatch(addressHeader -> StringUtils.containsIgnoreCase(addressHeader.fullAddress, valueToMatch));
ContentMatcher ADDRESS_NOT_CONTAINS_MATCHER = negate(ADDRESS_CONTAINS_MATCHER);
ContentMatcher ADDRESS_NOT_EXACTLY_EQUALS_MATCHER = negate(new ExactAddressContentMatcher());
+ ContentMatcher ADDRESS_START_WITH_MATCHER = (contents, valueToMatch) -> contents
+ .map(ContentMatcher::asAddressHeader)
+ .anyMatch(addressHeader -> addressHeader.fullAddress.startsWith(valueToMatch));
Map<Rule.Condition.Comparator, ContentMatcher> HEADER_ADDRESS_MATCHER_REGISTRY = ImmutableMap.<Rule.Condition.Comparator, ContentMatcher>builder()
.put(Rule.Condition.Comparator.CONTAINS, ADDRESS_CONTAINS_MATCHER)
.put(Rule.Condition.Comparator.NOT_CONTAINS, ADDRESS_NOT_CONTAINS_MATCHER)
.put(Rule.Condition.Comparator.EXACTLY_EQUALS, new ExactAddressContentMatcher())
.put(Rule.Condition.Comparator.NOT_EXACTLY_EQUALS, ADDRESS_NOT_EXACTLY_EQUALS_MATCHER)
+ .put(Rule.Condition.Comparator.START_WITH, ADDRESS_START_WITH_MATCHER)
.build();
Map<Rule.Condition.Comparator, ContentMatcher> CONTENT_STRING_MATCHER_REGISTRY = ImmutableMap.<Rule.Condition.Comparator, ContentMatcher>builder()
@@ -113,6 +118,7 @@ public interface ContentMatcher {
.put(Rule.Condition.Comparator.NOT_CONTAINS, STRING_NOT_CONTAINS_MATCHER)
.put(Rule.Condition.Comparator.EXACTLY_EQUALS, STRING_EXACTLY_EQUALS_MATCHER)
.put(Rule.Condition.Comparator.NOT_EXACTLY_EQUALS, STRING_NOT_EXACTLY_EQUALS_MATCHER)
+ .put(Rule.Condition.Comparator.START_WITH, STRING_START_WITH_MATCHER)
.build();
Map<Rule.Condition.Field, Map<Rule.Condition.Comparator, ContentMatcher>> CONTENT_MATCHER_REGISTRY = ImmutableMap.<Rule.Condition.Field, Map<Rule.Condition.Comparator, ContentMatcher>>builder()
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
(james-project) 04/04: JAMES 4143 Update tests to show that start-with filter is different from contains filter
Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 612e60ade30df2e09a6319bf035f635228a27044
Author: Trung NGUYEN <qt...@linagora.com>
AuthorDate: Wed Sep 10 16:37:10 2025 +0200
JAMES 4143 Update tests to show that start-with filter is different from contains filter
---
.../org/apache/james/jmap/mailet/filter/JMAPFilteringTest.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/server/protocols/jmap-rfc-8621/src/test/java/org/apache/james/jmap/mailet/filter/JMAPFilteringTest.java b/server/protocols/jmap-rfc-8621/src/test/java/org/apache/james/jmap/mailet/filter/JMAPFilteringTest.java
index 3008166590..c3648f30ae 100644
--- a/server/protocols/jmap-rfc-8621/src/test/java/org/apache/james/jmap/mailet/filter/JMAPFilteringTest.java
+++ b/server/protocols/jmap-rfc-8621/src/test/java/org/apache/james/jmap/mailet/filter/JMAPFilteringTest.java
@@ -1147,7 +1147,10 @@ class JMAPFilteringTest {
@Test
void startWithAddressMailNotMatched(JMAPFilteringTestSystem testSystem) throws Exception {
testSystem.defineRulesForRecipient1(
- Rule.Condition.of(FROM, START_WITH, "abcdef")
+ // start-with a random text
+ Rule.Condition.of(FROM, START_WITH, "abcdef"),
+ // start-with behaves differently from contains
+ Rule.Condition.of(FROM, START_WITH, USER_1_ADDRESS.substring(2, 5))
);
FakeMail mail = testSystem.asMail(mimeMessageBuilder()
@@ -1173,7 +1176,10 @@ class JMAPFilteringTest {
@Test
void startWithSubjectNotMatched(JMAPFilteringTestSystem testSystem) throws Exception {
testSystem.defineRulesForRecipient1(
- Rule.Condition.of(SUBJECT, START_WITH, "abcdef")
+ // start-with a random text
+ Rule.Condition.of(SUBJECT, START_WITH, "abcdef"),
+ // start-with behaves differently from contains
+ Rule.Condition.of(SUBJECT, START_WITH, SCRAMBLED_SUBJECT.substring(2, 5))
);
FakeMail mail = testSystem.asMail(mimeMessageBuilder()
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org