http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java b/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java index f15a71b..1cb71f3 100644 --- a/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java +++ b/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java @@ -44,7 +44,6 @@ import org.apache.james.mailbox.elasticsearch.query.QueryConverter; import org.apache.james.mailbox.elasticsearch.search.ElasticSearchSearcher; import org.apache.james.mailbox.elasticsearch.utils.TestingClientProvider; import org.apache.james.mailbox.exception.MailboxException; -import org.apache.james.mailbox.inmemory.InMemoryId; import org.apache.james.mailbox.inmemory.InMemoryMailboxSessionMapperFactory; import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.mailbox.store.MockAuthenticator; @@ -67,7 +66,7 @@ public class ElasticSearchHostSystem extends JamesImapHostSystem { private EmbeddedElasticSearch embeddedElasticSearch; private Path tempDirectory; - private StoreMailboxManager<InMemoryId> mailboxManager; + private StoreMailboxManager mailboxManager; private MockAuthenticator userManager; public boolean addUser(String user, String password) throws Exception { @@ -102,16 +101,16 @@ public class ElasticSearchHostSystem extends JamesImapHostSystem { userManager = new MockAuthenticator(); InMemoryMailboxSessionMapperFactory factory = new InMemoryMailboxSessionMapperFactory(); - ElasticSearchListeningMessageSearchIndex<InMemoryId> searchIndex = new ElasticSearchListeningMessageSearchIndex<>( + ElasticSearchListeningMessageSearchIndex searchIndex = new ElasticSearchListeningMessageSearchIndex( factory, new ElasticSearchIndexer(client, new DeleteByQueryPerformer(client, Executors.newSingleThreadExecutor())), - new ElasticSearchSearcher<>(client, new QueryConverter(new CriterionConverter())), + new ElasticSearchSearcher(client, new QueryConverter(new CriterionConverter())), new MessageToElasticSearchJson(new DefaultTextExtractor())); MailboxACLResolver aclResolver = new UnionMailboxACLResolver(); GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver(); - mailboxManager = new StoreMailboxManager<>(factory, userManager, aclResolver, groupMembershipResolver); + mailboxManager = new StoreMailboxManager(factory, userManager, aclResolver, groupMembershipResolver); mailboxManager.setMessageSearchIndex(searchIndex); try {
http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryEventAsynchronousHostSystem.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryEventAsynchronousHostSystem.java b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryEventAsynchronousHostSystem.java index 22650d3..c855e65 100644 --- a/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryEventAsynchronousHostSystem.java +++ b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryEventAsynchronousHostSystem.java @@ -28,7 +28,6 @@ import org.apache.james.mailbox.acl.MailboxACLResolver; import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver; import org.apache.james.mailbox.acl.UnionMailboxACLResolver; import org.apache.james.mailbox.exception.MailboxException; -import org.apache.james.mailbox.inmemory.InMemoryId; import org.apache.james.mailbox.inmemory.InMemoryMailboxSessionMapperFactory; import org.apache.james.mailbox.inmemory.quota.InMemoryCurrentQuotaManager; import org.apache.james.mailbox.inmemory.quota.InMemoryPerUserMaxQuotaManager; @@ -52,7 +51,7 @@ public class InMemoryEventAsynchronousHostSystem extends JamesImapHostSystem { private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT); - private StoreMailboxManager<InMemoryId> mailboxManager; + private StoreMailboxManager mailboxManager; private MockAuthenticator userManager; public static JamesImapHostSystem build() throws Exception { @@ -79,7 +78,7 @@ public class InMemoryEventAsynchronousHostSystem extends JamesImapHostSystem { MailboxACLResolver aclResolver = new UnionMailboxACLResolver(); GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver(); - mailboxManager = new StoreMailboxManager<InMemoryId>(factory, userManager, aclResolver, groupMembershipResolver); + mailboxManager = new StoreMailboxManager(factory, userManager, aclResolver, groupMembershipResolver); QuotaRootResolver quotaRootResolver = new DefaultQuotaRootResolver(factory); InMemoryPerUserMaxQuotaManager perUserMaxQuotaManager = new InMemoryPerUserMaxQuotaManager(); @@ -87,7 +86,7 @@ public class InMemoryEventAsynchronousHostSystem extends JamesImapHostSystem { perUserMaxQuotaManager.setDefaultMaxStorage(5L * 1024L * 1024L * 1024L); InMemoryCurrentQuotaManager currentQuotaManager = new InMemoryCurrentQuotaManager( - new CurrentQuotaCalculator<InMemoryId>(factory, quotaRootResolver), + new CurrentQuotaCalculator(factory, quotaRootResolver), mailboxManager); StoreQuotaManager quotaManager = new StoreQuotaManager(); http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java index 63f20d1..87ef8a5 100644 --- a/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java +++ b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java @@ -28,7 +28,6 @@ import org.apache.james.mailbox.acl.MailboxACLResolver; import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver; import org.apache.james.mailbox.acl.UnionMailboxACLResolver; import org.apache.james.mailbox.exception.MailboxException; -import org.apache.james.mailbox.inmemory.InMemoryId; import org.apache.james.mailbox.inmemory.InMemoryMailboxManager; import org.apache.james.mailbox.inmemory.InMemoryMailboxSessionMapperFactory; import org.apache.james.mailbox.inmemory.quota.InMemoryCurrentQuotaManager; @@ -89,7 +88,7 @@ public class InMemoryHostSystem extends JamesImapHostSystem { perUserMaxQuotaManager.setDefaultMaxStorage(5L * 1024L * 1024L * 1024L); InMemoryCurrentQuotaManager currentQuotaManager = new InMemoryCurrentQuotaManager( - new CurrentQuotaCalculator<InMemoryId>(mailboxManager.getMapperFactory(), quotaRootResolver), + new CurrentQuotaCalculator(mailboxManager.getMapperFactory(), quotaRootResolver), mailboxManager); StoreQuotaManager quotaManager = new StoreQuotaManager(); http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java b/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java index 45a4c67..99c52b0 100644 --- a/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java +++ b/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java @@ -30,7 +30,6 @@ import org.apache.james.mailbox.acl.MailboxACLResolver; import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver; import org.apache.james.mailbox.acl.UnionMailboxACLResolver; import org.apache.james.mailbox.exception.MailboxException; -import org.apache.james.mailbox.maildir.MaildirId; import org.apache.james.mailbox.maildir.MaildirMailboxSessionMapperFactory; import org.apache.james.mailbox.maildir.MaildirStore; import org.apache.james.mailbox.model.MailboxPath; @@ -51,7 +50,7 @@ public class MaildirHostSystem extends JamesImapHostSystem { private static final String MAILDIR_HOME = "target/Maildir"; private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(); - private final StoreMailboxManager<MaildirId> mailboxManager; + private final StoreMailboxManager mailboxManager; private final MockAuthenticator userManager; private final MaildirMailboxSessionMapperFactory mailboxSessionMapperFactory; @@ -69,7 +68,7 @@ public class MaildirHostSystem extends JamesImapHostSystem { MailboxACLResolver aclResolver = new UnionMailboxACLResolver(); GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver(); - mailboxManager = new StoreMailboxManager<MaildirId>(mailboxSessionMapperFactory, userManager, locker, aclResolver, groupMembershipResolver); + mailboxManager = new StoreMailboxManager(mailboxSessionMapperFactory, userManager, locker, aclResolver, groupMembershipResolver); mailboxManager.init(); final ImapProcessor defaultImapProcessorFactory = http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java index 7cd0040..4949765 100644 --- a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java +++ b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java @@ -25,18 +25,16 @@ import org.apache.james.CassandraJamesServerMain; import org.apache.james.GuiceJamesServer; import org.apache.james.backends.cassandra.EmbeddedCassandra; import org.apache.james.dnsservice.api.DNSService; -import org.apache.james.mailbox.cassandra.CassandraId; import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch; import org.apache.james.modules.CassandraJmapServerModule; -import org.apache.james.mpt.smtp.SmtpHostSystem; import org.apache.james.mpt.monitor.SystemLoggingMonitor; import org.apache.james.mpt.session.ExternalSessionFactory; +import org.apache.james.mpt.smtp.SmtpHostSystem; import org.apache.james.mpt.smtp.dns.InMemoryDNSService; import org.junit.rules.TemporaryFolder; import com.google.common.base.Preconditions; import com.google.common.base.Splitter; -import com.google.inject.TypeLiteral; public class CassandraJamesSmtpHostSystem extends ExternalSessionFactory implements SmtpHostSystem { @@ -44,7 +42,7 @@ public class CassandraJamesSmtpHostSystem extends ExternalSessionFactory impleme private EmbeddedCassandra embeddedCassandra; private EmbeddedElasticSearch embeddedElasticSearch; - private GuiceJamesServer<CassandraId> jamesServer; + private GuiceJamesServer jamesServer; private InMemoryDNSService inMemoryDNSService; @@ -106,8 +104,8 @@ public class CassandraJamesSmtpHostSystem extends ExternalSessionFactory impleme return inMemoryDNSService; } - protected GuiceJamesServer<CassandraId> createJamesServer() { - return new GuiceJamesServer<>(new TypeLiteral<CassandraId>(){}) + protected GuiceJamesServer createJamesServer() { + return new GuiceJamesServer() .combineWith(CassandraJamesServerMain.cassandraServerModule) .overrideWith(new CassandraJmapServerModule(folder::getRoot, embeddedElasticSearch, embeddedCassandra), (binder) -> binder.bind(DNSService.class).toInstance(inMemoryDNSService)); http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java index 4b7d1cd..766b902 100644 --- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java +++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java @@ -19,7 +19,6 @@ package org.apache.james; -import org.apache.james.mailbox.cassandra.CassandraId; import org.apache.james.modules.data.CassandraDomainListModule; import org.apache.james.modules.data.CassandraJmapModule; import org.apache.james.modules.data.CassandraRecipientRewriteTableModule; @@ -33,12 +32,10 @@ import org.apache.james.modules.server.JMXServerModule; import org.apache.james.modules.server.QuotaModule; import com.google.inject.Module; -import com.google.inject.TypeLiteral; import com.google.inject.util.Modules; public class CassandraJamesServerMain { - public static final TypeLiteral<CassandraId> cassandraId = new TypeLiteral<CassandraId>(){}; public static final Module cassandraServerModule = Modules.combine( new CassandraUsersRepositoryModule(), new CassandraDomainListModule(), @@ -49,12 +46,11 @@ public class CassandraJamesServerMain { new CassandraSessionModule(), new ElasticSearchMailboxModule(), new QuotaModule(), - new ActiveMQQueueModule<>(cassandraId)); + new ActiveMQQueueModule()); public static void main(String[] args) throws Exception { - GuiceJamesServer<CassandraId> server = - new GuiceJamesServer<>(cassandraId) + GuiceJamesServer server = new GuiceJamesServer() .combineWith(cassandraServerModule, new JMXServerModule()); server.start(); } http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java index 883aad7..6bbba65 100644 --- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java +++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java @@ -25,7 +25,6 @@ import org.apache.james.backends.cassandra.components.CassandraModule; import org.apache.james.mailbox.MailboxManager; import org.apache.james.mailbox.MailboxPathLocker; import org.apache.james.mailbox.SubscriptionManager; -import org.apache.james.mailbox.cassandra.CassandraId; import org.apache.james.mailbox.cassandra.CassandraMailboxManager; import org.apache.james.mailbox.cassandra.CassandraMailboxSessionMapperFactory; import org.apache.james.mailbox.cassandra.CassandraSubscriptionManager; @@ -39,14 +38,12 @@ import org.apache.james.mailbox.store.mail.MailboxMapperFactory; import org.apache.james.mailbox.store.mail.MessageMapperFactory; import org.apache.james.mailbox.store.mail.ModSeqProvider; import org.apache.james.mailbox.store.mail.UidProvider; -import org.apache.james.mailbox.store.mail.model.MailboxId; import org.apache.james.modules.Names; import org.apache.james.utils.MailboxManagerDefinition; import com.google.inject.AbstractModule; import com.google.inject.Inject; import com.google.inject.Provides; -import com.google.inject.TypeLiteral; import com.google.inject.multibindings.Multibinder; import com.google.inject.name.Named; @@ -54,13 +51,11 @@ public class CassandraMailboxModule extends AbstractModule { @Override protected void configure() { - bind(new TypeLiteral<MessageMapperFactory<CassandraId>>(){}).to(CassandraMailboxSessionMapperFactory.class); - bind(new TypeLiteral<MailboxMapperFactory<CassandraId>>(){}).to(CassandraMailboxSessionMapperFactory.class); + bind(MessageMapperFactory.class).to(CassandraMailboxSessionMapperFactory.class); bind(MailboxMapperFactory.class).to(CassandraMailboxSessionMapperFactory.class); - bind(new TypeLiteral<MailboxSessionMapperFactory<CassandraId>>(){}).to(CassandraMailboxSessionMapperFactory.class); - bind(new TypeLiteral<MailboxSessionMapperFactory<? extends MailboxId>>(){}).to(CassandraMailboxSessionMapperFactory.class); - bind(new TypeLiteral<ModSeqProvider<CassandraId>>(){}).to(new TypeLiteral<CassandraModSeqProvider>(){}); - bind(new TypeLiteral<UidProvider<CassandraId>>(){}).to(new TypeLiteral<CassandraUidProvider>(){}); + bind(MailboxSessionMapperFactory.class).to(CassandraMailboxSessionMapperFactory.class); + bind(ModSeqProvider.class).to(CassandraModSeqProvider.class); + bind(UidProvider.class).to(CassandraUidProvider.class); bind(SubscriptionManager.class).to(CassandraSubscriptionManager.class); bind(MailboxSessionMapperFactory.class).to(CassandraMailboxSessionMapperFactory.class); http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java index d3c5368..53f1666 100644 --- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java +++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java @@ -27,7 +27,6 @@ import javax.inject.Singleton; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.james.filesystem.api.FileSystem; -import org.apache.james.mailbox.cassandra.CassandraId; import org.apache.james.mailbox.elasticsearch.ClientProvider; import org.apache.james.mailbox.elasticsearch.ClientProviderImpl; import org.apache.james.mailbox.elasticsearch.IndexCreationFactory; @@ -41,7 +40,6 @@ import org.elasticsearch.client.transport.NoNodeAvailableException; import com.google.inject.AbstractModule; import com.google.inject.Provides; -import com.google.inject.TypeLiteral; import com.nurkiewicz.asyncretry.AsyncRetryExecutor; public class ElasticSearchMailboxModule extends AbstractModule { @@ -51,7 +49,7 @@ public class ElasticSearchMailboxModule extends AbstractModule { @Override protected void configure() { - bind(new TypeLiteral<MessageSearchIndex<CassandraId>>(){}).to(new TypeLiteral<ElasticSearchListeningMessageSearchIndex<CassandraId>>() {}); + bind(MessageSearchIndex.class).to(ElasticSearchListeningMessageSearchIndex.class); bind(TextExtractor.class).to(TikaTextExtractor.class); } http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java index dcb6b08..6407262 100644 --- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java +++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java @@ -22,7 +22,6 @@ package org.apache.james; import org.apache.james.backends.cassandra.CassandraCluster; import org.apache.james.backends.cassandra.components.CassandraModule; import org.apache.james.jmap.methods.GetMessageListMethod; -import org.apache.james.mailbox.cassandra.CassandraId; import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch; import org.apache.james.modules.TestElasticSearchModule; import org.apache.james.modules.TestFilesystemModule; @@ -35,9 +34,8 @@ import com.datastax.driver.core.Session; import com.google.inject.AbstractModule; import com.google.inject.Provides; import com.google.inject.Singleton; -import com.google.inject.TypeLiteral; -public class CassandraJamesServerTest extends AbstractJamesServerTest<CassandraId> { +public class CassandraJamesServerTest extends AbstractJamesServerTest { private TemporaryFolder temporaryFolder = new TemporaryFolder(); private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder); @@ -46,8 +44,8 @@ public class CassandraJamesServerTest extends AbstractJamesServerTest<CassandraI public RuleChain chain = RuleChain.outerRule(temporaryFolder).around(embeddedElasticSearch); @Override - protected GuiceJamesServer<CassandraId> createJamesServer() { - return new GuiceJamesServer<>(new TypeLiteral<CassandraId>(){}) + protected GuiceJamesServer createJamesServer() { + return new GuiceJamesServer() .combineWith(CassandraJamesServerMain.cassandraServerModule) .overrideWith(new TestElasticSearchModule(embeddedElasticSearch), new TestFilesystemModule(temporaryFolder), http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java index b39f3af..5451747 100644 --- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java +++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java @@ -25,7 +25,6 @@ import org.apache.james.backends.cassandra.CassandraCluster; import org.apache.james.backends.cassandra.components.CassandraModule; import org.apache.james.jmap.methods.GetMessageListMethod; import org.apache.james.mailbox.MailboxManager; -import org.apache.james.mailbox.cassandra.CassandraId; import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch; import org.apache.james.modules.TestElasticSearchModule; import org.apache.james.modules.TestFilesystemModule; @@ -43,7 +42,7 @@ import com.google.inject.Singleton; public class JamesCapabilitiesServerTest { - private GuiceJamesServer<CassandraId> server; + private GuiceJamesServer server; private TemporaryFolder temporaryFolder = new TemporaryFolder(); private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder); @@ -75,8 +74,8 @@ public class JamesCapabilitiesServerTest { server.stop(); } - private GuiceJamesServer<CassandraId> createCassandraJamesServer(final MailboxManager mailboxManager) { - return new GuiceJamesServer<>(CassandraJamesServerMain.cassandraId) + private GuiceJamesServer createCassandraJamesServer(final MailboxManager mailboxManager) { + return new GuiceJamesServer() .combineWith(CassandraJamesServerMain.cassandraServerModule) .overrideWith(new TestElasticSearchModule(embeddedElasticSearch), new TestFilesystemModule(temporaryFolder), http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java ---------------------------------------------------------------------- diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java b/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java index 6071f61..c7c3121 100644 --- a/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java +++ b/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java @@ -23,13 +23,11 @@ import java.util.Arrays; import javax.annotation.PreDestroy; import org.apache.james.jmap.JMAPServer; -import org.apache.james.mailbox.store.mail.model.MailboxId; import org.apache.james.modules.CommonServicesModule; import org.apache.james.modules.MailetProcessingModule; import org.apache.james.modules.ProtocolsModule; import org.apache.james.utils.ConfigurationsPerformer; import org.apache.james.utils.ExtendedServerProbe; -import org.apache.james.utils.GuiceGenericType; import org.apache.james.utils.GuiceServerProbe; import org.apache.onami.lifecycle.core.Stager; @@ -41,42 +39,38 @@ import com.google.inject.Module; import com.google.inject.TypeLiteral; import com.google.inject.util.Modules; -public class GuiceJamesServer<Id extends MailboxId> { +public class GuiceJamesServer { - private final TypeLiteral<Id> type; private final Module module; - private final GuiceGenericType<Id> guiceGenericType; private Stager<PreDestroy> preDestroy; - private GuiceServerProbe<Id> serverProbe; + private GuiceServerProbe serverProbe; private int jmapPort; - public GuiceJamesServer(TypeLiteral<Id> type) { - this(type, Modules.combine( - new CommonServicesModule<>(type), - new ProtocolsModule<>(type), + public GuiceJamesServer() { + this(Modules.combine( + new CommonServicesModule(), + new ProtocolsModule(), new MailetProcessingModule())); } - private GuiceJamesServer(TypeLiteral<Id> type, Module module) { - this.type = type; - this.guiceGenericType = new GuiceGenericType<>(type); + private GuiceJamesServer(Module module) { this.module = module; } - public GuiceJamesServer<Id> combineWith(Module... modules) { - return new GuiceJamesServer<>(type, Modules.combine(Iterables.concat(Arrays.asList(module), Arrays.asList(modules)))); + public GuiceJamesServer combineWith(Module... modules) { + return new GuiceJamesServer(Modules.combine(Iterables.concat(Arrays.asList(module), Arrays.asList(modules)))); } - public GuiceJamesServer<Id> overrideWith(Module... overrides) { - return new GuiceJamesServer<>(type, Modules.override(module).with(overrides)); + public GuiceJamesServer overrideWith(Module... overrides) { + return new GuiceJamesServer(Modules.override(module).with(overrides)); } public void start() throws Exception { Injector injector = Guice.createInjector(module); injector.getInstance(ConfigurationsPerformer.class).initModules(); preDestroy = injector.getInstance(Key.get(new TypeLiteral<Stager<PreDestroy>>() {})); - serverProbe = injector.getInstance(Key.get(guiceGenericType.newGenericType(GuiceServerProbe.class))); + serverProbe = injector.getInstance(GuiceServerProbe.class); jmapPort = injector.getInstance(JMAPServer.class).getPort(); } @@ -84,7 +78,7 @@ public class GuiceJamesServer<Id extends MailboxId> { preDestroy.stage(); } - public ExtendedServerProbe<Id> serverProbe() { + public ExtendedServerProbe serverProbe() { return serverProbe; } http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java index ca33dd9..72d49fc 100644 --- a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java +++ b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java @@ -31,7 +31,6 @@ import org.apache.james.filesystem.api.FileSystem; import org.apache.james.jmap.methods.RequestHandler; import org.apache.james.lifecycle.api.Configurable; import org.apache.james.mailbox.MailboxManager; -import org.apache.james.mailbox.store.mail.model.MailboxId; import org.apache.james.utils.ConfigurationPerformer; import org.apache.james.utils.ConfigurationProvider; @@ -43,21 +42,15 @@ import com.google.inject.AbstractModule; import com.google.inject.Inject; import com.google.inject.Provides; import com.google.inject.Singleton; -import com.google.inject.TypeLiteral; import com.google.inject.multibindings.Multibinder; -public class JMAPModule<Id extends MailboxId> extends AbstractModule { +public class JMAPModule extends AbstractModule { private static final int DEFAULT_JMAP_PORT = 80; - private final TypeLiteral<Id> type; - - public JMAPModule(TypeLiteral<Id> type) { - this.type = type; - } @Override protected void configure() { install(new JMAPCommonModule()); - install(new MethodsModule<Id>(type)); + install(new MethodsModule()); bind(RequestHandler.class).in(Singleton.class); Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(MailetConfigurationPrecondition.class); Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(MoveCapabilityPrecondition.class); http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/MethodsModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/MethodsModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/MethodsModule.java index d1422ff..c8dc863 100644 --- a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/MethodsModule.java +++ b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/MethodsModule.java @@ -40,22 +40,13 @@ import org.apache.james.jmap.methods.SetMessagesMethod; import org.apache.james.jmap.methods.SetMessagesProcessor; import org.apache.james.jmap.methods.SetMessagesUpdateProcessor; import org.apache.james.jmap.methods.SetVacationResponseMethod; -import org.apache.james.mailbox.store.mail.model.MailboxId; -import org.apache.james.utils.GuiceGenericType; import com.google.inject.AbstractModule; import com.google.inject.Singleton; -import com.google.inject.TypeLiteral; import com.google.inject.multibindings.Multibinder; import com.google.inject.name.Names; -public class MethodsModule<Id extends MailboxId> extends AbstractModule { - - private final GuiceGenericType<Id> guiceGenericType; - - public MethodsModule(TypeLiteral<Id> type) { - this.guiceGenericType = new GuiceGenericType<>(type); - } +public class MethodsModule extends AbstractModule { @Override protected void configure() { @@ -66,25 +57,25 @@ public class MethodsModule<Id extends MailboxId> extends AbstractModule { bindConstant().annotatedWith(Names.named(GetMessageListMethod.MAXIMUM_LIMIT)).to(GetMessageListMethod.DEFAULT_MAXIMUM_LIMIT); Multibinder<Method> methods = Multibinder.newSetBinder(binder(), Method.class); - methods.addBinding().to(guiceGenericType.newGenericType(GetMailboxesMethod.class)); - methods.addBinding().to(guiceGenericType.newGenericType(GetMessageListMethod.class)); - methods.addBinding().to(guiceGenericType.newGenericType(GetMessagesMethod.class)); - methods.addBinding().to(guiceGenericType.newGenericType(SetMessagesMethod.class)); - methods.addBinding().to(guiceGenericType.newGenericType(SetMailboxesMethod.class)); - methods.addBinding().to(guiceGenericType.newGenericType(GetVacationResponseMethod.class)); - methods.addBinding().to(guiceGenericType.newGenericType(SetVacationResponseMethod.class)); + methods.addBinding().to(GetMailboxesMethod.class); + methods.addBinding().to(GetMessageListMethod.class); + methods.addBinding().to(GetMessagesMethod.class); + methods.addBinding().to(SetMessagesMethod.class); + methods.addBinding().to(SetMailboxesMethod.class); + methods.addBinding().to(GetVacationResponseMethod.class); + methods.addBinding().to(SetVacationResponseMethod.class); - Multibinder<SetMailboxesProcessor<Id>> setMailboxesProcessor = - Multibinder.newSetBinder(binder(), guiceGenericType.newGenericType(SetMailboxesProcessor.class)); - setMailboxesProcessor.addBinding().to(guiceGenericType.newGenericType(SetMailboxesCreationProcessor.class)); - setMailboxesProcessor.addBinding().to(guiceGenericType.newGenericType(SetMailboxesUpdateProcessor.class)); - setMailboxesProcessor.addBinding().to(guiceGenericType.newGenericType(SetMailboxesDestructionProcessor.class)); + Multibinder<SetMailboxesProcessor> setMailboxesProcessor = + Multibinder.newSetBinder(binder(), SetMailboxesProcessor.class); + setMailboxesProcessor.addBinding().to(SetMailboxesCreationProcessor.class); + setMailboxesProcessor.addBinding().to(SetMailboxesUpdateProcessor.class); + setMailboxesProcessor.addBinding().to(SetMailboxesDestructionProcessor.class); - Multibinder<SetMessagesProcessor<Id>> setMessagesProcessors = - Multibinder.newSetBinder(binder(), guiceGenericType.newGenericType(SetMessagesProcessor.class)); - setMessagesProcessors.addBinding().to(guiceGenericType.newGenericType(SetMessagesUpdateProcessor.class)); - setMessagesProcessors.addBinding().to(guiceGenericType.newGenericType(SetMessagesCreationProcessor.class)); - setMessagesProcessors.addBinding().to(guiceGenericType.newGenericType(SetMessagesDestructionProcessor.class)); + Multibinder<SetMessagesProcessor> setMessagesProcessors = + Multibinder.newSetBinder(binder(), SetMessagesProcessor.class); + setMessagesProcessors.addBinding().to(SetMessagesUpdateProcessor.class); + setMessagesProcessors.addBinding().to(SetMessagesCreationProcessor.class); + setMessagesProcessors.addBinding().to(SetMessagesDestructionProcessor.class); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java index ccf3822..02cb0c5 100644 --- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java +++ b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java @@ -29,27 +29,22 @@ import org.apache.james.core.JamesServerResourceLoader; import org.apache.james.core.filesystem.FileSystemImpl; import org.apache.james.filesystem.api.FileSystem; import org.apache.james.filesystem.api.JamesDirectoriesProvider; -import org.apache.james.mailbox.store.mail.model.MailboxId; import org.apache.james.modules.server.AsyncTasksExecutorModule; import org.apache.james.modules.server.ConfigurationProviderModule; import org.apache.james.modules.server.DNSServiceModule; import org.apache.james.utils.ConfigurationProvider; import org.apache.james.utils.FileConfigurationProvider; -import org.apache.james.utils.GuiceGenericType; import org.apache.james.utils.GuiceServerProbe; import org.apache.onami.lifecycle.jsr250.PreDestroyModule; import com.google.inject.AbstractModule; import com.google.inject.Provides; -import com.google.inject.TypeLiteral; -public class CommonServicesModule<Id extends MailboxId> extends AbstractModule { +public class CommonServicesModule extends AbstractModule { public static final String CONFIGURATION_PATH = "configurationPath"; - private final GuiceGenericType<Id> guiceGenericType; - public CommonServicesModule(TypeLiteral<Id> type) { - guiceGenericType = new GuiceGenericType<>(type); + public CommonServicesModule() { } @Override @@ -62,8 +57,7 @@ public class CommonServicesModule<Id extends MailboxId> extends AbstractModule { bind(FileSystem.class).to(FileSystemImpl.class); bind(ConfigurationProvider.class).to(FileConfigurationProvider.class); - TypeLiteral<GuiceServerProbe<Id>> serverProbe = guiceGenericType.newGenericType(GuiceServerProbe.class); - bind(serverProbe).in(Singleton.class); + bind(GuiceServerProbe.class).in(Singleton.class); } @Provides @Singleton @Named(CONFIGURATION_PATH) http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/guice-common/src/main/java/org/apache/james/modules/ProtocolsModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/ProtocolsModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/ProtocolsModule.java index c03575f..eca1926 100644 --- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/ProtocolsModule.java +++ b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/ProtocolsModule.java @@ -18,7 +18,6 @@ ****************************************************************/ package org.apache.james.modules; -import org.apache.james.mailbox.store.mail.model.MailboxId; import org.apache.james.modules.protocols.IMAPServerModule; import org.apache.james.modules.protocols.JMAPServerModule; import org.apache.james.modules.protocols.LMTPServerModule; @@ -28,19 +27,12 @@ import org.apache.james.modules.protocols.ProtocolHandlerModule; import org.apache.james.modules.protocols.SMTPServerModule; import com.google.inject.AbstractModule; -import com.google.inject.TypeLiteral; -public class ProtocolsModule<Id extends MailboxId> extends AbstractModule { - - private final TypeLiteral<Id> type; - - public ProtocolsModule(TypeLiteral<Id> type) { - this.type = type; - } +public class ProtocolsModule extends AbstractModule { @Override protected void configure() { - install(new JMAPServerModule<>(type)); + install(new JMAPServerModule()); install(new IMAPServerModule()); install(new ProtocolHandlerModule()); install(new POP3ServerModule()); http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/JMAPServerModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/JMAPServerModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/JMAPServerModule.java index 8b301bf..f317b21 100644 --- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/JMAPServerModule.java +++ b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/JMAPServerModule.java @@ -26,7 +26,6 @@ import org.apache.james.jmap.JMAPModule; import org.apache.james.jmap.JMAPServer; import org.apache.james.jmap.crypto.JamesSignatureHandler; import org.apache.james.lifecycle.api.Configurable; -import org.apache.james.mailbox.store.mail.model.MailboxId; import org.apache.james.utils.ConfigurationPerformer; import org.bouncycastle.jce.provider.BouncyCastleProvider; @@ -35,20 +34,13 @@ import com.google.common.collect.ImmutableList; import com.google.inject.AbstractModule; import com.google.inject.Inject; import com.google.inject.Singleton; -import com.google.inject.TypeLiteral; import com.google.inject.multibindings.Multibinder; -public class JMAPServerModule<Id extends MailboxId> extends AbstractModule { - - private final TypeLiteral<Id> type; - - public JMAPServerModule(TypeLiteral<Id> type) { - this.type = type; - } +public class JMAPServerModule extends AbstractModule { @Override protected void configure() { - install(new JMAPModule<Id>(type)); + install(new JMAPModule()); Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JMAPModuleConfigurationPerformer.class); } http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/ActiveMQQueueModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/ActiveMQQueueModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/ActiveMQQueueModule.java index 336dc55..e6edbbc 100644 --- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/ActiveMQQueueModule.java +++ b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/ActiveMQQueueModule.java @@ -22,33 +22,23 @@ package org.apache.james.modules.server; import javax.jms.ConnectionFactory; import org.apache.james.jmap.send.PostDequeueDecoratorFactory; -import org.apache.james.mailbox.store.mail.model.MailboxId; import org.apache.james.queue.activemq.ActiveMQMailQueueFactory; import org.apache.james.queue.api.MailQueueFactory; import org.apache.james.queue.api.MailQueueItemDecoratorFactory; -import org.apache.james.utils.GuiceGenericType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.inject.AbstractModule; import com.google.inject.Provides; import com.google.inject.Singleton; -import com.google.inject.TypeLiteral; -public class ActiveMQQueueModule<Id extends MailboxId> extends AbstractModule { +public class ActiveMQQueueModule extends AbstractModule { private static final Logger LOGGER = LoggerFactory.getLogger(ActiveMQQueueModule.class); - private final GuiceGenericType<Id> guiceGenericType; - - public ActiveMQQueueModule(TypeLiteral<Id> type) { - guiceGenericType = new GuiceGenericType<>(type); - } @Override protected void configure() { - bind(MailQueueItemDecoratorFactory.class) - .to(guiceGenericType.newGenericType(PostDequeueDecoratorFactory.class)) - .in(Singleton.class); + bind(MailQueueItemDecoratorFactory.class).to(PostDequeueDecoratorFactory.class).in(Singleton.class); } @Provides http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ExtendedServerProbe.java ---------------------------------------------------------------------- diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ExtendedServerProbe.java b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ExtendedServerProbe.java index dc066c8..f1da266 100644 --- a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ExtendedServerProbe.java +++ b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ExtendedServerProbe.java @@ -31,14 +31,13 @@ import org.apache.james.mailbox.exception.BadCredentialsException; import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.mailbox.store.mail.model.Mailbox; -import org.apache.james.mailbox.store.mail.model.MailboxId; -public interface ExtendedServerProbe<Id extends MailboxId> extends ServerProbe { +public interface ExtendedServerProbe extends ServerProbe { void appendMessage(String username, MailboxPath mailboxPath, InputStream message, Date internalDate, boolean isRecent, Flags flags) throws BadCredentialsException, MailboxException; - Mailbox<Id> getMailbox(String namespace, String user, String name); + Mailbox getMailbox(String namespace, String user, String name); void modifyVacation(AccountId accountId, Vacation vacation); http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceGenericType.java ---------------------------------------------------------------------- diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceGenericType.java b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceGenericType.java deleted file mode 100644 index 2487810..0000000 --- a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceGenericType.java +++ /dev/null @@ -1,40 +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.utils; - -import java.lang.reflect.Type; - -import com.google.inject.TypeLiteral; -import com.google.inject.util.Types; - -public class GuiceGenericType<T> { - - private final TypeLiteral<T> type; - - public GuiceGenericType(TypeLiteral<T> type) { - this.type = type; - } - - @SuppressWarnings("unchecked") - public <V> TypeLiteral<V> newGenericType(Class<?> base) { - Type newType = Types.newParameterizedType(base, type.getType()); - return (TypeLiteral<V>) TypeLiteral.get(newType); - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceServerProbe.java ---------------------------------------------------------------------- diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceServerProbe.java b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceServerProbe.java index fb33a94..06ce5df 100644 --- a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceServerProbe.java +++ b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceServerProbe.java @@ -47,7 +47,6 @@ import org.apache.james.mailbox.model.MailboxQuery; import org.apache.james.mailbox.store.mail.MailboxMapper; import org.apache.james.mailbox.store.mail.MailboxMapperFactory; import org.apache.james.mailbox.store.mail.model.Mailbox; -import org.apache.james.mailbox.store.mail.model.MailboxId; import org.apache.james.rrt.api.RecipientRewriteTable; import org.apache.james.rrt.lib.Mappings; import org.apache.james.sieverepository.api.SieveRepository; @@ -59,12 +58,12 @@ import com.google.common.base.Throwables; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; -public class GuiceServerProbe<Id extends MailboxId> implements ExtendedServerProbe<Id> { +public class GuiceServerProbe implements ExtendedServerProbe { private static final Logger LOGGER = LoggerFactory.getLogger(GuiceServerProbe.class); private final MailboxManager mailboxManager; - private final MailboxMapperFactory<Id> mailboxMapperFactory; + private final MailboxMapperFactory mailboxMapperFactory; private final DomainList domainList; private final UsersRepository usersRepository; private final SieveRepository sieveRepository; @@ -72,7 +71,7 @@ public class GuiceServerProbe<Id extends MailboxId> implements ExtendedServerPro private final VacationRepository vacationRepository; @Inject - private GuiceServerProbe(MailboxManager mailboxManager, MailboxMapperFactory<Id> mailboxMapperFactory, + private GuiceServerProbe(MailboxManager mailboxManager, MailboxMapperFactory mailboxMapperFactory, DomainList domainList, UsersRepository usersRepository, SieveRepository sieveRepository, RecipientRewriteTable recipientRewriteTable, VacationRepository vacationRepository) { this.mailboxManager = mailboxManager; @@ -183,11 +182,11 @@ public class GuiceServerProbe<Id extends MailboxId> implements ExtendedServerPro } @Override - public Mailbox<Id> getMailbox(String namespace, String user, String name) { + public Mailbox getMailbox(String namespace, String user, String name) { MailboxSession mailboxSession = null; try { mailboxSession = mailboxManager.createSystemSession(user, LOGGER); - MailboxMapper<Id> mailboxMapper = mailboxMapperFactory.getMailboxMapper(mailboxSession); + MailboxMapper mailboxMapper = mailboxMapperFactory.getMailboxMapper(mailboxSession); return mailboxMapper.findMailboxByPath(new MailboxPath(namespace, user, name)); } catch (MailboxException e) { throw Throwables.propagate(e); http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJamesServerTest.java ---------------------------------------------------------------------- diff --git a/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJamesServerTest.java b/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJamesServerTest.java index cdb408c..b179cf2 100644 --- a/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJamesServerTest.java +++ b/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJamesServerTest.java @@ -29,7 +29,6 @@ import java.nio.ByteBuffer; import java.nio.channels.SocketChannel; import java.nio.charset.Charset; -import org.apache.james.mailbox.store.mail.model.MailboxId; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -38,7 +37,7 @@ import com.google.common.base.Charsets; import com.jayway.restassured.RestAssured; import com.jayway.restassured.http.ContentType; -public abstract class AbstractJamesServerTest<Id extends MailboxId> { +public abstract class AbstractJamesServerTest { private static final int IMAP_PORT = 1143; // You need to be root (superuser) to bind to ports under 1024. private static final int IMAP_PORT_SSL = 1993; @@ -46,7 +45,7 @@ public abstract class AbstractJamesServerTest<Id extends MailboxId> { private static final int SMTP_PORT = 1025; private static final int LMTP_PORT = 1024; - private GuiceJamesServer<Id> server; + private GuiceJamesServer server; private SocketChannel socketChannel; @Before @@ -59,7 +58,7 @@ public abstract class AbstractJamesServerTest<Id extends MailboxId> { RestAssured.config = newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8)); } - protected abstract GuiceJamesServer<Id> createJamesServer(); + protected abstract GuiceJamesServer createJamesServer(); @After public void tearDown() throws Exception { http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java ---------------------------------------------------------------------- diff --git a/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java b/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java index 3d6fc04..4fc14d3 100644 --- a/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java +++ b/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java @@ -19,7 +19,6 @@ package org.apache.james; -import org.apache.james.mailbox.inmemory.InMemoryId; import org.apache.james.modules.data.MemoryDataJmapModule; import org.apache.james.modules.data.MemoryDataModule; import org.apache.james.modules.mailbox.MemoryMailboxModule; @@ -28,22 +27,19 @@ import org.apache.james.modules.server.MemoryMailQueueModule; import org.apache.james.modules.server.QuotaModule; import com.google.inject.Module; -import com.google.inject.TypeLiteral; import com.google.inject.util.Modules; public class MemoryJamesServerMain { - public static final TypeLiteral<InMemoryId> inMemoryId = new TypeLiteral<InMemoryId>(){}; - public static final Module inMemoryServerModule = Modules.combine( new MemoryDataModule(), new MemoryDataJmapModule(), new MemoryMailboxModule(), new QuotaModule(), - new MemoryMailQueueModule<>(inMemoryId)); + new MemoryMailQueueModule()); public static void main(String[] args) throws Exception { - new GuiceJamesServer<>(inMemoryId) + new GuiceJamesServer() .combineWith(inMemoryServerModule, new JMXServerModule()) .start(); } http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/mailbox/MemoryMailboxModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/mailbox/MemoryMailboxModule.java b/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/mailbox/MemoryMailboxModule.java index 85d6db9..90c9d38 100644 --- a/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/mailbox/MemoryMailboxModule.java +++ b/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/mailbox/MemoryMailboxModule.java @@ -30,7 +30,6 @@ import org.apache.james.mailbox.acl.MailboxACLResolver; import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver; import org.apache.james.mailbox.acl.UnionMailboxACLResolver; import org.apache.james.mailbox.exception.MailboxException; -import org.apache.james.mailbox.inmemory.InMemoryId; import org.apache.james.mailbox.inmemory.InMemoryMailboxManager; import org.apache.james.mailbox.inmemory.InMemoryMailboxSessionMapperFactory; import org.apache.james.mailbox.inmemory.mail.InMemoryModSeqProvider; @@ -44,7 +43,6 @@ import org.apache.james.mailbox.store.mail.MailboxMapperFactory; import org.apache.james.mailbox.store.mail.MessageMapperFactory; import org.apache.james.mailbox.store.mail.ModSeqProvider; import org.apache.james.mailbox.store.mail.UidProvider; -import org.apache.james.mailbox.store.mail.model.MailboxId; import org.apache.james.mailbox.store.search.MessageSearchIndex; import org.apache.james.mailbox.store.search.SimpleMessageSearchIndex; import org.apache.james.mailbox.store.user.SubscriptionMapperFactory; @@ -54,7 +52,6 @@ import org.apache.james.modules.Names; import com.google.inject.AbstractModule; import com.google.inject.Provides; import com.google.inject.Scopes; -import com.google.inject.TypeLiteral; import com.google.inject.name.Named; public class MemoryMailboxModule extends AbstractModule { @@ -62,13 +59,11 @@ public class MemoryMailboxModule extends AbstractModule { @Override protected void configure() { - bind(new TypeLiteral<MessageMapperFactory<InMemoryId>>(){}).to(InMemoryMailboxSessionMapperFactory.class); - bind(new TypeLiteral<MailboxMapperFactory<InMemoryId>>(){}).to(InMemoryMailboxSessionMapperFactory.class); + bind(MessageMapperFactory.class).to(InMemoryMailboxSessionMapperFactory.class); bind(MailboxMapperFactory.class).to(InMemoryMailboxSessionMapperFactory.class); - bind(new TypeLiteral<MailboxSessionMapperFactory<InMemoryId>>(){}).to(InMemoryMailboxSessionMapperFactory.class); - bind(new TypeLiteral<MailboxSessionMapperFactory<? extends MailboxId>>(){}).to(InMemoryMailboxSessionMapperFactory.class); - bind(new TypeLiteral<ModSeqProvider<InMemoryId>>(){}).to(new TypeLiteral<InMemoryModSeqProvider>(){}); - bind(new TypeLiteral<UidProvider<InMemoryId>>(){}).to(new TypeLiteral<InMemoryUidProvider>(){}); + bind(MailboxSessionMapperFactory.class).to(InMemoryMailboxSessionMapperFactory.class); + bind(ModSeqProvider.class).to(InMemoryModSeqProvider.class); + bind(UidProvider.class).to(InMemoryUidProvider.class); bind(SubscriptionManager.class).to(StoreSubscriptionManager.class); bind(SubscriptionMapperFactory.class).to(InMemoryMailboxSessionMapperFactory.class); @@ -79,12 +74,12 @@ public class MemoryMailboxModule extends AbstractModule { bind(MailboxACLResolver.class).to(UnionMailboxACLResolver.class); bind(GroupMembershipResolver.class).to(SimpleGroupMembershipResolver.class); - bind(new TypeLiteral<MessageSearchIndex<InMemoryId>>(){}).to(new TypeLiteral<SimpleMessageSearchIndex<InMemoryId>>() {}); + bind(MessageSearchIndex.class).to(SimpleMessageSearchIndex.class); bind(TextExtractor.class).to(TikaTextExtractor.class); bind(InMemoryMailboxSessionMapperFactory.class).in(Scopes.SINGLETON); - bind(new TypeLiteral<InMemoryModSeqProvider>(){}).in(Scopes.SINGLETON); - bind(new TypeLiteral<InMemoryUidProvider>(){}).in(Scopes.SINGLETON); + bind(InMemoryModSeqProvider.class).in(Scopes.SINGLETON); + bind(InMemoryUidProvider.class).in(Scopes.SINGLETON); bind(StoreSubscriptionManager.class).in(Scopes.SINGLETON); bind(JVMMailboxPathLocker.class).in(Scopes.SINGLETON); bind(UserRepositoryAuthenticator.class).in(Scopes.SINGLETON); http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/server/MemoryMailQueueModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/server/MemoryMailQueueModule.java b/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/server/MemoryMailQueueModule.java index c41f101..2698900 100644 --- a/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/server/MemoryMailQueueModule.java +++ b/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/server/MemoryMailQueueModule.java @@ -20,28 +20,17 @@ package org.apache.james.modules.server; import org.apache.james.jmap.send.PostDequeueDecoratorFactory; -import org.apache.james.mailbox.store.mail.model.MailboxId; import org.apache.james.queue.api.MailQueueFactory; import org.apache.james.queue.api.MailQueueItemDecoratorFactory; -import org.apache.james.utils.GuiceGenericType; import com.google.inject.AbstractModule; import com.google.inject.Singleton; -import com.google.inject.TypeLiteral; -public class MemoryMailQueueModule<Id extends MailboxId> extends AbstractModule { +public class MemoryMailQueueModule extends AbstractModule { - private final GuiceGenericType<Id> guiceGenericType; - - public MemoryMailQueueModule(TypeLiteral<Id> type) { - guiceGenericType = new GuiceGenericType<>(type); - } - @Override protected void configure() { bind(MailQueueFactory.class).to(MemoryMailQueueFactory.class); - bind(MailQueueItemDecoratorFactory.class) - .to(guiceGenericType.newGenericType(PostDequeueDecoratorFactory.class)) - .in(Singleton.class); + bind(MailQueueItemDecoratorFactory.class).to(PostDequeueDecoratorFactory.class).in(Singleton.class); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJamesServerTest.java ---------------------------------------------------------------------- diff --git a/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJamesServerTest.java b/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJamesServerTest.java index 2926711..0dd9f95 100644 --- a/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJamesServerTest.java +++ b/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJamesServerTest.java @@ -20,22 +20,19 @@ package org.apache.james; import org.apache.james.jmap.methods.GetMessageListMethod; -import org.apache.james.mailbox.inmemory.InMemoryId; import org.apache.james.modules.TestFilesystemModule; import org.apache.james.modules.TestJMAPServerModule; import org.junit.Rule; import org.junit.rules.TemporaryFolder; -import com.google.inject.TypeLiteral; - -public class MemoryJamesServerTest extends AbstractJamesServerTest<InMemoryId> { +public class MemoryJamesServerTest extends AbstractJamesServerTest { @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); @Override - protected GuiceJamesServer<InMemoryId> createJamesServer() { - return new GuiceJamesServer<>(new TypeLiteral<InMemoryId>(){}) + protected GuiceJamesServer createJamesServer() { + return new GuiceJamesServer() .combineWith(MemoryJamesServerMain.inMemoryServerModule) .overrideWith(new TestFilesystemModule(temporaryFolder), new TestJMAPServerModule(GetMessageListMethod.DEFAULT_MAXIMUM_LIMIT)); http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/container/mailbox-adapter/src/test/java/org/apache/james/adapter/mailbox/MailboxManagementTest.java ---------------------------------------------------------------------- diff --git a/server/container/mailbox-adapter/src/test/java/org/apache/james/adapter/mailbox/MailboxManagementTest.java b/server/container/mailbox-adapter/src/test/java/org/apache/james/adapter/mailbox/MailboxManagementTest.java index 88cadea..86a3976 100644 --- a/server/container/mailbox-adapter/src/test/java/org/apache/james/adapter/mailbox/MailboxManagementTest.java +++ b/server/container/mailbox-adapter/src/test/java/org/apache/james/adapter/mailbox/MailboxManagementTest.java @@ -24,7 +24,6 @@ import static org.assertj.core.api.Assertions.assertThat; import org.apache.james.mailbox.MailboxSession; import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver; import org.apache.james.mailbox.acl.UnionMailboxACLResolver; -import org.apache.james.mailbox.inmemory.InMemoryId; import org.apache.james.mailbox.inmemory.InMemoryMailboxSessionMapperFactory; import org.apache.james.mailbox.model.MailboxConstants; import org.apache.james.mailbox.model.MailboxPath; @@ -51,7 +50,7 @@ public class MailboxManagementTest { @Before public void setUp() throws Exception { inMemoryMapperFactory = new InMemoryMailboxSessionMapperFactory(); - StoreMailboxManager<InMemoryId> mailboxManager = new StoreMailboxManager<InMemoryId>( + StoreMailboxManager mailboxManager = new StoreMailboxManager( inMemoryMapperFactory, new MockAuthenticator(), new JVMMailboxPathLocker(), @@ -66,38 +65,36 @@ public class MailboxManagementTest { @Test public void deleteMailboxesShouldDeleteMailboxes() throws Exception { - inMemoryMapperFactory.createMailboxMapper(session).save(new SimpleMailbox<InMemoryId>(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name"), UID_VALIDITY)); + inMemoryMapperFactory.createMailboxMapper(session).save(new SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name"), UID_VALIDITY)); mailboxManagerManagement.deleteMailboxes(USER); assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).isEmpty(); } @Test public void deleteMailboxesShouldDeleteInbox() throws Exception { - inMemoryMapperFactory.createMailboxMapper(session).save(new SimpleMailbox<InMemoryId>(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "INBOX"), UID_VALIDITY)); + inMemoryMapperFactory.createMailboxMapper(session).save(new SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "INBOX"), UID_VALIDITY)); mailboxManagerManagement.deleteMailboxes(USER); assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).isEmpty(); } @Test public void deleteMailboxesShouldDeleteMailboxesChildren() throws Exception { - inMemoryMapperFactory.createMailboxMapper(session).save(new SimpleMailbox<InMemoryId>(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "INBOX.test"), UID_VALIDITY)); + inMemoryMapperFactory.createMailboxMapper(session).save(new SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "INBOX.test"), UID_VALIDITY)); mailboxManagerManagement.deleteMailboxes(USER); assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).isEmpty(); } - @SuppressWarnings("unchecked") @Test public void deleteMailboxesShouldNotDeleteMailboxesBelongingToNotPrivateNamespace() throws Exception { - Mailbox<InMemoryId> mailbox = new SimpleMailbox<InMemoryId>(new MailboxPath("#top", USER, "name"), UID_VALIDITY); + Mailbox mailbox = new SimpleMailbox(new MailboxPath("#top", USER, "name"), UID_VALIDITY); inMemoryMapperFactory.createMailboxMapper(session).save(mailbox); mailboxManagerManagement.deleteMailboxes(USER); assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).containsExactly(mailbox); } - @SuppressWarnings("unchecked") @Test public void deleteMailboxesShouldNotDeleteMailboxesBelongingToOtherUsers() throws Exception { - Mailbox<InMemoryId> mailbox = new SimpleMailbox<InMemoryId>(new MailboxPath(MailboxConstants.USER_NAMESPACE, "userbis", "name"), UID_VALIDITY); + Mailbox mailbox = new SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, "userbis", "name"), UID_VALIDITY); inMemoryMapperFactory.createMailboxMapper(session).save(mailbox); mailboxManagerManagement.deleteMailboxes(USER); assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).containsExactly(mailbox); @@ -105,7 +102,7 @@ public class MailboxManagementTest { @Test public void deleteMailboxesShouldDeleteMailboxesWithEmptyNames() throws Exception { - inMemoryMapperFactory.createMailboxMapper(session).save(new SimpleMailbox<InMemoryId>(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, ""), UID_VALIDITY)); + inMemoryMapperFactory.createMailboxMapper(session).save(new SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, ""), UID_VALIDITY)); mailboxManagerManagement.deleteMailboxes(USER); assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).isEmpty(); } @@ -122,9 +119,9 @@ public class MailboxManagementTest { @Test public void deleteMailboxesShouldDeleteMultipleMailboxes() throws Exception { - inMemoryMapperFactory.createMailboxMapper(session).save(new SimpleMailbox<InMemoryId>(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name"), UID_VALIDITY)); - inMemoryMapperFactory.createMailboxMapper(session).save(new SimpleMailbox<InMemoryId>(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "INBOX"), UID_VALIDITY)); - inMemoryMapperFactory.createMailboxMapper(session).save(new SimpleMailbox<InMemoryId>(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "INBOX.test"), UID_VALIDITY)); + inMemoryMapperFactory.createMailboxMapper(session).save(new SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name"), UID_VALIDITY)); + inMemoryMapperFactory.createMailboxMapper(session).save(new SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "INBOX"), UID_VALIDITY)); + inMemoryMapperFactory.createMailboxMapper(session).save(new SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "INBOX.test"), UID_VALIDITY)); mailboxManagerManagement.deleteMailboxes(USER); assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).isEmpty(); } @@ -136,11 +133,10 @@ public class MailboxManagementTest { assertThat(inMemoryMapperFactory.createMailboxMapper(session).findMailboxByPath(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name"))).isNotNull(); } - @SuppressWarnings("unchecked") @Test public void createMailboxShouldNotThrowIfMailboxAlreadyExist() throws Exception { MailboxPath path = new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name"); - Mailbox<InMemoryId> mailbox = new SimpleMailbox<InMemoryId>(path, UID_VALIDITY); + Mailbox mailbox = new SimpleMailbox(path, UID_VALIDITY); inMemoryMapperFactory.createMailboxMapper(session).save(mailbox); mailboxManagerManagement.createMailbox(MailboxConstants.USER_NAMESPACE, USER, "name"); assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).containsExactly(mailbox); @@ -178,12 +174,12 @@ public class MailboxManagementTest { @Test public void listMailboxesShouldReturnUserMailboxes() throws Exception { - Mailbox<InMemoryId> mailbox1 = new SimpleMailbox<InMemoryId>(new MailboxPath("#top", USER, "name1"), UID_VALIDITY); - Mailbox<InMemoryId> mailbox2 = new SimpleMailbox<InMemoryId>(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name2"), UID_VALIDITY); - Mailbox<InMemoryId> mailbox3 = new SimpleMailbox<InMemoryId>(new MailboxPath(MailboxConstants.USER_NAMESPACE, "other_user", "name3"), UID_VALIDITY); - Mailbox<InMemoryId> mailbox4 = new SimpleMailbox<InMemoryId>(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name4"), UID_VALIDITY); - Mailbox<InMemoryId> mailbox5 = new SimpleMailbox<InMemoryId>(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "INBOX"), UID_VALIDITY); - Mailbox<InMemoryId> mailbox6 = new SimpleMailbox<InMemoryId>(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "INBOX.toto"), UID_VALIDITY); + Mailbox mailbox1 = new SimpleMailbox(new MailboxPath("#top", USER, "name1"), UID_VALIDITY); + Mailbox mailbox2 = new SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name2"), UID_VALIDITY); + Mailbox mailbox3 = new SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, "other_user", "name3"), UID_VALIDITY); + Mailbox mailbox4 = new SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name4"), UID_VALIDITY); + Mailbox mailbox5 = new SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "INBOX"), UID_VALIDITY); + Mailbox mailbox6 = new SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "INBOX.toto"), UID_VALIDITY); inMemoryMapperFactory.createMailboxMapper(session).save(mailbox1); inMemoryMapperFactory.createMailboxMapper(session).save(mailbox2); inMemoryMapperFactory.createMailboxMapper(session).save(mailbox3); @@ -205,33 +201,30 @@ public class MailboxManagementTest { @Test public void deleteMailboxShouldDeleteGivenMailbox() throws Exception { - inMemoryMapperFactory.createMailboxMapper(session).save(new SimpleMailbox<InMemoryId>(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name"), UID_VALIDITY)); + inMemoryMapperFactory.createMailboxMapper(session).save(new SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name"), UID_VALIDITY)); mailboxManagerManagement.deleteMailbox(MailboxConstants.USER_NAMESPACE, USER, "name"); assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).isEmpty(); } - @SuppressWarnings("unchecked") @Test public void deleteMailboxShouldNotDeleteGivenMailboxIfWrongNamespace() throws Exception { - Mailbox<InMemoryId> mailbox = new SimpleMailbox<InMemoryId>(new MailboxPath("#top", USER, "name"), UID_VALIDITY); + Mailbox mailbox = new SimpleMailbox(new MailboxPath("#top", USER, "name"), UID_VALIDITY); inMemoryMapperFactory.createMailboxMapper(session).save(mailbox); mailboxManagerManagement.deleteMailbox(MailboxConstants.USER_NAMESPACE, USER, "name"); assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).containsOnly(mailbox); } - @SuppressWarnings("unchecked") @Test public void deleteMailboxShouldNotDeleteGivenMailboxIfWrongUser() throws Exception { - Mailbox<InMemoryId> mailbox = new SimpleMailbox<InMemoryId>(new MailboxPath(MailboxConstants.USER_NAMESPACE, "userbis", "name"), UID_VALIDITY); + Mailbox mailbox = new SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, "userbis", "name"), UID_VALIDITY); inMemoryMapperFactory.createMailboxMapper(session).save(mailbox); mailboxManagerManagement.deleteMailbox(MailboxConstants.USER_NAMESPACE, USER, "name"); assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).containsOnly(mailbox); } - @SuppressWarnings("unchecked") @Test public void deleteMailboxShouldNotDeleteGivenMailboxIfWrongName() throws Exception { - Mailbox<InMemoryId> mailbox = new SimpleMailbox<InMemoryId>(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "wrong_name"), UID_VALIDITY); + Mailbox mailbox = new SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "wrong_name"), UID_VALIDITY); inMemoryMapperFactory.createMailboxMapper(session).save(mailbox); mailboxManagerManagement.deleteMailbox(MailboxConstants.USER_NAMESPACE, USER, "name"); assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).containsOnly(mailbox); http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMailboxesMethodTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMailboxesMethodTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMailboxesMethodTest.java index de712bc..c3caa2c 100644 --- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMailboxesMethodTest.java +++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMailboxesMethodTest.java @@ -23,9 +23,8 @@ import org.apache.james.CassandraJamesServerMain; import org.apache.james.GuiceJamesServer; import org.apache.james.backends.cassandra.EmbeddedCassandra; import org.apache.james.jmap.methods.integration.GetMailboxesMethodTest; -import org.apache.james.modules.CassandraJmapServerModule; -import org.apache.james.mailbox.cassandra.CassandraId; import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch; +import org.apache.james.modules.CassandraJmapServerModule; import org.junit.Rule; import org.junit.rules.RuleChain; import org.junit.rules.TemporaryFolder; @@ -43,8 +42,8 @@ public class CassandraGetMailboxesMethodTest extends GetMailboxesMethodTest { .around(embeddedElasticSearch); @Override - protected GuiceJamesServer<CassandraId> createJmapServer() { - return new GuiceJamesServer<>(CassandraJamesServerMain.cassandraId) + protected GuiceJamesServer createJmapServer() { + return new GuiceJamesServer() .combineWith(CassandraJamesServerMain.cassandraServerModule) .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra)); } http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessageListMethodTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessageListMethodTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessageListMethodTest.java index 54ed007..efe5e37 100644 --- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessageListMethodTest.java +++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessageListMethodTest.java @@ -23,8 +23,8 @@ import org.apache.james.CassandraJamesServerMain; import org.apache.james.GuiceJamesServer; import org.apache.james.backends.cassandra.EmbeddedCassandra; import org.apache.james.jmap.methods.integration.GetMessageListMethodTest; -import org.apache.james.modules.CassandraJmapServerModule; import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch; +import org.apache.james.modules.CassandraJmapServerModule; import org.junit.Rule; import org.junit.rules.RuleChain; import org.junit.rules.TemporaryFolder; @@ -41,8 +41,8 @@ public class CassandraGetMessageListMethodTest extends GetMessageListMethodTest .around(embeddedElasticSearch); @Override - protected GuiceJamesServer<?> createJmapServer() { - return new GuiceJamesServer<>(CassandraJamesServerMain.cassandraId) + protected GuiceJamesServer createJmapServer() { + return new GuiceJamesServer() .combineWith(CassandraJamesServerMain.cassandraServerModule) .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra)); } http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessagesMethodTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessagesMethodTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessagesMethodTest.java index 04eb484..5c161b8 100644 --- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessagesMethodTest.java +++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessagesMethodTest.java @@ -23,8 +23,8 @@ import org.apache.james.CassandraJamesServerMain; import org.apache.james.GuiceJamesServer; import org.apache.james.backends.cassandra.EmbeddedCassandra; import org.apache.james.jmap.methods.integration.GetMessagesMethodTest; -import org.apache.james.modules.CassandraJmapServerModule; import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch; +import org.apache.james.modules.CassandraJmapServerModule; import org.junit.Rule; import org.junit.rules.RuleChain; import org.junit.rules.TemporaryFolder; @@ -41,8 +41,8 @@ public class CassandraGetMessagesMethodTest extends GetMessagesMethodTest { .around(embeddedElasticSearch); @Override - protected GuiceJamesServer<?> createJmapServer() { - return new GuiceJamesServer<>(CassandraJamesServerMain.cassandraId) + protected GuiceJamesServer createJmapServer() { + return new GuiceJamesServer() .combineWith(CassandraJamesServerMain.cassandraServerModule) .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra)); } http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetVacationResponseTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetVacationResponseTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetVacationResponseTest.java index 717e8aa..1421a2e 100644 --- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetVacationResponseTest.java +++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetVacationResponseTest.java @@ -23,8 +23,8 @@ import org.apache.james.CassandraJamesServerMain; import org.apache.james.GuiceJamesServer; import org.apache.james.backends.cassandra.EmbeddedCassandra; import org.apache.james.jmap.methods.integration.GetVacationResponseTest; -import org.apache.james.modules.CassandraJmapServerModule; import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch; +import org.apache.james.modules.CassandraJmapServerModule; import org.junit.Rule; import org.junit.rules.RuleChain; import org.junit.rules.TemporaryFolder; @@ -41,8 +41,8 @@ public class CassandraGetVacationResponseTest extends GetVacationResponseTest { .around(embeddedElasticSearch); @Override - protected GuiceJamesServer<?> createJmapServer() { - return new GuiceJamesServer<>(CassandraJamesServerMain.cassandraId) + protected GuiceJamesServer createJmapServer() { + return new GuiceJamesServer() .combineWith(CassandraJamesServerMain.cassandraServerModule) .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra)); } http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapAuthenticationTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapAuthenticationTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapAuthenticationTest.java index ae2cb1e..ebadae7 100644 --- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapAuthenticationTest.java +++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapAuthenticationTest.java @@ -23,9 +23,9 @@ import org.apache.james.GuiceJamesServer; import org.apache.james.backends.cassandra.EmbeddedCassandra; import org.apache.james.jmap.FixedDateZonedDateTimeProvider; import org.apache.james.jmap.JMAPAuthenticationTest; -import org.apache.james.modules.CassandraJmapServerModule; import org.apache.james.jmap.utils.ZonedDateTimeProvider; import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch; +import org.apache.james.modules.CassandraJmapServerModule; import org.junit.Rule; import org.junit.rules.RuleChain; import org.junit.rules.TemporaryFolder; @@ -42,8 +42,8 @@ public class CassandraJmapAuthenticationTest extends JMAPAuthenticationTest { .around(embeddedElasticSearch); @Override - protected GuiceJamesServer<?> createJmapServer(FixedDateZonedDateTimeProvider zonedDateTimeProvider) { - return new GuiceJamesServer<>(CassandraJamesServerMain.cassandraId) + protected GuiceJamesServer createJmapServer(FixedDateZonedDateTimeProvider zonedDateTimeProvider) { + return new GuiceJamesServer() .combineWith(CassandraJamesServerMain.cassandraServerModule) .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra), (binder) -> binder.bind(ZonedDateTimeProvider.class).toInstance(zonedDateTimeProvider)); http://git-wip-us.apache.org/repos/asf/james-project/blob/7015d946/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMailboxesMethodStepdefs.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMailboxesMethodStepdefs.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMailboxesMethodStepdefs.java index 1df517d..fe80ae9 100644 --- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMailboxesMethodStepdefs.java +++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMailboxesMethodStepdefs.java @@ -44,7 +44,7 @@ public class CassandraSetMailboxesMethodStepdefs { public void init() throws Exception { temporaryFolder.create(); embeddedElasticSearch.before(); - mainStepdefs.jmapServer = new GuiceJamesServer<>(CassandraJamesServerMain.cassandraId) + mainStepdefs.jmapServer = new GuiceJamesServer() .combineWith(CassandraJamesServerMain.cassandraServerModule) .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra)); mainStepdefs.awaitMethod = () -> embeddedElasticSearch.awaitForElasticSearch(); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
