james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [05/41] james-project git commit: JAMES-2082 Re-organize cassandra project hierarchy
Date Mon, 10 Jul 2017 17:54:17 GMT
JAMES-2082 Re-organize cassandra project hierarchy

Ids deserve their own package, Limit should be in utils


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

Branch: refs/heads/master
Commit: a30859612cd443cf5e0dbeb8ad16c4def73104a8
Parents: 31567b2
Author: benwa <btellier@linagora.com>
Authored: Thu Jul 6 10:35:10 2017 +0700
Committer: Antoine Duprat <aduprat@linagora.com>
Committed: Mon Jul 10 14:23:55 2017 +0200

----------------------------------------------------------------------
 .../apache/james/mailbox/cassandra/BlobId.java  |  73 ------------
 .../james/mailbox/cassandra/CassandraId.java    |  81 -------------
 .../CassandraMailboxIdDeserializer.java         |  38 ------
 .../mailbox/cassandra/CassandraMessageId.java   |  84 --------------
 .../apache/james/mailbox/cassandra/Limit.java   |  76 ------------
 .../apache/james/mailbox/cassandra/PartId.java  |  72 ------------
 .../james/mailbox/cassandra/ids/BlobId.java     |  73 ++++++++++++
 .../mailbox/cassandra/ids/CassandraId.java      |  81 +++++++++++++
 .../ids/CassandraMailboxIdDeserializer.java     |  38 ++++++
 .../cassandra/ids/CassandraMessageId.java       |  84 ++++++++++++++
 .../james/mailbox/cassandra/ids/PartId.java     |  72 ++++++++++++
 .../cassandra/mail/CassandraACLMapper.java      |   2 +-
 .../mail/CassandraAnnotationMapper.java         |   2 +-
 .../mail/CassandraApplicableFlagDAO.java        |   4 +-
 .../cassandra/mail/CassandraBlobsDAO.java       |   4 +-
 .../mail/CassandraDeletedMessageDAO.java        |   2 +-
 .../cassandra/mail/CassandraFirstUnseenDAO.java |   2 +-
 .../mail/CassandraIndexTableHandler.java        |   2 +-
 .../mail/CassandraMailboxCounterDAO.java        |   2 +-
 .../cassandra/mail/CassandraMailboxDAO.java     |   2 +-
 .../cassandra/mail/CassandraMailboxMapper.java  |   2 +-
 .../cassandra/mail/CassandraMailboxPathDAO.java |   2 +-
 .../mail/CassandraMailboxRecentsDAO.java        |   2 +-
 .../cassandra/mail/CassandraMessageDAO.java     |   4 +-
 .../cassandra/mail/CassandraMessageDAOV2.java   |   6 +-
 .../cassandra/mail/CassandraMessageIdDAO.java   |   6 +-
 .../mail/CassandraMessageIdMapper.java          |   6 +-
 .../mail/CassandraMessageIdToImapUidDAO.java    |   6 +-
 .../cassandra/mail/CassandraMessageMapper.java  |   6 +-
 .../cassandra/mail/CassandraModSeqProvider.java |   2 +-
 .../cassandra/mail/CassandraUidProvider.java    |   2 +-
 .../mail/migration/V1ToV2Migration.java         |   5 +-
 .../mailbox/cassandra/mail/utils/Limit.java     |  76 ++++++++++++
 .../mailbox/cassandra/CassandraIdTest.java      |  56 ---------
 .../CassandraMailboxIdDeserializerTest.java     |  53 ---------
 .../CassandraMailboxManagerProvider.java        |   1 +
 .../CassandraMessageIdManagerTestSystem.java    |   1 +
 .../cassandra/CassandraMessageIdTest.java       |  65 -----------
 .../cassandra/CassandraTestSystemFixture.java   |   1 +
 .../james/mailbox/cassandra/LimitTest.java      | 114 ------------------
 .../mailbox/cassandra/ids/CassandraIdTest.java  |  56 +++++++++
 .../ids/CassandraMailboxIdDeserializerTest.java |  53 +++++++++
 .../cassandra/ids/CassandraMessageIdTest.java   |  65 +++++++++++
 .../cassandra/mail/CassandraACLMapperTest.java  |   2 +-
 .../mail/CassandraApplicableFlagDAOTest.java    |   2 +-
 .../cassandra/mail/CassandraBlobsDAOTest.java   |   2 +-
 .../mail/CassandraDeletedMessageDAOTest.java    |   2 +-
 .../mail/CassandraFirstUnseenDAOTest.java       |   2 +-
 .../mail/CassandraIndexTableHandlerTest.java    |   4 +-
 .../mail/CassandraMailboxCounterDAOTest.java    |   2 +-
 .../cassandra/mail/CassandraMailboxDAOTest.java |   2 +-
 .../CassandraMailboxManagerAttachmentTest.java  |   2 +-
 .../mail/CassandraMailboxPathDAOTest.java       |   2 +-
 .../mail/CassandraMailboxRecentDAOTest.java     |   2 +-
 .../cassandra/mail/CassandraMapperProvider.java |   6 +-
 .../cassandra/mail/CassandraMessageDAOTest.java |   6 +-
 .../mail/CassandraMessageDAOV2Test.java         |   6 +-
 .../mail/CassandraMessageIdDAOTest.java         |   4 +-
 .../CassandraMessageIdToImapUidDAOTest.java     |   4 +-
 .../mail/migration/V1ToV2MigrationTest.java     |   7 +-
 .../mailbox/cassandra/mail/utils/LimitTest.java | 116 +++++++++++++++++++
 .../cassandra/host/CassandraHostSystem.java     |   2 +-
 .../modules/mailbox/CassandraMailboxModule.java |   4 +-
 .../CassandraSetMessagesMethodTest.java         |   2 +-
 .../cassandra/cucumber/CassandraStepdefs.java   |   2 +-
 65 files changed, 784 insertions(+), 783 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/BlobId.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/BlobId.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/BlobId.java
deleted file mode 100644
index 50601b6..0000000
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/BlobId.java
+++ /dev/null
@@ -1,73 +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.cassandra;
-
-import org.apache.commons.codec.digest.DigestUtils;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-
-public class BlobId {
-    public static BlobId forPayload(byte[] payload) {
-        Preconditions.checkArgument(payload != null);
-        return new BlobId(DigestUtils.sha1Hex(payload));
-    }
-
-    public static BlobId from(String id) {
-        Preconditions.checkArgument(!Strings.isNullOrEmpty(id));
-        return new BlobId(id);
-    }
-
-    private final String id;
-
-    @VisibleForTesting
-    BlobId(String id) {
-        this.id = id;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    @Override
-    public final boolean equals(Object obj) {
-        if (obj instanceof BlobId) {
-            BlobId other = (BlobId) obj;
-            return Objects.equal(id, other.id);
-        }
-        return false;
-    }
-
-    @Override
-    public final int hashCode() {
-        return Objects.hashCode(id);
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects
-            .toStringHelper(this)
-            .add("id", id)
-            .toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraId.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraId.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraId.java
deleted file mode 100644
index 9b33c8d..0000000
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraId.java
+++ /dev/null
@@ -1,81 +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.cassandra;
-
-import java.util.Objects;
-import java.util.UUID;
-
-import org.apache.james.mailbox.model.MailboxId;
-
-import com.datastax.driver.core.utils.UUIDs;
-import com.google.common.base.MoreObjects;
-
-public class CassandraId implements MailboxId {
-
-    public static class Factory implements MailboxId.Factory {
-        @Override
-        public CassandraId fromString(String serialized) {
-            return of(UUID.fromString(serialized));
-        }
-    }
-    
-    private final UUID id;
-
-    public static CassandraId timeBased() {
-        return of(UUIDs.timeBased());
-    }
-
-    public static CassandraId of(UUID id) {
-        return new CassandraId(id);
-    }
-
-    private CassandraId(UUID id) {
-        this.id = id;
-    }
-
-    @Override
-    public String serialize() {
-        return id.toString();
-    }
-
-    public UUID asUuid() {
-        return id;
-    }
-
-    @Override
-    public final boolean equals(Object o) {
-        if (o instanceof CassandraId) {
-            CassandraId other = (CassandraId) o;
-            return Objects.equals(id, other.id);
-        }
-        return false;
-    }
-
-    @Override
-    public final int hashCode() {
-        return Objects.hash(id);
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects.toStringHelper(this)
-            .add("id", id)
-            .toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxIdDeserializer.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxIdDeserializer.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxIdDeserializer.java
deleted file mode 100644
index dc42a21..0000000
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxIdDeserializer.java
+++ /dev/null
@@ -1,38 +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.cassandra;
-
-import java.util.UUID;
-
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserialisationException;
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserializer;
-
-public class CassandraMailboxIdDeserializer implements MailboxIdDeserializer {
-
-    @Override
-    public CassandraId deserialize(String serializedMailboxId) throws MailboxIdDeserialisationException {
-        try {
-            return CassandraId.of(UUID.fromString(serializedMailboxId));
-        } catch (Exception e) {
-            throw new MailboxIdDeserialisationException("Error de-serialising " + serializedMailboxId, e);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMessageId.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMessageId.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMessageId.java
deleted file mode 100644
index 5dc5b93..0000000
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMessageId.java
+++ /dev/null
@@ -1,84 +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.cassandra;
-
-import java.util.Objects;
-import java.util.UUID;
-
-import org.apache.james.mailbox.model.MessageId;
-
-import com.datastax.driver.core.utils.UUIDs;
-import com.google.common.base.MoreObjects;
-
-public class CassandraMessageId implements MessageId {
-
-    public static class Factory implements MessageId.Factory {
-
-        @Override
-        public CassandraMessageId generate() {
-            return of(UUIDs.timeBased());
-        }
-
-        public CassandraMessageId of(UUID uuid) {
-            return new CassandraMessageId(uuid);
-        }
-
-        @Override
-        public MessageId fromString(String serialized) {
-            return of(UUID.fromString(serialized));
-        }
-    }
-
-    private final UUID uuid;
-
-    private CassandraMessageId(UUID uuid) {
-        this.uuid = uuid;
-    }
-    
-    @Override
-    public String serialize() {
-        return uuid.toString();
-    }
-
-    public UUID get() {
-        return uuid;
-    }
-
-    @Override
-    public final boolean equals(Object o) {
-        if (o instanceof CassandraMessageId) {
-            CassandraMessageId other = (CassandraMessageId) o;
-            return Objects.equals(uuid, other.uuid);
-        }
-        return false;
-    }
-
-    @Override
-    public final int hashCode() {
-        return Objects.hash(uuid);
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects.toStringHelper(this)
-            .add("uuid", uuid)
-            .toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/Limit.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/Limit.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/Limit.java
deleted file mode 100644
index 0e982ce..0000000
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/Limit.java
+++ /dev/null
@@ -1,76 +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.cassandra;
-
-import com.google.common.base.Preconditions;
-
-import java.util.Objects;
-import java.util.Optional;
-import java.util.stream.Stream;
-
-public class Limit {
-
-    public static Limit from(int limit) {
-        if (limit > 0) {
-            return new Limit(Optional.of(limit));
-        } else {
-            return unlimited();
-        }
-    }
-
-    public static Limit unlimited() {
-        return new Limit(Optional.empty());
-    }
-
-    public static Limit limit(int limit) {
-        Preconditions.checkArgument(limit > 0, "limit should be positive");
-        return new Limit(Optional.of(limit));
-    }
-
-    private final Optional<Integer> limit;
-
-    private Limit(Optional<Integer> limit) {
-        this.limit = limit;
-    }
-
-    public Optional<Integer> getLimit() {
-        return limit;
-    }
-
-    public <T> Stream<T> applyOnStream(Stream<T> stream) {
-        return limit
-            .map(stream::limit)
-            .orElse(stream);
-    }
-
-    @Override
-    public final boolean equals(Object o) {
-        if (o instanceof Limit) {
-            Limit other = (Limit) o;
-            return Objects.equals(limit, other.limit);
-        }
-        return false;
-    }
-
-    @Override
-    public final int hashCode() {
-        return Objects.hash(limit);
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/PartId.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/PartId.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/PartId.java
deleted file mode 100644
index 421be7f..0000000
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/PartId.java
+++ /dev/null
@@ -1,72 +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.cassandra;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-
-public class PartId {
-    public static PartId create(BlobId blobId, int position) {
-        Preconditions.checkNotNull(blobId);
-        Preconditions.checkArgument(position >= 0, "Position needs to be positive");
-        return new PartId(blobId.getId() + "-" + position);
-    }
-
-    public static PartId from(String id) {
-        Preconditions.checkArgument(!Strings.isNullOrEmpty(id));
-        return new PartId(id);
-    }
-
-    private final String id;
-
-    @VisibleForTesting
-    PartId(String id) {
-        this.id = id;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    @Override
-    public final boolean equals(Object obj) {
-        if (obj instanceof PartId) {
-            PartId other = (PartId) obj;
-            return Objects.equal(id, other.id);
-        }
-        return false;
-    }
-
-    @Override
-    public final int hashCode() {
-        return Objects.hashCode(id);
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects
-            .toStringHelper(this)
-            .add("id", id)
-            .toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/BlobId.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/BlobId.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/BlobId.java
new file mode 100644
index 0000000..d04fc07
--- /dev/null
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/BlobId.java
@@ -0,0 +1,73 @@
+/****************************************************************
+ * 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.cassandra.ids;
+
+import org.apache.commons.codec.digest.DigestUtils;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+
+public class BlobId {
+    public static BlobId forPayload(byte[] payload) {
+        Preconditions.checkArgument(payload != null);
+        return new BlobId(DigestUtils.sha1Hex(payload));
+    }
+
+    public static BlobId from(String id) {
+        Preconditions.checkArgument(!Strings.isNullOrEmpty(id));
+        return new BlobId(id);
+    }
+
+    private final String id;
+
+    @VisibleForTesting
+    BlobId(String id) {
+        this.id = id;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    @Override
+    public final boolean equals(Object obj) {
+        if (obj instanceof BlobId) {
+            BlobId other = (BlobId) obj;
+            return Objects.equal(id, other.id);
+        }
+        return false;
+    }
+
+    @Override
+    public final int hashCode() {
+        return Objects.hashCode(id);
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects
+            .toStringHelper(this)
+            .add("id", id)
+            .toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/CassandraId.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/CassandraId.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/CassandraId.java
new file mode 100644
index 0000000..3db4329
--- /dev/null
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/CassandraId.java
@@ -0,0 +1,81 @@
+/****************************************************************
+ * 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.cassandra.ids;
+
+import java.util.Objects;
+import java.util.UUID;
+
+import org.apache.james.mailbox.model.MailboxId;
+
+import com.datastax.driver.core.utils.UUIDs;
+import com.google.common.base.MoreObjects;
+
+public class CassandraId implements MailboxId {
+
+    public static class Factory implements MailboxId.Factory {
+        @Override
+        public CassandraId fromString(String serialized) {
+            return of(UUID.fromString(serialized));
+        }
+    }
+    
+    private final UUID id;
+
+    public static CassandraId timeBased() {
+        return of(UUIDs.timeBased());
+    }
+
+    public static CassandraId of(UUID id) {
+        return new CassandraId(id);
+    }
+
+    private CassandraId(UUID id) {
+        this.id = id;
+    }
+
+    @Override
+    public String serialize() {
+        return id.toString();
+    }
+
+    public UUID asUuid() {
+        return id;
+    }
+
+    @Override
+    public final boolean equals(Object o) {
+        if (o instanceof CassandraId) {
+            CassandraId other = (CassandraId) o;
+            return Objects.equals(id, other.id);
+        }
+        return false;
+    }
+
+    @Override
+    public final int hashCode() {
+        return Objects.hash(id);
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(this)
+            .add("id", id)
+            .toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/CassandraMailboxIdDeserializer.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/CassandraMailboxIdDeserializer.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/CassandraMailboxIdDeserializer.java
new file mode 100644
index 0000000..96fc17c
--- /dev/null
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/CassandraMailboxIdDeserializer.java
@@ -0,0 +1,38 @@
+/****************************************************************
+ * 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.cassandra.ids;
+
+import java.util.UUID;
+
+import org.apache.james.mailbox.store.mail.model.MailboxIdDeserialisationException;
+import org.apache.james.mailbox.store.mail.model.MailboxIdDeserializer;
+
+public class CassandraMailboxIdDeserializer implements MailboxIdDeserializer {
+
+    @Override
+    public CassandraId deserialize(String serializedMailboxId) throws MailboxIdDeserialisationException {
+        try {
+            return CassandraId.of(UUID.fromString(serializedMailboxId));
+        } catch (Exception e) {
+            throw new MailboxIdDeserialisationException("Error de-serialising " + serializedMailboxId, e);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/CassandraMessageId.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/CassandraMessageId.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/CassandraMessageId.java
new file mode 100644
index 0000000..54b190f
--- /dev/null
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/CassandraMessageId.java
@@ -0,0 +1,84 @@
+/****************************************************************
+ * 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.cassandra.ids;
+
+import java.util.Objects;
+import java.util.UUID;
+
+import org.apache.james.mailbox.model.MessageId;
+
+import com.datastax.driver.core.utils.UUIDs;
+import com.google.common.base.MoreObjects;
+
+public class CassandraMessageId implements MessageId {
+
+    public static class Factory implements MessageId.Factory {
+
+        @Override
+        public CassandraMessageId generate() {
+            return of(UUIDs.timeBased());
+        }
+
+        public CassandraMessageId of(UUID uuid) {
+            return new CassandraMessageId(uuid);
+        }
+
+        @Override
+        public MessageId fromString(String serialized) {
+            return of(UUID.fromString(serialized));
+        }
+    }
+
+    private final UUID uuid;
+
+    private CassandraMessageId(UUID uuid) {
+        this.uuid = uuid;
+    }
+    
+    @Override
+    public String serialize() {
+        return uuid.toString();
+    }
+
+    public UUID get() {
+        return uuid;
+    }
+
+    @Override
+    public final boolean equals(Object o) {
+        if (o instanceof CassandraMessageId) {
+            CassandraMessageId other = (CassandraMessageId) o;
+            return Objects.equals(uuid, other.uuid);
+        }
+        return false;
+    }
+
+    @Override
+    public final int hashCode() {
+        return Objects.hash(uuid);
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(this)
+            .add("uuid", uuid)
+            .toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/PartId.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/PartId.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/PartId.java
new file mode 100644
index 0000000..38715d0
--- /dev/null
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/PartId.java
@@ -0,0 +1,72 @@
+/****************************************************************
+ * 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.cassandra.ids;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+
+public class PartId {
+    public static PartId create(BlobId blobId, int position) {
+        Preconditions.checkNotNull(blobId);
+        Preconditions.checkArgument(position >= 0, "Position needs to be positive");
+        return new PartId(blobId.getId() + "-" + position);
+    }
+
+    public static PartId from(String id) {
+        Preconditions.checkArgument(!Strings.isNullOrEmpty(id));
+        return new PartId(id);
+    }
+
+    private final String id;
+
+    @VisibleForTesting
+    PartId(String id) {
+        this.id = id;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    @Override
+    public final boolean equals(Object obj) {
+        if (obj instanceof PartId) {
+            PartId other = (PartId) obj;
+            return Objects.equal(id, other.id);
+        }
+        return false;
+    }
+
+    @Override
+    public final int hashCode() {
+        return Objects.hashCode(id);
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects
+            .toStringHelper(this)
+            .add("id", id)
+            .toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraACLMapper.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraACLMapper.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraACLMapper.java
index 7e1626d..8cf4d76 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraACLMapper.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraACLMapper.java
@@ -34,7 +34,7 @@ import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.backends.cassandra.utils.CassandraConstants;
 import org.apache.james.backends.cassandra.utils.FunctionRunnerWithRetry;
 import org.apache.james.backends.cassandra.utils.LightweightTransactionException;
-import org.apache.james.mailbox.cassandra.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
 import org.apache.james.mailbox.cassandra.table.CassandraACLTable;
 import org.apache.james.mailbox.cassandra.table.CassandraMailboxTable;
 import org.apache.james.mailbox.exception.MailboxException;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAnnotationMapper.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAnnotationMapper.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAnnotationMapper.java
index 073227b..92aca6d 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAnnotationMapper.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAnnotationMapper.java
@@ -35,7 +35,7 @@ import java.util.stream.Stream;
 
 import org.apache.james.backends.cassandra.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
-import org.apache.james.mailbox.cassandra.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
 import org.apache.james.mailbox.cassandra.table.CassandraAnnotationTable;
 import org.apache.james.mailbox.model.MailboxAnnotation;
 import org.apache.james.mailbox.model.MailboxAnnotationKey;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraApplicableFlagDAO.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraApplicableFlagDAO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraApplicableFlagDAO.java
index 71ea774..eed9857 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraApplicableFlagDAO.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraApplicableFlagDAO.java
@@ -37,14 +37,12 @@ import javax.inject.Inject;
 import javax.mail.Flags;
 
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
-import org.apache.james.mailbox.cassandra.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
 
 import com.datastax.driver.core.PreparedStatement;
 import com.datastax.driver.core.Session;
 import com.datastax.driver.core.querybuilder.Update;
 import com.datastax.driver.core.querybuilder.Update.Assignments;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
 
 public class CassandraApplicableFlagDAO {
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraBlobsDAO.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraBlobsDAO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraBlobsDAO.java
index 0d20e88..55efcda 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraBlobsDAO.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraBlobsDAO.java
@@ -36,8 +36,8 @@ import javax.inject.Inject;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
-import org.apache.james.mailbox.cassandra.BlobId;
-import org.apache.james.mailbox.cassandra.PartId;
+import org.apache.james.mailbox.cassandra.ids.BlobId;
+import org.apache.james.mailbox.cassandra.ids.PartId;
 import org.apache.james.mailbox.cassandra.mail.utils.DataChunker;
 import org.apache.james.util.CompletableFutureUtil;
 import org.apache.james.util.FluentFutureStream;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraDeletedMessageDAO.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraDeletedMessageDAO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraDeletedMessageDAO.java
index f9a3803..0ac87ba 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraDeletedMessageDAO.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraDeletedMessageDAO.java
@@ -39,7 +39,7 @@ import com.datastax.driver.core.ResultSet;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.cassandra.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
 
 import com.datastax.driver.core.PreparedStatement;
 import com.datastax.driver.core.Session;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraFirstUnseenDAO.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraFirstUnseenDAO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraFirstUnseenDAO.java
index 436efd6..e710e69 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraFirstUnseenDAO.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraFirstUnseenDAO.java
@@ -36,7 +36,7 @@ import javax.inject.Inject;
 
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.cassandra.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
 
 import com.datastax.driver.core.PreparedStatement;
 import com.datastax.driver.core.Session;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraIndexTableHandler.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraIndexTableHandler.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraIndexTableHandler.java
index c173c7b..3f1485e 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraIndexTableHandler.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraIndexTableHandler.java
@@ -25,7 +25,7 @@ import javax.inject.Inject;
 import javax.mail.Flags;
 
 import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.cassandra.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
 import org.apache.james.mailbox.model.ComposedMessageIdWithMetaData;
 import org.apache.james.mailbox.model.UpdatedFlags;
 import org.apache.james.mailbox.store.mail.model.MailboxMessage;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxCounterDAO.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxCounterDAO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxCounterDAO.java
index 2c00017..a5a499c 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxCounterDAO.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxCounterDAO.java
@@ -32,7 +32,7 @@ import java.util.concurrent.CompletableFuture;
 import javax.inject.Inject;
 
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
-import org.apache.james.mailbox.cassandra.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
 import org.apache.james.mailbox.cassandra.table.CassandraMailboxCountersTable;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.MailboxCounters;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxDAO.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxDAO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxDAO.java
index c9a136d..823ac59 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxDAO.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxDAO.java
@@ -42,7 +42,7 @@ import org.apache.james.backends.cassandra.CassandraConfiguration;
 import org.apache.james.backends.cassandra.init.CassandraTypesProvider;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
-import org.apache.james.mailbox.cassandra.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
 import org.apache.james.mailbox.cassandra.mail.utils.MailboxBaseTupleUtil;
 import org.apache.james.mailbox.cassandra.table.CassandraMailboxTable;
 import org.apache.james.mailbox.model.MailboxACL;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapper.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapper.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapper.java
index 0a2a3f0..82429b3 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapper.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapper.java
@@ -31,7 +31,7 @@ import java.util.stream.Collectors;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.james.backends.cassandra.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
-import org.apache.james.mailbox.cassandra.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.exception.MailboxExistsException;
 import org.apache.james.mailbox.exception.MailboxNotFoundException;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxPathDAO.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxPathDAO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxPathDAO.java
index 3ad6695..f6eb674 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxPathDAO.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxPathDAO.java
@@ -38,7 +38,7 @@ import javax.inject.Inject;
 import org.apache.james.backends.cassandra.init.CassandraTypesProvider;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
-import org.apache.james.mailbox.cassandra.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
 import org.apache.james.mailbox.cassandra.mail.utils.MailboxBaseTupleUtil;
 import org.apache.james.mailbox.cassandra.table.CassandraMailboxTable;
 import org.apache.james.mailbox.model.MailboxPath;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxRecentsDAO.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxRecentsDAO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxRecentsDAO.java
index 738e7ac..2018e0b 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxRecentsDAO.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxRecentsDAO.java
@@ -33,7 +33,7 @@ import javax.inject.Inject;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.cassandra.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
 import org.apache.james.mailbox.cassandra.table.CassandraMailboxRecentsTable;
 
 import com.datastax.driver.core.BoundStatement;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
index ed29a11..5b11de3 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
@@ -56,8 +56,8 @@ import org.apache.commons.lang3.tuple.Pair;
 import org.apache.james.backends.cassandra.CassandraConfiguration;
 import org.apache.james.backends.cassandra.init.CassandraTypesProvider;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
-import org.apache.james.mailbox.cassandra.CassandraMessageId;
-import org.apache.james.mailbox.cassandra.Limit;
+import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
+import org.apache.james.mailbox.cassandra.mail.utils.Limit;
 import org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.Attachments;
 import org.apache.james.mailbox.cassandra.table.CassandraMessageV1Table.Properties;
 import org.apache.james.mailbox.exception.MailboxException;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAOV2.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAOV2.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAOV2.java
index 170d80d..9bb0b35 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAOV2.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAOV2.java
@@ -55,9 +55,9 @@ import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.james.backends.cassandra.init.CassandraTypesProvider;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
-import org.apache.james.mailbox.cassandra.BlobId;
-import org.apache.james.mailbox.cassandra.CassandraMessageId;
-import org.apache.james.mailbox.cassandra.Limit;
+import org.apache.james.mailbox.cassandra.ids.BlobId;
+import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
+import org.apache.james.mailbox.cassandra.mail.utils.Limit;
 import org.apache.james.mailbox.cassandra.table.CassandraMessageV2Table.Attachments;
 import org.apache.james.mailbox.cassandra.table.CassandraMessageV2Table.Properties;
 import org.apache.james.mailbox.exception.MailboxException;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdDAO.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdDAO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdDAO.java
index f32f0a0..51365e6 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdDAO.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdDAO.java
@@ -53,9 +53,9 @@ import javax.mail.Flags.Flag;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.cassandra.CassandraId;
-import org.apache.james.mailbox.cassandra.CassandraMessageId;
-import org.apache.james.mailbox.cassandra.CassandraMessageId.Factory;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
+import org.apache.james.mailbox.cassandra.ids.CassandraMessageId.Factory;
 import org.apache.james.mailbox.model.ComposedMessageId;
 import org.apache.james.mailbox.model.ComposedMessageIdWithMetaData;
 import org.apache.james.mailbox.model.MessageRange;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapper.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapper.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapper.java
index d84c8c8..b94ffa6 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapper.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapper.java
@@ -34,9 +34,9 @@ import org.apache.james.backends.cassandra.utils.FunctionRunnerWithRetry;
 import org.apache.james.backends.cassandra.utils.LightweightTransactionException;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
-import org.apache.james.mailbox.cassandra.CassandraId;
-import org.apache.james.mailbox.cassandra.CassandraMessageId;
-import org.apache.james.mailbox.cassandra.Limit;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
+import org.apache.james.mailbox.cassandra.mail.utils.Limit;
 import org.apache.james.mailbox.cassandra.mail.migration.V1ToV2Migration;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.ComposedMessageId;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdToImapUidDAO.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdToImapUidDAO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdToImapUidDAO.java
index ae1ffc1..7ca5349 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdToImapUidDAO.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdToImapUidDAO.java
@@ -51,9 +51,9 @@ import javax.mail.Flags.Flag;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.cassandra.CassandraId;
-import org.apache.james.mailbox.cassandra.CassandraMessageId;
-import org.apache.james.mailbox.cassandra.CassandraMessageId.Factory;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
+import org.apache.james.mailbox.cassandra.ids.CassandraMessageId.Factory;
 import org.apache.james.mailbox.model.ComposedMessageId;
 import org.apache.james.mailbox.model.ComposedMessageIdWithMetaData;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
index 6d716b7..de07b8c 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
@@ -37,9 +37,9 @@ import org.apache.james.mailbox.ApplicableFlagBuilder;
 import org.apache.james.mailbox.FlagsBuilder;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.cassandra.CassandraId;
-import org.apache.james.mailbox.cassandra.CassandraMessageId;
-import org.apache.james.mailbox.cassandra.Limit;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
+import org.apache.james.mailbox.cassandra.mail.utils.Limit;
 import org.apache.james.mailbox.cassandra.mail.migration.V1ToV2Migration;
 import org.apache.james.mailbox.cassandra.mail.utils.FlagsUpdateStageResult;
 import org.apache.james.mailbox.exception.MailboxException;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraModSeqProvider.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraModSeqProvider.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraModSeqProvider.java
index 986fc74..1959d01 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraModSeqProvider.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraModSeqProvider.java
@@ -39,7 +39,7 @@ import org.apache.james.backends.cassandra.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.backends.cassandra.utils.FunctionRunnerWithRetry;
 import org.apache.james.mailbox.MailboxSession;
-import org.apache.james.mailbox.cassandra.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.store.mail.ModSeqProvider;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraUidProvider.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraUidProvider.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraUidProvider.java
index 8f738f4..e6a854a 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraUidProvider.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraUidProvider.java
@@ -39,7 +39,7 @@ import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.backends.cassandra.utils.FunctionRunnerWithRetry;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.cassandra.CassandraId;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.store.mail.UidProvider;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2Migration.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2Migration.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2Migration.java
index 6ae6e4f..84d21a6 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2Migration.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2Migration.java
@@ -25,8 +25,8 @@ import java.util.concurrent.CompletionStage;
 import java.util.stream.Stream;
 
 import org.apache.commons.lang3.tuple.Pair;
-import org.apache.james.mailbox.cassandra.CassandraMessageId;
-import org.apache.james.mailbox.cassandra.Limit;
+import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
+import org.apache.james.mailbox.cassandra.mail.utils.Limit;
 import org.apache.james.mailbox.cassandra.mail.AttachmentLoader;
 import org.apache.james.mailbox.cassandra.mail.CassandraAttachmentMapper;
 import org.apache.james.mailbox.cassandra.mail.CassandraMessageDAO;
@@ -34,7 +34,6 @@ import org.apache.james.mailbox.cassandra.mail.CassandraMessageDAOV2;
 import org.apache.james.mailbox.cassandra.mail.MessageAttachmentRepresentation;
 import org.apache.james.mailbox.cassandra.mail.MessageWithoutAttachment;
 import org.apache.james.mailbox.exception.MailboxException;
-import org.apache.james.mailbox.model.ComposedMessageIdWithMetaData;
 import org.apache.james.mailbox.store.mail.MessageMapper;
 import org.apache.james.mailbox.store.mail.model.impl.SimpleMailboxMessage;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/utils/Limit.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/utils/Limit.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/utils/Limit.java
new file mode 100644
index 0000000..68343dd
--- /dev/null
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/utils/Limit.java
@@ -0,0 +1,76 @@
+/****************************************************************
+ * 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.cassandra.mail.utils;
+
+import com.google.common.base.Preconditions;
+
+import java.util.Objects;
+import java.util.Optional;
+import java.util.stream.Stream;
+
+public class Limit {
+
+    public static Limit from(int limit) {
+        if (limit > 0) {
+            return new Limit(Optional.of(limit));
+        } else {
+            return unlimited();
+        }
+    }
+
+    public static Limit unlimited() {
+        return new Limit(Optional.empty());
+    }
+
+    public static Limit limit(int limit) {
+        Preconditions.checkArgument(limit > 0, "limit should be positive");
+        return new Limit(Optional.of(limit));
+    }
+
+    private final Optional<Integer> limit;
+
+    private Limit(Optional<Integer> limit) {
+        this.limit = limit;
+    }
+
+    public Optional<Integer> getLimit() {
+        return limit;
+    }
+
+    public <T> Stream<T> applyOnStream(Stream<T> stream) {
+        return limit
+            .map(stream::limit)
+            .orElse(stream);
+    }
+
+    @Override
+    public final boolean equals(Object o) {
+        if (o instanceof Limit) {
+            Limit other = (Limit) o;
+            return Objects.equals(limit, other.limit);
+        }
+        return false;
+    }
+
+    @Override
+    public final int hashCode() {
+        return Objects.hash(limit);
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraIdTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraIdTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraIdTest.java
deleted file mode 100644
index df576cf..0000000
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraIdTest.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.cassandra;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.util.UUID;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import nl.jqno.equalsverifier.EqualsVerifier;
-
-public class CassandraIdTest {
-
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
-    @Test
-    public void beanShouldRespectBeanContract() {
-        EqualsVerifier.forClass(CassandraId.class)
-            .verify();
-    }
-
-    @Test
-    public void fromStringShouldWorkWhenParameterIsAnUUID() {
-        UUID id = UUID.randomUUID();
-
-        CassandraId cassandraId = new CassandraId.Factory().fromString(id.toString());
-
-        assertThat(cassandraId.asUuid()).isEqualTo(id);
-    }
-
-    @Test
-    public void fromStringShouldThrowWhenParameterIsNotAnUUID() {
-        expectedException.expect(IllegalArgumentException.class);
-        new CassandraId.Factory().fromString("not an UUID");
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxIdDeserializerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxIdDeserializerTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxIdDeserializerTest.java
deleted file mode 100644
index 02391a0..0000000
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxIdDeserializerTest.java
+++ /dev/null
@@ -1,53 +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.cassandra;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserialisationException;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.UUID;
-
-public class CassandraMailboxIdDeserializerTest {
-
-    private static final String UUID_STRING = "5530370f-44c6-4647-990e-7768ce5131d4";
-    private static final String MALFORMED_UUID_STRING = "xyz";
-    private static final CassandraId CASSANDRA_ID = CassandraId.of(UUID.fromString(UUID_STRING));
-
-    private CassandraMailboxIdDeserializer mailboxIdDeserializer;
-
-    @Before
-    public void setUp() {
-        mailboxIdDeserializer = new CassandraMailboxIdDeserializer();
-    }
-
-    @Test
-    public void deserializeShouldWork() throws Exception {
-        assertThat(mailboxIdDeserializer.deserialize(UUID_STRING)).isEqualTo(CASSANDRA_ID);
-    }
-
-    @Test(expected = MailboxIdDeserialisationException.class)
-    public void deserializeShouldThrowOnMalformedData() throws Exception {
-        mailboxIdDeserializer.deserialize(MALFORMED_UUID_STRING);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerProvider.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerProvider.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerProvider.java
index 7f02c9c..8640cf9 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerProvider.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerProvider.java
@@ -24,6 +24,7 @@ import org.apache.james.mailbox.acl.GroupMembershipResolver;
 import org.apache.james.mailbox.acl.MailboxACLResolver;
 import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
 import org.apache.james.mailbox.acl.UnionMailboxACLResolver;
+import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
 import org.apache.james.mailbox.cassandra.mail.CassandraApplicableFlagDAO;
 import org.apache.james.mailbox.cassandra.mail.CassandraBlobsDAO;
 import org.apache.james.mailbox.cassandra.mail.CassandraDeletedMessageDAO;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMessageIdManagerTestSystem.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMessageIdManagerTestSystem.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMessageIdManagerTestSystem.java
index 0e0ff8d..73c2b5d 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMessageIdManagerTestSystem.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMessageIdManagerTestSystem.java
@@ -27,6 +27,7 @@ import javax.mail.util.SharedByteArrayInputStream;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageIdManager;
 import org.apache.james.mailbox.MessageUid;
+import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MailboxPath;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMessageIdTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMessageIdTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMessageIdTest.java
deleted file mode 100644
index 909eb02..0000000
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMessageIdTest.java
+++ /dev/null
@@ -1,65 +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.cassandra;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.util.UUID;
-
-import org.junit.Test;
-
-import nl.jqno.equalsverifier.EqualsVerifier;
-
-public class CassandraMessageIdTest {
-
-    @Test
-    public void beanShouldRespectBeanContract() {
-        EqualsVerifier.forClass(CassandraMessageId.class)
-            .verify();
-    }
-
-    @Test
-    public void generateShouldReturnAValidCassandraMesssageId() {
-        CassandraMessageId.Factory testee = new CassandraMessageId.Factory();
-
-        CassandraMessageId cassandraMessageId = testee.generate();
-        assertThat(cassandraMessageId.serialize()).isNotNull();
-    }
-
-    @Test
-    public void ofShouldReturnAValidCassandraMesssageId() {
-        CassandraMessageId.Factory testee = new CassandraMessageId.Factory();
-
-        UUID expectedUuid = UUID.randomUUID();
-        CassandraMessageId cassandraMessageId = testee.of(expectedUuid);
-
-        assertThat(cassandraMessageId.get()).isEqualTo(expectedUuid);
-    }
-
-    @Test
-    public void serializeShouldReturnTheUuidAsString() {
-        CassandraMessageId.Factory testee = new CassandraMessageId.Factory();
-
-        UUID uuid = UUID.randomUUID();
-        CassandraMessageId cassandraMessageId = testee.of(uuid);
-
-        String expected = uuid.toString();
-        assertThat(cassandraMessageId.serialize()).isEqualTo(expected);
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraTestSystemFixture.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraTestSystemFixture.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraTestSystemFixture.java
index ea41086..de5c0ad 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraTestSystemFixture.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraTestSystemFixture.java
@@ -23,6 +23,7 @@ import static org.mockito.Mockito.mock;
 
 import org.apache.james.backends.cassandra.CassandraCluster;
 import org.apache.james.backends.cassandra.init.CassandraModuleComposite;
+import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
 import org.apache.james.mailbox.cassandra.mail.CassandraBlobsDAO;
 import org.apache.james.mailbox.cassandra.mail.CassandraDeletedMessageDAO;
 import org.apache.james.mailbox.cassandra.mail.CassandraFirstUnseenDAO;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3085961/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/LimitTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/LimitTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/LimitTest.java
deleted file mode 100644
index adaf039..0000000
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/LimitTest.java
+++ /dev/null
@@ -1,114 +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.cassandra;
-
-import com.github.steveash.guavate.Guavate;
-import com.google.common.collect.ImmutableList;
-import nl.jqno.equalsverifier.EqualsVerifier;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-
-import java.util.List;
-import java.util.Optional;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class LimitTest {
-
-    private final List<Integer> aList = ImmutableList.of(1, 2, 3, 4, 5, 6);
-
-    @Rule
-    public final ExpectedException expectedException = ExpectedException.none();
-
-    @Test
-    public void unlimitedShouldCreateLimitWithNoLimit() {
-        Limit testee = Limit.unlimited();
-        assertThat(testee.getLimit()).isEqualTo(Optional.empty());
-    }
-
-    @Test
-    public void beanShouldRespectBeanContract() {
-        EqualsVerifier.forClass(Limit.class)
-            .verify();
-    }
-
-    @Test
-    public void unlimitedShouldCreateLimitThatDoesNotAffectStream() {
-
-        Limit testee = Limit.unlimited();
-        assertThat(
-            testee
-                .applyOnStream(aList.stream())
-                .collect(Guavate.toImmutableList())
-        ).isEqualTo(aList);
-    }
-
-    @Test
-    public void limitShouldCreateLimitWithNoLimit() {
-        int expected = 3;
-
-        Limit testee = Limit.limit(expected);
-        assertThat(testee.getLimit())
-            .isEqualTo(Optional.of(expected));
-    }
-
-    @Test
-    public void limitShouldCreateLimitThatCorrectlyTruncateStream() {
-        Limit testee = Limit.limit(3);
-
-        assertThat(testee
-            .applyOnStream(aList.stream())
-            .collect(Guavate.toImmutableList())
-        ).isEqualTo(ImmutableList.of(1, 2, 3));
-    }
-
-    @Test
-    public void limitShouldThrowAnErrorWhenCalledWithZero() {
-        expectedException.expect(IllegalArgumentException.class);
-        Limit.limit(0);
-    }
-
-
-    @Test
-    public void limitShouldThrowAnErrorWhenCalledWithNegativeValue() {
-        expectedException.expect(IllegalArgumentException.class);
-        Limit.limit(-1);
-    }
-
-    @Test
-    public void ofShouldTakePositiveValueAsLimit() {
-        assertThat(Limit.from(3))
-            .isEqualTo(Limit.limit(3));
-    }
-
-    @Test
-    public void ofShouldTakeNegativeValueAsUnlimited() {
-        assertThat(Limit.from(-1))
-            .isEqualTo(Limit.unlimited());
-    }
-
-    @Test
-    public void ofShouldTakeZeroValueAsUnlimited() {
-        assertThat(Limit.from(0))
-            .isEqualTo(Limit.unlimited());
-    }
-}
\ No newline at end of file


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