You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ma...@apache.org on 2017/09/29 07:21:46 UTC
[08/31] james-project git commit: MAILBOX-307 Add MailboxMapper tests
for ACL storage
MAILBOX-307 Add MailboxMapper tests for ACL storage
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/d87584e5
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/d87584e5
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/d87584e5
Branch: refs/heads/master
Commit: d87584e522b26b98b12cdbac7694ef30c3663129
Parents: 3b247fd
Author: benwa <bt...@linagora.com>
Authored: Mon Sep 25 11:42:23 2017 +0700
Committer: Matthieu Baechler <ma...@apache.org>
Committed: Fri Sep 29 09:20:40 2017 +0200
----------------------------------------------------------------------
.../mail/CassandraMailboxMapperAclTest.java | 79 ++++++
.../inmemory/mail/InMemoryMailboxMapper.java | 2 +-
.../inmemory/mail/InMemoryMapperProvider.java | 3 +-
.../mail/MemoryMailboxMapperAclTest.java | 37 +++
.../store/mail/model/impl/SimpleMailbox.java | 1 +
.../store/mail/model/MailboxMapperACLTest.java | 256 +++++++++++++++++++
.../store/mail/model/MapperProvider.java | 3 +-
7 files changed, 378 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87584e5/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapperAclTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapperAclTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapperAclTest.java
new file mode 100644
index 0000000..9490386
--- /dev/null
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapperAclTest.java
@@ -0,0 +1,79 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.cassandra.mail;
+
+import org.apache.james.backends.cassandra.CassandraCluster;
+import org.apache.james.backends.cassandra.DockerCassandraRule;
+import org.apache.james.backends.cassandra.init.CassandraModuleComposite;
+import org.apache.james.mailbox.cassandra.modules.CassandraAclModule;
+import org.apache.james.mailbox.cassandra.modules.CassandraAnnotationModule;
+import org.apache.james.mailbox.cassandra.modules.CassandraApplicableFlagsModule;
+import org.apache.james.mailbox.cassandra.modules.CassandraAttachmentModule;
+import org.apache.james.mailbox.cassandra.modules.CassandraBlobModule;
+import org.apache.james.mailbox.cassandra.modules.CassandraDeletedMessageModule;
+import org.apache.james.mailbox.cassandra.modules.CassandraFirstUnseenModule;
+import org.apache.james.mailbox.cassandra.modules.CassandraMailboxCounterModule;
+import org.apache.james.mailbox.cassandra.modules.CassandraMailboxModule;
+import org.apache.james.mailbox.cassandra.modules.CassandraMailboxRecentsModule;
+import org.apache.james.mailbox.cassandra.modules.CassandraMessageModule;
+import org.apache.james.mailbox.cassandra.modules.CassandraModSeqModule;
+import org.apache.james.mailbox.cassandra.modules.CassandraUidModule;
+import org.apache.james.mailbox.store.mail.model.MailboxMapperACLTest;
+import org.apache.james.mailbox.store.mail.model.MapperProvider;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
+
+public class CassandraMailboxMapperAclTest extends MailboxMapperACLTest {
+
+ @ClassRule public static DockerCassandraRule cassandraServer = new DockerCassandraRule();
+
+ private CassandraCluster cassandra;
+
+ @Before
+ public void setUp() throws Exception {
+ CassandraModuleComposite modules = new CassandraModuleComposite(
+ new CassandraAclModule(),
+ new CassandraMailboxModule(),
+ new CassandraMessageModule(),
+ new CassandraMailboxCounterModule(),
+ new CassandraMailboxRecentsModule(),
+ new CassandraModSeqModule(),
+ new CassandraUidModule(),
+ new CassandraAttachmentModule(),
+ new CassandraAnnotationModule(),
+ new CassandraFirstUnseenModule(),
+ new CassandraApplicableFlagsModule(),
+ new CassandraDeletedMessageModule(),
+ new CassandraBlobModule());
+ this.cassandra = CassandraCluster.create(modules, cassandraServer.getIp(), cassandraServer.getBindingPort());
+ super.setUp();
+ }
+
+ @After
+ public void tearDown() {
+ cassandra.close();
+ }
+
+ @Override
+ protected MapperProvider createMapperProvider() {
+ return new CassandraMapperProvider(cassandra);
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87584e5/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryMailboxMapper.java
----------------------------------------------------------------------
diff --git a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryMailboxMapper.java b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryMailboxMapper.java
index 2500e78..5d57d6c 100644
--- a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryMailboxMapper.java
+++ b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryMailboxMapper.java
@@ -156,6 +156,6 @@ public class InMemoryMailboxMapper implements MailboxMapper {
@Override
public void updateACL(Mailbox mailbox, MailboxACL.MailboxACLCommand mailboxACLCommand) throws MailboxException{
- mailbox.setACL(mailbox.getACL().apply(mailboxACLCommand));
+ mailboxesByPath.get(mailbox.generateAssociatedPath()).setACL(mailbox.getACL().apply(mailboxACLCommand));
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87584e5/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/InMemoryMapperProvider.java
----------------------------------------------------------------------
diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/InMemoryMapperProvider.java b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/InMemoryMapperProvider.java
index f9463fe..5bbf330 100644
--- a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/InMemoryMapperProvider.java
+++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/InMemoryMapperProvider.java
@@ -113,7 +113,8 @@ public class InMemoryMapperProvider implements MapperProvider {
Capabilities.MAILBOX,
Capabilities.ATTACHMENT,
Capabilities.ANNOTATION,
- Capabilities.MOVE);
+ Capabilities.MOVE,
+ Capabilities.ACL_STORAGE);
}
@Override
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87584e5/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/MemoryMailboxMapperAclTest.java
----------------------------------------------------------------------
diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/MemoryMailboxMapperAclTest.java b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/MemoryMailboxMapperAclTest.java
new file mode 100644
index 0000000..fcce880
--- /dev/null
+++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/MemoryMailboxMapperAclTest.java
@@ -0,0 +1,37 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.inmemory.mail;
+
+import org.apache.james.mailbox.store.mail.model.MailboxMapperACLTest;
+import org.apache.james.mailbox.store.mail.model.MapperProvider;
+import org.junit.Before;
+
+public class MemoryMailboxMapperAclTest extends MailboxMapperACLTest {
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Override
+ protected MapperProvider createMapperProvider() {
+ return new InMemoryMapperProvider();
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87584e5/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMailbox.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMailbox.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMailbox.java
index 23f4ad9..6727d8e 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMailbox.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMailbox.java
@@ -56,6 +56,7 @@ public class SimpleMailbox implements Mailbox {
this.user = mailbox.getUser();
this.name = mailbox.getName();
this.uidValidity = mailbox.getUidValidity();
+ this.acl = new SimpleMailboxACL(mailbox.getACL().getEntries());
}
/**
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87584e5/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MailboxMapperACLTest.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MailboxMapperACLTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MailboxMapperACLTest.java
new file mode 100644
index 0000000..fe5b593
--- /dev/null
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MailboxMapperACLTest.java
@@ -0,0 +1,256 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.store.mail.model;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.model.MailboxACL;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mailbox.model.SimpleMailboxACL;
+import org.apache.james.mailbox.store.mail.MailboxMapper;
+import org.apache.james.mailbox.store.mail.model.impl.SimpleMailbox;
+import org.junit.Assume;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import com.google.common.collect.ImmutableMap;
+
+public abstract class MailboxMapperACLTest {
+ private final static long UID_VALIDITY = 42;
+ public static final boolean POSITIVE = true;
+ public static final boolean NEGATIVE = !POSITIVE;
+
+ private MailboxPath benwaInboxPath;
+ private Mailbox benwaInboxMailbox;
+
+ @Rule
+ public ExpectedException expected = ExpectedException.none();
+ private MailboxMapper mailboxMapper;
+ private MapperProvider mapperProvider;
+
+ protected abstract MapperProvider createMapperProvider();
+
+ public void setUp() throws Exception {
+ this.mapperProvider = createMapperProvider();
+ Assume.assumeTrue(mapperProvider.getSupportedCapabilities().contains(MapperProvider.Capabilities.MAILBOX));
+ Assume.assumeTrue(mapperProvider.getSupportedCapabilities().contains(MapperProvider.Capabilities.ACL_STORAGE));
+
+ this.mailboxMapper = mapperProvider.createMailboxMapper();
+
+ benwaInboxPath = new MailboxPath("#private", "benwa", "INBOX");
+ benwaInboxMailbox = createMailbox(benwaInboxPath);
+ mailboxMapper.save(benwaInboxMailbox);
+ }
+
+ @Test
+ public void storedAclShouldBeEmptyByDefault() throws MailboxException {
+ assertThat(
+ mailboxMapper.findMailboxById(benwaInboxMailbox.getMailboxId())
+ .getACL()
+ .getEntries())
+ .isEmpty();
+ }
+
+ @Test
+ public void updateAclShouldSaveAclWhenReplace() throws MailboxException {
+ SimpleMailboxACL.SimpleMailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE);
+ SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew");
+ mailboxMapper.updateACL(benwaInboxMailbox,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key,
+ MailboxACL.EditMode.REPLACE,
+ rights));
+
+ assertThat(
+ mailboxMapper.findMailboxById(benwaInboxMailbox.getMailboxId())
+ .getACL()
+ .getEntries())
+ .hasSize(1)
+ .containsEntry(key, rights);
+ }
+
+ @Test
+ public void updateAclShouldOverrightStoredAclWhenReplace() throws MailboxException {
+ SimpleMailboxACL.SimpleMailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE);
+ SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew");
+ SimpleMailboxACL.Rfc4314Rights newRights = new SimpleMailboxACL.Rfc4314Rights("skate");
+ mailboxMapper.updateACL(benwaInboxMailbox,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key,
+ MailboxACL.EditMode.REPLACE,
+ rights));
+ mailboxMapper.updateACL(benwaInboxMailbox,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key,
+ MailboxACL.EditMode.REPLACE,
+ newRights));
+
+ assertThat(
+ mailboxMapper.findMailboxById(benwaInboxMailbox.getMailboxId())
+ .getACL()
+ .getEntries())
+ .hasSize(1)
+ .containsEntry(key, newRights);
+ }
+
+ @Test
+ public void updateAclShouldTreatNegativeAndPositiveRightSeparately() throws MailboxException {
+ SimpleMailboxACL.SimpleMailboxACLEntryKey key1 = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE);
+ SimpleMailboxACL.SimpleMailboxACLEntryKey key2 = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, POSITIVE);
+ SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew");
+ SimpleMailboxACL.Rfc4314Rights newRights = new SimpleMailboxACL.Rfc4314Rights("skate");
+ mailboxMapper.updateACL(benwaInboxMailbox,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key1,
+ MailboxACL.EditMode.REPLACE,
+ rights));
+ mailboxMapper.updateACL(benwaInboxMailbox,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key2,
+ MailboxACL.EditMode.REPLACE,
+ newRights));
+
+ assertThat(
+ mailboxMapper.findMailboxById(benwaInboxMailbox.getMailboxId())
+ .getACL()
+ .getEntries())
+ .hasSize(2)
+ .containsEntry(key1, rights)
+ .containsEntry(key2, newRights);
+ }
+
+ @Test
+ public void updateAclShouldTreatNameTypesRightSeparately() throws MailboxException {
+ SimpleMailboxACL.SimpleMailboxACLEntryKey key1 = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE);
+ SimpleMailboxACL.SimpleMailboxACLEntryKey key2 = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.group, NEGATIVE);
+ SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew");
+ SimpleMailboxACL.Rfc4314Rights newRights = new SimpleMailboxACL.Rfc4314Rights("skate");
+ mailboxMapper.updateACL(benwaInboxMailbox,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key1,
+ MailboxACL.EditMode.REPLACE,
+ rights));
+ mailboxMapper.updateACL(benwaInboxMailbox,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key2,
+ MailboxACL.EditMode.REPLACE,
+ newRights));
+
+ assertThat(
+ mailboxMapper.findMailboxById(benwaInboxMailbox.getMailboxId())
+ .getACL()
+ .getEntries())
+ .hasSize(2)
+ .containsEntry(key1, rights)
+ .containsEntry(key2, newRights);
+ }
+
+ @Test
+ public void updateAclShouldCleanAclEntryWhenEmptyReplace() throws MailboxException {
+ SimpleMailboxACL.SimpleMailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE);
+ SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew");
+ SimpleMailboxACL.Rfc4314Rights newRights = new SimpleMailboxACL.Rfc4314Rights("");
+ mailboxMapper.updateACL(benwaInboxMailbox,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key,
+ MailboxACL.EditMode.REPLACE,
+ rights));
+ mailboxMapper.updateACL(benwaInboxMailbox,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key,
+ MailboxACL.EditMode.REPLACE,
+ newRights));
+
+ assertThat(
+ mailboxMapper.findMailboxById(benwaInboxMailbox.getMailboxId())
+ .getACL()
+ .getEntries())
+ .isEmpty();
+ }
+
+ @Test
+ public void updateAclShouldCombineStoredAclWhenAdd() throws MailboxException {
+ SimpleMailboxACL.SimpleMailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE);
+ SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew");
+ SimpleMailboxACL.Rfc4314Rights newRights = new SimpleMailboxACL.Rfc4314Rights("skate");
+ SimpleMailboxACL.Rfc4314Rights bothRights = new SimpleMailboxACL.Rfc4314Rights("asewkt");
+ mailboxMapper.updateACL(benwaInboxMailbox,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key,
+ MailboxACL.EditMode.REPLACE,
+ rights));
+ mailboxMapper.updateACL(benwaInboxMailbox,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key,
+ MailboxACL.EditMode.ADD,
+ newRights));
+
+ assertThat(
+ mailboxMapper.findMailboxById(benwaInboxMailbox.getMailboxId())
+ .getACL()
+ .getEntries())
+ .hasSize(1)
+ .containsEntry(key, bothRights);
+ }
+
+ @Test
+ public void removeAclShouldRemoveSomeStoredAclWhenAdd() throws MailboxException {
+ SimpleMailboxACL.SimpleMailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE);
+ SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew");
+ SimpleMailboxACL.Rfc4314Rights removedRights = new SimpleMailboxACL.Rfc4314Rights("se");
+ SimpleMailboxACL.Rfc4314Rights finalRights = new SimpleMailboxACL.Rfc4314Rights("aw");
+ mailboxMapper.updateACL(benwaInboxMailbox,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key,
+ MailboxACL.EditMode.REPLACE,
+ rights));
+ mailboxMapper.updateACL(benwaInboxMailbox,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key,
+ MailboxACL.EditMode.REMOVE,
+ removedRights));
+
+ assertThat(
+ mailboxMapper.findMailboxById(benwaInboxMailbox.getMailboxId())
+ .getACL()
+ .getEntries())
+ .hasSize(1)
+ .containsEntry(key, finalRights);
+ }
+
+ @Test
+ public void removeAclShouldNotFailWhenRemovingNonExistingRight() throws MailboxException {
+ SimpleMailboxACL.SimpleMailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE);
+ SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew");
+ SimpleMailboxACL.Rfc4314Rights removedRights = new SimpleMailboxACL.Rfc4314Rights("sel");
+ SimpleMailboxACL.Rfc4314Rights finalRights = new SimpleMailboxACL.Rfc4314Rights("aw");
+ mailboxMapper.updateACL(benwaInboxMailbox,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key,
+ MailboxACL.EditMode.REPLACE,
+ rights));
+ mailboxMapper.updateACL(benwaInboxMailbox,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key,
+ MailboxACL.EditMode.REMOVE,
+ removedRights));
+
+ assertThat(
+ mailboxMapper.findMailboxById(benwaInboxMailbox.getMailboxId())
+ .getACL()
+ .getEntries())
+ .hasSize(1)
+ .containsEntry(key, finalRights);
+ }
+
+ private SimpleMailbox createMailbox(MailboxPath mailboxPath) {
+ SimpleMailbox mailbox = new SimpleMailbox(mailboxPath, UID_VALIDITY);
+ mailbox.setMailboxId(mapperProvider.generateId());
+ return mailbox;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87584e5/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MapperProvider.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MapperProvider.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MapperProvider.java
index cea5d59..1b7deec 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MapperProvider.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MapperProvider.java
@@ -40,7 +40,8 @@ public interface MapperProvider {
MOVE,
UNIQUE_MESSAGE_ID,
THREAD_SAFE_FLAGS_UPDATE,
- INCREMENTAL_APPLICABLE_FLAGS
+ INCREMENTAL_APPLICABLE_FLAGS,
+ ACL_STORAGE
}
List<Capabilities> getSupportedCapabilities();
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org