james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [08/14] james-project git commit: MAILBOX-355 Delete Event serialization
Date Wed, 05 Dec 2018 09:44:39 GMT
MAILBOX-355 Delete Event serialization

A new scala based version will be proposed.

Removing previous code makes subsequent changes easier.


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/e877c0b2
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/e877c0b2
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/e877c0b2

Branch: refs/heads/master
Commit: e877c0b2215e53c455c4f9f883c4369dd3770ad9
Parents: 9494a11
Author: Benoit Tellier <btellier@linagora.com>
Authored: Tue Dec 4 10:30:27 2018 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Wed Dec 5 16:34:24 2018 +0700

----------------------------------------------------------------------
 .../resources/META-INF/spring/event-system.xml  |   4 -
 .../store/json/JacksonEventSerializer.java      | 227 ------------------
 .../mailbox/store/json/JsonEventSerializer.java |  32 ---
 .../store/json/event/EventConverter.java        | 232 -------------------
 .../json/event/EventNotValidException.java      |  26 ---
 .../store/json/event/MailboxConverter.java      |  91 --------
 .../json/event/dto/EventDataTransferObject.java | 203 ----------------
 .../mailbox/store/json/event/dto/EventType.java |  32 ---
 .../json/event/dto/FlagsDataTransferObject.java |  83 -------
 .../event/dto/LocaleDataTransferObject.java     |  49 ----
 .../event/dto/MailboxDataTransferObject.java    | 143 ------------
 .../dto/MailboxPathDataTransferObject.java      |  49 ----
 .../dto/MailboxSessionDataTransferObject.java   | 111 ---------
 .../dto/MessageMetaDataDataTransferObject.java  |  95 --------
 .../dto/UpdatedFlagsDataTransferObject.java     |  56 -----
 .../mailbox/store/json/EventSerializerTest.java | 165 -------------
 .../store/json/JsonEventSerializerTest.java     |  37 ---
 17 files changed, 1635 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/spring/src/main/resources/META-INF/spring/event-system.xml
----------------------------------------------------------------------
diff --git a/mailbox/spring/src/main/resources/META-INF/spring/event-system.xml b/mailbox/spring/src/main/resources/META-INF/spring/event-system.xml
index 44eace7..2bdc06e 100644
--- a/mailbox/spring/src/main/resources/META-INF/spring/event-system.xml
+++ b/mailbox/spring/src/main/resources/META-INF/spring/event-system.xml
@@ -28,10 +28,6 @@
         <constructor-arg index="1" ref="event-registry"/>
     </bean>
 
-    <bean id="event-converter" class="org.apache.james.mailbox.store.json.event.EventConverter" lazy-init="true">
-        <constructor-arg index="0" ref="mailbox-converter"/>
-    </bean>
-
     <bean id="synchronous-event-delivery" class="org.apache.james.mailbox.store.event.SynchronousEventDelivery" lazy-init="true">
         <constructor-arg index="0" ref="metricFactory"/>
     </bean>

http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/JacksonEventSerializer.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/JacksonEventSerializer.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/JacksonEventSerializer.java
deleted file mode 100644
index 6710b58..0000000
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/JacksonEventSerializer.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mailbox.store.json;
-
-import java.io.IOException;
-import java.util.Optional;
-
-import org.apache.james.core.Domain;
-import org.apache.james.core.quota.QuotaCount;
-import org.apache.james.core.quota.QuotaSize;
-import org.apache.james.mailbox.MailboxListener;
-import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.model.MessageId;
-import org.apache.james.mailbox.model.MessageId.Factory;
-import org.apache.james.mailbox.model.QuotaRoot;
-import org.apache.james.mailbox.store.event.EventSerializer;
-import org.apache.james.mailbox.store.json.event.EventConverter;
-import org.apache.james.mailbox.store.json.event.dto.EventDataTransferObject;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.ObjectCodec;
-import com.fasterxml.jackson.core.TreeNode;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.KeyDeserializer;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-import com.fasterxml.jackson.databind.node.TextNode;
-import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
-import com.github.fge.lambdas.Throwing;
-
-public class JacksonEventSerializer implements EventSerializer {
-
-    private final EventConverter eventConverter;
-    private final ObjectMapper objectMapper;
-
-    public JacksonEventSerializer(EventConverter eventConverter, ObjectMapper objectMapper) {
-        this.eventConverter = eventConverter;
-        this.objectMapper = objectMapper;
-    }
-
-    @Override
-    public byte[] serializeEvent(MailboxListener.MailboxEvent event) throws Exception {
-        return objectMapper.writeValueAsBytes(eventConverter.convertToDataTransferObject(event));
-    }
-
-    @Override
-    public MailboxListener.MailboxEvent deSerializeEvent(byte[] serializedEvent) throws Exception {
-        EventDataTransferObject eventDataTransferObject = objectMapper.readValue(serializedEvent, EventDataTransferObject.class);
-        return eventConverter.retrieveEvent(eventDataTransferObject);
-    }
-
-    public static ObjectMapper configureObjectMapper(ObjectMapper objectMapper, MessageId.Factory messageIdFactory) {
-        SimpleModule module = new SimpleModule();
-        module.addDeserializer(MessageUid.class, new MessageUidDeserializer());
-        module.addKeyDeserializer(MessageUid.class, new MessageUidKeyDeserializer());
-        module.addSerializer(MessageUid.class, new MessageUidSerializer());
-        module.addKeySerializer(MessageUid.class, new MessageUidKeySerializer());
-        module.addSerializer(MessageId.class, new MessageIdSerializer());
-        module.addDeserializer(MessageId.class, new MessageIdDeserializer(messageIdFactory));
-        module.addSerializer(QuotaRoot.class, new QuotaRootSerializer());
-        module.addDeserializer(QuotaRoot.class, new QuotaRootDeserializer());
-        module.addSerializer(QuotaCount.class, new QuotaCountSerializer());
-        module.addDeserializer(QuotaCount.class, new QuotaCountDeserializer());
-        module.addSerializer(QuotaSize.class, new QuotaSizeSerializer());
-        module.addDeserializer(QuotaSize.class, new QuotaSizeDeserializer());
-        objectMapper.registerModules(module, new Jdk8Module());
-        return objectMapper;
-    }
-
-    public static class MessageUidDeserializer extends JsonDeserializer<MessageUid> {
-
-        @Override
-        public MessageUid deserialize(JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException {
-            return MessageUid.of(Long.parseLong(parser.getValueAsString()));
-        }
-        
-    }
-
-    public static class MessageUidSerializer extends JsonSerializer<MessageUid> {
-
-        @Override
-        public void serialize(MessageUid value, JsonGenerator generator, SerializerProvider serializers) throws IOException, JsonProcessingException {
-            generator.writeString(String.valueOf(value.asLong()));
-        }
-        
-    }
-
-    public static class MessageUidKeyDeserializer extends KeyDeserializer {
-
-        @Override
-        public Object deserializeKey(String key, DeserializationContext context) throws IOException, JsonProcessingException {
-            return MessageUid.of(Long.parseLong(key));
-        }
-        
-    }
-
-    public static class MessageUidKeySerializer extends JsonSerializer<MessageUid> {
-
-        @Override
-        public void serialize(MessageUid value, JsonGenerator generator, SerializerProvider serializers) throws IOException, JsonProcessingException {
-            generator.writeFieldName(String.valueOf(value.asLong()));
-        }
-        
-    }
-
-    public static class MessageIdSerializer extends JsonSerializer<MessageId> {
-
-        @Override
-        public void serialize(MessageId value, JsonGenerator generator, SerializerProvider serializers) throws IOException, JsonProcessingException {
-            generator.writeString(String.valueOf(value.serialize()));
-        }
-        
-    }
-
-    public static class MessageIdDeserializer extends JsonDeserializer<MessageId> {
-        private final Factory factory;
-
-        public MessageIdDeserializer(MessageId.Factory factory) {
-            this.factory = factory;
-        }
-
-        @Override
-        public MessageId deserialize(JsonParser p, DeserializationContext context) throws IOException, JsonProcessingException {
-            return factory.fromString(p.getValueAsString());
-        }
-        
-    }
-
-    private static final String QUOTA_ROOT_VALUE_FIELD = "value";
-    private static final String QUOTA_ROOT_DOMAIN_FIELD = "domain";
-
-    public static class QuotaRootSerializer extends JsonSerializer<QuotaRoot> {
-
-        @Override
-        public void serialize(QuotaRoot value, JsonGenerator generator, SerializerProvider serializers) throws IOException, JsonProcessingException {
-            generator.writeStartObject();
-            generator.writeStringField(QUOTA_ROOT_VALUE_FIELD, value.getValue());
-            value.getDomain()
-                .ifPresent(Throwing.consumer(domain -> generator.writeStringField(QUOTA_ROOT_DOMAIN_FIELD, domain.asString())));
-            generator.writeEndObject();
-        }
-        
-    }
-
-    public static class QuotaRootDeserializer extends JsonDeserializer<QuotaRoot> {
-
-        @Override
-        public QuotaRoot deserialize(JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException {
-            ObjectCodec codec = parser.getCodec();
-            TreeNode node = codec.readTree(parser);
-            return QuotaRoot.quotaRoot(value(node), domain(node));
-        }
-
-        private String value(TreeNode node) throws IOException, JsonParseException {
-            TextNode value = (TextNode) node.get(QUOTA_ROOT_VALUE_FIELD);
-            return value.asText();
-        }
-
-        private Optional<Domain> domain(TreeNode node) throws IOException, JsonParseException {
-            TreeNode value = node.get(QUOTA_ROOT_DOMAIN_FIELD);
-            if (value == null || value.isMissingNode()) {
-                return Optional.empty();
-            }
-            return Optional.ofNullable(node.asToken().asString()).map(Domain::of);
-        }
-        
-    }
-
-    public static class QuotaCountSerializer extends JsonSerializer<QuotaCount> {
-
-        @Override
-        public void serialize(QuotaCount value, JsonGenerator generator, SerializerProvider serializers) throws IOException, JsonProcessingException {
-            generator.writeNumber(value.asLong());
-        }
-        
-    }
-
-    public static class QuotaCountDeserializer extends JsonDeserializer<QuotaCount> {
-
-        @Override
-        public QuotaCount deserialize(JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException {
-            return QuotaCount.count(parser.getLongValue());
-        }
-        
-    }
-
-    public static class QuotaSizeSerializer extends JsonSerializer<QuotaSize> {
-
-        @Override
-        public void serialize(QuotaSize value, JsonGenerator generator, SerializerProvider serializers) throws IOException, JsonProcessingException {
-            generator.writeNumber(value.asLong());
-        }
-        
-    }
-
-    public static class QuotaSizeDeserializer extends JsonDeserializer<QuotaSize> {
-
-        @Override
-        public QuotaSize deserialize(JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException {
-            return QuotaSize.size(parser.getLongValue());
-        }
-        
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/JsonEventSerializer.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/JsonEventSerializer.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/JsonEventSerializer.java
deleted file mode 100644
index 5ec4ff4..0000000
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/JsonEventSerializer.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mailbox.store.json;
-
-import org.apache.james.mailbox.model.MessageId;
-import org.apache.james.mailbox.store.json.event.EventConverter;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class JsonEventSerializer extends JacksonEventSerializer {
-
-    public JsonEventSerializer(EventConverter eventConverter, MessageId.Factory messageIdFactory) {
-        super(eventConverter, configureObjectMapper(new ObjectMapper(), messageIdFactory));
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/EventConverter.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/EventConverter.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/EventConverter.java
deleted file mode 100644
index d92d077..0000000
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/EventConverter.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mailbox.store.json.event;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.apache.james.core.quota.QuotaCount;
-import org.apache.james.core.quota.QuotaSize;
-import org.apache.james.mailbox.MailboxListener;
-import org.apache.james.mailbox.MailboxSession;
-import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.model.MailboxPath;
-import org.apache.james.mailbox.model.MessageMetaData;
-import org.apache.james.mailbox.model.QuotaRoot;
-import org.apache.james.mailbox.model.UpdatedFlags;
-import org.apache.james.mailbox.store.event.EventFactory;
-import org.apache.james.mailbox.store.json.event.dto.EventDataTransferObject;
-import org.apache.james.mailbox.store.json.event.dto.EventType;
-import org.apache.james.mailbox.store.json.event.dto.MailboxDataTransferObject;
-import org.apache.james.mailbox.store.json.event.dto.MailboxPathDataTransferObject;
-import org.apache.james.mailbox.store.json.event.dto.MailboxSessionDataTransferObject;
-import org.apache.james.mailbox.store.json.event.dto.MessageMetaDataDataTransferObject;
-import org.apache.james.mailbox.store.json.event.dto.UpdatedFlagsDataTransferObject;
-import org.apache.james.mailbox.store.mail.model.Mailbox;
-import org.apache.james.mailbox.store.mail.model.MailboxMessage;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.github.steveash.guavate.Guavate;
-import com.google.common.collect.ImmutableMap;
-
-public class EventConverter {
-
-    private static final Logger LOG = LoggerFactory.getLogger(EventConverter.class);
-
-    private final EventFactory eventFactory;
-    private final MailboxConverter mailboxConverter;
-
-    public EventConverter(MailboxConverter mailboxConverter) {
-        this.eventFactory = new EventFactory();
-        this.mailboxConverter = mailboxConverter;
-    }
-
-    public EventDataTransferObject convertToDataTransferObject(MailboxListener.MailboxEvent event) throws Exception {
-        MailboxDataTransferObject mailboxDataTransferObject = mailboxConverter.extractMailboxDataTransferObject(event);
-        if (event instanceof MailboxListener.Added) {
-            return constructMeteDataHoldingEventProxy(EventType.ADDED,
-                event.getSession(),
-                mailboxDataTransferObject,
-                ((MailboxListener.Added) event).getUids(),
-                (MailboxListener.Added) event);
-        } else if (event instanceof MailboxListener.Expunged) {
-            return constructMeteDataHoldingEventProxy(EventType.DELETED,
-                event.getSession(), mailboxDataTransferObject,
-                ((MailboxListener.Expunged) event).getUids(),
-                (MailboxListener.Expunged) event);
-        } else if (event instanceof MailboxListener.FlagsUpdated) {
-            return constructFalgsUpdatedProxy(event.getSession(),
-                mailboxDataTransferObject,
-                ((MailboxListener.FlagsUpdated) event).getUids(),
-                ((MailboxListener.FlagsUpdated) event).getUpdatedFlags());
-        } else if (event instanceof MailboxListener.MailboxRenamed) {
-            return constructMailboxRenamedProxy(event.getSession(),
-                mailboxDataTransferObject,
-                event.getMailboxPath());
-        } else if (event instanceof MailboxListener.MailboxDeletion) {
-            MailboxListener.MailboxDeletion deletionEvent = (MailboxListener.MailboxDeletion) event;
-            return constructMailboxDeletionProxy(EventType.MAILBOX_DELETED,
-                event.getSession(),
-                mailboxDataTransferObject,
-                deletionEvent.getQuotaRoot(),
-                deletionEvent.getDeletedMessageCount(),
-                deletionEvent.getTotalDeletedSize());
-        } else if (event instanceof MailboxListener.MailboxAdded) {
-            return constructMailboxAddedProxy(EventType.MAILBOX_ADDED,
-                event.getSession(),
-                mailboxDataTransferObject);
-        } else {
-            throw new Exception("You are trying to serialize an event that can't be serialized");
-        }
-    }
-
-    public MailboxListener.MailboxEvent retrieveEvent(EventDataTransferObject eventDataTransferObject) throws Exception {
-        Mailbox mailbox = mailboxConverter.retrieveMailbox(eventDataTransferObject.getMailbox());
-        switch (eventDataTransferObject.getType()) {
-            case ADDED:
-                return eventFactory.added(eventDataTransferObject.getSession().getMailboxSession(),
-                    retrieveMetadata(eventDataTransferObject.getMetaDataProxyMap()),
-                    mailbox,
-                    ImmutableMap.<MessageUid, MailboxMessage>of());
-            case DELETED:
-                return eventFactory.expunged(eventDataTransferObject.getSession().getMailboxSession(),
-                    retrieveMetadata(eventDataTransferObject.getMetaDataProxyMap()),
-                    mailbox);
-            case FLAGS:
-                return eventFactory.flagsUpdated(eventDataTransferObject.getSession().getMailboxSession(),
-                    eventDataTransferObject.getUids(),
-                    mailbox,
-                    retrieveUpdatedFlags(eventDataTransferObject.getUpdatedFlags()));
-            case MAILBOX_ADDED:
-                return eventFactory.mailboxAdded(eventDataTransferObject.getSession().getMailboxSession(), mailbox);
-            case MAILBOX_DELETED:
-                return eventFactory.mailboxDeleted(eventDataTransferObject.getSession().getMailboxSession(), mailbox, 
-                    eventDataTransferObject.getQuotaRoot().orElseThrow(() -> new EventNotValidException("Not a Deletion event, missing quotaRoot")),
-                    eventDataTransferObject.getDeletedMessageCount().orElseThrow(() -> new EventNotValidException("Not a Deletion event, missing quotaCount")),
-                    eventDataTransferObject.getTotalDeletedSize().orElseThrow(() -> new EventNotValidException("Not a Deletion event, missing quotaSize")));
-            case MAILBOX_RENAMED:
-                return eventFactory.mailboxRenamed(eventDataTransferObject.getSession().getMailboxSession(),
-                    eventDataTransferObject.getFrom().getPath(),
-                    mailbox);
-            default:
-                throw new Exception("Can not deserialize unknown event");
-        }
-    }
-
-    private EventDataTransferObject constructMailboxAddedProxy(EventType eventType,
-                                                               MailboxSession mailboxSession,
-                                                               MailboxDataTransferObject mailboxIntermediate) {
-        return EventDataTransferObject.builder()
-            .type(eventType)
-            .session(new MailboxSessionDataTransferObject(mailboxSession))
-            .mailbox(mailboxIntermediate)
-            .build();
-    }
-
-    private EventDataTransferObject constructMailboxDeletionProxy(EventType eventType,
-                                                               MailboxSession mailboxSession,
-                                                               MailboxDataTransferObject mailboxIntermediate, 
-                                                               QuotaRoot quotaRoot, 
-                                                               QuotaCount deletedMessageCount,
-                                                               QuotaSize totalDeletedSize) {
-        return EventDataTransferObject.builder()
-            .type(eventType)
-            .session(new MailboxSessionDataTransferObject(mailboxSession))
-            .mailbox(mailboxIntermediate)
-            .quotaRoot(Optional.of(quotaRoot))
-            .deletedMessageCount(Optional.of(deletedMessageCount))
-            .totalDeletedSize(Optional.of(totalDeletedSize))
-            .build();
-    }
-
-    private EventDataTransferObject constructMailboxRenamedProxy(MailboxSession mailboxSession,
-                                                                 MailboxDataTransferObject mailboxIntermediate,
-                                                                 MailboxPath from) {
-        return EventDataTransferObject.builder()
-            .type(EventType.MAILBOX_RENAMED)
-            .session(new MailboxSessionDataTransferObject(mailboxSession))
-            .mailbox(mailboxIntermediate)
-            .from(new MailboxPathDataTransferObject(from))
-            .build();
-    }
-
-    private EventDataTransferObject constructFalgsUpdatedProxy(MailboxSession session,
-                                                               MailboxDataTransferObject mailboxIntermediate,
-                                                               List<MessageUid> uids,
-                                                               List<UpdatedFlags> updatedFlagsList) {
-        List<UpdatedFlagsDataTransferObject> updatedFlagsDataTransferObjects = updatedFlagsList.stream()
-            .map(UpdatedFlagsDataTransferObject::new)
-            .collect(Guavate.toImmutableList());
-        return EventDataTransferObject.builder()
-            .type(EventType.FLAGS)
-            .session(new MailboxSessionDataTransferObject(session))
-            .mailbox(mailboxIntermediate)
-            .uids(uids)
-            .updatedFlags(updatedFlagsDataTransferObjects)
-            .build();
-    }
-
-    private EventDataTransferObject constructMeteDataHoldingEventProxy(EventType eventType,
-                                                                       MailboxSession mailboxSession,
-                                                                       MailboxDataTransferObject mailboxIntermediate,
-                                                                       List<MessageUid> uids,
-                                                                       MailboxListener.MetaDataHoldingEvent event) {
-        HashMap<MessageUid, MessageMetaDataDataTransferObject> metaDataProxyMap = new HashMap<>();
-        for (MessageUid uid : uids) {
-            metaDataProxyMap.put(uid, new MessageMetaDataDataTransferObject(
-                event.getMetaData(uid)
-            ));
-        }
-        return EventDataTransferObject.builder()
-            .type(eventType)
-            .session(new MailboxSessionDataTransferObject(mailboxSession))
-            .mailbox(mailboxIntermediate)
-            .uids(uids)
-            .metaData(metaDataProxyMap)
-            .build();
-    }
-
-    private SortedMap<MessageUid, MessageMetaData> retrieveMetadata(Map<MessageUid, MessageMetaDataDataTransferObject> metaDataProxyMap) {
-        if (metaDataProxyMap != null) {
-            TreeMap<MessageUid, MessageMetaData> result = new TreeMap<>();
-            Set<Map.Entry<MessageUid, MessageMetaDataDataTransferObject>> entrySet = metaDataProxyMap.entrySet();
-            for (Map.Entry<MessageUid, MessageMetaDataDataTransferObject> entry : entrySet) {
-                result.put(entry.getKey(), entry.getValue().getMetadata());
-            }
-            return result;
-        } else {
-            LOG.warn("Event serialization problem : No metadata");
-            return null;
-        }
-    }
-
-    private List<UpdatedFlags> retrieveUpdatedFlags(List<UpdatedFlagsDataTransferObject> updatedFlagsDataTransferObject) {
-        return updatedFlagsDataTransferObject.stream()
-            .map(UpdatedFlagsDataTransferObject::retrieveUpdatedFlags)
-            .collect(Guavate.toImmutableList());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/EventNotValidException.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/EventNotValidException.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/EventNotValidException.java
deleted file mode 100644
index f4536be..0000000
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/EventNotValidException.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-package org.apache.james.mailbox.store.json.event;
-
-public class EventNotValidException extends Exception {
-
-    public EventNotValidException(String message) {
-        super(message);
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/MailboxConverter.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/MailboxConverter.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/MailboxConverter.java
deleted file mode 100644
index e2273fd..0000000
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/MailboxConverter.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mailbox.store.json.event;
-
-import java.io.IOException;
-
-import org.apache.james.mailbox.MailboxListener;
-import org.apache.james.mailbox.model.MailboxPath;
-import org.apache.james.mailbox.store.event.EventFactory;
-import org.apache.james.mailbox.store.json.MailboxACLJsonConverter;
-import org.apache.james.mailbox.store.json.event.dto.MailboxDataTransferObject;
-import org.apache.james.mailbox.store.mail.model.Mailbox;
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserialisationException;
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserializer;
-import org.apache.james.mailbox.store.mail.model.impl.SimpleMailbox;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-
-public class MailboxConverter {
-
-    private static final Logger LOGGER = LoggerFactory.getLogger(MailboxConverter.class);
-
-    private final MailboxIdDeserializer mailboxIdDeserializer;
-
-    public MailboxConverter(MailboxIdDeserializer mailboxIdDeserializer) {
-        this.mailboxIdDeserializer = mailboxIdDeserializer;
-    }
-
-    public Mailbox retrieveMailbox(MailboxDataTransferObject mailboxDataTransferObject) {
-        SimpleMailbox mailbox = new SimpleMailbox(new MailboxPath(mailboxDataTransferObject.getNamespace(),
-            mailboxDataTransferObject.getUser(),
-            mailboxDataTransferObject.getName()),
-            mailboxDataTransferObject.getUidValidity());
-        try {
-            mailbox.setACL(MailboxACLJsonConverter.toACL(mailboxDataTransferObject.getSerializedACL()));
-            mailbox.setMailboxId(mailboxIdDeserializer.deserialize(mailboxDataTransferObject.getSerializedMailboxId()));
-        } catch (IOException e) {
-            LOGGER.warn("Failed to deserialize ACL", e);
-        } catch (MailboxIdDeserialisationException e) {
-            LOGGER.warn("Failed to deserialize mailbox ID", e);
-        }
-        return mailbox;
-    }
-
-    public MailboxDataTransferObject convertMailboxDataTransferObject(Mailbox mailbox) {
-        return MailboxDataTransferObject.builder()
-            .serializedMailboxId(mailbox.getMailboxId().serialize())
-            .namespace(mailbox.getNamespace())
-            .user(mailbox.getUser())
-            .name(mailbox.getName())
-            .uidValidity(mailbox.getUidValidity())
-            .serializedACL(getSerializedACL(mailbox))
-            .build();
-    }
-
-    public MailboxDataTransferObject extractMailboxDataTransferObject(MailboxListener.MailboxEvent event) {
-        if (event instanceof EventFactory.MailboxAware) {
-            return convertMailboxDataTransferObject(((EventFactory.MailboxAware) event).getMailbox());
-        } else {
-            throw new RuntimeException("Unsupported event class : " + event.getClass().getCanonicalName());
-        }
-    }
-
-    private String getSerializedACL(Mailbox mailbox) {
-        try {
-            return MailboxACLJsonConverter.toJson(mailbox.getACL());
-        } catch (JsonProcessingException e) {
-            return "{\"entries\":{}}";
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/EventDataTransferObject.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/EventDataTransferObject.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/EventDataTransferObject.java
deleted file mode 100644
index 0041a21..0000000
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/EventDataTransferObject.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mailbox.store.json.event.dto;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-
-import org.apache.james.core.quota.QuotaCount;
-import org.apache.james.core.quota.QuotaSize;
-import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.model.QuotaRoot;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class EventDataTransferObject {
-
-    public static class Builder {
-
-        private EventType type;
-        private MailboxDataTransferObject mailbox;
-        private MailboxSessionDataTransferObject session;
-        private List<MessageUid> uids;
-        private Map<MessageUid, MessageMetaDataDataTransferObject> metaData;
-        private List<UpdatedFlagsDataTransferObject> updatedFlags;
-        private MailboxPathDataTransferObject from;
-        private Optional<QuotaRoot> quotaRoot;
-        private Optional<QuotaCount> deletedMessageCount;
-        private Optional<QuotaSize> totalDeletedSize;
-
-        public Builder type(EventType type) {
-            this.type = type;
-            return this;
-        }
-
-        public Builder mailbox(MailboxDataTransferObject mailbox) {
-            this.mailbox = mailbox;
-            return this;
-        }
-
-        public Builder session(MailboxSessionDataTransferObject session) {
-            this.session = session;
-            return this;
-        }
-
-        public Builder from(MailboxPathDataTransferObject from) {
-            this.from = from;
-            return this;
-        }
-
-        public Builder uids(List<MessageUid> uids) {
-            this.uids = uids;
-            return this;
-        }
-
-        public Builder metaData(Map<MessageUid, MessageMetaDataDataTransferObject> metaData) {
-            this.metaData = metaData;
-            return this;
-        }
-
-        public Builder updatedFlags(List<UpdatedFlagsDataTransferObject> updatedFlagsList) {
-            this.updatedFlags = updatedFlagsList;
-            return this;
-        }
-
-        public Builder quotaRoot(Optional<QuotaRoot> quotaRoot) {
-            this.quotaRoot = quotaRoot;
-            return this;
-        }
-
-        public Builder deletedMessageCount(Optional<QuotaCount> deletedMessageCount) {
-            this.deletedMessageCount = deletedMessageCount;
-            return this;
-        }
-
-        public Builder totalDeletedSize(Optional<QuotaSize> totalDeletedSize) {
-            this.totalDeletedSize = totalDeletedSize;
-            return this;
-        }
-
-        public EventDataTransferObject build() {
-            return new EventDataTransferObject(type, mailbox, session, uids, metaData, updatedFlags, from, quotaRoot, deletedMessageCount, totalDeletedSize);
-        }
-
-    }
-
-    public static Builder builder() {
-        return new Builder();
-    }
-
-    @JsonProperty()
-    private EventType type;
-    @JsonProperty()
-    private MailboxDataTransferObject mailbox;
-    @JsonProperty()
-    private MailboxSessionDataTransferObject session;
-    @JsonProperty()
-    private List<MessageUid> uids;
-    @JsonProperty()
-    private Map<MessageUid, MessageMetaDataDataTransferObject> metaData;
-    @JsonProperty()
-    private List<UpdatedFlagsDataTransferObject> updatedFlags;
-    @JsonProperty()
-    private MailboxPathDataTransferObject from;
-    @JsonProperty()
-    private Optional<QuotaRoot> quotaRoot;
-    @JsonProperty()
-    private Optional<QuotaCount> deletedMessageCount;
-    @JsonProperty()
-    private Optional<QuotaSize> totalDeletedSize;
-
-    public EventDataTransferObject() {}
-
-    public EventDataTransferObject(EventType type,
-                                   MailboxDataTransferObject mailbox,
-                                   MailboxSessionDataTransferObject session,
-                                   List<MessageUid> uids,
-                                   Map<MessageUid, MessageMetaDataDataTransferObject> metaData,
-                                   List<UpdatedFlagsDataTransferObject> updatedFlags,
-                                   MailboxPathDataTransferObject from, 
-                                   Optional<QuotaRoot> quotaRoot, 
-                                   Optional<QuotaCount> deletedMessageCount,
-                                   Optional<QuotaSize> totalDeletedSize) {
-        this.type = type;
-        this.mailbox = mailbox;
-        this.session = session;
-        this.uids = uids;
-        this.metaData = metaData;
-        this.updatedFlags = updatedFlags;
-        this.from = from;
-        this.quotaRoot = quotaRoot;
-        this.deletedMessageCount = deletedMessageCount;
-        this.totalDeletedSize = totalDeletedSize;
-    }
-
-    @JsonIgnore
-    public EventType getType() {
-        return type;
-    }
-
-    @JsonIgnore
-    public MailboxDataTransferObject getMailbox() {
-        return mailbox;
-    }
-
-    @JsonIgnore
-    public MailboxSessionDataTransferObject getSession() {
-        return session;
-    }
-
-    @JsonIgnore
-    public List<MessageUid> getUids() {
-        return uids;
-    }
-
-    @JsonIgnore
-    public Map<MessageUid, MessageMetaDataDataTransferObject> getMetaDataProxyMap() {
-        return metaData;
-    }
-
-    @JsonIgnore
-    public List<UpdatedFlagsDataTransferObject> getUpdatedFlags() {
-        return updatedFlags;
-    }
-
-    @JsonIgnore
-    public MailboxPathDataTransferObject getFrom() {
-        return from;
-    }
-
-    @JsonIgnore
-    public Optional<QuotaRoot> getQuotaRoot() {
-        return quotaRoot;
-    }
-
-    @JsonIgnore
-    public Optional<QuotaCount> getDeletedMessageCount() {
-        return deletedMessageCount;
-    }
-
-    @JsonIgnore
-    public Optional<QuotaSize> getTotalDeletedSize() {
-        return totalDeletedSize;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/EventType.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/EventType.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/EventType.java
deleted file mode 100644
index d3beae3..0000000
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/EventType.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mailbox.store.json.event.dto;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-@JsonFormat(shape = JsonFormat.Shape.NUMBER)
-public enum EventType {
-    ADDED,
-    DELETED,
-    FLAGS,
-    MAILBOX_RENAMED,
-    MAILBOX_ADDED,
-    MAILBOX_DELETED
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/FlagsDataTransferObject.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/FlagsDataTransferObject.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/FlagsDataTransferObject.java
deleted file mode 100644
index 08515ab..0000000
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/FlagsDataTransferObject.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mailbox.store.json.event.dto;
-
-import javax.mail.Flags;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class FlagsDataTransferObject {
-    @JsonProperty()
-    private boolean answered;
-    @JsonProperty()
-    private boolean flagged;
-    @JsonProperty()
-    private boolean recent;
-    @JsonProperty()
-    private boolean deleted;
-    @JsonProperty()
-    private boolean draft;
-    @JsonProperty()
-    private boolean seen;
-    @JsonProperty()
-    private String[] userFlags;
-
-    public FlagsDataTransferObject() {
-
-    }
-
-    public FlagsDataTransferObject(Flags flags) {
-        this.answered = flags.contains(Flags.Flag.ANSWERED);
-        this.flagged = flags.contains(Flags.Flag.FLAGGED);
-        this.recent = flags.contains(Flags.Flag.RECENT);
-        this.deleted = flags.contains(Flags.Flag.DELETED);
-        this.draft = flags.contains(Flags.Flag.DRAFT);
-        this.seen = flags.contains(Flags.Flag.SEEN);
-        this.userFlags = flags.getUserFlags();
-    }
-
-    @JsonIgnore
-    public Flags getFlags() {
-        Flags result = new Flags();
-        if (answered) {
-            result.add(Flags.Flag.ANSWERED);
-        }
-        if (flagged) {
-            result.add(Flags.Flag.FLAGGED);
-        }
-        if (recent) {
-            result.add(Flags.Flag.RECENT);
-        }
-        if (deleted) {
-            result.add(Flags.Flag.DELETED);
-        }
-        if (draft) {
-            result.add(Flags.Flag.DRAFT);
-        }
-        if (seen) {
-            result.add(Flags.Flag.SEEN);
-        }
-        for (String flag : userFlags) {
-            result.add(flag);
-        }
-        return result;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/LocaleDataTransferObject.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/LocaleDataTransferObject.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/LocaleDataTransferObject.java
deleted file mode 100644
index dfbf307..0000000
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/LocaleDataTransferObject.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mailbox.store.json.event.dto;
-
-import java.util.Locale;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class LocaleDataTransferObject {
-    @JsonProperty()
-    private String country;
-    @JsonProperty()
-    private String variant;
-    @JsonProperty()
-    private String language;
-
-    public LocaleDataTransferObject() {
-
-    }
-
-    public LocaleDataTransferObject(Locale locale) {
-        this.country = locale.getCountry();
-        this.variant = locale.getVariant();
-        this.language = locale.getLanguage();
-    }
-
-    @JsonIgnore
-    public Locale getLocale() {
-        return new Locale(language, country, variant);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxDataTransferObject.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxDataTransferObject.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxDataTransferObject.java
deleted file mode 100644
index f7fdfa5..0000000
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxDataTransferObject.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mailbox.store.json.event.dto;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class MailboxDataTransferObject {
-
-    public static class Builder {
-        private String serializedMailboxId;
-        private String namespace;
-        private String user;
-        private String name;
-        private long uidValidity;
-        private String serializedACL;
-
-        private Builder() {
-
-        }
-
-        public Builder serializedMailboxId(String serializedMailboxId) {
-            this.serializedMailboxId = serializedMailboxId;
-            return this;
-        }
-
-        public Builder namespace(String namespace) {
-            this.namespace = namespace;
-            return this;
-        }
-
-        public Builder user(String user) {
-            this.user = user;
-            return this;
-        }
-
-        public Builder name(String name) {
-            this.name = name;
-            return this;
-        }
-
-        public Builder uidValidity(long uidValidity) {
-            this.uidValidity = uidValidity;
-            return this;
-        }
-
-        public Builder serializedACL(String serializedACL) {
-            this.serializedACL = serializedACL;
-            return this;
-        }
-
-        public MailboxDataTransferObject build() {
-            return new MailboxDataTransferObject(serializedMailboxId,
-                namespace,
-                user,
-                name,
-                uidValidity,
-                serializedACL);
-        }
-    }
-
-    public static Builder builder() {
-        return new Builder();
-    }
-
-    @JsonProperty()
-    private String serializedMailboxId;
-    @JsonProperty()
-    private String namespace;
-    @JsonProperty()
-    private String user;
-    @JsonProperty()
-    private String name;
-    @JsonProperty()
-    private long uidValidity;
-    @JsonProperty()
-    private String serializedACL;
-
-    public MailboxDataTransferObject() {
-
-    }
-
-    private MailboxDataTransferObject(String serializedMailboxId,
-                                      String namespace,
-                                      String user,
-                                      String name,
-                                      long uidValidity,
-                                      String serializedACL) {
-        this.serializedMailboxId = serializedMailboxId;
-        this.namespace = namespace;
-        this.user = user;
-        this.name = name;
-        this.uidValidity = uidValidity;
-        this.serializedACL = serializedACL;
-    }
-
-    @JsonIgnore
-    public String getSerializedMailboxId() {
-        return serializedMailboxId;
-    }
-
-    @JsonIgnore
-    public String getNamespace() {
-        return namespace;
-    }
-
-    @JsonIgnore
-    public String getUser() {
-        return user;
-    }
-
-    @JsonIgnore
-    public String getName() {
-        return name;
-    }
-
-    @JsonIgnore
-    public long getUidValidity() {
-        return uidValidity;
-    }
-
-    @JsonIgnore
-    public String getSerializedACL() {
-        return serializedACL;
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxPathDataTransferObject.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxPathDataTransferObject.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxPathDataTransferObject.java
deleted file mode 100644
index f2755bb..0000000
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxPathDataTransferObject.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mailbox.store.json.event.dto;
-
-import org.apache.james.mailbox.model.MailboxPath;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class MailboxPathDataTransferObject {
-    @JsonProperty()
-    private String user;
-    @JsonProperty()
-    private String namespace;
-    @JsonProperty()
-    private String name;
-
-    public MailboxPathDataTransferObject() {
-
-    }
-
-    public MailboxPathDataTransferObject(MailboxPath path) {
-        this.user = path.getUser();
-        this.name = path.getName();
-        this.namespace = path.getNamespace();
-    }
-
-    @JsonIgnore
-    public MailboxPath getPath() {
-        return new MailboxPath(namespace, user, name);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxSessionDataTransferObject.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxSessionDataTransferObject.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxSessionDataTransferObject.java
deleted file mode 100644
index 2c59ba0..0000000
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxSessionDataTransferObject.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mailbox.store.json.event.dto;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-import org.apache.james.mailbox.MailboxSession;
-import org.apache.james.mailbox.store.SimpleMailboxSession;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.Lists;
-
-public class MailboxSessionDataTransferObject {
-    @JsonProperty()
-    private long sessionId;
-    @JsonProperty()
-    private String username;
-    @JsonProperty()
-    private List<String> sharedSpaces;
-    @JsonProperty()
-    private String otherUserSpace;
-    @JsonProperty()
-    private char separator;
-    @JsonProperty()
-    private List<LocaleDataTransferObject> locales;
-    @JsonProperty("r")
-    private int sessionType;
-
-    private static final Logger LOG = LoggerFactory.getLogger(MailboxSessionDataTransferObject.class);
-
-    public MailboxSessionDataTransferObject() {
-
-    }
-
-    public MailboxSessionDataTransferObject(MailboxSession session) {
-        username = session.getUser().getUserName();
-        sharedSpaces = new ArrayList<>(session.getSharedSpaces());
-        otherUserSpace = session.getOtherUsersSpace();
-        separator = session.getPathDelimiter();
-        sessionType = extractSessionType(session);
-        sessionId = session.getSessionId();
-        locales = Lists.transform(session.getUser().getLocalePreferences(), LocaleDataTransferObject::new);
-    }
-
-    @JsonIgnore
-    public MailboxSession getMailboxSession() {
-        return new SimpleMailboxSession(sessionId,
-            username,
-            "",
-            retrieveLocales(),
-            sharedSpaces,
-            otherUserSpace,
-            separator,
-            retrieveSessionType());
-    }
-
-    private List<Locale> retrieveLocales() {
-        if (locales != null) {
-            return Lists.transform(locales, LocaleDataTransferObject::getLocale);
-        } else {
-            return new ArrayList<>();
-        }
-    }
-
-    private MailboxSession.SessionType retrieveSessionType() {
-        switch (this.sessionType) {
-            case 0:
-                return MailboxSession.SessionType.User;
-            case 1:
-                return MailboxSession.SessionType.System;
-            default:
-                LOG.warn("Unknown session type number while deserializing. Assuming user instead");
-                return MailboxSession.SessionType.User;
-        }
-    }
-
-    private int extractSessionType(MailboxSession session) {
-        switch (session.getType()) {
-            case User:
-                return 0;
-            case System:
-                return 1;
-            default:
-                LOG.warn("Unknow session type while serializing mailbox session");
-                return 0;
-        }
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MessageMetaDataDataTransferObject.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MessageMetaDataDataTransferObject.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MessageMetaDataDataTransferObject.java
deleted file mode 100644
index 91c36e0..0000000
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MessageMetaDataDataTransferObject.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mailbox.store.json.event.dto;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.model.MessageId;
-import org.apache.james.mailbox.model.MessageMetaData;
-import org.apache.james.mailbox.store.SimpleMessageMetaData;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class MessageMetaDataDataTransferObject {
-    @JsonProperty()
-    private long uid;
-    @JsonProperty()
-    private long modseq;
-    @JsonProperty()
-    private FlagsDataTransferObject flags;
-    @JsonProperty()
-    private long size;
-    @JsonProperty()
-    private String date;
-    @JsonProperty
-    private MessageId messageId;
-
-    private static final Logger LOG = LoggerFactory.getLogger(MessageMetaDataDataTransferObject.class);
-
-    private static final ThreadLocal<SimpleDateFormat> simpleDateFormat = ThreadLocal.withInitial(
-        () -> new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"));
-
-    private static Date parse(String date) throws ParseException {
-        if (date != null) {
-            return simpleDateFormat.get().parse(date);
-        } else {
-            return null;
-        }
-    }
-
-    private static String format(Date date) {
-        if (date != null) {
-            return simpleDateFormat.get().format(date);
-        } else {
-            return null;
-        }
-    }
-
-
-    public MessageMetaDataDataTransferObject() {
-
-    }
-
-    public MessageMetaDataDataTransferObject(MessageMetaData metadata) {
-        this.uid = metadata.getUid().asLong();
-        this.modseq = metadata.getModSeq();
-        this.flags = new FlagsDataTransferObject(metadata.getFlags());
-        this.size = metadata.getSize();
-        this.date = format(metadata.getInternalDate());
-        this.messageId = metadata.getMessageId();
-    }
-
-    @JsonIgnore
-    public SimpleMessageMetaData getMetadata() {
-        try {
-            return new SimpleMessageMetaData(MessageUid.of(uid), modseq, flags.getFlags(), size, parse(date), messageId);
-        } catch (ParseException parseException) {
-            LOG.error("Parse exception while parsing date while deserializing metadata upon event serialization. Using nowadays date instead.", parseException);
-            return new SimpleMessageMetaData(MessageUid.of(uid), modseq, flags.getFlags(), size, new Date(), messageId);
-        }
-
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/UpdatedFlagsDataTransferObject.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/UpdatedFlagsDataTransferObject.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/UpdatedFlagsDataTransferObject.java
deleted file mode 100644
index b5cdda0..0000000
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/UpdatedFlagsDataTransferObject.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mailbox.store.json.event.dto;
-
-import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.model.UpdatedFlags;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class UpdatedFlagsDataTransferObject {
-    @JsonProperty("uid")
-    private long uid;
-    @JsonProperty("modseq")
-    private long modseq;
-    @JsonProperty("oldFlags")
-    private FlagsDataTransferObject oldFlags;
-    @JsonProperty("newFlags")
-    private FlagsDataTransferObject newFlags;
-
-    public UpdatedFlagsDataTransferObject() {
-    }
-
-    public UpdatedFlagsDataTransferObject(UpdatedFlags updatedFlags) {
-        this.uid = updatedFlags.getUid().asLong();
-        this.modseq = updatedFlags.getModSeq();
-        this.oldFlags = new FlagsDataTransferObject(updatedFlags.getOldFlags());
-        this.newFlags = new FlagsDataTransferObject(updatedFlags.getNewFlags());
-    }
-
-    public UpdatedFlags retrieveUpdatedFlags() {
-        return UpdatedFlags.builder()
-            .uid(MessageUid.of(uid))
-            .modSeq(modseq)
-            .oldFlags(oldFlags.getFlags())
-            .newFlags(newFlags.getFlags())
-            .build();
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/store/src/test/java/org/apache/james/mailbox/store/json/EventSerializerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/json/EventSerializerTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/json/EventSerializerTest.java
deleted file mode 100644
index f6d68b8..0000000
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/json/EventSerializerTest.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mailbox.store.json;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.util.Optional;
-import java.util.TreeMap;
-
-import javax.mail.Flags;
-
-import org.apache.james.core.quota.QuotaCount;
-import org.apache.james.core.quota.QuotaSize;
-import org.apache.james.mailbox.MailboxListener;
-import org.apache.james.mailbox.MailboxSession;
-import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.mock.MockMailboxSession;
-import org.apache.james.mailbox.model.MailboxPath;
-import org.apache.james.mailbox.model.MessageId;
-import org.apache.james.mailbox.model.MessageMetaData;
-import org.apache.james.mailbox.model.QuotaRoot;
-import org.apache.james.mailbox.model.TestId;
-import org.apache.james.mailbox.model.TestMessageId;
-import org.apache.james.mailbox.model.UpdatedFlags;
-import org.apache.james.mailbox.store.SimpleMessageMetaData;
-import org.apache.james.mailbox.store.event.EventFactory;
-import org.apache.james.mailbox.store.event.EventSerializer;
-import org.apache.james.mailbox.store.mail.model.MailboxMessage;
-import org.apache.james.mailbox.store.mail.model.impl.SimpleMailbox;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-
-public abstract class EventSerializerTest {
-
-    public static final MessageUid UID = MessageUid.of(42);
-    public static final long MOD_SEQ = 24L;
-    public static final Flags FLAGS = new Flags();
-    public static final UpdatedFlags UPDATED_FLAGS = UpdatedFlags.builder()
-        .uid(UID)
-        .modSeq(MOD_SEQ)
-        .oldFlags(FLAGS)
-        .newFlags(new Flags(Flags.Flag.SEEN))
-        .build();
-    public static final long SIZE = 45L;
-    private static final MessageId MESSAGE_ID = new TestMessageId.Factory().generate();
-    public static final SimpleMessageMetaData MESSAGE_META_DATA = new SimpleMessageMetaData(UID, MOD_SEQ, FLAGS, SIZE, null, MESSAGE_ID);
-    public static final MailboxPath FROM = new MailboxPath("namespace", "user", "name");
-
-    private EventSerializer serializer;
-    private EventFactory eventFactory;
-    private MailboxSession mailboxSession;
-    private SimpleMailbox mailbox;
-
-    abstract EventSerializer createSerializer();
-
-    @Before
-    public void setUp() {
-        eventFactory = new EventFactory();
-        serializer = createSerializer();
-        mailboxSession = new MockMailboxSession("benwa");
-        mailbox = new SimpleMailbox(MailboxPath.forUser("benwa", "name"), 42);
-        mailbox.setMailboxId(TestId.of(28L));
-    }
-
-    @Test
-    public void addedEventShouldBeWellConverted() throws Exception {
-        TreeMap<MessageUid, MessageMetaData> treeMap = new TreeMap<>();
-        treeMap.put(UID, MESSAGE_META_DATA);
-        MailboxListener.MailboxEvent event = eventFactory.added(mailboxSession, treeMap, mailbox, ImmutableMap.<MessageUid, MailboxMessage>of());
-        byte[] serializedEvent = serializer.serializeEvent(event);
-        MailboxListener.MailboxEvent deserializedEvent = serializer.deSerializeEvent(serializedEvent);
-        assertThat(deserializedEvent.getMailboxPath()).isEqualTo(event.getMailboxPath());
-        assertThat(deserializedEvent.getSession().getSessionId()).isEqualTo(event.getSession().getSessionId());
-        assertThat(deserializedEvent).isInstanceOf(MailboxListener.Added.class);
-        assertThat(((MailboxListener.Added)deserializedEvent).getUids()).containsOnly(UID);
-        MessageMetaData messageMetaData = ((MailboxListener.Added)deserializedEvent).getMetaData(UID);
-        assertThat(messageMetaData).isEqualTo(MESSAGE_META_DATA);
-        assertThat(messageMetaData.getMessageId()).isEqualTo(MESSAGE_ID);
-    }
-
-    @Test
-    public void expungedEventShouldBeWellConverted() throws Exception {
-        TreeMap<MessageUid, MessageMetaData> treeMap = new TreeMap<>();
-        treeMap.put(UID, MESSAGE_META_DATA);
-        MailboxListener.MailboxEvent event = eventFactory.expunged(mailboxSession, treeMap, mailbox);
-        byte[] serializedEvent = serializer.serializeEvent(event);
-        MailboxListener.MailboxEvent deserializedEvent = serializer.deSerializeEvent(serializedEvent);
-        assertThat(deserializedEvent.getMailboxPath()).isEqualTo(event.getMailboxPath());
-        assertThat(deserializedEvent.getSession().getSessionId()).isEqualTo(event.getSession().getSessionId());
-        assertThat(deserializedEvent).isInstanceOf(MailboxListener.Expunged.class);
-        assertThat(((MailboxListener.Expunged)deserializedEvent).getUids()).containsOnly(UID);
-        MessageMetaData messageMetaData = ((MailboxListener.Expunged)deserializedEvent).getMetaData(UID);
-        assertThat(messageMetaData).isEqualTo(MESSAGE_META_DATA);
-        assertThat(messageMetaData.getMessageId()).isEqualTo(MESSAGE_ID);
-    }
-
-    @Test
-    public void flagsUpdatedEventShouldBeWellConverted() throws Exception {
-        MailboxListener.MailboxEvent event = eventFactory.flagsUpdated(mailboxSession, Lists.newArrayList(UID), mailbox, Lists.newArrayList(UPDATED_FLAGS));
-        byte[] serializedEvent = serializer.serializeEvent(event);
-        MailboxListener.MailboxEvent deserializedEvent = serializer.deSerializeEvent(serializedEvent);
-        assertThat(deserializedEvent.getMailboxPath()).isEqualTo(event.getMailboxPath());
-        assertThat(deserializedEvent.getSession().getSessionId()).isEqualTo(event.getSession().getSessionId());
-        assertThat(deserializedEvent).isInstanceOf(MailboxListener.FlagsUpdated.class);
-        assertThat(((MailboxListener.FlagsUpdated)event).getUpdatedFlags()).containsOnly(UPDATED_FLAGS);
-    }
-
-    @Test
-    public void mailboxAddedShouldBeWellConverted() throws Exception {
-        MailboxListener.MailboxEvent event = eventFactory.mailboxAdded(mailboxSession, mailbox);
-        byte[] serializedEvent = serializer.serializeEvent(event);
-        MailboxListener.MailboxEvent deserializedEvent = serializer.deSerializeEvent(serializedEvent);
-        assertThat(deserializedEvent.getMailboxPath()).isEqualTo(event.getMailboxPath());
-        assertThat(deserializedEvent.getSession().getSessionId()).isEqualTo(event.getSession().getSessionId());
-        assertThat(deserializedEvent).isInstanceOf(MailboxListener.MailboxAdded.class);
-    }
-
-    @Test
-    public void mailboxDeletionShouldBeWellConverted() throws Exception {
-        QuotaRoot quotaRoot = QuotaRoot.quotaRoot("root", Optional.empty());
-        QuotaCount quotaCount = QuotaCount.count(123);
-        QuotaSize quotaSize = QuotaSize.size(456);
-        MailboxListener.MailboxDeletion event = eventFactory.mailboxDeleted(mailboxSession, mailbox, quotaRoot, quotaCount, quotaSize);
-        byte[] serializedEvent = serializer.serializeEvent(event);
-        MailboxListener.MailboxDeletion deserializedEvent = (MailboxListener.MailboxDeletion) serializer.deSerializeEvent(serializedEvent);
-        assertThat(deserializedEvent.getMailboxPath()).isEqualTo(event.getMailboxPath());
-        assertThat(deserializedEvent.getSession().getSessionId()).isEqualTo(event.getSession().getSessionId());
-        assertThat(deserializedEvent).isInstanceOf(MailboxListener.MailboxDeletion.class);
-        assertThat(deserializedEvent.getQuotaRoot()).isEqualTo(quotaRoot);
-        assertThat(deserializedEvent.getDeletedMessageCount()).isEqualTo(quotaCount);
-        assertThat(deserializedEvent.getTotalDeletedSize()).isEqualTo(quotaSize);
-    }
-
-    @Test
-    public void mailboxRenamedShouldBeWellConverted() throws Exception {
-        MailboxListener.MailboxEvent event = eventFactory.mailboxRenamed(mailboxSession, FROM, mailbox);
-        byte[] serializedEvent = serializer.serializeEvent(event);
-        MailboxListener.MailboxEvent deserializedEvent = serializer.deSerializeEvent(serializedEvent);
-        assertThat(deserializedEvent.getMailboxPath()).isEqualTo(event.getMailboxPath());
-        assertThat(deserializedEvent.getSession().getSessionId()).isEqualTo(event.getSession().getSessionId());
-        assertThat(deserializedEvent).isInstanceOf(MailboxListener.MailboxRenamed.class);
-        assertThat(deserializedEvent.getMailboxPath()).isEqualTo(event.getMailboxPath());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/e877c0b2/mailbox/store/src/test/java/org/apache/james/mailbox/store/json/JsonEventSerializerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/json/JsonEventSerializerTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/json/JsonEventSerializerTest.java
deleted file mode 100644
index ac7a6c9..0000000
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/json/JsonEventSerializerTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mailbox.store.json;
-
-import org.apache.james.mailbox.model.TestMessageId;
-import org.apache.james.mailbox.store.TestIdDeserializer;
-import org.apache.james.mailbox.store.event.EventSerializer;
-import org.apache.james.mailbox.store.json.event.EventConverter;
-import org.apache.james.mailbox.store.json.event.MailboxConverter;
-
-public class JsonEventSerializerTest extends EventSerializerTest {
-
-    @Override
-    EventSerializer createSerializer() {
-        return new JsonEventSerializer(
-            new EventConverter(
-                new MailboxConverter(new TestIdDeserializer())),
-            new TestMessageId.Factory());
-    }
-}


---------------------------------------------------------------------
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