This is an automated email from the ASF dual-hosted git repository.

aduprat pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 9ebaa14a0ace03e0b2b19b7cee18b15e95376183
Author: Benoit Tellier <btell...@linagora.com>
AuthorDate: Tue Jun 25 11:21:36 2019 +0700

    JAMES-2807 Create POJOs for DeletedMessageMetadataVault API
---
 .../deleted-messages-vault-blobstore/pom.xml       | 86 ++++++++++++++++++++++
 .../DeletedMessageWithStorageInformation.java      | 61 +++++++++++++++
 .../org/apache/james/vault/StorageInformation.java | 64 ++++++++++++++++
 .../vault/DeletedMessageVaultMetadataFixture.java  | 30 ++++++++
 .../DeletedMessageWithStorageInformationTest.java  | 47 ++++++++++++
 .../apache/james/vault/StorageInformationTest.java | 47 ++++++++++++
 mailbox/pom.xml                                    |  4 +
 7 files changed, 339 insertions(+)

diff --git a/mailbox/plugin/deleted-messages-vault-blobstore/pom.xml 
b/mailbox/plugin/deleted-messages-vault-blobstore/pom.xml
new file mode 100644
index 0000000..5575f57
--- /dev/null
+++ b/mailbox/plugin/deleted-messages-vault-blobstore/pom.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <artifactId>apache-james-mailbox</artifactId>
+        <groupId>org.apache.james</groupId>
+        <version>3.4.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    
<artifactId>apache-james-mailbox-deleted-messages-vault-blobstore</artifactId>
+    <name>Apache James :: Mailbox :: Plugin :: Deleted Messages Vault :: 
BlobStore</name>
+    <description>Apache James Mailbox Deleted Messages Vault implementation on 
top of BlobStore</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>apache-james-mailbox-api</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            
<artifactId>apache-james-mailbox-deleted-messages-vault</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            
<artifactId>apache-james-mailbox-deleted-messages-vault</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>apache-james-mailbox-memory</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>apache-james-mailbox-memory</artifactId>
+            <scope>test</scope>
+            <type>test-jar</type>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>blob-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>nl.jqno.equalsverifier</groupId>
+            <artifactId>equalsverifier</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.platform</groupId>
+            <artifactId>junit-platform-launcher</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file
diff --git 
a/mailbox/plugin/deleted-messages-vault-blobstore/src/main/java/org/apache/james/vault/DeletedMessageWithStorageInformation.java
 
b/mailbox/plugin/deleted-messages-vault-blobstore/src/main/java/org/apache/james/vault/DeletedMessageWithStorageInformation.java
new file mode 100644
index 0000000..669b3a6
--- /dev/null
+++ 
b/mailbox/plugin/deleted-messages-vault-blobstore/src/main/java/org/apache/james/vault/DeletedMessageWithStorageInformation.java
@@ -0,0 +1,61 @@
+/****************************************************************
+ * 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.vault;
+
+import java.util.Objects;
+
+import com.google.common.base.Preconditions;
+
+public class DeletedMessageWithStorageInformation {
+    private final DeletedMessage deletedmessage;
+    private final StorageInformation storageInformation;
+
+    public DeletedMessageWithStorageInformation(DeletedMessage deletedmessage, 
StorageInformation storageInformation) {
+        Preconditions.checkNotNull(deletedmessage);
+        Preconditions.checkNotNull(storageInformation);
+
+        this.deletedmessage = deletedmessage;
+        this.storageInformation = storageInformation;
+    }
+
+    public DeletedMessage getDeletedmessage() {
+        return deletedmessage;
+    }
+
+    public StorageInformation getStorageInformation() {
+        return storageInformation;
+    }
+
+    @Override
+    public final boolean equals(Object o) {
+        if (o instanceof DeletedMessageWithStorageInformation) {
+            DeletedMessageWithStorageInformation that = 
(DeletedMessageWithStorageInformation) o;
+
+            return Objects.equals(this.deletedmessage, that.deletedmessage)
+                && Objects.equals(this.storageInformation, 
that.storageInformation);
+        }
+        return false;
+    }
+
+    @Override
+    public final int hashCode() {
+        return Objects.hash(deletedmessage, storageInformation);
+    }
+}
diff --git 
a/mailbox/plugin/deleted-messages-vault-blobstore/src/main/java/org/apache/james/vault/StorageInformation.java
 
b/mailbox/plugin/deleted-messages-vault-blobstore/src/main/java/org/apache/james/vault/StorageInformation.java
new file mode 100644
index 0000000..4ebc6ca
--- /dev/null
+++ 
b/mailbox/plugin/deleted-messages-vault-blobstore/src/main/java/org/apache/james/vault/StorageInformation.java
@@ -0,0 +1,64 @@
+/****************************************************************
+ * 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.vault;
+
+import java.util.Objects;
+
+import org.apache.james.blob.api.BlobId;
+import org.apache.james.blob.api.BucketName;
+
+import com.google.common.base.Preconditions;
+
+public class StorageInformation {
+    private final BucketName bucketName;
+    private final BlobId blobId;
+
+    public StorageInformation(BucketName bucketName, BlobId blobId) {
+        Preconditions.checkNotNull(bucketName);
+        Preconditions.checkNotNull(blobId);
+
+        this.bucketName = bucketName;
+        this.blobId = blobId;
+    }
+
+    public BucketName getBucketName() {
+        return bucketName;
+    }
+
+    public BlobId getBlobId() {
+        return blobId;
+    }
+
+    @Override
+    public final boolean equals(Object o) {
+        if (o instanceof StorageInformation) {
+            StorageInformation that = (StorageInformation) o;
+
+            return Objects.equals(this.bucketName, that.bucketName)
+                && Objects.equals(this.blobId, that.blobId);
+        }
+        return false;
+    }
+
+    @Override
+    public final int hashCode() {
+        return Objects.hash(bucketName, blobId);
+    }
+}
diff --git 
a/mailbox/plugin/deleted-messages-vault-blobstore/src/test/java/org/apache/james/vault/DeletedMessageVaultMetadataFixture.java
 
b/mailbox/plugin/deleted-messages-vault-blobstore/src/test/java/org/apache/james/vault/DeletedMessageVaultMetadataFixture.java
new file mode 100644
index 0000000..a7a4db8
--- /dev/null
+++ 
b/mailbox/plugin/deleted-messages-vault-blobstore/src/test/java/org/apache/james/vault/DeletedMessageVaultMetadataFixture.java
@@ -0,0 +1,30 @@
+/****************************************************************
+ * 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.vault;
+
+import org.apache.james.blob.api.BlobId;
+import org.apache.james.blob.api.BucketName;
+import org.apache.james.blob.api.HashBlobId;
+
+public interface DeletedMessageVaultMetadataFixture {
+    BlobId BLOB_ID = new 
HashBlobId.Factory().from("05dcb33b-8382-4744-923a-bc593ad84d23");
+    BucketName BUCKET_NAME = BucketName.of("bucket-2019-06-01");
+    StorageInformation STORAGE_INFORMATION = new 
StorageInformation(BUCKET_NAME, BLOB_ID);
+}
diff --git 
a/mailbox/plugin/deleted-messages-vault-blobstore/src/test/java/org/apache/james/vault/DeletedMessageWithStorageInformationTest.java
 
b/mailbox/plugin/deleted-messages-vault-blobstore/src/test/java/org/apache/james/vault/DeletedMessageWithStorageInformationTest.java
new file mode 100644
index 0000000..a79a67f
--- /dev/null
+++ 
b/mailbox/plugin/deleted-messages-vault-blobstore/src/test/java/org/apache/james/vault/DeletedMessageWithStorageInformationTest.java
@@ -0,0 +1,47 @@
+/****************************************************************
+ * 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.vault;
+
+import static 
org.apache.james.vault.DeletedMessageVaultMetadataFixture.STORAGE_INFORMATION;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import org.junit.jupiter.api.Test;
+
+import nl.jqno.equalsverifier.EqualsVerifier;
+
+class DeletedMessageWithStorageInformationTest {
+
+    @Test
+    void shouldRespectBeanContract() {
+        
EqualsVerifier.forClass(DeletedMessageWithStorageInformation.class).verify();
+    }
+
+    @Test
+    void constructorShouldThrowOnNullDeletedMessage() {
+        assertThatThrownBy(() -> new 
DeletedMessageWithStorageInformation(null, STORAGE_INFORMATION))
+            .isInstanceOf(NullPointerException.class);
+    }
+
+    @Test
+    void constructorShouldThrowOnNullStorageInformation() {
+        assertThatThrownBy(() -> new 
DeletedMessageWithStorageInformation(DeletedMessageFixture.DELETED_MESSAGE, 
null))
+            .isInstanceOf(NullPointerException.class);
+    }
+}
\ No newline at end of file
diff --git 
a/mailbox/plugin/deleted-messages-vault-blobstore/src/test/java/org/apache/james/vault/StorageInformationTest.java
 
b/mailbox/plugin/deleted-messages-vault-blobstore/src/test/java/org/apache/james/vault/StorageInformationTest.java
new file mode 100644
index 0000000..b55cf55
--- /dev/null
+++ 
b/mailbox/plugin/deleted-messages-vault-blobstore/src/test/java/org/apache/james/vault/StorageInformationTest.java
@@ -0,0 +1,47 @@
+/****************************************************************
+ * 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.vault;
+
+import static 
org.apache.james.vault.DeletedMessageVaultMetadataFixture.BLOB_ID;
+import static 
org.apache.james.vault.DeletedMessageVaultMetadataFixture.BUCKET_NAME;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import org.junit.jupiter.api.Test;
+
+import nl.jqno.equalsverifier.EqualsVerifier;
+
+class StorageInformationTest {
+    @Test
+    void shouldRespectBeanContract() {
+        EqualsVerifier.forClass(StorageInformation.class).verify();
+    }
+
+    @Test
+    void constructorShouldThrowOnNullBucketName() {
+        assertThatThrownBy(() -> new StorageInformation(null, BLOB_ID))
+            .isInstanceOf(NullPointerException.class);
+    }
+
+    @Test
+    void constructorShouldThrowOnNullBlobId() {
+        assertThatThrownBy(() -> new StorageInformation(BUCKET_NAME, null))
+            .isInstanceOf(NullPointerException.class);
+    }
+}
\ No newline at end of file
diff --git a/mailbox/pom.xml b/mailbox/pom.xml
index 7e3dcd2..b191407 100644
--- a/mailbox/pom.xml
+++ b/mailbox/pom.xml
@@ -52,12 +52,16 @@
         <module>memory</module>
 
         <module>plugin/deleted-messages-vault</module>
+        <module>plugin/deleted-messages-vault-blobstore</module>
+
         <module>plugin/quota-mailing</module>
         <module>plugin/quota-mailing-cassandra</module>
         <module>plugin/quota-mailing-memory</module>
+
         <module>plugin/quota-search</module>
         <module>plugin/quota-search-elasticsearch</module>
         <module>plugin/quota-search-scanning</module>
+
         <module>plugin/spamassassin</module>
 
         <module>scanning-search</module>


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

Reply via email to