james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject svn commit: r1688148 - in /james/mailbox/trunk/elasticsearch/src: main/java/org/apache/james/mailbox/elasticsearch/json/ test/java/org/apache/james/mailbox/elasticsearch/ test/java/org/apache/james/mailbox/elasticsearch/json/
Date Mon, 29 Jun 2015 08:47:29 GMT
Author: btellier
Date: Mon Jun 29 08:47:29 2015
New Revision: 1688148

URL: http://svn.apache.org/r1688148
Log:
MAILBOX-234 Use specified time zone for tests

Modified:
    james/mailbox/trunk/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessage.java
    james/mailbox/trunk/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJson.java
    james/mailbox/trunk/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java
    james/mailbox/trunk/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJsonTest.java

Modified: james/mailbox/trunk/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessage.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessage.java?rev=1688148&r1=1688147&r2=1688148&view=diff
==============================================================================
--- james/mailbox/trunk/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessage.java
(original)
+++ james/mailbox/trunk/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessage.java
Mon Jun 29 08:47:29 2015
@@ -42,18 +42,18 @@ import java.util.stream.Collectors;
 
 public class IndexableMessage {
 
-    public static IndexableMessage from(Message<? extends MailboxId> message, TextExtractor
textExtractor) {
+    public static IndexableMessage from(Message<? extends MailboxId> message, TextExtractor
textExtractor, ZoneId zoneId) {
         Preconditions.checkNotNull(message.getMailboxId());
         IndexableMessage indexableMessage = new IndexableMessage();
         try {
             MimePart parsingResult = new MimePartParser(message, textExtractor).parse();
             indexableMessage.bodyText = parsingResult.locateFirstTextualBody();
             indexableMessage.setFlattenedAttachments(parsingResult);
-            indexableMessage.copyHeaderFields(parsingResult.getHeaderCollection(), getSanitizedInternalDate(message));
+            indexableMessage.copyHeaderFields(parsingResult.getHeaderCollection(), getSanitizedInternalDate(message,
zoneId));
         } catch (IOException | MimeException e) {
             throw Throwables.propagate(e);
         }
-        indexableMessage.copyMessageFields(message);
+        indexableMessage.copyMessageFields(message, zoneId);
         return indexableMessage;
     }
 
@@ -72,12 +72,12 @@ public class IndexableMessage {
         this.sentDate = DateResolutionFormater.DATE_TIME_FOMATTER.format(headerCollection.getSentDate().orElse(internalDate));
     }
 
-    private void copyMessageFields(Message<? extends MailboxId> message) {
+    private void copyMessageFields(Message<? extends MailboxId> message, ZoneId zoneId)
{
         this.id = message.getUid();
         this.mailboxId = message.getMailboxId().serialize();
         this.modSeq = message.getModSeq();
         this.size = message.getFullContentOctets();
-        this.date = DateResolutionFormater.DATE_TIME_FOMATTER.format(getSanitizedInternalDate(message));
+        this.date = DateResolutionFormater.DATE_TIME_FOMATTER.format(getSanitizedInternalDate(message,
zoneId));
         this.mediaType = message.getMediaType();
         this.subType = message.getSubType();
         this.isAnswered = message.isAnswered();
@@ -90,13 +90,13 @@ public class IndexableMessage {
         this.properties = message.getProperties();
     }
 
-    private static ZonedDateTime getSanitizedInternalDate(Message<? extends MailboxId>
message) {
+    private static ZonedDateTime getSanitizedInternalDate(Message<? extends MailboxId>
message, ZoneId zoneId) {
         if (message.getInternalDate() == null) {
             return ZonedDateTime.now();
         }
         return ZonedDateTime.ofInstant(
             Instant.ofEpochMilli(message.getInternalDate().getTime()),
-            ZoneId.systemDefault());
+            zoneId);
     }
 
     private Long id;

Modified: james/mailbox/trunk/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJson.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJson.java?rev=1688148&r1=1688147&r2=1688148&view=diff
==============================================================================
--- james/mailbox/trunk/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJson.java
(original)
+++ james/mailbox/trunk/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJson.java
Mon Jun 29 08:47:29 2015
@@ -21,6 +21,8 @@ package org.apache.james.mailbox.elastic
 
 import javax.mail.Flags;
 
+import java.time.ZoneId;
+
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.datatype.guava.GuavaModule;
@@ -33,9 +35,11 @@ public class MessageToElasticSearchJson
 
     private final ObjectMapper mapper;
     private final TextExtractor textExtractor;
+    private final ZoneId zoneId;
 
-    public MessageToElasticSearchJson(TextExtractor textExtractor) {
+    public MessageToElasticSearchJson(TextExtractor textExtractor, ZoneId zoneId) {
         this.textExtractor = textExtractor;
+        this.zoneId = zoneId;
         this.mapper = new ObjectMapper();
         this.mapper.registerModule(new GuavaModule());
         this.mapper.registerModule(new Jdk8Module());
@@ -47,7 +51,7 @@ public class MessageToElasticSearchJson
 
     public String convertToJson(Message<?> message) throws JsonProcessingException
{
         Preconditions.checkNotNull(message);
-        return mapper.writeValueAsString(IndexableMessage.from(message, textExtractor));
+        return mapper.writeValueAsString(IndexableMessage.from(message, textExtractor, zoneId));
     }
 
     public String getUpdatedJsonMessagePart(Flags flags, long modSeq) throws JsonProcessingException
{

Modified: james/mailbox/trunk/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java?rev=1688148&r1=1688147&r2=1688148&view=diff
==============================================================================
--- james/mailbox/trunk/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java
(original)
+++ james/mailbox/trunk/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java
Mon Jun 29 08:47:29 2015
@@ -21,7 +21,8 @@ package org.apache.james.mailbox.elastic
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import java.text.SimpleDateFormat;
+import java.time.ZoneId;
+import java.util.Date;
 
 import javax.mail.Flags;
 
@@ -71,14 +72,11 @@ public class ElasticSearchIntegrationTes
     private StoreMailboxManager<InMemoryId> storeMailboxManager;
     private ElasticSearchListeningMessageSearchIndex<InMemoryId> elasticSearchListeningMessageSearchIndex;
     private Mailbox<InMemoryId> mailbox;
-    private SimpleDateFormat format;
     private MailboxSession session;
 
     @Before
     @SuppressWarnings("unchecked")
     public void setUp() throws Exception {
-        format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS");
-
         initializeMailboxManager();
 
         session = storeMailboxManager.createSystemSession("benwa", LOGGER);
@@ -88,65 +86,74 @@ public class ElasticSearchIntegrationTes
         mailbox = messageManager.getMailboxEntity();
 
         // sentDate: Wed, 3 Jun 2015 09:05:46 +0000
+        // Internal date : 2014/01/02 00:00:00.000
         messageManager.appendMessage(
             ClassLoader.getSystemResourceAsStream("documents/spamMail.eml"),
-            format.parse("2014/01/02 00:00:00.000"),
+            new Date(1388617200000L),
             session,
             true,
             new Flags(Flags.Flag.DELETED));
-        //sentDate: Thu, 4 Jun 2015 09:23:37 +0000
+        // sentDate: Thu, 4 Jun 2015 09:23:37 +0000
+        // Internal date : 2014/02/02 00:00:00.000
         messageManager.appendMessage(
             ClassLoader.getSystemResourceAsStream("documents/mail1.eml"),
-            format.parse("2014/02/02 00:00:00.000"),
+            new Date(1391295600000L),
             session,
             true,
             new Flags(Flags.Flag.ANSWERED));
-        //sentDate: Thu, 4 Jun 2015 09:27:37 +0000
+        // sentDate: Thu, 4 Jun 2015 09:27:37 +0000
+        // Internal date : 2014/03/02 00:00:00.000
         messageManager.appendMessage(
             ClassLoader.getSystemResourceAsStream("documents/mail2.eml"),
-            format.parse("2014/03/02 00:00:00.000"),
+            new Date(1393714800000L),
             session,
             true,
             new Flags(Flags.Flag.DRAFT));
-        //sentDate: Tue, 2 Jun 2015 08:16:19 +0000
+        // sentDate: Tue, 2 Jun 2015 08:16:19 +0000
+        // Internal date : 2014/05/02 00:00:00.000
         messageManager.appendMessage(
             ClassLoader.getSystemResourceAsStream("documents/mail3.eml"),
-            format.parse("2014/05/02 00:00:00.000"),
+            new Date(1398981600000L),
             session,
             true,
             new Flags(Flags.Flag.RECENT));
-        //sentDate: Fri, 15 May 2015 06:35:59 +0000
+        // sentDate: Fri, 15 May 2015 06:35:59 +0000
+        // Internal date : 2014/04/02 00:00:00.000
         messageManager.appendMessage(
             ClassLoader.getSystemResourceAsStream("documents/mail4.eml"),
-            format.parse("2014/04/02 00:00:00.000"),
+            new Date(1396389600000L),
             session,
             true,
             new Flags(Flags.Flag.FLAGGED));
-        //sentDate: Wed, 03 Jun 2015 19:14:32 +0000
+        // sentDate: Wed, 03 Jun 2015 19:14:32 +0000
+        // Internal date : 2014/06/02 00:00:00.000
         messageManager.appendMessage(
             ClassLoader.getSystemResourceAsStream("documents/pgpSignedMail.eml"),
-            format.parse("2014/06/02 00:00:00.000"),
+            new Date(1401660000000L),
             session,
             true,
             new Flags(Flags.Flag.SEEN));
-        //sentDate: Thu, 04 Jun 2015 07:36:08 +0000
+        // sentDate: Thu, 04 Jun 2015 07:36:08 +0000
+        // Internal date : 2014/07/02 00:00:00.000
         messageManager.appendMessage(
             ClassLoader.getSystemResourceAsStream("documents/htmlMail.eml"),
-            format.parse("2014/07/02 00:00:00.000"),
+            new Date(1404252000000L),
             session,
             false,
             new Flags());
-        //sentDate: Thu, 4 Jun 2015 06:08:41 +0200
+        // sentDate: Thu, 4 Jun 2015 06:08:41 +0200
+        // Internal date : 2014/08/02 00:00:00.000
         messageManager.appendMessage(
             ClassLoader.getSystemResourceAsStream("documents/mail.eml"),
-            format.parse("2014/08/02 00:00:00.000"),
+            new Date(1406930400000L),
             session,
             true,
             new Flags("Hello"));
-        //sentDate: Tue, 2 Jun 2015 12:00:55 +0200
+        // sentDate: Tue, 2 Jun 2015 12:00:55 +0200
+        // Internal date : 2014/09/02 00:00:00.000
         messageManager.appendMessage(
             ClassLoader.getSystemResourceAsStream("documents/frnog.eml"),
-            format.parse("2014/09/02 00:00:00.000"),
+            new Date(1409608800000L),
             session,
             true,
             new Flags("Hello you"));
@@ -162,7 +169,7 @@ public class ElasticSearchIntegrationTes
         elasticSearchListeningMessageSearchIndex = new ElasticSearchListeningMessageSearchIndex<>(mapperFactory,
             new ElasticSearchIndexer(clientProvider),
             new ElasticSearchSearcher<>(clientProvider, new QueryConverter(new CriterionConverter())),
-            new MessageToElasticSearchJson(new DefaultTextExtractor()));
+            new MessageToElasticSearchJson(new DefaultTextExtractor(), ZoneId.of("Europe/Paris")));
         storeMailboxManager = new StoreMailboxManager<>(
             mapperFactory,
             new MockAuthenticator(),
@@ -334,7 +341,8 @@ public class ElasticSearchIntegrationTes
     @Test
     public void internalDateAfterShouldReturnMessagesAfterAGivenDate() throws Exception {
         SearchQuery searchQuery = new SearchQuery();
-        searchQuery.andCriteria(SearchQuery.internalDateAfter(format.parse("2014/07/02 00:00:00.000"),
SearchQuery.DateResolution.Day));
+        // Date : 2014/07/02 00:00:00.000 ( Paris time zone )
+        searchQuery.andCriteria(SearchQuery.internalDateAfter(new Date(1404252000000L), SearchQuery.DateResolution.Day));
         assertThat(elasticSearchListeningMessageSearchIndex.search(session, mailbox, searchQuery))
             .containsOnly(7L, 8L, 9L);
     }
@@ -342,7 +350,8 @@ public class ElasticSearchIntegrationTes
     @Test
     public void internalDateBeforeShouldReturnMessagesBeforeAGivenDate() throws Exception
{
         SearchQuery searchQuery = new SearchQuery();
-        searchQuery.andCriteria(SearchQuery.internalDateBefore(format.parse("2014/02/02 00:00:00.000"),
SearchQuery.DateResolution.Day));
+        // Date : 2014/02/02 00:00:00.000 ( Paris time zone )
+        searchQuery.andCriteria(SearchQuery.internalDateBefore(new Date(1391295600000L),
SearchQuery.DateResolution.Day));
         assertThat(elasticSearchListeningMessageSearchIndex.search(session, mailbox, searchQuery))
             .containsOnly(1L, 2L);
     }
@@ -350,7 +359,8 @@ public class ElasticSearchIntegrationTes
     @Test
     public void internalDateOnShouldReturnMessagesOfTheGivenDate() throws Exception {
         SearchQuery searchQuery = new SearchQuery();
-        searchQuery.andCriteria(SearchQuery.internalDateOn(format.parse("2014/03/02 00:00:00.000"),
SearchQuery.DateResolution.Day));
+        // Date : 2014/03/02 00:00:00.000 ( Paris time zone )
+        searchQuery.andCriteria(SearchQuery.internalDateOn(new Date(1393714800000L), SearchQuery.DateResolution.Day));
         assertThat(elasticSearchListeningMessageSearchIndex.search(session, mailbox, searchQuery))
             .containsOnly(3L);
     }
@@ -488,7 +498,8 @@ public class ElasticSearchIntegrationTes
     @Test
     public void headerDateAfterShouldWork() throws Exception {
         SearchQuery searchQuery = new SearchQuery();
-        searchQuery.andCriteria(SearchQuery.headerDateAfter("sentDate", format.parse("2015/06/04
11:00:00.000"), SearchQuery.DateResolution.Second));
+        // Date : 2015/06/04 11:00:00.000 ( Paris time zone )
+        searchQuery.andCriteria(SearchQuery.headerDateAfter("sentDate", new Date(1433408400000L),
SearchQuery.DateResolution.Second));
         searchQuery.setSorts(Lists.newArrayList(new SearchQuery.Sort(SearchQuery.Sort.SortClause.Arrival,
true)));
         assertThat(elasticSearchListeningMessageSearchIndex.search(session, mailbox, searchQuery))
             .containsOnly(3L, 2L);
@@ -497,7 +508,8 @@ public class ElasticSearchIntegrationTes
     @Test
     public void headerDateBeforeShouldWork() throws Exception {
         SearchQuery searchQuery = new SearchQuery();
-        searchQuery.andCriteria(SearchQuery.headerDateBefore("sentDate", format.parse("2015/06/01
00:00:00.000"), SearchQuery.DateResolution.Day));
+        // Date : 2015/06/01 00:00:00.000 ( Paris time zone )
+        searchQuery.andCriteria(SearchQuery.headerDateBefore("sentDate", new Date(1433109600000L),
SearchQuery.DateResolution.Day));
         searchQuery.setSorts(Lists.newArrayList(new SearchQuery.Sort(SearchQuery.Sort.SortClause.Arrival,
true)));
         assertThat(elasticSearchListeningMessageSearchIndex.search(session, mailbox, searchQuery))
             .containsOnly(5L);
@@ -506,7 +518,8 @@ public class ElasticSearchIntegrationTes
     @Test
     public void headerDateOnShouldWork() throws Exception {
         SearchQuery searchQuery = new SearchQuery();
-        searchQuery.andCriteria(SearchQuery.headerDateOn("sentDate", format.parse("2015/06/02
08:00:00.000"), SearchQuery.DateResolution.Day));
+        // Date : 2015/06/02 08:00:00.000 ( Paris time zone )
+        searchQuery.andCriteria(SearchQuery.headerDateOn("sentDate", new Date(1433224800000L),
SearchQuery.DateResolution.Day));
         searchQuery.setSorts(Lists.newArrayList(new SearchQuery.Sort(SearchQuery.Sort.SortClause.Arrival,
true)));
         assertThat(elasticSearchListeningMessageSearchIndex.search(session, mailbox, searchQuery))
             .containsOnly(4L, 9L);

Modified: james/mailbox/trunk/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJsonTest.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJsonTest.java?rev=1688148&r1=1688147&r2=1688148&view=diff
==============================================================================
--- james/mailbox/trunk/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJsonTest.java
(original)
+++ james/mailbox/trunk/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJsonTest.java
Mon Jun 29 08:47:29 2015
@@ -35,14 +35,13 @@ import javax.mail.Flags;
 import javax.mail.util.SharedByteArrayInputStream;
 
 import java.io.IOException;
-import java.text.SimpleDateFormat;
+import java.time.ZoneId;
 import java.util.Date;
 
 import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
 import static net.javacrumbs.jsonunit.core.Option.IGNORING_VALUES;
 import static net.javacrumbs.jsonunit.fluent.JsonFluentAssert.assertThatJson;
 
-
 public class MessageToElasticSearchJsonTest {
 
     public static final int SIZE = 25;
@@ -51,14 +50,13 @@ public class MessageToElasticSearchJsonT
     public static final long MOD_SEQ = 42L;
     public static final long UID = 25L;
 
-    private SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
-
     private Date date;
     private PropertyBuilder propertyBuilder;
 
     @Before
     public void setUp() throws Exception {
-        date = formatter.parse("07-06-2015");
+        // 2015/06/07 00:00:00 0200 (Paris time zone)
+        date = new Date(1433628000000L);
         propertyBuilder = new PropertyBuilder();
         propertyBuilder.setMediaType("plain");
         propertyBuilder.setSubType("text");
@@ -68,7 +66,9 @@ public class MessageToElasticSearchJsonT
 
     @Test
     public void spamEmailShouldBeWellConvertedToJson() throws IOException {
-        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(new
DefaultTextExtractor());
+        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(
+            new DefaultTextExtractor(),
+            ZoneId.of("Europe/Paris"));
         Message<TestId> spamMail = new SimpleMessage<>(date,
             SIZE,
             BODY_START_OCTET,
@@ -84,7 +84,9 @@ public class MessageToElasticSearchJsonT
 
     @Test
     public void htmlEmailShouldBeWellConvertedToJson() throws IOException {
-        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(new
DefaultTextExtractor());
+        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(
+            new DefaultTextExtractor(),
+            ZoneId.of("Europe/Paris"));
         Message<TestId> htmlMail = new SimpleMessage<>(date,
             SIZE,
             BODY_START_OCTET,
@@ -101,7 +103,9 @@ public class MessageToElasticSearchJsonT
 
     @Test
     public void pgpSignedEmailShouldBeWellConvertedToJson() throws IOException {
-        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(new
DefaultTextExtractor());
+        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(
+            new DefaultTextExtractor(),
+            ZoneId.of("Europe/Paris"));
         Message<TestId> pgpSignedMail = new SimpleMessage<>(date,
             SIZE,
             BODY_START_OCTET,
@@ -118,7 +122,9 @@ public class MessageToElasticSearchJsonT
 
     @Test
     public void simpleEmailShouldBeWellConvertedToJson() throws IOException {
-        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(new
DefaultTextExtractor());
+        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(
+            new DefaultTextExtractor(),
+            ZoneId.of("Europe/Paris"));
         Message<TestId> mail = new SimpleMessage<>(date,
             SIZE,
             BODY_START_OCTET,
@@ -135,7 +141,9 @@ public class MessageToElasticSearchJsonT
 
     @Test
     public void recursiveEmailShouldBeWellConvertedToJson() throws IOException {
-        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(new
DefaultTextExtractor());
+        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(
+            new DefaultTextExtractor(),
+            ZoneId.of("Europe/Paris"));
         Message<TestId> recursiveMail = new SimpleMessage<>(date,
             SIZE,
             BODY_START_OCTET,
@@ -152,7 +160,9 @@ public class MessageToElasticSearchJsonT
 
     @Test
     public void emailWithNoInternalDateShouldUseNowDate() throws IOException {
-        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(new
DefaultTextExtractor());
+        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(
+            new DefaultTextExtractor(),
+            ZoneId.of("Europe/Paris"));
         Message<TestId> mailWithNoInternalDate = new SimpleMessage<>(null,
             SIZE,
             BODY_START_OCTET,
@@ -170,7 +180,9 @@ public class MessageToElasticSearchJsonT
 
     @Test(expected = NullPointerException.class)
     public void emailWithNoMailboxIdShouldThrow() throws IOException {
-        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(new
DefaultTextExtractor());
+        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(
+            new DefaultTextExtractor(),
+            ZoneId.of("Europe/Paris"));
         Message<TestId> mailWithNoMailboxId;
         try {
             mailWithNoMailboxId = new SimpleMessage<>(date,
@@ -190,27 +202,35 @@ public class MessageToElasticSearchJsonT
 
     @Test
     public void getUpdatedJsonMessagePartShouldBehaveWellOnEmptyFlags() throws Exception
{
-        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(new
DefaultTextExtractor());
+        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(
+            new DefaultTextExtractor(),
+            ZoneId.of("Europe/Paris"));
         assertThatJson(messageToElasticSearchJson.getUpdatedJsonMessagePart(new Flags(),
MOD_SEQ))
             .isEqualTo("{\"modSeq\":42,\"isAnswered\":false,\"isDeleted\":false,\"isDraft\":false,\"isFlagged\":false,\"isRecent\":false,\"userFlags\":[],\"isUnread\":true}");
     }
 
     @Test
     public void getUpdatedJsonMessagePartShouldBehaveWellOnNonEmptyFlags() throws Exception
{
-        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(new
DefaultTextExtractor());
+        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(
+            new DefaultTextExtractor(),
+            ZoneId.of("Europe/Paris"));
         assertThatJson(messageToElasticSearchJson.getUpdatedJsonMessagePart(new FlagsBuilder().add(Flags.Flag.DELETED,
Flags.Flag.FLAGGED).add("user").build(), MOD_SEQ))
             .isEqualTo("{\"modSeq\":42,\"isAnswered\":false,\"isDeleted\":true,\"isDraft\":false,\"isFlagged\":true,\"isRecent\":false,\"userFlags\":[\"user\"],\"isUnread\":true}");
     }
 
     @Test(expected = NullPointerException.class)
     public void getUpdatedJsonMessagePartShouldThrowIfFlagsIsNull() throws Exception {
-        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(new
DefaultTextExtractor());
+        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(
+            new DefaultTextExtractor(),
+            ZoneId.of("Europe/Paris"));
         messageToElasticSearchJson.getUpdatedJsonMessagePart(null, MOD_SEQ);
     }
 
     @Test
     public void spamEmailShouldBeWellConvertedToJsonWithApacheTika() throws IOException {
-        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(new
TikaTextExtractor());
+        MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson(
+            new TikaTextExtractor(),
+            ZoneId.of("Europe/Paris"));
         Message<TestId> spamMail = new SimpleMessage<>(date,
             SIZE,
             BODY_START_OCTET,



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


Mime
View raw message