JAMES-2584 Add a Cassandra related integration test on stemming
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/e9b89556 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/e9b89556 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/e9b89556 Branch: refs/heads/master Commit: e9b8955603cdf131cb2d1c1f118ad4cd57688f12 Parents: d6be7a1 Author: Antoine Duprat <[email protected]> Authored: Tue Nov 6 15:02:22 2018 +0100 Committer: Antoine Duprat <[email protected]> Committed: Fri Nov 9 08:49:10 2018 +0100 ---------------------------------------------------------------------- .../store/src/test/resources/eml/htmlMail.eml | 14 ++-- .../store/src/test/resources/eml/htmlMail.json | 18 ++--- .../cassandra-jmap-integration-testing/pom.xml | 2 +- .../integration/GetMessageListMethodTest.java | 19 +++++ .../src/test/resources/eml/htmlMail.eml | 81 ++++++++++++++++++++ .../memory/MemoryGetMessageListMethodTest.java | 12 ++- 6 files changed, 127 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/e9b89556/mailbox/store/src/test/resources/eml/htmlMail.eml ---------------------------------------------------------------------- diff --git a/mailbox/store/src/test/resources/eml/htmlMail.eml b/mailbox/store/src/test/resources/eml/htmlMail.eml index 41705b9..ba2da77 100644 --- a/mailbox/store/src/test/resources/eml/htmlMail.eml +++ b/mailbox/store/src/test/resources/eml/htmlMail.eml @@ -1,17 +1,17 @@ -Delivered-To: [email protected] +Delivered-To: [email protected] Received: by 10.28.170.202 with SMTP id t193csp327634wme; Thu, 4 Jun 2015 00:36:15 -0700 (PDT) X-Received: by 10.180.77.195 with SMTP id u3mr5042880wiw.30.1433403375307; Thu, 04 Jun 2015 00:36:15 -0700 (PDT) -Return-Path: <[email protected]> +Return-Path: <[email protected]> Received: from o7.email.airbnb.com (o7.email.airbnb.com. [167.89.32.249]) by mx.google.com with ESMTPS id i2si5691730wjz.123.2015.06.04.00.36.13 - for <[email protected]> + for <[email protected]> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jun 2015 00:36:15 -0700 (PDT) -Received-SPF: pass (google.com: domain of [email protected] designates 167.89.32.249 as permitted sender) client-ip=167.89.32.249; +Received-SPF: pass (google.com: domain of [email protected] designates 167.89.32.249 as permitted sender) client-ip=167.89.32.249; Authentication-Results: mx.google.com; - spf=pass (google.com: domain of [email protected] designates 167.89.32.249 as permitted sender) smtp.mail=bounces+1453977-062b-benoittellier3=gmail....@email.airbnb.com; + spf=pass (google.com: domain of [email protected] designates 167.89.32.249 as permitted sender) [email protected]; dkim=pass [email protected]; dmarc=pass (p=REJECT dis=NONE) header.from=airbnb.com DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=email.airbnb.com; @@ -30,12 +30,12 @@ Received: by filter0490p1mdw1.sendgrid.net with SMTP id filter0490p1mdw1.13271.5 2015-06-04 07:36:09.249601779 +0000 UTC Received: from i-dee0850e.inst.aws.airbnb.com (ec2-54-90-154-187.compute-1.amazonaws.com [54.90.154.187]) by ismtpd-017 (SG) with ESMTP id 14dbd7fa6b4.779a.254b43 - for <[email protected]>; Thu, 04 Jun 2015 07:36:09 +0000 (UTC) + for <[email protected]>; Thu, 04 Jun 2015 07:36:09 +0000 (UTC) Received: by i-dee0850e.inst.aws.airbnb.com (Postfix, from userid 1041) id 19CBA24C60; Thu, 4 Jun 2015 07:36:09 +0000 (UTC) Date: Thu, 04 Jun 2015 07:36:08 +0000 From: Airbnb <[email protected]> -To: [email protected] +To: [email protected] Message-ID: <[email protected]> Subject: Text and Html not similar Mime-Version: 1.0 http://git-wip-us.apache.org/repos/asf/james-project/blob/e9b89556/mailbox/store/src/test/resources/eml/htmlMail.json ---------------------------------------------------------------------- diff --git a/mailbox/store/src/test/resources/eml/htmlMail.json b/mailbox/store/src/test/resources/eml/htmlMail.json index 30cbbf1..3ecdf3e 100644 --- a/mailbox/store/src/test/resources/eml/htmlMail.json +++ b/mailbox/store/src/test/resources/eml/htmlMail.json @@ -23,14 +23,14 @@ "engagement" ], "return-path":[ - "<[email protected]>" + "<[email protected]>" ], "subject":[ "Text and Html not similar" ],"x-sg-id":["pQ7zy0fBcyQB3Gm22dZtqT6AR3zbAquH5ABZFkQfSKaxWRhz0YhtD36Li5uybRUjnPsuB21NpreKvG t8iQBUn2ygs6hx6sMcgyI7L7bAY28p14Qj47KqA3JXbtMa0Xa3wdZaUUjZpemCg078XxMM5VaSHdDO ChUhSV+z9RAJ38wAdUfXkpbO+m97vpU+mtWzVBoOrSiWCVYoNxPhvE4yIQ==" ], "received":[ - "by 10.28.170.202 with SMTP id t193csp327634wme; Thu, 4 Jun 2015 00:36:15 -0700 (PDT)","from o7.email.airbnb.com (o7.email.airbnb.com. [167.89.32.249]) by mx.google.com with ESMTPS id i2si5691730wjz.123.2015.06.04.00.36.13 for <[email protected]> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jun 2015 00:36:15 -0700 (PDT)","by filter0490p1mdw1.sendgrid.net with SMTP id filter0490p1mdw1.13271.556FFFE7B 2015-06-04 07:36:09.249601779 +0000 UTC","from i-dee0850e.inst.aws.airbnb.com (ec2-54-90-154-187.compute-1.amazonaws.com [54.90.154.187])\tby ismtpd-017 (SG) with ESMTP id 14dbd7fa6b4.779a.254b43\tfor <[email protected]>; Thu, 04 Jun 2015 07:36:09 +0000 (UTC)","by i-dee0850e.inst.aws.airbnb.com (Postfix, from userid 1041)\tid 19CBA24C60; Thu, 4 Jun 2015 07:36:09 +0000 (UTC)" + "by 10.28.170.202 with SMTP id t193csp327634wme; Thu, 4 Jun 2015 00:36:15 -0700 (PDT)","from o7.email.airbnb.com (o7.email.airbnb.com. [167.89.32.249]) by mx.google.com with ESMTPS id i2si5691730wjz.123.2015.06.04.00.36.13 for <[email protected]> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jun 2015 00:36:15 -0700 (PDT)","by filter0490p1mdw1.sendgrid.net with SMTP id filter0490p1mdw1.13271.556FFFE7B 2015-06-04 07:36:09.249601779 +0000 UTC","from i-dee0850e.inst.aws.airbnb.com (ec2-54-90-154-187.compute-1.amazonaws.com [54.90.154.187])\tby ismtpd-017 (SG) with ESMTP id 14dbd7fa6b4.779a.254b43\tfor <[email protected]>; Thu, 04 Jun 2015 07:36:09 +0000 (UTC)","by i-dee0850e.inst.aws.airbnb.com (Postfix, from userid 1041)\tid 19CBA24C60; Thu, 4 Jun 2015 07:36:09 +0000 (UTC)" ], "x-user-id":[ "32692788" @@ -45,10 +45,10 @@ "fr" ], "received-spf":[ - "pass (google.com: domain of [email protected] designates 167.89.32.249 as permitted sender) client-ip=167.89.32.249;" + "pass (google.com: domain of [email protected] designates 167.89.32.249 as permitted sender) client-ip=167.89.32.249;" ], "delivered-to":[ - "[email protected]" + "[email protected]" ], "x-received":[ "by 10.180.77.195 with SMTP id u3mr5042880wiw.30.1433403375307; Thu, 04 Jun 2015 00:36:15 -0700 (PDT)" @@ -69,10 +69,10 @@ "multipart/alternative; boundary=\"--==_mimepart_556fffe8c7e84_7ed0e0fe20445637\"; charset=UTF-8" ], "authentication-results":[ - "mx.google.com; spf=pass (google.com: domain of [email protected] designates 167.89.32.249 as permitted sender) smtp.mail=bounces+1453977-062b-benoittellier3=gmail....@email.airbnb.com; dkim=pass [email protected]; dmarc=pass (p=REJECT dis=NONE) header.from=airbnb.com" + "mx.google.com; spf=pass (google.com: domain of [email protected] designates 167.89.32.249 as permitted sender) [email protected]; dkim=pass [email protected]; dmarc=pass (p=REJECT dis=NONE) header.from=airbnb.com" ], "to":[ - "[email protected]" + "[email protected]" ], "sent-on":[ "" @@ -89,8 +89,8 @@ ], "to":[ { - "name":"[email protected]", - "address":"[email protected]" + "name":"[email protected]", + "address":"[email protected]" } ], "cc":[], @@ -163,5 +163,5 @@ "users": [ "username" ], - "text": "Airbnb [email protected] [email protected] [email protected] Text and Html not similar The text/plain part is not matching the html one.\r\n <html>\r\n <head>\r\n\r\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n </head>\r\n <body bgcolor=\"#FFFFFF\" text=\"#000000\">\r\n <i>This is a mail with <b>beautifull</b> html content which contains a banana.</i><br>\r\n </body>\r\n</html>\r\n" + "text": "Airbnb [email protected] [email protected] [email protected] Text and Html not similar The text/plain part is not matching the html one.\r\n <html>\r\n <head>\r\n\r\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n </head>\r\n <body bgcolor=\"#FFFFFF\" text=\"#000000\">\r\n <i>This is a mail with <b>beautifull</b> html content which contains a banana.</i><br>\r\n </body>\r\n</html>\r\n" } http://git-wip-us.apache.org/repos/asf/james-project/blob/e9b89556/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/pom.xml ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/pom.xml b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/pom.xml index ebd4966..45ba1cb 100644 --- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/pom.xml +++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/pom.xml @@ -227,7 +227,7 @@ <reuseForks>true</reuseForks> <!-- Fail tests longer than 2 hours, prevent form random locking tests --> <forkedProcessTimeoutInSeconds>7200</forkedProcessTimeoutInSeconds> - <groups combine.self="override">org.apache.james.jmap.categories.CassandraAndElasticSearchOnly,org.apache.james.jmap.categories.BasicFeature,org.apache.james.jmap.categories.EnableCucumber</groups> + <groups combine.self="override">org.apache.james.jmap.categories.CassandraAndElasticSearchCategory,org.apache.james.jmap.categories.BasicFeature,org.apache.james.jmap.categories.EnableCucumber</groups> </configuration> <dependencies> <dependency> http://git-wip-us.apache.org/repos/asf/james-project/blob/e9b89556/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java index 83747b6..869bca0 100644 --- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java +++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java @@ -979,6 +979,25 @@ public abstract class GetMessageListMethodTest { } @Test + @Category(CassandraAndElasticSearchCategory.class) + public void getMessageListShouldIncludeMessagesWhenTextFilterMatchesBodyWithStemming() throws Exception { + mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE, "mailbox"); + ComposedMessageId message = mailboxProbe.appendMessage(ALICE, MailboxPath.forUser(ALICE, "mailbox"), + ClassLoader.getSystemResourceAsStream("eml/htmlMail.eml"), new Date(), false, new Flags()); + await(); + // text/html contains: "This is a mail with beautifull html content which contains a banana." + + given() + .header("Authorization", aliceAccessToken.serialize()) + .body("[[\"getMessageList\", {\"filter\":{\"text\":\"contain banana\"}}, \"#0\"]]") + .when() + .post("/jmap") + .then() + .statusCode(200) + .body(ARGUMENTS + ".messageIds", contains(message.getMessageId().serialize())); + } + + @Test public void getMessageListShouldIncludeMessagesWhenSubjectFilterMatchesSubject() throws Exception { mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE, "mailbox"); ComposedMessageId message = mailboxProbe.appendMessage(ALICE, MailboxPath.forUser(ALICE, "mailbox"), http://git-wip-us.apache.org/repos/asf/james-project/blob/e9b89556/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/htmlMail.eml ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/htmlMail.eml b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/htmlMail.eml new file mode 100644 index 0000000..ba2da77 --- /dev/null +++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/htmlMail.eml @@ -0,0 +1,81 @@ +Delivered-To: [email protected] +Received: by 10.28.170.202 with SMTP id t193csp327634wme; + Thu, 4 Jun 2015 00:36:15 -0700 (PDT) +X-Received: by 10.180.77.195 with SMTP id u3mr5042880wiw.30.1433403375307; + Thu, 04 Jun 2015 00:36:15 -0700 (PDT) +Return-Path: <[email protected]> +Received: from o7.email.airbnb.com (o7.email.airbnb.com. [167.89.32.249]) + by mx.google.com with ESMTPS id i2si5691730wjz.123.2015.06.04.00.36.13 + for <[email protected]> + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Thu, 04 Jun 2015 00:36:15 -0700 (PDT) +Received-SPF: pass (google.com: domain of [email protected] designates 167.89.32.249 as permitted sender) client-ip=167.89.32.249; +Authentication-Results: mx.google.com; + spf=pass (google.com: domain of [email protected] designates 167.89.32.249 as permitted sender) [email protected]; + dkim=pass [email protected]; + dmarc=pass (p=REJECT dis=NONE) header.from=airbnb.com +DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=email.airbnb.com; + h=from:to:subject:mime-version:content-type:content-transfer-encoding; + s=s20150428; bh=2mhWUwzjtQTC0KljgpaEsuvrqok=; b=EhC2QHKb5+63egDD + qDCAepUELCeUZXCkw8+31kGT+O1va3iAKvQSAvzXJ3qJlIL9FgdeFk8sR78Vszn/ + A73vp6NGjAW60M4gUZjxEOIPzGKIS95KfmHxg10fXUOFW0uePojNEg4ZPCcuitrZ + HuWvzHK5I2siGnqupiivwxDgs5c= +DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.info; + h=from:to:subject:mime-version:content-type:content-transfer-encoding:x-feedback-id; + s=smtpapi; bh=2mhWUwzjtQTC0KljgpaEsuvrqok=; b=FPiYMmNJLCrL2e8v/0 + DQC4voofe8nuuE7rhXZ25oqNAhAQja4oKIysJ1qAME2aEaqh+N5aJlCEuHrSG/7+ + NAQ0OY8KaJ2zlnxAbmgJETOjnf4oGdAa+nU/nVVEPfN2NRcBCNLGQZ80U4T5k8Xi + PakIuZvKDTRq7PiosSCSHT/FQ= +Received: by filter0490p1mdw1.sendgrid.net with SMTP id filter0490p1mdw1.13271.556FFFE7B + 2015-06-04 07:36:09.249601779 +0000 UTC +Received: from i-dee0850e.inst.aws.airbnb.com (ec2-54-90-154-187.compute-1.amazonaws.com [54.90.154.187]) + by ismtpd-017 (SG) with ESMTP id 14dbd7fa6b4.779a.254b43 + for <[email protected]>; Thu, 04 Jun 2015 07:36:09 +0000 (UTC) +Received: by i-dee0850e.inst.aws.airbnb.com (Postfix, from userid 1041) + id 19CBA24C60; Thu, 4 Jun 2015 07:36:09 +0000 (UTC) +Date: Thu, 04 Jun 2015 07:36:08 +0000 +From: Airbnb <[email protected]> +To: [email protected] +Message-ID: <[email protected]> +Subject: Text and Html not similar +Mime-Version: 1.0 +Content-Type: multipart/alternative; + boundary="--==_mimepart_556fffe8c7e84_7ed0e0fe20445637"; + charset=UTF-8 +Content-Transfer-Encoding: 7bit +X-User-ID: 32692788 +X-Locale: fr +X-Category: engagement +X-Template: low_intent_top_destinations +recipients: +sent-on: +X-SG-EID: mgVKhb3i1xMIKbRk82EYOUTMOPmiNk6g5BaWGQQKDTQchtClhw7VcIxig2BMwy1QMCr7h56hNVush8 + 4aRV0ieMn+WZ1XVnpY0OcmMYNZnuuvlOoNkBaiuiqeWuKVZO9c9S5OyxPy7WQeI0mccenq35NpLqjI + nQt7IAl2sIUksUD4lM8Ai0u2C88YW13cL+Lo +X-SG-ID: pQ7zy0fBcyQB3Gm22dZtqT6AR3zbAquH5ABZFkQfSKaxWRhz0YhtD36Li5uybRUjnPsuB21NpreKvG + t8iQBUn2ygs6hx6sMcgyI7L7bAY28p14Qj47KqA3JXbtMa0Xa3wdZaUUjZpemCg078XxMM5VaSHdDO + ChUhSV+z9RAJ38wAdUfXkpbO+m97vpU+mtWzVBoOrSiWCVYoNxPhvE4yIQ== +X-Feedback-ID: 1453977:N5+DXWRfRBXSDDbqVYXPNg8MjWYWwZibliGo1i/oSqY=:Ibl/atjs+SOcHCINmWWv/YvIGzDUihUrks9jdHsNF1+pafkc987UhcxmuyggxNgdCkEmMZDb9gJcndcUJy5KOw==:SG + +----==_mimepart_556fffe8c7e84_7ed0e0fe20445637 +Content-Type: text/plain; + charset=UTF-8 +Content-Transfer-Encoding: quoted-printable + +The text/plain part is not matching the html one. + +----==_mimepart_556fffe8c7e84_7ed0e0fe20445637 +Content-Type: text/html; charset=utf-8 +Content-Transfer-Encoding: 7bit + +<html> + <head> + + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + </head> + <body bgcolor="#FFFFFF" text="#000000"> + <i>This is a mail with <b>beautifull</b> html content which contains a banana.</i><br> + </body> +</html> + +----==_mimepart_556fffe8c7e84_7ed0e0fe20445637-- http://git-wip-us.apache.org/repos/asf/james-project/blob/e9b89556/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessageListMethodTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessageListMethodTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessageListMethodTest.java index 23c495e..630f9a4 100644 --- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessageListMethodTest.java +++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessageListMethodTest.java @@ -19,13 +19,15 @@ package org.apache.james.jmap.memory; -import java.io.IOException; - import org.apache.james.GuiceJamesServer; import org.apache.james.MemoryJmapTestRule; import org.apache.james.jmap.methods.integration.GetMessageListMethodTest; import org.apache.james.modules.TestJMAPServerModule; +import org.junit.Ignore; import org.junit.Rule; +import org.junit.Test; + +import java.io.IOException; public class MemoryGetMessageListMethodTest extends GetMessageListMethodTest { @@ -41,4 +43,10 @@ public class MemoryGetMessageListMethodTest extends GetMessageListMethodTest { protected void await() { } + + @Override + @Ignore("This feature is not supported by MessageSearchIndex implementation binded in the Memory product") + @Test + public void getMessageListShouldIncludeMessagesWhenTextFilterMatchesBodyWithStemming() { + } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
