Skip to content

Commit

Permalink
MAILBOX-312 Silent some Eclipse warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Ouazana authored and mbaechler committed Oct 18, 2017
1 parent 7f0d94f commit 6d4e32c
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 26 deletions.
Expand Up @@ -657,7 +657,7 @@ public void searchForMessageShouldNotReturnMessagesFromMyDelegatedMailboxesICanN
MailboxId delegatedMailboxId = mailboxManager.createMailbox(delegatedMailboxPath, sessionFromDelegater).get(); MailboxId delegatedMailboxId = mailboxManager.createMailbox(delegatedMailboxPath, sessionFromDelegater).get();
MessageManager delegatedMessageManager = mailboxManager.getMailbox(delegatedMailboxId, sessionFromDelegater); MessageManager delegatedMessageManager = mailboxManager.getMailbox(delegatedMailboxId, sessionFromDelegater);


MessageId messageId = delegatedMessageManager.appendMessage( delegatedMessageManager.appendMessage(
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()),
new Date(), new Date(),
sessionFromDelegater, sessionFromDelegater,
Expand Down Expand Up @@ -692,7 +692,7 @@ public void searchForMessageShouldOnlySearchInMailboxICanRead() throws MailboxEx
MailboxId otherMailboxId = mailboxManager.createMailbox(otherMailboxPath, sessionFromDelegater).get(); MailboxId otherMailboxId = mailboxManager.createMailbox(otherMailboxPath, sessionFromDelegater).get();
MessageManager otherMailboxManager = mailboxManager.getMailbox(otherMailboxId, sessionFromDelegater); MessageManager otherMailboxManager = mailboxManager.getMailbox(otherMailboxId, sessionFromDelegater);


MessageId messageId = otherMailboxManager.appendMessage( otherMailboxManager.appendMessage(
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()),
new Date(), new Date(),
sessionFromDelegater, sessionFromDelegater,
Expand All @@ -719,7 +719,7 @@ public void searchForMessageShouldIgnoreMailboxThatICanNotRead() throws MailboxE
MailboxId otherMailboxId = mailboxManager.createMailbox(otherMailboxPath, sessionFromDelegater).get(); MailboxId otherMailboxId = mailboxManager.createMailbox(otherMailboxPath, sessionFromDelegater).get();
MessageManager otherMessageManager = mailboxManager.getMailbox(otherMailboxId, sessionFromDelegater); MessageManager otherMessageManager = mailboxManager.getMailbox(otherMailboxId, sessionFromDelegater);


MessageId messageId = otherMessageManager.appendMessage( otherMessageManager.appendMessage(
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()),
new Date(), new Date(),
sessionFromDelegater, sessionFromDelegater,
Expand All @@ -746,7 +746,7 @@ public void searchForMessageShouldCorrectlyExcludeMailbox() throws MailboxExcept
MailboxId otherMailboxId = mailboxManager.createMailbox(otherMailboxPath, session).get(); MailboxId otherMailboxId = mailboxManager.createMailbox(otherMailboxPath, session).get();
MessageManager otherMessageManager = mailboxManager.getMailbox(otherMailboxId, session); MessageManager otherMessageManager = mailboxManager.getMailbox(otherMailboxId, session);


MessageId messageId = otherMessageManager.appendMessage( otherMessageManager.appendMessage(
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()),
new Date(), new Date(),
session, session,
Expand All @@ -773,7 +773,7 @@ public void searchForMessageShouldPriorizeExclusionFromInclusion() throws Mailbo
MailboxId otherMailboxId = mailboxManager.createMailbox(otherMailboxPath, session).get(); MailboxId otherMailboxId = mailboxManager.createMailbox(otherMailboxPath, session).get();
MessageManager otherMessageManager = mailboxManager.getMailbox(otherMailboxId, session); MessageManager otherMessageManager = mailboxManager.getMailbox(otherMailboxId, session);


MessageId messageId = otherMessageManager.appendMessage( otherMessageManager.appendMessage(
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()),
new Date(), new Date(),
session, session,
Expand Down
Expand Up @@ -41,14 +41,14 @@
/** /**
* Provide an initialized Mailbox environment where we can run managers tests * Provide an initialized Mailbox environment where we can run managers tests
*/ */
public class ManagerTestResources { public class ManagerTestResources<T extends MailboxManager> {


public static final String USER = "user@domain.org"; public static final String USER = "user@domain.org";
public static final String USER_PASS = "pass"; public static final String USER_PASS = "pass";
public static final String OTHER_USER = "otherUser@domain.org"; public static final String OTHER_USER = "otherUser@domain.org";
public static final String OTHER_USER_PASS = "otherPass"; public static final String OTHER_USER_PASS = "otherPass";


private MailboxManager mailboxManager; private T mailboxManager;


private MailboxPath inbox; private MailboxPath inbox;
private MessageManager messageManager; private MessageManager messageManager;
Expand All @@ -61,9 +61,9 @@ public class ManagerTestResources {
private GroupMembershipResolver groupMembershipResolver; private GroupMembershipResolver groupMembershipResolver;
private QuotaRootResolver quotaRootResolver; private QuotaRootResolver quotaRootResolver;


private IntegrationResources integrationResources; private IntegrationResources<T> integrationResources;


public ManagerTestResources(IntegrationResources integrationResources) throws Exception { public ManagerTestResources(IntegrationResources<T> integrationResources) throws Exception {
this.integrationResources = integrationResources; this.integrationResources = integrationResources;
maxQuotaManager = integrationResources.createMaxQuotaManager(); maxQuotaManager = integrationResources.createMaxQuotaManager();
groupMembershipResolver = integrationResources.createGroupMembershipResolver(); groupMembershipResolver = integrationResources.createGroupMembershipResolver();
Expand Down Expand Up @@ -121,7 +121,7 @@ public MailboxSession getSession() {
return session; return session;
} }


public IntegrationResources getIntegrationResources() { public IntegrationResources<T> getIntegrationResources() {
return integrationResources; return integrationResources;
} }


Expand Down
Expand Up @@ -41,9 +41,9 @@
* Tests are performed with sufficient rights to ensure all underlying functions behave well. * Tests are performed with sufficient rights to ensure all underlying functions behave well.
* Quota are adjusted and we check that exceptions are well thrown. * Quota are adjusted and we check that exceptions are well thrown.
*/ */
public abstract class QuotaMessageManagerTest { public abstract class QuotaMessageManagerTest<T extends MailboxManager> {


private ManagerTestResources resources; private ManagerTestResources<T> resources;


private MessageManager messageManager; private MessageManager messageManager;
private MailboxManager mailboxManager; private MailboxManager mailboxManager;
Expand All @@ -54,7 +54,7 @@ public abstract class QuotaMessageManagerTest {
private MailboxPath inbox; private MailboxPath inbox;
private MailboxPath subFolder; private MailboxPath subFolder;


protected abstract ManagerTestResources createResources() throws Exception; protected abstract ManagerTestResources<T> createResources() throws Exception;


@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
Expand Down
Expand Up @@ -39,7 +39,6 @@
import org.apache.james.mailbox.model.MailboxId; import org.apache.james.mailbox.model.MailboxId;
import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mailbox.model.MessageId; import org.apache.james.mailbox.model.MessageId;
import org.apache.james.mailbox.model.MultimailboxesSearchQuery;
import org.apache.james.mailbox.model.SearchQuery; import org.apache.james.mailbox.model.SearchQuery;
import org.apache.james.mailbox.model.SearchQuery.AddressType; import org.apache.james.mailbox.model.SearchQuery.AddressType;
import org.apache.james.mailbox.model.SearchQuery.DateResolution; import org.apache.james.mailbox.model.SearchQuery.DateResolution;
Expand Down
Expand Up @@ -20,18 +20,19 @@


import org.apache.james.mailbox.manager.ManagerTestResources; import org.apache.james.mailbox.manager.ManagerTestResources;
import org.apache.james.mailbox.manager.QuotaMessageManagerTest; import org.apache.james.mailbox.manager.QuotaMessageManagerTest;
import org.apache.james.mailbox.store.StoreMailboxManager;


/** /**
* Test for quota support upon basic MailboxMessage manager operation. * Test for quota support upon basic MailboxMessage manager operation.
* *
* Tests are performed with sufficient rights to ensure all underlying functions behave well. * Tests are performed with sufficient rights to ensure all underlying functions behave well.
* Quota are adjusted and we check that exceptions are well thrown. * Quota are adjusted and we check that exceptions are well thrown.
*/ */
public class InMemoryQuotaMailboxMessageManagerTest extends QuotaMessageManagerTest { public class InMemoryQuotaMailboxMessageManagerTest extends QuotaMessageManagerTest<StoreMailboxManager> {


@Override @Override
protected ManagerTestResources createResources() throws Exception { protected ManagerTestResources<StoreMailboxManager> createResources() throws Exception {
return new ManagerTestResources(new InMemoryIntegrationResources()); return new ManagerTestResources<StoreMailboxManager>(new InMemoryIntegrationResources());
} }


} }
Expand Up @@ -22,7 +22,6 @@
import java.util.EnumSet; import java.util.EnumSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.SortedSet; import java.util.SortedSet;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.stream.Stream; import java.util.stream.Stream;
Expand Down
Expand Up @@ -40,10 +40,8 @@
import org.apache.james.mailbox.model.MessageId; import org.apache.james.mailbox.model.MessageId;
import org.apache.james.mailbox.model.MessageId.Factory; import org.apache.james.mailbox.model.MessageId.Factory;
import org.apache.james.mailbox.model.TestId; import org.apache.james.mailbox.model.TestId;
import org.apache.james.mailbox.model.search.MailboxNameExpression;
import org.apache.james.mailbox.model.search.MailboxQuery; import org.apache.james.mailbox.model.search.MailboxQuery;
import org.apache.james.mailbox.model.search.PrefixedRegex; import org.apache.james.mailbox.model.search.PrefixedRegex;
import org.apache.james.mailbox.model.search.PrefixedWildcard;
import org.apache.james.mailbox.store.mail.MailboxMapper; import org.apache.james.mailbox.store.mail.MailboxMapper;
import org.apache.james.mailbox.store.mail.model.Mailbox; import org.apache.james.mailbox.store.mail.model.Mailbox;
import org.apache.james.mailbox.store.mail.model.impl.MessageParser; import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
Expand Down
Expand Up @@ -37,11 +37,8 @@
import org.apache.james.mailbox.MessageManager; import org.apache.james.mailbox.MessageManager;
import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.exception.MailboxException;
import org.apache.james.mailbox.model.ComposedMessageId; import org.apache.james.mailbox.model.ComposedMessageId;
import org.apache.james.mailbox.model.MailboxACL;
import org.apache.james.mailbox.model.MailboxId;
import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mailbox.model.MessageId; import org.apache.james.mailbox.model.MessageId;
import org.apache.james.mailbox.model.MultimailboxesSearchQuery;
import org.apache.james.mailbox.model.SearchQuery; import org.apache.james.mailbox.model.SearchQuery;
import org.apache.james.mailbox.model.SearchQuery.AddressType; import org.apache.james.mailbox.model.SearchQuery.AddressType;
import org.apache.james.mailbox.model.SearchQuery.DateResolution; import org.apache.james.mailbox.model.SearchQuery.DateResolution;
Expand Down
Expand Up @@ -38,7 +38,6 @@
import org.apache.james.mailbox.exception.MailboxNotFoundException; import org.apache.james.mailbox.exception.MailboxNotFoundException;
import org.apache.james.mailbox.exception.UnsupportedRightException; import org.apache.james.mailbox.exception.UnsupportedRightException;
import org.apache.james.mailbox.model.MailboxACL; import org.apache.james.mailbox.model.MailboxACL;
import org.apache.james.mailbox.model.MailboxACL.EditMode;
import org.apache.james.mailbox.model.MailboxACL.EntryKey; import org.apache.james.mailbox.model.MailboxACL.EntryKey;
import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.metrics.api.MetricFactory; import org.apache.james.metrics.api.MetricFactory;
Expand Down
Expand Up @@ -33,6 +33,7 @@
import org.apache.james.mailbox.model.MessageRange; import org.apache.james.mailbox.model.MessageRange;
import org.apache.james.mailbox.model.MessageResult; import org.apache.james.mailbox.model.MessageResult;
import org.apache.james.mailbox.model.MessageResultIterator; import org.apache.james.mailbox.model.MessageResultIterator;
import org.apache.james.mailbox.store.StoreMailboxManager;
import org.apache.mailet.base.test.MimeMessageBuilder; import org.apache.mailet.base.test.MimeMessageBuilder;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
Expand Down Expand Up @@ -65,7 +66,7 @@ public void setUp() throws Exception {


integrationResources = new InMemoryIntegrationResources(); integrationResources = new InMemoryIntegrationResources();
integrationResources.init(); integrationResources.init();
mailboxManager = new ManagerTestResources(integrationResources).getMailboxManager(); mailboxManager = new ManagerTestResources<StoreMailboxManager>(integrationResources).getMailboxManager();
testee = new MailboxAppender(mailboxManager); testee = new MailboxAppender(mailboxManager);


session = mailboxManager.createSystemSession("TEST"); session = mailboxManager.createSystemSession("TEST");
Expand Down
Expand Up @@ -38,7 +38,6 @@
import org.apache.james.mailbox.model.MessageId; import org.apache.james.mailbox.model.MessageId;
import org.apache.james.mailbox.model.MessageResult; import org.apache.james.mailbox.model.MessageResult;
import org.apache.james.metrics.api.MetricFactory; import org.apache.james.metrics.api.MetricFactory;
import org.apache.james.metrics.api.TimeMetric;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;


Expand Down
Expand Up @@ -33,6 +33,7 @@ public enum Type {
Delegated("Delegated"), Delegated("Delegated"),
Personal("Personal"); Personal("Personal");


@SuppressWarnings("unused")
private final String type; private final String type;


Type(String type) { Type(String type) {
Expand Down

0 comments on commit 6d4e32c

Please sign in to comment.