Repository: james-project
Updated Branches:
  refs/heads/master 3bb571bf7 -> 8e9c667e7


http://git-wip-us.apache.org/repos/asf/james-project/blob/f48f0c22/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/GetMessageListAndSharing.feature
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/GetMessageListAndSharing.feature
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/GetMessageListAndSharing.feature
new file mode 100644
index 0000000..2a7b24b
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/GetMessageListAndSharing.feature
@@ -0,0 +1,59 @@
+#***************************************************************
+# 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.                                           *
+# **************************************************************/
+Feature: Listing message from shared mailbox
+  As a James user
+  I want to be able to see message from mailbox that has been shared to me or 
from mailbox I shared
+
+  Background:
+    Given a domain named "domain.tld"
+    And a user "al...@domain.tld"
+    And a user "b...@domain.tld"
+    And "al...@domain.tld" has a mailbox "shared"
+    And "al...@domain.tld" shares her mailbox "shared" with "b...@domain.tld" 
with "aeilrwt" rights
+    And "al...@domain.tld" has a mailbox "shared2"
+
+  Scenario: Sharer can read the total and unread counts on a shared folder
+    Given "al...@domain.tld" has a message "m1" in "shared" mailbox
+    And "al...@domain.tld" has a message "m2" in "shared" mailbox with subject 
"my test subject 2", content "testmail 2"
+    When "al...@domain.tld" lists mailboxes
+    Then the mailbox "shared" has 2 messages
+    And the mailbox "shared" has 2 unseen messages
+
+  Scenario: Sharee can read the total and unread counts on a shared folder
+    Given "al...@domain.tld" has a message "m1" in "shared" mailbox
+    And "al...@domain.tld" has a message "m2" in "shared" mailbox with subject 
"my test subject 2", content "testmail 2"
+    When "b...@domain.tld" lists mailboxes
+    Then the mailbox "shared" has 2 messages
+    And the mailbox "shared" has 2 unseen messages
+
+  Scenario: As sharee read a message it should not update unseen count when no 
rights and read by sharee
+    Given "al...@domain.tld" shares her mailbox "shared2" with 
"b...@domain.tld" with "lri" rights
+    And "al...@domain.tld" has a message "m1" in "shared2" mailbox
+    When "b...@domain.tld" sets flags "$Seen" on message "m1"
+    When "b...@domain.tld" lists mailboxes
+    Then the mailbox "shared2" has 1 message
+    And the mailbox "shared2" has 1 unseen message
+
+  Scenario: Lookup right should not be enough to read message and unseen counts
+    Given "al...@domain.tld" shares her mailbox "shared2" with 
"b...@domain.tld" with "l" rights
+    And "al...@domain.tld" has a message "m1" in "shared2" mailbox
+    When "b...@domain.tld" lists mailboxes
+    Then the mailbox "shared2" has 0 messages
+    And the mailbox "shared2" has 0 unseen messages
+

http://git-wip-us.apache.org/repos/asf/james-project/blob/f48f0c22/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/KeywordsConsistencyOnDelegationMailbox.feature
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/KeywordsConsistencyOnDelegationMailbox.feature
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/KeywordsConsistencyOnDelegationMailbox.feature
new file mode 100644
index 0000000..8631a12
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/KeywordsConsistencyOnDelegationMailbox.feature
@@ -0,0 +1,140 @@
+#***************************************************************
+# 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.                                           *
+# **************************************************************/
+Feature: Keywords consistency on delegation mailbox
+
+  Background:
+    Given a domain named "domain.tld"
+    And some users "al...@domain.tld", "b...@domain.tld"
+    And "al...@domain.tld" has a mailbox "notShared"
+    And "al...@domain.tld" has a mailbox "shared"
+    And "al...@domain.tld" shares its mailbox "shared" with rights "lrw" with 
"b...@domain.tld"
+    And "al...@domain.tld" has a message "m1" in "notShared" mailbox with 
subject "My awesome subject", content "This is the content"
+    And "al...@domain.tld" copies "m1" from mailbox "notShared" to mailbox 
"shared"
+
+  Scenario: getMessageList filtered by flag should combine flag when 
delegation mailbox
+    Given "b...@domain.tld" sets flags "$Flagged" on message "m1"
+    When "al...@domain.tld" asks for message list in mailboxes 
"shared,notShared" with flag "$Flagged"
+    Then the message list contains "m1"
+
+  Scenario: getMessageList filtered by flag should keep flag on non-shared 
mailbox
+    Given "b...@domain.tld" sets flags "$Flagged" on message "m1"
+    When "al...@domain.tld" asks for message list in mailboxes "notShared" 
with flag "$Flagged"
+    Then the message list is empty
+
+  Scenario: getMessageList filtered by flag should keep flag on delegation 
mailbox
+    Given "b...@domain.tld" sets flags "$Flagged" on message "m1"
+    When "al...@domain.tld" asks for message list in mailboxes "shared" with 
flag "$Flagged"
+    Then the message list contains "m1"
+
+  Scenario: Get message list should select Draft flag on all mailbox
+    Given message "m1" has flags $Draft in mailbox "shared" of user 
"al...@domain.tld"
+    When "al...@domain.tld" asks for message list in mailboxes 
"shared,notShared" with flag "$Draft"
+    Then the message list contains "m1"
+
+  Scenario: Get message list should keep flags on non-shared mailbox
+    Given message "m1" has flags $Draft in mailbox "shared" of user 
"al...@domain.tld"
+    When "al...@domain.tld" asks for message list in mailbox "notShared" with 
flag "$Draft"
+    Then the message list is empty
+
+  Scenario: Get message list should keep flags on shared mailbox
+    Given message "m1" has flags $Draft in mailbox "shared" of user 
"al...@domain.tld"
+    When "al...@domain.tld" asks for message list in mailbox "shared" with 
flag "$Draft"
+    Then the message list contains "m1"
+
+  Scenario: getMessage with shared user should return message with combine 
flag when delegation mailbox
+    Given message "m1" has flags $Flagged in mailbox "shared" of user 
"al...@domain.tld"
+    When "b...@domain.tld" ask for messages "m1"
+    Then no error is returned
+    And the keywords of the message is $Flagged
+
+  Scenario: getMessage of owner mailbox should return message with combine 
flag when delegation mailbox
+    Given message "m1" has flags $Flagged in mailbox "shared" of user 
"al...@domain.tld"
+    When "al...@domain.tld" ask for messages "m1"
+    Then no error is returned
+    And the keywords of the message is $Flagged
+
+  Scenario: message should update message status based on delegation mailbox
+    Given "al...@domain.tld" sets flags "$Flagged,$Seen" on message "m1"
+    And "b...@domain.tld" sets flags "$Seen" on message "m1"
+    When "al...@domain.tld" ask for messages "m1"
+    Then no error is returned
+    And the message has IMAP flag "\Flagged \Seen" in mailbox "notShared" for 
"al...@domain.tld"
+    And the message has IMAP flag "\Seen" in mailbox "shared" for 
"al...@domain.tld"
+
+  Scenario: message should keep origin message status when cut the sharing
+    Given "b...@domain.tld" sets flags "$Flagged" on message "m1"
+    And "al...@domain.tld" shares its mailbox "shared" with rights "" with 
"b...@domain.tld"
+    When "al...@domain.tld" ask for messages "m1"
+    Then no error is returned
+    And the message has IMAP flag "\Flagged" in mailbox "shared" for 
"al...@domain.tld"
+    And the message has IMAP flag "" in mailbox "notShared" for 
"al...@domain.tld"
+
+  Scenario: getMessage should keep origin message status when delegation 
mailbox
+    Given message "m1" has flags $Flagged in mailbox "notShared" of user 
"al...@domain.tld"
+    And message "m1" has flags $Seen in mailbox "shared" of user 
"al...@domain.tld"
+    And "al...@domain.tld" shares its mailbox "shared" with rights "" with 
"b...@domain.tld"
+    When "al...@domain.tld" ask for messages "m1"
+    Then no error is returned
+    And the keywords of the message is $Flagged,$Seen
+
+  Scenario: getMessage on mailbox should keep its flag as it is when owner
+    Given "al...@domain.tld" sets flags "$Flagged" on message "m1"
+    When "al...@domain.tld" ask for messages "m1"
+    Then no error is returned
+    And the message has IMAP flag "\Flagged" in mailbox "shared" for 
"al...@domain.tld"
+    And the message has IMAP flag "\Flagged" in mailbox "notShared" for 
"al...@domain.tld"
+
+  Scenario: messages should keep Draft flag as it is when onwer
+    Given message "m1" has flags $Draft in mailbox "shared" of user 
"al...@domain.tld"
+    When "b...@domain.tld" ask for messages "m1"
+    Then no error is returned
+    And the keywords of the message is $Draft
+
+  Scenario: message should intersect flag when Draft
+    Given message "m1" has flags $Draft in mailbox "shared" of user 
"al...@domain.tld"
+    When "al...@domain.tld" ask for messages "m1"
+    Then no error is returned
+    And the message has no keyword
+
+  Scenario: message should intersect flag when Draft after cut sharing
+    Given message "m1" has flags $Draft in mailbox "shared" of user 
"al...@domain.tld"
+    And "al...@domain.tld" shares its mailbox "shared" with rights "" with 
"b...@domain.tld"
+    When "al...@domain.tld" ask for messages "m1"
+    Then no error is returned
+    And the message has no keyword
+
+  Scenario: message should combine flag if not Draft
+    Given the user has an open IMAP connection with mailbox "shared" selected
+    And the user set flags via IMAP to "\FLAGGED" for all messages in mailbox 
"shared"
+    When "al...@domain.tld" ask for messages "m1"
+    Then no error is returned
+    And the keywords of the message is $Flagged
+
+  Scenario: message should combine flag if not Draft on all mailboxes
+    Given "al...@domain.tld" sets flags "$Flagged" on message "m1"
+    When "al...@domain.tld" ask for messages "m1"
+    Then no error is returned
+    And the keywords of the message is $Flagged
+
+  Scenario: message should intersect Draft flag with onwer mailbox
+    Given the user has an open IMAP connection with mailbox "shared" selected
+    And the user set flags via IMAP to "\DRAFT" for all messages in mailbox 
"shared"
+    When "al...@domain.tld" ask for messages "m1"
+    Then no error is returned
+    And the message has no keyword

http://git-wip-us.apache.org/repos/asf/james-project/blob/f48f0c22/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/MailboxCreationAndSharing.feature
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/MailboxCreationAndSharing.feature
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/MailboxCreationAndSharing.feature
new file mode 100644
index 0000000..9083333
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/MailboxCreationAndSharing.feature
@@ -0,0 +1,36 @@
+#***************************************************************
+# 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.                                           *
+# **************************************************************/
+Feature: Mailbox creation and sharing
+  As a James user
+  I don't want other user to create mailbox in my mailbox even I shared it to 
them
+
+  Background:
+    Given a domain named "domain.tld"
+    And some users "al...@domain.tld", "b...@domain.tld"
+    And "al...@domain.tld" has a mailbox "shared"
+    And "al...@domain.tld" shares her mailbox "shared" with "b...@domain.tld" 
with "aeilrwt" rights
+
+  Scenario: A sharee should not be able to create a shared mailbox child
+    Given "b...@domain.tld" creates mailbox "sharedChild" with creationId 
"c-01" in mailbox "shared" owned by "al...@domain.tld"
+    When "al...@domain.tld" lists mailboxes
+    Then the mailboxes should contain "shared" in "Personal" namespace
+
+  Scenario: A sharee should receive a not created response when trying to 
create a shared mailbox child
+    When "b...@domain.tld" creates mailbox "sharedChild" with creationId 
"c-01" in mailbox "shared" owned by "al...@domain.tld"
+    Then mailbox with creationId "c-01" is not created

http://git-wip-us.apache.org/repos/asf/james-project/blob/f48f0c22/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/MailboxDeletionAndSharing.feature
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/MailboxDeletionAndSharing.feature
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/MailboxDeletionAndSharing.feature
new file mode 100644
index 0000000..5a9543c
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/MailboxDeletionAndSharing.feature
@@ -0,0 +1,36 @@
+#***************************************************************
+# 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.                                           *
+# **************************************************************/
+Feature: Mailbox deletion and shared mailbox
+  As a James user I don't want user to delete the mailbox I share to them
+
+  Background:
+    Given a domain named "domain.tld"
+    And a user "al...@domain.tld"
+    And a user "b...@domain.tld"
+    And "al...@domain.tld" has a mailbox "shared"
+    And "al...@domain.tld" shares her mailbox "shared" with "b...@domain.tld" 
with "aeilrwt" rights
+
+  Scenario: A sharee should receive a not destroyed response when trying to 
destroy a shared mailbox
+    Given "b...@domain.tld" deletes the mailbox "shared" owned by 
"al...@domain.tld"
+    Then mailbox "shared" owned by "al...@domain.tld" is not destroyed
+
+  Scenario: A sharee should not be able to delete a shared mailbox
+    Given "b...@domain.tld" deletes the mailbox "shared" owned by 
"al...@domain.tld"
+    When "al...@domain.tld" lists mailboxes
+    Then the mailboxes should contain "shared" in "Personal" namespace

http://git-wip-us.apache.org/repos/asf/james-project/blob/f48f0c22/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/MoveMailboxAndSharing.feature
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/MoveMailboxAndSharing.feature
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/MoveMailboxAndSharing.feature
new file mode 100644
index 0000000..2cc7b0b
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/MoveMailboxAndSharing.feature
@@ -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.                                           *
+# **************************************************************/
+Feature: Moving mailbox and sharing
+  As a James user
+  I want that moving shared mailbox work correctly
+
+  Background:
+    Given a domain named "domain.tld"
+    And some users "al...@domain.tld", "b...@domain.tld"
+    And "al...@domain.tld" has a mailbox "shared"
+    And "al...@domain.tld" shares her mailbox "shared" with "b...@domain.tld" 
with "aeilrwt" rights
+    And "al...@domain.tld" has a mailbox "shared.sharedChild"
+    And "al...@domain.tld" shares her mailbox "shared.sharedChild" with 
"b...@domain.tld" with "aeilrwt" rights
+    And "al...@domain.tld" has a mailbox "otherShared"
+    And "al...@domain.tld" shares her mailbox "otherShared" with 
"b...@domain.tld" with "aeilrwt" rights
+    And "b...@domain.tld" has a mailbox "bobMailbox"
+
+  Scenario: A sharer can not move its mailboxes to someone else delegated 
mailboxes
+    And "b...@domain.tld" shares her mailbox "bobMailbox" with 
"al...@domain.tld" with "aeilrwt" rights
+    When "al...@domain.tld" moves the mailbox "shared.sharedChild" owned by 
"al...@domain.tld", into mailbox "bobMailbox" owned by "b...@domain.tld"
+    Then mailbox "shared.sharedChild" owned by "al...@domain.tld" is not 
updated
+
+  Scenario: A sharee moving a delegated mailbox as top level should be rejected
+    When "b...@domain.tld" moves the mailbox "shared.sharedChild" owned by 
"al...@domain.tld" as top level mailbox
+    Then mailbox "shared.sharedChild" owned by "al...@domain.tld" is not 
updated
+
+  Scenario: A sharee moving a delegated mailbox as top level should not move 
mailbox
+    When "b...@domain.tld" moves the mailbox "shared.sharedChild" owned by 
"al...@domain.tld" as top level mailbox
+    Then "al...@domain.tld" lists mailboxes
+    And the mailboxes should contain "sharedChild" in "Personal" namespace, 
with parent mailbox "shared" of user "al...@domain.tld"
+
+  Scenario: A sharee moving a delegated mailbox into sharer mailboxes should 
be rejected
+    When "b...@domain.tld" moves the mailbox "shared.sharedChild" owned by 
"al...@domain.tld", into mailbox "otherShared" owned by "al...@domain.tld"
+    Then mailbox "shared.sharedChild" owned by "al...@domain.tld" is not 
updated
+
+  Scenario: A sharee moving a delegated mailbox into another delegated mailbox 
should not move mailbox
+    When "b...@domain.tld" moves the mailbox "shared.sharedChild" owned by 
"al...@domain.tld", into mailbox "otherShared" owned by "al...@domain.tld"
+    Then "al...@domain.tld" lists mailboxes
+    And the mailboxes should contain "sharedChild" in "Personal" namespace, 
with parent mailbox "shared" of user "al...@domain.tld"
+
+  Scenario: A sharee moving a delegated mailbox to his mailboxes should be 
rejected
+    When "b...@domain.tld" moves the mailbox "shared.sharedChild" owned by 
"al...@domain.tld", into mailbox "bobMailbox" owned by "b...@domain.tld"
+    Then mailbox "shared.sharedChild" owned by "al...@domain.tld" is not 
updated
+
+  Scenario: A sharee moving a delegated mailbox into his mailbox should not 
move mailbox
+    When "b...@domain.tld" moves the mailbox "shared.sharedChild" owned by 
"al...@domain.tld", into mailbox "bobMailbox" owned by "b...@domain.tld"
+    Then "al...@domain.tld" lists mailboxes
+    And the mailboxes should contain "sharedChild" in "Personal" namespace, 
with parent mailbox "shared" of user "al...@domain.tld"
+
+  Scenario: A sharee should be able to retrieve a mailbox after sharer moved 
it as a top level mailbox
+    When "al...@domain.tld" moves the mailbox "shared.sharedChild" owned by 
"al...@domain.tld" as top level mailbox
+    Then "b...@domain.tld" lists mailboxes
+    And the mailboxes should contain "sharedChild" in "Delegated" namespace, 
with no parent mailbox
+
+  Scenario: A sharee should be able to retrieve a mailbox after sharer moved 
it into another mailbox
+    Given "al...@domain.tld" has a mailbox "notShared"
+    When "al...@domain.tld" moves the mailbox "shared.sharedChild" owned by 
"al...@domain.tld", into mailbox "notShared" owned by "al...@domain.tld"
+    Then "b...@domain.tld" lists mailboxes
+    And the mailboxes should contain "sharedChild" in "Delegated" namespace, 
with parent mailbox "notShared" of user "al...@domain.tld"
+

http://git-wip-us.apache.org/repos/asf/james-project/blob/f48f0c22/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/MoveMessageAndSharing.feature
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/MoveMessageAndSharing.feature
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/MoveMessageAndSharing.feature
new file mode 100644
index 0000000..b388a49
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/MoveMessageAndSharing.feature
@@ -0,0 +1,146 @@
+#***************************************************************
+# 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.                                           *
+# **************************************************************/
+Feature: Move message and sharing
+  As a James user
+  I want that moving message work correctly with shared folder
+
+  Background:
+    Given a domain named "domain.tld"
+    And some users "al...@domain.tld", "b...@domain.tld"
+    And "al...@domain.tld" has a mailbox "shared"
+    And "al...@domain.tld" shares her mailbox "shared" with "b...@domain.tld" 
with "aeilrwt" rights
+    And "b...@domain.tld" has a mailbox "bobMailbox"
+
+  Scenario: Move message should update the total and the unread counts when 
asked by sharer
+    Given "al...@domain.tld" has a message "m1" in "INBOX" mailbox
+    And "al...@domain.tld" moves "m1" to mailbox "shared" of user 
"al...@domain.tld"
+    When "al...@domain.tld" lists mailboxes
+    Then the mailbox "shared" has 1 message
+    And the mailbox "shared" has 1 unseen message
+
+  Scenario: Move message should update the total and the unread counts of 
origin mailbox when asked by sharer
+    Given "al...@domain.tld" has a message "m1" in "INBOX" mailbox
+    And "al...@domain.tld" moves "m1" to mailbox "shared" of user 
"al...@domain.tld"
+    When "al...@domain.tld" lists mailboxes
+    Then the mailbox "INBOX" has 0 messages
+    And the mailbox "INBOX" has 0 unseen messages
+
+  Scenario: Move message should update the total and the unread counts when 
asked by sharer / sharee view
+    Given "al...@domain.tld" has a message "m1" in "INBOX" mailbox
+    And "al...@domain.tld" moves "m1" to mailbox "shared" of user 
"al...@domain.tld"
+    When "b...@domain.tld" lists mailboxes
+    Then the mailbox "shared" has 1 message
+    And the mailbox "shared" has 1 unseen message
+
+  Scenario: Move message should update the total and the unread counts of 
origin mailbox when asked by sharer / sharee view
+    Given "al...@domain.tld" has a mailbox "sharedBis"
+    And "al...@domain.tld" has a message "m1" in "sharedBis" mailbox
+    And "al...@domain.tld" shares her mailbox "sharedBis" with 
"b...@domain.tld" with "aeilrwt" rights
+    And "al...@domain.tld" moves "m1" to mailbox "shared" of user 
"al...@domain.tld"
+    When "b...@domain.tld" lists mailboxes
+    Then the mailbox "sharedBis" has 0 messages
+    And the mailbox "sharedBis" has 0 unseen messages
+
+  Scenario: Move message should update the total and the unread counts when 
asked by sharee
+    Given "b...@domain.tld" has a message "m1" in "bobMailbox" mailbox
+    And "b...@domain.tld" moves "m1" to mailbox "shared" of user 
"al...@domain.tld"
+    When "al...@domain.tld" lists mailboxes
+    Then the mailbox "shared" has 1 message
+    And the mailbox "shared" has 1 unseen message
+
+  Scenario: Move message should update the total and the unread counts of 
origin mailbox when asked by sharee
+    Given "b...@domain.tld" has a mailbox "sharedBis"
+    And "b...@domain.tld" has a message "m1" in "sharedBis" mailbox
+    And "b...@domain.tld" shares her mailbox "sharedBis" with 
"al...@domain.tld" with "aeilrwt" rights
+    And "b...@domain.tld" moves "m1" to mailbox "shared" of user 
"al...@domain.tld"
+    When "al...@domain.tld" lists mailboxes
+    Then the mailbox "sharedBis" has 0 messages
+    And the mailbox "sharedBis" has 0 unseen messages
+
+  Scenario: Move message should update the total and the unread counts when 
asked by sharee / sharee view
+    Given "b...@domain.tld" has a message "m1" in "bobMailbox" mailbox
+    And "b...@domain.tld" moves "m1" to mailbox "shared" of user 
"al...@domain.tld"
+    When "b...@domain.tld" lists mailboxes
+    Then the mailbox "shared" has 1 message
+    And the mailbox "shared" has 1 unseen message
+
+  Scenario: Move message should update the total and the unread counts of 
origin mailbox when asked by sharee / sharee view
+    Given "b...@domain.tld" has a message "m1" in "bobMailbox" mailbox
+    And "b...@domain.tld" moves "m1" to mailbox "shared" of user 
"al...@domain.tld"
+    When "b...@domain.tld" lists mailboxes
+    Then the mailbox "bobMailbox" has 0 messages
+    And the mailbox "bobMailbox" has 0 unseen messages
+
+  Scenario: Moving a message to a delegated mailbox without rights should not 
change the total and the unread counts
+    Given "al...@domain.tld" has a mailbox "shared2"
+    And "al...@domain.tld" shares her mailbox "shared2" with "b...@domain.tld" 
with "lr" rights
+    And "b...@domain.tld" has a message "m1" in "bobMailbox" mailbox
+    And "b...@domain.tld" moves "m1" to mailbox "shared2" of user 
"al...@domain.tld"
+    When "al...@domain.tld" lists mailboxes
+    Then the mailbox "shared" has 0 messages
+    And the mailbox "shared" has 0 unseen messages
+
+  Scenario: Moving a message to a delegated mailbox without rights should not 
change the total and the unread counts / sharee view
+    Given "al...@domain.tld" has a mailbox "shared2"
+    And "al...@domain.tld" shares her mailbox "shared2" with "b...@domain.tld" 
with "lr" rights
+    And "b...@domain.tld" has a message "m1" in "bobMailbox" mailbox
+    And "b...@domain.tld" moves "m1" to mailbox "shared2" of user 
"al...@domain.tld"
+    When "b...@domain.tld" lists mailboxes
+    Then the mailbox "shared" has 0 messages
+    And the mailbox "shared" has 0 unseen messages
+
+  Scenario: Move message should update the total and the unread counts when 
asked by sharee and seen message
+    Given "b...@domain.tld" has a message "m1" in the "bobMailbox" mailbox 
with flags "$Seen"
+    And "b...@domain.tld" moves "m1" to mailbox "shared" of user 
"al...@domain.tld"
+    When "al...@domain.tld" lists mailboxes
+    Then the mailbox "shared" has 1 message
+    And the mailbox "shared" has 0 unseen message
+
+  Scenario: Move message should update the total and the unread counts when 
asked by sharee / sharee view and seen message
+    Given "b...@domain.tld" has a message "m1" in the "bobMailbox" mailbox 
with flags "$Seen"
+    And "b...@domain.tld" moves "m1" to mailbox "shared" of user 
"al...@domain.tld"
+    When "b...@domain.tld" lists mailboxes
+    Then the mailbox "shared" has 1 message
+    And the mailbox "shared" has 0 unseen message
+
+  Scenario: Move message should update the total and the unread counts of 
origin mailbox when asked by sharer and seen message
+    Given "al...@domain.tld" has a message "m1" in the "INBOX" mailbox with 
flags "$Seen"
+    And "al...@domain.tld" moves "m1" to mailbox "shared" of user 
"al...@domain.tld"
+    When "al...@domain.tld" lists mailboxes
+    Then the mailbox "INBOX" has 0 messages
+    And the mailbox "INBOX" has 0 unseen messages
+
+  Scenario: Moving a message to a delegated mailbox without rights should not 
change the total and the unread counts
+    Given "al...@domain.tld" has a mailbox "shared2"
+    And "al...@domain.tld" shares her mailbox "shared2" with "b...@domain.tld" 
with "lri" rights
+    And "b...@domain.tld" has a message "m1" in the "bobMailbox" mailbox with 
flags "$Seen"
+    And "b...@domain.tld" moves "m1" to mailbox "shared2" of user 
"al...@domain.tld"
+    When "al...@domain.tld" lists mailboxes
+    Then the mailbox "shared" has 0 messages
+    And the mailbox "shared" has 0 unseen messages
+
+  Scenario: Moving a message to a delegated mailbox without rights should not 
change the total and the unread counts / sharee view
+    Given "al...@domain.tld" has a mailbox "shared2"
+    And "al...@domain.tld" shares her mailbox "shared2" with "b...@domain.tld" 
with "lri" rights
+    And "b...@domain.tld" has a message "m1" in the "bobMailbox" mailbox with 
flags "$Seen"
+    And "b...@domain.tld" moves "m1" to mailbox "shared2" of user 
"al...@domain.tld"
+    When "b...@domain.tld" lists mailboxes
+    Then the mailbox "shared" has 0 messages
+    And the mailbox "shared" has 0 unseen messages
+

http://git-wip-us.apache.org/repos/asf/james-project/blob/f48f0c22/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/RenamingMailboxAndSharing.feature
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/RenamingMailboxAndSharing.feature
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/RenamingMailboxAndSharing.feature
new file mode 100644
index 0000000..769209a
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/RenamingMailboxAndSharing.feature
@@ -0,0 +1,48 @@
+#***************************************************************
+# 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.                                           *
+# **************************************************************/
+Feature: Renaming mailbox and sharing
+  As a James user
+  I want that renaming shared mailbox work properly
+
+  Background:
+    Given a domain named "domain.tld"
+    And some users "al...@domain.tld", "b...@domain.tld"
+    And "al...@domain.tld" has a mailbox "shared"
+    And "al...@domain.tld" shares her mailbox "shared" with "b...@domain.tld" 
with "aeilrwt" rights
+
+  Scenario: A sharee should be able to access a shared mailbox after it has 
been renamed by the owner
+    Given "al...@domain.tld" renames her mailbox "shared" to "mySharedMailbox"
+    When "b...@domain.tld" lists mailboxes
+    Then the mailboxes should contain "mySharedMailbox" in "Delegated" 
namespace
+
+  Scenario: A sharee should not be able to rename a shared mailbox
+    Given "b...@domain.tld" renames the mailbox, owned by "al...@domain.tld", 
"shared" to "mySharedMailbox"
+    When "al...@domain.tld" lists mailboxes
+    Then the mailboxes should contain "shared" in "Personal" namespace
+
+  Scenario: A user should not be able to rename an other user mailbox
+    Given "al...@domain.tld" has a mailbox "mySecrets"
+    And "b...@domain.tld" renames the mailbox, owned by "al...@domain.tld", 
"mySecrets" to "revealMySecrets"
+    When "al...@domain.tld" lists mailboxes
+    Then the mailboxes should contain "mySecrets" in "Personal" namespace
+
+  Scenario: A sharee should receive a not updated response when trying to 
rename a shared mailbox
+    Given "b...@domain.tld" renames the mailbox, owned by "al...@domain.tld", 
"shared" to "mySharedMailbox"
+    Then mailbox "shared" owned by "al...@domain.tld" is not updated
+

http://git-wip-us.apache.org/repos/asf/james-project/blob/f48f0c22/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SetFlagAndSharing.feature
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SetFlagAndSharing.feature
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SetFlagAndSharing.feature
new file mode 100644
index 0000000..2925725
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SetFlagAndSharing.feature
@@ -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.                                           *
+# **************************************************************/
+Feature: Set flag and sharing
+  As a James user
+  I want that set flag work correctly with shared mailbox
+
+  Background:
+    Given a domain named "domain.tld"
+    And some users "al...@domain.tld", "b...@domain.tld"
+    And "al...@domain.tld" has a mailbox "shared"
+    And "al...@domain.tld" shares her mailbox "shared" with "b...@domain.tld" 
with "aeilrwt" rights
+    And "al...@domain.tld" has a message "m1" in "shared" mailbox
+
+  Scenario: Set flags by sharer should update unseen count when read by sharer
+    When "al...@domain.tld" sets flags "$Seen" on message "m1"
+    When "al...@domain.tld" lists mailboxes
+    Then the mailbox "shared" has 1 message
+    And the mailbox "shared" has 0 unseen messages
+
+  Scenario: Set flags by sharer should update unseen count when read by sharee
+    When "al...@domain.tld" sets flags "$Seen" on message "m1"
+    When "b...@domain.tld" lists mailboxes
+    Then the mailbox "shared" has 1 message
+    And the mailbox "shared" has 0 unseen messages
+
+  Scenario: Set flags by sharee should update unseen count when read by sharer
+    When "b...@domain.tld" sets flags "$Seen" on message "m1"
+    When "al...@domain.tld" lists mailboxes
+    Then the mailbox "shared" has 1 message
+    And the mailbox "shared" has 0 unseen messages
+
+  Scenario: Set flags by sharee should update unseen count when read by sharee
+    When "b...@domain.tld" sets flags "$Seen" on message "m1"
+    When "b...@domain.tld" lists mailboxes
+    Then the mailbox "shared" has 1 message
+    And the mailbox "shared" has 0 unseen messages
+
+  Scenario: Set flags by sharee should not update unseen count when no rights 
and read by sharer
+    Given "al...@domain.tld" has a mailbox "shared2"
+    And "al...@domain.tld" shares her mailbox "shared2" with "b...@domain.tld" 
with "lri" rights
+    And "al...@domain.tld" has a message "m2" in "shared2" mailbox
+    When "b...@domain.tld" sets flags "$Seen" on message "m2"
+    When "al...@domain.tld" lists mailboxes
+    Then the mailbox "shared2" has 1 message
+    And the mailbox "shared2" has 1 unseen message

http://git-wip-us.apache.org/repos/asf/james-project/blob/f48f0c22/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SetMessagesOnSharedMailbox.feature
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SetMessagesOnSharedMailbox.feature
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SetMessagesOnSharedMailbox.feature
new file mode 100644
index 0000000..9a3631d
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SetMessagesOnSharedMailbox.feature
@@ -0,0 +1,107 @@
+#***************************************************************
+# 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.                                           *
+# **************************************************************/
+Feature: SetMessages method on shared folders
+  As a James user
+  I want to be able to modify properties of a shared mail
+
+  Background:
+    Given a domain named "domain.tld"
+    And some users "al...@domain.tld", "b...@domain.tld"
+    And "b...@domain.tld" has a mailbox "shared"
+    And "al...@domain.tld" has a mailbox "INBOX"
+    And "b...@domain.tld" has a message "mBob" in "shared" mailbox with two 
attachments in text
+    And "al...@domain.tld" has a message "mAlice" in "INBOX" mailbox with two 
attachments in text
+
+  Scenario: A delegated user can copy messages from shared mailbox when having 
"read" right
+    Given "b...@domain.tld" shares his mailbox "shared" with 
"al...@domain.tld" with "lr" rights
+    And "al...@domain.tld" copies "mBob" from mailbox "shared" of user 
"b...@domain.tld" to mailbox "INBOX" of user "al...@domain.tld"
+    Then "al...@domain.tld" should see message "mBob" in mailboxes:
+        |al...@domain.tld |INBOX  |
+        |b...@domain.tld   |shared |
+
+  Scenario: A delegated user can move messages out of shared mailbox when 
having "read" and "delete" rights
+    Given "b...@domain.tld" shares his mailbox "shared" with 
"al...@domain.tld" with "lrte" rights
+    And "al...@domain.tld" moves "mBob" to mailbox "INBOX" of user 
"al...@domain.tld"
+    Then "al...@domain.tld" should see message "mBob" in mailboxes:
+        |al...@domain.tld |INBOX  |
+
+  Scenario: A delegated user can add messages to a shared mailbox when having 
"insert" rights
+    Given "b...@domain.tld" shares his mailbox "shared" with 
"al...@domain.tld" with "lri" rights
+    And "al...@domain.tld" copies "mAlice" from mailbox "INBOX" of user 
"al...@domain.tld" to mailbox "shared" of user "b...@domain.tld"
+    Then "al...@domain.tld" should see message "mAlice" in mailboxes:
+        |al...@domain.tld |INBOX  |
+        |b...@domain.tld   |shared |
+
+  Scenario: A delegated user can add messages with keywords to a shared 
mailbox when having "write" right
+    Given "b...@domain.tld" shares his mailbox "shared" with 
"al...@domain.tld" with "lriws" rights
+    And "al...@domain.tld" sets flags "$Flagged" on message "mAlice"
+    And "al...@domain.tld" moves "mAlice" to mailbox "shared" of user 
"b...@domain.tld"
+    Then "al...@domain.tld" should see message "mAlice" with keywords 
"$Flagged"
+
+  Scenario: A delegated user can add sanitized messages to a shared mailbox 
when missing "write" right
+    Given "b...@domain.tld" shares his mailbox "shared" with 
"al...@domain.tld" with "lri" rights
+    And "al...@domain.tld" sets flags "$Flagged" on message "mAlice"
+    And "al...@domain.tld" moves "mAlice" to mailbox "shared" of user 
"b...@domain.tld"
+    Then "al...@domain.tld" should see message "mAlice" without keywords
+
+  Scenario: A delegated user can not copy messages from shared mailbox when 
missing "read" right
+    Given "b...@domain.tld" shares his mailbox "shared" with 
"al...@domain.tld" with "litewsa" rights
+    When "al...@domain.tld" copies "mBob" from mailbox "shared" of user 
"b...@domain.tld" to mailbox "INBOX" of user "al...@domain.tld"
+    Then message "mBob" is not updated
+
+  Scenario: A delegated user can not copy messages to shared mailbox when 
missing "insert" right
+    Given "b...@domain.tld" shares his mailbox "shared" with 
"al...@domain.tld" with "lrtewsa" rights
+    When "al...@domain.tld" copies "mAlice" from mailbox "INBOX" of user 
"al...@domain.tld" to mailbox "shared" of user "b...@domain.tld"
+    Then message "mAlice" is not updated
+
+  Scenario: A delegated user can not move messages out of shared mailbox when 
missing "delete" right
+    Given "b...@domain.tld" shares his mailbox "shared" with 
"al...@domain.tld" with "lriwsa" rights
+    When "al...@domain.tld" moves "mBob" to mailbox "INBOX" of user 
"al...@domain.tld"
+    Then message "mBob" is not updated
+
+
+  Scenario: A delegated user add keywords on a delegated message when having 
"write" right
+    Given "b...@domain.tld" shares his mailbox "shared" with 
"al...@domain.tld" with "lrw" rights
+    When "al...@domain.tld" sets flags "$Flagged" on message "mBob"
+    Then "al...@domain.tld" should see message "mBob" with keywords "$Flagged"
+
+  Scenario: A delegated user can not add keywords on a delegated message when 
missing "write" right
+    Given "b...@domain.tld" shares his mailbox "shared" with 
"al...@domain.tld" with "latires" rights
+    When "al...@domain.tld" sets flags "$Flagged" on message "mBob"
+    Then message "mBob" is not updated
+
+  Scenario: A delegated user remove keywords on a delegated message when 
having "write" right
+    Given "b...@domain.tld" shares his mailbox "shared" with 
"al...@domain.tld" with "lrw" rights
+    And "b...@domain.tld" sets flags "$Flagged" on message "mBob"
+    When "al...@domain.tld" sets flags "" on message "mBob"
+    Then "al...@domain.tld" should see message "mBob" without keywords
+
+  Scenario: A delegated user can not remove keywords on a delegated message 
when missing "write" right
+    Given "b...@domain.tld" shares his mailbox "shared" with 
"al...@domain.tld" with "latires" rights
+    And "b...@domain.tld" sets flags "$Flagged" on message "mBob"
+    When "al...@domain.tld" sets flags "" on message "mBob"
+    Then message "mBob" is not updated
+
+  Scenario: A delegated user can not move draft from draft mailbox to outbox
+    Given "b...@domain.tld" has a mailbox "Drafts"
+    And "b...@domain.tld" tries to create a draft message "mDraft" in mailbox 
"Drafts"
+    When "al...@domain.tld" moves "mDraft" to mailbox "Outbox" of user 
"b...@domain.tld"
+    Then message "mDraft" is not updated
+    And message "mBob" has flags $Draft in mailbox "Drafts" of user 
"b...@domain.tld"
+

http://git-wip-us.apache.org/repos/asf/james-project/blob/f48f0c22/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SharingChildrenWithoutSharingParent.feature
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SharingChildrenWithoutSharingParent.feature
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SharingChildrenWithoutSharingParent.feature
new file mode 100644
index 0000000..641de31
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SharingChildrenWithoutSharingParent.feature
@@ -0,0 +1,42 @@
+#***************************************************************
+# 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.                                           *
+# **************************************************************/
+Feature: Sharing children mailbox
+  As a James user
+  I want to be able to share a children mailbox without sharing it's parent one
+
+  Background:
+    Given a domain named "domain.tld"
+    And a user "al...@domain.tld"
+    And a user "b...@domain.tld"
+    And "al...@domain.tld" has a mailbox "shared"
+    And "al...@domain.tld" shares her mailbox "shared" with "b...@domain.tld" 
with "aeilrwt" rights
+    And "al...@domain.tld" has a mailbox "mailbox1"
+    And "al...@domain.tld" has a mailbox "mailbox1.shared"
+
+  Scenario: User can share sub-mailbox without sharing its parent
+    Given "al...@domain.tld" shares her mailbox "mailbox1.shared" with 
"b...@domain.tld" with "aeirwt" rights
+    When "b...@domain.tld" lists mailboxes
+    Then the mailboxes should contain "shared" in "Delegated" namespace
+    And the mailboxes should not contain "mailbox1"
+
+  Scenario: User can share sub-mailbox without sharing its parent and then 
sharee can see the parent mailbox
+    Given "al...@domain.tld" shares her mailbox "mailbox1.shared" with 
"b...@domain.tld" with "l" rights
+    When "b...@domain.tld" lists mailboxes
+    Then the mailboxes should contain "shared" in "Delegated" namespace
+    And the mailboxes should contain "mailbox1" in "Delegated" namespace

http://git-wip-us.apache.org/repos/asf/james-project/blob/f48f0c22/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SharingMailboxWithOtherDomain.feature
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SharingMailboxWithOtherDomain.feature
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SharingMailboxWithOtherDomain.feature
new file mode 100644
index 0000000..31a4424
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SharingMailboxWithOtherDomain.feature
@@ -0,0 +1,31 @@
+#***************************************************************
+# 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.                                           *
+# **************************************************************/
+Feature: Delegation with other domain
+  As a James user I can not share a mailbox with a other from an other domain
+
+  Background:
+    Given a domain named "domain.tld"
+    And a user "al...@domain.tld"
+    And "al...@domain.tld" has a mailbox "shared"
+
+  Scenario: alice should not be able to share her mailbox with a user from an 
other domain
+    Given a domain named "otherdomain.tld"
+    And a user "b...@otherdomain.tld"
+    When "al...@domain.tld" shares its mailbox "shared" with rights "lrw" with 
"b...@otherdomain.tld"
+    Then "al...@domain.tld" receives not updated on mailbox "shared" with kind 
"invalidArguments" and message "Cannot share a mailbox to another domain"

http://git-wip-us.apache.org/repos/asf/james-project/blob/f48f0c22/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SharingParentMailboxWithAndWithoutChildren.feature
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SharingParentMailboxWithAndWithoutChildren.feature
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SharingParentMailboxWithAndWithoutChildren.feature
new file mode 100644
index 0000000..361859b
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/sharing/SharingParentMailboxWithAndWithoutChildren.feature
@@ -0,0 +1,104 @@
+#***************************************************************
+# 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.                                           *
+# **************************************************************/
+Feature: Share parent mailbox without sharing submailbox
+  As a James user
+  I want to be able to retrieve my mailboxes
+
+  Background:
+    Given a domain named "domain.tld"
+    And a user "al...@domain.tld"
+    And a user "b...@domain.tld"
+    And "al...@domain.tld" has a mailbox "shared"
+    And "al...@domain.tld" has a mailbox "shared.secret"
+    And "al...@domain.tld" has a mailbox "shared.notsecret"
+    And "al...@domain.tld" shares her mailbox "shared" with "b...@domain.tld" 
with "aeilrwt" rights
+    And "al...@domain.tld" shares her mailbox "shared.notsecret" with 
"b...@domain.tld" with "aeilrwt" rights
+    And "al...@domain.tld" has a message "m1" in "shared" mailbox
+    And "al...@domain.tld" has a message "m2" in "shared.secret" mailbox
+    And "al...@domain.tld" has a message "m3" in "shared.notsecret" mailbox
+
+  Scenario: Bob can see shared mailbox and explicitly shared children mailbox
+    When "b...@domain.tld" lists mailboxes
+    Then the mailboxes should contain "shared" in "Delegated" namespace
+    And the mailboxes should contain "notsecret" in "Delegated" namespace, 
with parent mailbox "shared" of user "al...@domain.tld"
+    And the mailbox "shared" has 1 messages
+    And the mailbox "notsecret" has 1 messages
+
+  Scenario: Bob can not see not explicitly shared children mailbox
+    When "b...@domain.tld" lists mailboxes
+    And the mailboxes should not contain "shared.secret" in "Delegated" 
namespace
+    And the mailboxes should not contain "secret" in "Personal" namespace
+    And the mailboxes should not contain "secret" in "Delegated" namespace, 
with parent mailbox "shared" of user "al...@domain.tld"
+
+  Scenario: Alice can see all her shared mailbox
+    When "al...@domain.tld" lists mailboxes
+    And the mailboxes should contain "shared" in "Personal" namespace
+    And the mailboxes should contain "notsecret" in "Personal" namespace, with 
parent mailbox "shared" of user "al...@domain.tld"
+    And the mailbox "shared" has 1 messages
+    And the mailbox "notsecret" has 1 messages
+
+  Scenario: Alice can see all her not shared mailbox
+    When "al...@domain.tld" lists mailboxes
+    And the mailboxes should contain "secret" in "Personal" namespace, with 
parent mailbox "shared" of user "al...@domain.tld"
+    And the mailbox "secret" has 1 messages
+
+  Scenario: Alice can get message from her shared mailbox
+    When "al...@domain.tld" ask for messages "m1"
+    Then no error is returned
+    And the list should contain 1 message
+    When "al...@domain.tld" ask for messages "m3"
+    Then no error is returned
+    And the list should contain 1 message
+
+  Scenario: Alice can get message from her not shared mailbox
+    When "al...@domain.tld" ask for messages "m2"
+    Then no error is returned
+    And the list should contain 1 message
+
+  Scenario: Bob can get message from all his shared mailbox
+    When "b...@domain.tld" ask for messages "m1"
+    Then no error is returned
+    And the list should contain 1 message
+    When "b...@domain.tld" ask for messages "m3"
+    Then no error is returned
+    And the list should contain 1 message
+
+  Scenario: Bob can not get message from mailbox not shared with him
+    When "b...@domain.tld" ask for messages "m2"
+    And the list should contain 0 message
+
+  Scenario: Alice can list message from all her shared mailbox
+    When "al...@domain.tld" asks for message list in mailbox "shared"
+    Then the message list has size 1
+    When "al...@domain.tld" asks for message list in mailbox "shared.notsecret"
+    Then the message list has size 1
+
+  Scenario: Alice can list message from all her mailbox she is not sharing
+    When "al...@domain.tld" asks for message list in mailbox "shared.secret"
+    Then the message list has size 1
+
+  Scenario: Bob can list message from all mailbox that are shared to him
+    When "b...@domain.tld" asks for message list in delegated mailbox "shared" 
from "al...@domain.tld"
+    Then the message list has size 1
+    When "b...@domain.tld" asks for message list in delegated mailbox 
"shared.notsecret" from "al...@domain.tld"
+    Then the message list has size 1
+
+  Scenario: Bob can not list message from mailbox that are not shared to him
+    When "b...@domain.tld" asks for message list in delegated mailbox 
"shared.secret" from "al...@domain.tld"
+    Then the message list has size 0

http://git-wip-us.apache.org/repos/asf/james-project/blob/f48f0c22/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryGetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryGetMailboxesMethodTest.java
 
b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryGetMailboxesMethodTest.java
deleted file mode 100644
index 799b467..0000000
--- 
a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryGetMailboxesMethodTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.jmap.memory.cucumber;
-
-import org.junit.runner.RunWith;
-
-import cucumber.api.CucumberOptions;
-import cucumber.api.junit.Cucumber;
-
-@RunWith(Cucumber.class)
-@CucumberOptions(features="classpath:cucumber/GetMailboxes.feature",
-                glue={"org.apache.james.jmap.methods.integration", 
"org.apache.james.jmap.memory.cucumber"},
-                strict = true)
-public class MemoryGetMailboxesMethodTest {
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/f48f0c22/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryKeywordsConsistencyOnDelegationMailboxTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryKeywordsConsistencyOnDelegationMailboxTest.java
 
b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryKeywordsConsistencyOnDelegationMailboxTest.java
deleted file mode 100644
index 2dc8e74..0000000
--- 
a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryKeywordsConsistencyOnDelegationMailboxTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.jmap.memory.cucumber;
-
-import org.junit.runner.RunWith;
-
-import cucumber.api.CucumberOptions;
-import cucumber.api.junit.Cucumber;
-
-@RunWith(Cucumber.class)
-@CucumberOptions(features="classpath:cucumber/KeywordsConsistencyOnDelegationMailbox.feature",
-    glue={"org.apache.james.jmap.methods.integration", 
"org.apache.james.jmap.memory.cucumber"},
-    strict = true)
-public class MemoryKeywordsConsistencyOnDelegationMailboxTest {
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/f48f0c22/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySharingParentMailboxWithAndWithoutChildrenTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySharingParentMailboxWithAndWithoutChildrenTest.java
 
b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySharingParentMailboxWithAndWithoutChildrenTest.java
deleted file mode 100644
index 312d4fd..0000000
--- 
a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySharingParentMailboxWithAndWithoutChildrenTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.jmap.memory.cucumber;
-
-import org.junit.runner.RunWith;
-
-import cucumber.api.CucumberOptions;
-import cucumber.api.junit.Cucumber;
-
-@RunWith(Cucumber.class)
-@CucumberOptions(features="classpath:cucumber/SharingParentMailboxWithAndWithoutChildren.feature",
-    glue={"org.apache.james.jmap.methods.integration", 
"org.apache.james.jmap.memory.cucumber"},
-    strict = true)
-public class MemorySharingParentMailboxWithAndWithoutChildrenTest {
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/f48f0c22/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySharingTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySharingTest.java
 
b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySharingTest.java
new file mode 100644
index 0000000..cd54d34
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySharingTest.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.jmap.memory.cucumber;
+
+import cucumber.api.CucumberOptions;
+import cucumber.api.junit.Cucumber;
+import org.junit.runner.RunWith;
+
+@RunWith(Cucumber.class)
+@CucumberOptions(features= {
+    
"classpath:cucumber/sharing/SharingParentMailboxWithAndWithoutChildren.feature",
+    "classpath:cucumber/sharing/SharingChildrenWithoutSharingParent.feature",
+    "classpath:cucumber/sharing/GetMessageAndSharing.feature",
+    "classpath:cucumber/sharing/SharingMailboxWithOtherDomain.feature",
+    "classpath:cucumber/sharing/MailboxCreationAndSharing.feature",
+    "classpath:cucumber/sharing/MailboxDeletionAndSharing.feature",
+    "classpath:cucumber/sharing/SetMessagesOnSharedMailbox.feature",
+    "classpath:cucumber/sharing/DownloadAndSharing.feature",
+    
"classpath:cucumber/sharing/KeywordsConsistencyOnDelegationMailbox.feature",
+    "classpath:cucumber/sharing/GetMessageListAndSharing.feature",
+    "classpath:cucumber/sharing/MoveMessageAndSharing.feature",
+    "classpath:cucumber/sharing/MoveMailboxAndSharing.feature",
+    "classpath:cucumber/sharing/SetFlagAndSharing.feature",
+    "classpath:cucumber/sharing/RenamingMailboxAndSharing.feature",
+    "classpath:cucumber/sharing/CopyAndSharing.feature" },
+    glue= { "org.apache.james.jmap.methods.integration", 
"org.apache.james.jmap.memory.cucumber" },
+    tags = {"~@Ignore"},
+    strict = true)
+public class MemorySharingTest {
+}


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