@Test public void testSerializeNegativeGroup() throws UnsupportedRightException { assertThat(new EntryKey(GROUP_1, NameType.group, true).serialize()) .isEqualTo(String.valueOf(MailboxACL.DEFAULT_NEGATIVE_MARKER) + MailboxACL.DEFAULT_GROUP_MARKER + GROUP_1); }
@Test public void testSerializeUser() throws UnsupportedRightException { assertThat(new EntryKey(USER_1, NameType.user, false).serialize()) .isEqualTo(USER_1); }
@Test public void testSerializeGroup() throws UnsupportedRightException { assertThat(new EntryKey(GROUP_1, NameType.group, false).serialize()) .isEqualTo(MailboxACL.DEFAULT_GROUP_MARKER + GROUP_1); }
@Override protected void doEncode(ImapMessage acceptableMessage, ImapResponseComposer composer, ImapSession session) throws IOException { final ACLResponse aclResponse = (ACLResponse) acceptableMessage; final Map<EntryKey, Rfc4314Rights> entries = aclResponse.getAcl().getEntries(); composer.untagged(); composer.commandName(ImapConstants.ACL_RESPONSE_NAME); String mailboxName = aclResponse.getMailboxName(); composer.mailbox(mailboxName == null ? "" : mailboxName); if (entries != null) { for (Entry<EntryKey, Rfc4314Rights> entry : entries.entrySet()) { String identifier = entry.getKey().serialize(); composer.quote(identifier); String rights = entry.getValue().serialize(); composer.quote(rights == null ? "" : rights); } } composer.end(); }
public String toString() { return serialize(); } }
@Test public void testSerializeNegativeAuthenticated() throws UnsupportedRightException { assertThat(new EntryKey(SpecialName.authenticated.toString(), NameType.special, true).serialize()) .isEqualTo(MailboxACL.DEFAULT_NEGATIVE_MARKER + SpecialName.authenticated.toString()); } }
@Test public void testSerializeAuthenticated() throws UnsupportedRightException { assertThat(new EntryKey(SpecialName.authenticated.toString(), NameType.special, false).serialize()) .isEqualTo(SpecialName.authenticated.toString()); }
@Test public void testSerializeNegativeUser() throws UnsupportedRightException { assertThat(new EntryKey(USER_1, NameType.user, true).serialize()) .isEqualTo(MailboxACL.DEFAULT_NEGATIVE_MARKER + USER_1); }
@Test public void testSerializeNegativeAnybody() throws UnsupportedRightException { assertThat(new EntryKey(SpecialName.anybody.toString(), NameType.special, true).serialize()) .isEqualTo(MailboxACL.DEFAULT_NEGATIVE_MARKER + SpecialName.anybody.toString()); }
@Test public void testSerializeOwner() throws UnsupportedRightException { assertThat(new EntryKey(SpecialName.owner.toString(), NameType.special, false).serialize()) .isEqualTo(SpecialName.owner.toString()); }
@Test public void testSerializeAnybody() throws UnsupportedRightException { assertThat(new EntryKey(SpecialName.anybody.toString(), NameType.special, false).serialize()) .isEqualTo(SpecialName.anybody.toString()); }
@Test public void testSerializeNegativeOwner() throws UnsupportedRightException { assertThat(new EntryKey(SpecialName.owner.toString(), NameType.special, true).serialize()) .isEqualTo(MailboxACL.DEFAULT_NEGATIVE_MARKER + SpecialName.owner.toString()); }