{"action":"created","comment":{"url":"https://api.github.com/repos/linagora/james-project/pulls/comments/215937077","pull_request_review_id":153311936,"id":215937077,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNTkzNzA3Nw==","diff_hunk":"@@ -0,0 +1,128 @@\n+/****************************************************************\n+ * Licensed to the Apache Software Foundation (ASF) under one   *\n+ * or more contributor license agreements.  See the NOTICE file *\n+ * distributed with this work for additional information        *\n+ * regarding copyright ownership.  The ASF licenses this file   *\n+ * to you under the Apache License, Version 2.0 (the            *\n+ * \"License\"); you may not use this file except in compliance   *\n+ * with the License.  You may obtain a copy of the License at   *\n+ *                                                              *\n+ *   http://www.apache.org/licenses/LICENSE-2.0                 *\n+ *                                                              *\n+ * Unless required by applicable law or agreed to in writing,   *\n+ * software distributed under the License is distributed on an  *\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *\n+ * KIND, either express or implied.  See the License for the    *\n+ * specific language governing permissions and limitations      *\n+ * under the License.                                           *\n+ ****************************************************************/\n+\n+package org.apache.james.blob.mail;\n+\n+import static org.assertj.core.api.Assertions.assertThat;\n+import static org.assertj.core.api.Assertions.assertThatThrownBy;\n+\n+import java.nio.charset.StandardCharsets;\n+\n+import javax.mail.internet.MimeMessage;\n+\n+import org.apache.james.blob.api.BlobId;\n+import org.apache.james.blob.api.BlobStore;\n+import org.apache.james.blob.api.HashBlobId;\n+import org.apache.james.blob.api.Store;\n+import org.apache.james.blob.memory.MemoryBlobStore;\n+import org.apache.james.core.builder.MimeMessageBuilder;\n+import org.apache.james.util.MimeMessageUtil;\n+import org.assertj.core.api.SoftAssertions;\n+import org.junit.jupiter.api.BeforeEach;\n+import org.junit.jupiter.api.Test;\n+\n+class MimeMessageStoreTest {\n+    private static final HashBlobId.Factory BLOB_ID_FACTORY = new HashBlobId.Factory();\n+\n+    private Store<MimeMessage, MimeMessagePartsId> testee;\n+    private BlobStore blobStore;\n+\n+    @BeforeEach\n+    void setUp() {\n+        blobStore = new MemoryBlobStore(BLOB_ID_FACTORY);\n+        testee = MimeMessageStore.factory(blobStore).mimeMessageStore();\n+    }\n+\n+    @Test\n+    void saveShouldThrowWhenNull() {\n+        assertThatThrownBy(() -> testee.save(null))\n+            .isInstanceOf(NullPointerException.class);\n+    }\n+\n+    @Test\n+    void readShouldThrowWhenNull() {\n+        assertThatThrownBy(() -> testee.read(null))\n+            .isInstanceOf(NullPointerException.class);\n+    }\n+\n+    @Test\n+    void mailStoreShouldPreserveContent() throws Exception {\n+        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()\n+            .addFrom(\"any@any.com\")\n+            .addToRecipient(\"toddy@any.com\")\n+            .setSubject(\"Important Mail\")\n+            .setText(\"Important mail content\")\n+            .build();\n+\n+        MimeMessagePartsId parts = testee.save(message).join();\n+\n+        MimeMessage retrievedMessage = testee.read(parts).join();\n+\n+        assertThat(MimeMessageUtil.asString(retrievedMessage))\n+            .isEqualTo(MimeMessageUtil.asString(message));\n+    }\n+\n+    @Test\n+    void mailStoreShouldPreserveMailWithoutBody() throws Exception {\n+        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()\n+            .addFrom(\"any@any.com\")\n+            .addToRecipient(\"toddy@any.com\")\n+            .setSubject(\"Important Mail\")\n+            .build();\n+\n+        MimeMessagePartsId parts = testee.save(message).join();\n+\n+        MimeMessage retrievedMessage = testee.read(parts).join();\n+\n+        assertThat(MimeMessageUtil.asString(retrievedMessage))\n+            .isEqualTo(MimeMessageUtil.asString(message));","path":"server/blob/mail-store/src/test/java/org/apache/james/blob/mail/MimeMessageStoreTest.java","position":78,"original_position":94,"commit_id":"c827f434206fdc24f1fda619805f506d94b7801c","original_commit_id":"c827f434206fdc24f1fda619805f506d94b7801c","user":{"login":"blackheaven","id":1362807,"node_id":"MDQ6VXNlcjEzNjI4MDc=","avatar_url":"https://avatars0.githubusercontent.com/u/1362807?v=4","gravatar_id":"","url":"https://api.github.com/users/blackheaven","html_url":"https://github.com/blackheaven","followers_url":"https://api.github.com/users/blackheaven/followers","following_url":"https://api.github.com/users/blackheaven/following{/other_user}","gists_url":"https://api.github.com/users/blackheaven/gists{/gist_id}","starred_url":"https://api.github.com/users/blackheaven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blackheaven/subscriptions","organizations_url":"https://api.github.com/users/blackheaven/orgs","repos_url":"https://api.github.com/users/blackheaven/repos","events_url":"https://api.github.com/users/blackheaven/events{/privacy}","received_events_url":"https://api.github.com/users/blackheaven/received_events","type":"User","site_admin":false},"body":"idem","created_at":"2018-09-07T12:05:38Z","updated_at":"2018-09-07T12:07:51Z","html_url":"https://github.com/linagora/james-project/pull/1722#discussion_r215937077","pull_request_url":"https://api.github.com/repos/linagora/james-project/pulls/1722","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/linagora/james-project/pulls/comments/215937077"},"html":{"href":"https://github.com/linagora/james-project/pull/1722#discussion_r215937077"},"pull_request":{"href":"https://api.github.com/repos/linagora/james-project/pulls/1722"}}},"pull_request":{"url":"https://api.github.com/repos/linagora/james-project/pulls/1722","id":213880089,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEzODgwMDg5","html_url":"https://github.com/linagora/james-project/pull/1722","diff_url":"https://github.com/linagora/james-project/pull/1722.diff","patch_url":"https://github.com/linagora/james-project/pull/1722.patch","issue_url":"https://api.github.com/repos/linagora/james-project/issues/1722","number":1722,"state":"open","locked":false,"title":"JAMES-2541 RabbitMQ mail queue","user":{"login":"chibenwa","id":6928740,"node_id":"MDQ6VXNlcjY5Mjg3NDA=","avatar_url":"https://avatars1.githubusercontent.com/u/6928740?v=4","gravatar_id":"","url":"https://api.github.com/users/chibenwa","html_url":"https://github.com/chibenwa","followers_url":"https://api.github.com/users/chibenwa/followers","following_url":"https://api.github.com/users/chibenwa/following{/other_user}","gists_url":"https://api.github.com/users/chibenwa/gists{/gist_id}","starred_url":"https://api.github.com/users/chibenwa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chibenwa/subscriptions","organizations_url":"https://api.github.com/users/chibenwa/orgs","repos_url":"https://api.github.com/users/chibenwa/repos","events_url":"https://api.github.com/users/chibenwa/events{/privacy}","received_events_url":"https://api.github.com/users/chibenwa/received_events","type":"User","site_admin":false},"body":"Based on https://github.com/linagora/james-project/pull/1720\r\n\r\nI did not tackle the subject of attribute serialization but the rest should be pretty fine...","created_at":"2018-09-07T10:09:59Z","updated_at":"2018-09-07T12:07:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"42b646b15f9d87efa88b827a3feafb29c151cf06","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":{"url":"https://api.github.com/repos/linagora/james-project/milestones/8","html_url":"https://github.com/linagora/james-project/milestone/8","labels_url":"https://api.github.com/repos/linagora/james-project/milestones/8/labels","id":3619176,"node_id":"MDk6TWlsZXN0b25lMzYxOTE3Ng==","number":8,"title":"Sprint 40","description":"","creator":{"login":"chibenwa","id":6928740,"node_id":"MDQ6VXNlcjY5Mjg3NDA=","avatar_url":"https://avatars1.githubusercontent.com/u/6928740?v=4","gravatar_id":"","url":"https://api.github.com/users/chibenwa","html_url":"https://github.com/chibenwa","followers_url":"https://api.github.com/users/chibenwa/followers","following_url":"https://api.github.com/users/chibenwa/following{/other_user}","gists_url":"https://api.github.com/users/chibenwa/gists{/gist_id}","starred_url":"https://api.github.com/users/chibenwa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chibenwa/subscriptions","organizations_url":"https://api.github.com/users/chibenwa/orgs","repos_url":"https://api.github.com/users/chibenwa/repos","events_url":"https://api.github.com/users/chibenwa/events{/privacy}","received_events_url":"https://api.github.com/users/chibenwa/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":11,"state":"open","created_at":"2018-09-04T03:28:50Z","updated_at":"2018-09-07T10:09:59Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/linagora/james-project/pulls/1722/commits","review_comments_url":"https://api.github.com/repos/linagora/james-project/pulls/1722/comments","review_comment_url":"https://api.github.com/repos/linagora/james-project/pulls/comments{/number}","comments_url":"https://api.github.com/repos/linagora/james-project/issues/1722/comments","statuses_url":"https://api.github.com/repos/linagora/james-project/statuses/c827f434206fdc24f1fda619805f506d94b7801c","head":{"label":"chibenwa:JAMES-2541","ref":"JAMES-2541","sha":"c827f434206fdc24f1fda619805f506d94b7801c","user":{"login":"chibenwa","id":6928740,"node_id":"MDQ6VXNlcjY5Mjg3NDA=","avatar_url":"https://avatars1.githubusercontent.com/u/6928740?v=4","gravatar_id":"","url":"https://api.github.com/users/chibenwa","html_url":"https://github.com/chibenwa","followers_url":"https://api.github.com/users/chibenwa/followers","following_url":"https://api.github.com/users/chibenwa/following{/other_user}","gists_url":"https://api.github.com/users/chibenwa/gists{/gist_id}","starred_url":"https://api.github.com/users/chibenwa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chibenwa/subscriptions","organizations_url":"https://api.github.com/users/chibenwa/orgs","repos_url":"https://api.github.com/users/chibenwa/repos","events_url":"https://api.github.com/users/chibenwa/events{/privacy}","received_events_url":"https://api.github.com/users/chibenwa/received_events","type":"User","site_admin":false},"repo":{"id":42459504,"node_id":"MDEwOlJlcG9zaXRvcnk0MjQ1OTUwNA==","name":"james-project","full_name":"chibenwa/james-project","owner":{"login":"chibenwa","id":6928740,"node_id":"MDQ6VXNlcjY5Mjg3NDA=","avatar_url":"https://avatars1.githubusercontent.com/u/6928740?v=4","gravatar_id":"","url":"https://api.github.com/users/chibenwa","html_url":"https://github.com/chibenwa","followers_url":"https://api.github.com/users/chibenwa/followers","following_url":"https://api.github.com/users/chibenwa/following{/other_user}","gists_url":"https://api.github.com/users/chibenwa/gists{/gist_id}","starred_url":"https://api.github.com/users/chibenwa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chibenwa/subscriptions","organizations_url":"https://api.github.com/users/chibenwa/orgs","repos_url":"https://api.github.com/users/chibenwa/repos","events_url":"https://api.github.com/users/chibenwa/events{/privacy}","received_events_url":"https://api.github.com/users/chibenwa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chibenwa/james-project","description":"Mirror of Apache James Project","fork":true,"url":"https://api.github.com/repos/chibenwa/james-project","forks_url":"https://api.github.com/repos/chibenwa/james-project/forks","keys_url":"https://api.github.com/repos/chibenwa/james-project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chibenwa/james-project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chibenwa/james-project/teams","hooks_url":"https://api.github.com/repos/chibenwa/james-project/hooks","issue_events_url":"https://api.github.com/repos/chibenwa/james-project/issues/events{/number}","events_url":"https://api.github.com/repos/chibenwa/james-project/events","assignees_url":"https://api.github.com/repos/chibenwa/james-project/assignees{/user}","branches_url":"https://api.github.com/repos/chibenwa/james-project/branches{/branch}","tags_url":"https://api.github.com/repos/chibenwa/james-project/tags","blobs_url":"https://api.github.com/repos/chibenwa/james-project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chibenwa/james-project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chibenwa/james-project/git/refs{/sha}","trees_url":"https://api.github.com/repos/chibenwa/james-project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chibenwa/james-project/statuses/{sha}","languages_url":"https://api.github.com/repos/chibenwa/james-project/languages","stargazers_url":"https://api.github.com/repos/chibenwa/james-project/stargazers","contributors_url":"https://api.github.com/repos/chibenwa/james-project/contributors","subscribers_url":"https://api.github.com/repos/chibenwa/james-project/subscribers","subscription_url":"https://api.github.com/repos/chibenwa/james-project/subscription","commits_url":"https://api.github.com/repos/chibenwa/james-project/commits{/sha}","git_commits_url":"https://api.github.com/repos/chibenwa/james-project/git/commits{/sha}","comments_url":"https://api.github.com/repos/chibenwa/james-project/comments{/number}","issue_comment_url":"https://api.github.com/repos/chibenwa/james-project/issues/comments{/number}","contents_url":"https://api.github.com/repos/chibenwa/james-project/contents/{+path}","compare_url":"https://api.github.com/repos/chibenwa/james-project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chibenwa/james-project/merges","archive_url":"https://api.github.com/repos/chibenwa/james-project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chibenwa/james-project/downloads","issues_url":"https://api.github.com/repos/chibenwa/james-project/issues{/number}","pulls_url":"https://api.github.com/repos/chibenwa/james-project/pulls{/number}","milestones_url":"https://api.github.com/repos/chibenwa/james-project/milestones{/number}","notifications_url":"https://api.github.com/repos/chibenwa/james-project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chibenwa/james-project/labels{/name}","releases_url":"https://api.github.com/repos/chibenwa/james-project/releases{/id}","deployments_url":"https://api.github.com/repos/chibenwa/james-project/deployments","created_at":"2015-09-14T15:57:25Z","updated_at":"2017-10-03T11:59:27Z","pushed_at":"2018-09-07T10:19:13Z","git_url":"git://github.com/chibenwa/james-project.git","ssh_url":"git@github.com:chibenwa/james-project.git","clone_url":"https://github.com/chibenwa/james-project.git","svn_url":"https://github.com/chibenwa/james-project","homepage":null,"size":46794,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":2,"open_issues":2,"watchers":0,"default_branch":"trunk"}},"base":{"label":"linagora:master","ref":"master","sha":"02d3f17ac99d854030d06964fa11bad34bf7f8ea","user":{"login":"linagora","id":1230365,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyMzAzNjU=","avatar_url":"https://avatars3.githubusercontent.com/u/1230365?v=4","gravatar_id":"","url":"https://api.github.com/users/linagora","html_url":"https://github.com/linagora","followers_url":"https://api.github.com/users/linagora/followers","following_url":"https://api.github.com/users/linagora/following{/other_user}","gists_url":"https://api.github.com/users/linagora/gists{/gist_id}","starred_url":"https://api.github.com/users/linagora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linagora/subscriptions","organizations_url":"https://api.github.com/users/linagora/orgs","repos_url":"https://api.github.com/users/linagora/repos","events_url":"https://api.github.com/users/linagora/events{/privacy}","received_events_url":"https://api.github.com/users/linagora/received_events","type":"Organization","site_admin":false},"repo":{"id":39182136,"node_id":"MDEwOlJlcG9zaXRvcnkzOTE4MjEzNg==","name":"james-project","full_name":"linagora/james-project","owner":{"login":"linagora","id":1230365,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyMzAzNjU=","avatar_url":"https://avatars3.githubusercontent.com/u/1230365?v=4","gravatar_id":"","url":"https://api.github.com/users/linagora","html_url":"https://github.com/linagora","followers_url":"https://api.github.com/users/linagora/followers","following_url":"https://api.github.com/users/linagora/following{/other_user}","gists_url":"https://api.github.com/users/linagora/gists{/gist_id}","starred_url":"https://api.github.com/users/linagora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linagora/subscriptions","organizations_url":"https://api.github.com/users/linagora/orgs","repos_url":"https://api.github.com/users/linagora/repos","events_url":"https://api.github.com/users/linagora/events{/privacy}","received_events_url":"https://api.github.com/users/linagora/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/linagora/james-project","description":"Mirror of Apache James Project","fork":true,"url":"https://api.github.com/repos/linagora/james-project","forks_url":"https://api.github.com/repos/linagora/james-project/forks","keys_url":"https://api.github.com/repos/linagora/james-project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/linagora/james-project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/linagora/james-project/teams","hooks_url":"https://api.github.com/repos/linagora/james-project/hooks","issue_events_url":"https://api.github.com/repos/linagora/james-project/issues/events{/number}","events_url":"https://api.github.com/repos/linagora/james-project/events","assignees_url":"https://api.github.com/repos/linagora/james-project/assignees{/user}","branches_url":"https://api.github.com/repos/linagora/james-project/branches{/branch}","tags_url":"https://api.github.com/repos/linagora/james-project/tags","blobs_url":"https://api.github.com/repos/linagora/james-project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/linagora/james-project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/linagora/james-project/git/refs{/sha}","trees_url":"https://api.github.com/repos/linagora/james-project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/linagora/james-project/statuses/{sha}","languages_url":"https://api.github.com/repos/linagora/james-project/languages","stargazers_url":"https://api.github.com/repos/linagora/james-project/stargazers","contributors_url":"https://api.github.com/repos/linagora/james-project/contributors","subscribers_url":"https://api.github.com/repos/linagora/james-project/subscribers","subscription_url":"https://api.github.com/repos/linagora/james-project/subscription","commits_url":"https://api.github.com/repos/linagora/james-project/commits{/sha}","git_commits_url":"https://api.github.com/repos/linagora/james-project/git/commits{/sha}","comments_url":"https://api.github.com/repos/linagora/james-project/comments{/number}","issue_comment_url":"https://api.github.com/repos/linagora/james-project/issues/comments{/number}","contents_url":"https://api.github.com/repos/linagora/james-project/contents/{+path}","compare_url":"https://api.github.com/repos/linagora/james-project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/linagora/james-project/merges","archive_url":"https://api.github.com/repos/linagora/james-project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/linagora/james-project/downloads","issues_url":"https://api.github.com/repos/linagora/james-project/issues{/number}","pulls_url":"https://api.github.com/repos/linagora/james-project/pulls{/number}","milestones_url":"https://api.github.com/repos/linagora/james-project/milestones{/number}","notifications_url":"https://api.github.com/repos/linagora/james-project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/linagora/james-project/labels{/name}","releases_url":"https://api.github.com/repos/linagora/james-project/releases{/id}","deployments_url":"https://api.github.com/repos/linagora/james-project/deployments","created_at":"2015-07-16T07:04:59Z","updated_at":"2018-09-07T06:28:07Z","pushed_at":"2018-09-07T10:19:15Z","git_url":"git://github.com/linagora/james-project.git","ssh_url":"git@github.com:linagora/james-project.git","clone_url":"https://github.com/linagora/james-project.git","svn_url":"https://github.com/linagora/james-project","homepage":null,"size":36173,"stargazers_count":21,"watchers_count":21,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":26,"mirror_url":null,"archived":false,"open_issues_count":67,"license":null,"forks":26,"open_issues":67,"watchers":21,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/linagora/james-project/pulls/1722"},"html":{"href":"https://github.com/linagora/james-project/pull/1722"},"issue":{"href":"https://api.github.com/repos/linagora/james-project/issues/1722"},"comments":{"href":"https://api.github.com/repos/linagora/james-project/issues/1722/comments"},"review_comments":{"href":"https://api.github.com/repos/linagora/james-project/pulls/1722/comments"},"review_comment":{"href":"https://api.github.com/repos/linagora/james-project/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/linagora/james-project/pulls/1722/commits"},"statuses":{"href":"https://api.github.com/repos/linagora/james-project/statuses/c827f434206fdc24f1fda619805f506d94b7801c"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"blackheaven"}}