You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2017/08/22 03:32:01 UTC
[6/9] james-project git commit: JAMES-2111 Remove Message V1 related
code
http://git-wip-us.apache.org/repos/asf/james-project/blob/4e0f1310/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAOTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAOTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAOTest.java
deleted file mode 100644
index 98c2fa6..0000000
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAOTest.java
+++ /dev/null
@@ -1,166 +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.mailbox.cassandra.mail;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import java.util.Date;
-import java.util.List;
-import java.util.Optional;
-import javax.mail.Flags;
-import javax.mail.util.SharedByteArrayInputStream;
-
-import org.apache.james.backends.cassandra.CassandraCluster;
-import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.cassandra.ids.CassandraId;
-import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
-import org.apache.james.mailbox.cassandra.mail.utils.Limit;
-import org.apache.james.mailbox.cassandra.modules.CassandraMessageModule;
-import org.apache.james.mailbox.model.Attachment;
-import org.apache.james.mailbox.model.AttachmentId;
-import org.apache.james.mailbox.model.Cid;
-import org.apache.james.mailbox.model.ComposedMessageId;
-import org.apache.james.mailbox.model.ComposedMessageIdWithMetaData;
-import org.apache.james.mailbox.model.MessageAttachment;
-import org.apache.james.mailbox.model.MessageId;
-import org.apache.james.mailbox.store.mail.MessageMapper;
-import org.apache.james.mailbox.store.mail.model.impl.PropertyBuilder;
-import org.apache.james.mailbox.store.mail.model.impl.SimpleMailboxMessage;
-
-import com.github.steveash.guavate.Guavate;
-import com.google.common.base.Charsets;
-import com.google.common.collect.ImmutableList;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class CassandraMessageDAOTest {
- private static final int BODY_START = 16;
- private static final CassandraId MAILBOX_ID = CassandraId.timeBased();
- private static final String CONTENT = "Subject: Test7 \n\nBody7\n.\n";
- private static final MessageUid messageUid = MessageUid.of(1);
-
- private CassandraCluster cassandra;
-
- private CassandraMessageDAO testee;
- private CassandraMessageId.Factory messageIdFactory;
-
- private SimpleMailboxMessage messageWith1Attachment;
- private CassandraMessageId messageId;
- private Attachment attachment;
- private ComposedMessageId composedMessageId;
- private List<ComposedMessageIdWithMetaData> messageIds;
-
- @Before
- public void setUp() {
- cassandra = CassandraCluster.create(new CassandraMessageModule());
- cassandra.ensureAllTables();
-
- messageIdFactory = new CassandraMessageId.Factory();
- messageId = messageIdFactory.generate();
- testee = new CassandraMessageDAO(cassandra.getConf(), cassandra.getTypesProvider());
-
- attachment = Attachment.builder()
- .attachmentId(AttachmentId.from("123"))
- .bytes("attachment".getBytes())
- .type("content")
- .build();
-
- composedMessageId = new ComposedMessageId(MAILBOX_ID, messageId, messageUid);
-
- messageIds = ImmutableList.of(ComposedMessageIdWithMetaData.builder()
- .composedMessageId(composedMessageId)
- .flags(new Flags())
- .modSeq(1)
- .build());
- }
-
- @After
- public void tearDown() {
- cassandra.clearAllTables();
- cassandra.close();
- }
-
- @Test
- public void saveShouldStoreMessageWithAttachmentAndCid() throws Exception {
- messageWith1Attachment = createMessage(messageId, CONTENT, BODY_START, new PropertyBuilder(),
- ImmutableList.of(MessageAttachment.builder()
- .attachment(attachment)
- .cid(Cid.from("<cid>"))
- .isInline(true)
- .build()));
-
- testee.save(messageWith1Attachment).join();
-
- List<Optional<MessageAttachmentRepresentation>> attachmentRepresentation =
- testee.retrieveMessages(messageIds, MessageMapper.FetchType.Body, Limit.unlimited())
- .get()
- .map(pair -> pair.getRight())
- .map(streamAttachemnt -> streamAttachemnt.findFirst())
- .collect(Guavate.toImmutableList());
-
- Cid expectedCid = Cid.from("cid");
-
- assertThat(attachmentRepresentation).hasSize(1);
- assertThat(attachmentRepresentation.get(0).get().getCid().get()).isEqualTo(expectedCid);
- }
-
- @Test
- public void saveShouldStoreMessageWithAttachmentButNoCid() throws Exception {
- messageWith1Attachment = createMessage(messageId, CONTENT, BODY_START, new PropertyBuilder(),
- ImmutableList.of(MessageAttachment.builder()
- .attachment(attachment)
- .isInline(true)
- .build()));
-
- testee.save(messageWith1Attachment).join();
-
- List<Optional<MessageAttachmentRepresentation>> attachmentRepresentation =
- testee.retrieveMessages(messageIds, MessageMapper.FetchType.Body, Limit.unlimited())
- .get()
- .map(pair -> pair.getRight())
- .map(streamAttachemnt -> streamAttachemnt.findFirst())
- .collect(Guavate.toImmutableList());
-
- assertThat(attachmentRepresentation).hasSize(1);
- assertThat(attachmentRepresentation.get(0).get().getCid().isPresent()).isFalse();
- }
-
- private SimpleMailboxMessage createMessage(
- MessageId messageId,
- String content,
- int bodyStart,
- PropertyBuilder propertyBuilder,
- List<MessageAttachment> attachments) {
-
- return SimpleMailboxMessage.builder()
- .messageId(messageId)
- .mailboxId(MAILBOX_ID)
- .uid(messageUid)
- .internalDate(new Date())
- .bodyStartOctet(bodyStart)
- .size(content.length())
- .content(new SharedByteArrayInputStream(content.getBytes(Charsets.UTF_8)))
- .flags(new Flags())
- .propertyBuilder(propertyBuilder)
- .addAttachments(attachments)
- .build();
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/4e0f1310/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2MigrationTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2MigrationTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2MigrationTest.java
deleted file mode 100644
index 6b0edea..0000000
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2MigrationTest.java
+++ /dev/null
@@ -1,304 +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.mailbox.cassandra.mail.migration;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Optional;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Stream;
-
-import javax.mail.Flags;
-import javax.mail.util.SharedByteArrayInputStream;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.tuple.Pair;
-import org.apache.james.backends.cassandra.CassandraCluster;
-import org.apache.james.backends.cassandra.CassandraConfiguration;
-import org.apache.james.backends.cassandra.init.CassandraModuleComposite;
-import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.cassandra.ids.CassandraId;
-import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
-import org.apache.james.mailbox.cassandra.mail.CassandraAttachmentMapper;
-import org.apache.james.mailbox.cassandra.mail.CassandraBlobsDAO;
-import org.apache.james.mailbox.cassandra.mail.CassandraMessageDAO;
-import org.apache.james.mailbox.cassandra.mail.CassandraMessageDAOV2;
-import org.apache.james.mailbox.cassandra.mail.MessageAttachmentRepresentation;
-import org.apache.james.mailbox.cassandra.mail.MessageWithoutAttachment;
-import org.apache.james.mailbox.cassandra.mail.utils.Limit;
-import org.apache.james.mailbox.cassandra.modules.CassandraAttachmentModule;
-import org.apache.james.mailbox.cassandra.modules.CassandraBlobModule;
-import org.apache.james.mailbox.cassandra.modules.CassandraMessageModule;
-import org.apache.james.mailbox.model.Attachment;
-import org.apache.james.mailbox.model.AttachmentId;
-import org.apache.james.mailbox.model.Cid;
-import org.apache.james.mailbox.model.ComposedMessageId;
-import org.apache.james.mailbox.model.ComposedMessageIdWithMetaData;
-import org.apache.james.mailbox.model.MessageAttachment;
-import org.apache.james.mailbox.model.MessageId;
-import org.apache.james.mailbox.store.mail.MessageMapper;
-import org.apache.james.mailbox.store.mail.model.impl.PropertyBuilder;
-import org.apache.james.mailbox.store.mail.model.impl.SimpleMailboxMessage;
-import org.apache.james.util.OptionalConverter;
-import org.assertj.core.api.JUnitSoftAssertions;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import com.github.steveash.guavate.Guavate;
-import com.google.common.base.Charsets;
-import com.google.common.collect.ImmutableList;
-import com.jayway.awaitility.Awaitility;
-import com.jayway.awaitility.Duration;
-import com.jayway.awaitility.core.ConditionFactory;
-
-public class V1ToV2MigrationTest {
- private static final int BODY_START = 16;
- private static final CassandraId MAILBOX_ID = CassandraId.timeBased();
- private static final String CONTENT = "Subject: Test7 \n\nBody7\n.\n";
- private static final MessageUid messageUid = MessageUid.of(1);
-
- private CassandraCluster cassandra;
-
- private CassandraMessageDAO messageDAOV1;
- private CassandraMessageDAOV2 messageDAOV2;
- private CassandraAttachmentMapper attachmentMapper;
- private V1ToV2Migration testee;
-
- private Attachment attachment;
- private CassandraMessageId messageId;
- private CassandraMessageId.Factory messageIdFactory;
- private ComposedMessageId composedMessageId;
- private List<ComposedMessageIdWithMetaData> metaDataList;
- private ComposedMessageIdWithMetaData metaData;
- private MessageAttachment messageAttachment;
-
- @Rule
- public final JUnitSoftAssertions softly = new JUnitSoftAssertions();
- private ConditionFactory awaitability;
-
- @Before
- public void setUp() {
- cassandra = CassandraCluster.create(new CassandraModuleComposite(
- new CassandraMessageModule(),
- new CassandraBlobModule(),
- new CassandraAttachmentModule()));
- cassandra.ensureAllTables();
-
- messageDAOV1 = new CassandraMessageDAO(cassandra.getConf(), cassandra.getTypesProvider());
- CassandraBlobsDAO blobsDAO = new CassandraBlobsDAO(cassandra.getConf());
- messageDAOV2 = new CassandraMessageDAOV2(cassandra.getConf(), cassandra.getTypesProvider(), blobsDAO);
- attachmentMapper = new CassandraAttachmentMapper(cassandra.getConf());
- testee = new V1ToV2Migration(messageDAOV1, messageDAOV2, attachmentMapper, CassandraConfiguration.builder()
- .onTheFlyV1ToV2Migration(true)
- .build());
-
-
- messageIdFactory = new CassandraMessageId.Factory();
- messageId = messageIdFactory.generate();
-
- attachment = Attachment.builder()
- .attachmentId(AttachmentId.from("123"))
- .bytes("attachment".getBytes())
- .type("content")
- .build();
-
- composedMessageId = new ComposedMessageId(MAILBOX_ID, messageId, messageUid);
-
- metaData = ComposedMessageIdWithMetaData.builder()
- .composedMessageId(composedMessageId)
- .flags(new Flags())
- .modSeq(1)
- .build();
- metaDataList = ImmutableList.of(metaData);
- messageAttachment = MessageAttachment.builder()
- .attachment(attachment)
- .cid(Cid.from("<cid>"))
- .isInline(true)
- .name("toto.png")
- .build();
-
- Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
- awaitability = Awaitility
- .with()
- .pollInterval(slowPacedPollInterval)
- .and()
- .pollDelay(slowPacedPollInterval).await();
- }
-
- @After
- public void tearDown() {
- testee.stop();
- cassandra.clearAllTables();
- cassandra.close();
- }
-
- @Test
- public void migrationShouldWorkWithoutAttachments() throws Exception {
- SimpleMailboxMessage originalMessage = createMessage(messageId, CONTENT, BODY_START,
- new PropertyBuilder(), ImmutableList.of());
- messageDAOV1.save(originalMessage).join();
-
- testee.getFromV2orElseFromV1AfterMigration(CassandraMessageDAOV2.notFound(metaData)).join();
-
- awaitMigration();
-
- CassandraMessageDAOV2.MessageResult messageResult = retrieveMessageOnV2().get();
- softly.assertThat(messageResult.message().getLeft().getMessageId()).isEqualTo(messageId);
- softly.assertThat(IOUtils.toString(messageResult.message().getLeft().getContent(), Charsets.UTF_8))
- .isEqualTo(CONTENT);
- softly.assertThat(messageResult.message().getRight().findAny().isPresent()).isFalse();
- }
-
- @Test
- public void runShouldMigrateMessages() throws Exception {
- SimpleMailboxMessage originalMessage = createMessage(messageId, CONTENT, BODY_START,
- new PropertyBuilder(), ImmutableList.of());
- messageDAOV1.save(originalMessage).join();
-
- testee.run();
-
- CassandraMessageDAOV2.MessageResult messageResult = retrieveMessageOnV2().get();
- softly.assertThat(messageResult.message().getLeft().getMessageId()).isEqualTo(messageId);
- softly.assertThat(IOUtils.toString(messageResult.message().getLeft().getContent(), Charsets.UTF_8))
- .isEqualTo(CONTENT);
- softly.assertThat(messageResult.message().getRight().findAny().isPresent()).isFalse();
- }
-
- @Test
- public void runShouldBeIdempotent() throws Exception {
- SimpleMailboxMessage originalMessage = createMessage(messageId, CONTENT, BODY_START,
- new PropertyBuilder(), ImmutableList.of());
- messageDAOV1.save(originalMessage).join();
-
- testee.run();
-
- testee.run();
-
- CassandraMessageDAOV2.MessageResult messageResult = retrieveMessageOnV2().get();
- softly.assertThat(messageResult.message().getLeft().getMessageId()).isEqualTo(messageId);
- softly.assertThat(IOUtils.toString(messageResult.message().getLeft().getContent(), Charsets.UTF_8))
- .isEqualTo(CONTENT);
- softly.assertThat(messageResult.message().getRight().findAny().isPresent()).isFalse();
- }
-
- @Test
- public void runShouldSucceedWhenOneMessage() throws Exception {
- SimpleMailboxMessage originalMessage = createMessage(messageId, CONTENT, BODY_START,
- new PropertyBuilder(), ImmutableList.of());
- messageDAOV1.save(originalMessage).join();
-
- assertThat(testee.run()).isEqualTo(Migration.MigrationResult.COMPLETED);
- }
-
- @Test
- public void runShouldSucceedWhenNoMessages() throws Exception {
- assertThat(testee.run()).isEqualTo(Migration.MigrationResult.COMPLETED);
- }
-
- @Test
- public void migrationShouldWorkWithAttachments() throws Exception {
- SimpleMailboxMessage originalMessage = createMessage(messageId, CONTENT, BODY_START,
- new PropertyBuilder(), ImmutableList.of(messageAttachment));
-
- attachmentMapper.storeAttachment(attachment);
-
- messageDAOV1.save(originalMessage).join();
-
- testee.getFromV2orElseFromV1AfterMigration(CassandraMessageDAOV2.notFound(metaData)).join();
-
- awaitMigration();
-
- CassandraMessageDAOV2.MessageResult messageResult = retrieveMessageOnV2().get();
- softly.assertThat(messageResult.message().getLeft().getMessageId()).isEqualTo(messageId);
- softly.assertThat(IOUtils.toString(messageResult.message().getLeft().getContent(), Charsets.UTF_8))
- .isEqualTo(CONTENT);
- softly.assertThat(messageResult.message().getRight().findAny().get()).isEqualTo(MessageAttachmentRepresentation.builder()
- .attachmentId(attachment.getAttachmentId())
- .cid(OptionalConverter.fromGuava(messageAttachment.getCid()))
- .isInline(messageAttachment.isInline())
- .name(messageAttachment.getName().get())
- .build());
- }
-
- @Test
- public void migratedDataShouldBeRetrievedNoAttachment() throws Exception {
- SimpleMailboxMessage originalMessage = createMessage(messageId, CONTENT, BODY_START,
- new PropertyBuilder(), ImmutableList.of());
-
- messageDAOV1.save(originalMessage).join();
-
- Pair<MessageWithoutAttachment, Stream<MessageAttachmentRepresentation>> migratedData =
- testee.getFromV2orElseFromV1AfterMigration(CassandraMessageDAOV2.notFound(metaData)).join();
-
- awaitMigration();
-
- softly.assertThat(migratedData.getLeft().getMessageId()).isEqualTo(messageId);
- softly.assertThat(migratedData.getRight().collect(Guavate.toImmutableList()))
- .isEmpty();
- }
-
- @Test
- public void migratedDataShouldBeRetrievedWhenAttachment() throws Exception {
- SimpleMailboxMessage originalMessage = createMessage(messageId, CONTENT, BODY_START,
- new PropertyBuilder(), ImmutableList.of(messageAttachment));
-
- attachmentMapper.storeAttachment(attachment);
-
- messageDAOV1.save(originalMessage).join();
-
- Pair<MessageWithoutAttachment, Stream<MessageAttachmentRepresentation>> migratedData =
- testee.getFromV2orElseFromV1AfterMigration(CassandraMessageDAOV2.notFound(metaData)).join();
-
- awaitMigration();
-
- softly.assertThat(migratedData.getLeft().getMessageId()).isEqualTo(messageId);
- softly.assertThat(migratedData.getRight().collect(Guavate.toImmutableList()))
- .containsOnly(MessageAttachmentRepresentation.fromAttachment(messageAttachment));
- }
-
- private void awaitMigration() {
- awaitability.atMost(1, TimeUnit.MINUTES)
- .until(() -> {
- try {
- retrieveMessageOnV2();
- return true;
- } catch(AssertionError e) {
- return false;
- }
- });
- }
-
- private Optional<CassandraMessageDAOV2.MessageResult> retrieveMessageOnV2() {
- Optional<CassandraMessageDAOV2.MessageResult> messageResult = messageDAOV2.retrieveMessages(metaDataList, MessageMapper.FetchType.Full, Limit.unlimited())
- .join()
- .findAny();
-
- assertThat(messageResult.isPresent()).isTrue();
- return messageResult;
- }
-
- private SimpleMailboxMessage createMessage(MessageId messageId, String content, int bodyStart, PropertyBuilder propertyBuilder, List<MessageAttachment> attachments) {
- return new SimpleMailboxMessage(messageId, new Date(), content.length(), bodyStart, new SharedByteArrayInputStream(content.getBytes()), new Flags(), propertyBuilder, MAILBOX_ID, attachments);
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/4e0f1310/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java b/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java
index 54dc713..75969a3 100644
--- a/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java
+++ b/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java
@@ -29,15 +29,14 @@ import org.apache.james.mailbox.SubscriptionManager;
import org.apache.james.mailbox.cassandra.CassandraMailboxManager;
import org.apache.james.mailbox.cassandra.CassandraMailboxSessionMapperFactory;
import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
+import org.apache.james.mailbox.cassandra.mail.CassandraApplicableFlagDAO;
import org.apache.james.mailbox.cassandra.mail.CassandraBlobsDAO;
import org.apache.james.mailbox.cassandra.mail.CassandraDeletedMessageDAO;
import org.apache.james.mailbox.cassandra.mail.CassandraFirstUnseenDAO;
-import org.apache.james.mailbox.cassandra.mail.CassandraApplicableFlagDAO;
import org.apache.james.mailbox.cassandra.mail.CassandraMailboxCounterDAO;
import org.apache.james.mailbox.cassandra.mail.CassandraMailboxDAO;
import org.apache.james.mailbox.cassandra.mail.CassandraMailboxPathDAO;
import org.apache.james.mailbox.cassandra.mail.CassandraMailboxRecentsDAO;
-import org.apache.james.mailbox.cassandra.mail.CassandraMessageDAO;
import org.apache.james.mailbox.cassandra.mail.CassandraMessageDAOV2;
import org.apache.james.mailbox.cassandra.mail.CassandraMessageIdDAO;
import org.apache.james.mailbox.cassandra.mail.CassandraMessageIdToImapUidDAO;
@@ -110,7 +109,6 @@ public class CassandraHostSystem extends JamesImapHostSystem {
CassandraUidProvider uidProvider = new CassandraUidProvider(session);
CassandraTypesProvider typesProvider = new CassandraTypesProvider(mailboxModule, session);
CassandraMessageId.Factory messageIdFactory = new CassandraMessageId.Factory();
- CassandraMessageDAO messageDAO = new CassandraMessageDAO(session, typesProvider);
CassandraBlobsDAO cassandraBlobsDAO = new CassandraBlobsDAO(session);
CassandraMessageDAOV2 messageDAOV2 = new CassandraMessageDAOV2(session, typesProvider, cassandraBlobsDAO);
CassandraMessageIdDAO messageIdDAO = new CassandraMessageIdDAO(session, messageIdFactory);
@@ -127,7 +125,6 @@ public class CassandraHostSystem extends JamesImapHostSystem {
uidProvider,
modSeqProvider,
session,
- messageDAO,
messageDAOV2,
messageIdDAO,
imapUidDAO,
http://git-wip-us.apache.org/repos/asf/james-project/blob/4e0f1310/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 3ab79b7..536cae0 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
@@ -35,7 +35,6 @@ import org.apache.james.mailbox.cassandra.ids.CassandraId;
import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
import org.apache.james.mailbox.cassandra.mail.CassandraBlobsDAO;
import org.apache.james.mailbox.cassandra.mail.CassandraMailboxMapper;
-import org.apache.james.mailbox.cassandra.mail.CassandraMessageDAO;
import org.apache.james.mailbox.cassandra.mail.CassandraMessageDAOV2;
import org.apache.james.mailbox.cassandra.mail.CassandraMessageIdDAO;
import org.apache.james.mailbox.cassandra.mail.CassandraMessageIdToImapUidDAO;
@@ -87,7 +86,6 @@ public class CassandraMailboxModule extends AbstractModule {
bind(UserRepositoryAuthorizator.class).in(Scopes.SINGLETON);
bind(CassandraId.Factory.class).in(Scopes.SINGLETON);
bind(CassandraMessageId.Factory.class).in(Scopes.SINGLETON);
- bind(CassandraMessageDAO.class).in(Scopes.SINGLETON);
bind(CassandraMessageIdDAO.class).in(Scopes.SINGLETON);
bind(CassandraMessageIdToImapUidDAO.class).in(Scopes.SINGLETON);
bind(MailboxEventDispatcher.class).in(Scopes.SINGLETON);
http://git-wip-us.apache.org/repos/asf/james-project/blob/4e0f1310/server/container/guice/protocols/webadmin-cassandra/src/main/java/org/apache/james/modules/server/CassandraRoutesModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/webadmin-cassandra/src/main/java/org/apache/james/modules/server/CassandraRoutesModule.java b/server/container/guice/protocols/webadmin-cassandra/src/main/java/org/apache/james/modules/server/CassandraRoutesModule.java
index 8e8f940..55b8c23 100644
--- a/server/container/guice/protocols/webadmin-cassandra/src/main/java/org/apache/james/modules/server/CassandraRoutesModule.java
+++ b/server/container/guice/protocols/webadmin-cassandra/src/main/java/org/apache/james/modules/server/CassandraRoutesModule.java
@@ -21,7 +21,6 @@ package org.apache.james.modules.server;
import org.apache.james.backends.cassandra.versions.CassandraSchemaVersionManager;
import org.apache.james.mailbox.cassandra.mail.migration.Migration;
-import org.apache.james.mailbox.cassandra.mail.migration.V1ToV2Migration;
import org.apache.james.webadmin.Routes;
import org.apache.james.webadmin.routes.CassandraMigrationRoutes;
import org.apache.james.webadmin.service.CassandraMigrationService;
@@ -33,22 +32,18 @@ import com.google.inject.multibindings.Multibinder;
import com.google.inject.name.Names;
public class CassandraRoutesModule extends AbstractModule {
-
- private static final int FROM_V1_TO_V2 = 1;
+ private static final int FROM_V2_TO_V3 = 2;
@Override
protected void configure() {
bind(CassandraRoutesModule.class).in(Scopes.SINGLETON);
bind(CassandraMigrationService.class).in(Scopes.SINGLETON);
- Multibinder<Migration> migrationMultibinder = Multibinder.newSetBinder(binder(), Migration.class);
- migrationMultibinder.addBinding().to(V1ToV2Migration.class);
-
Multibinder<Routes> routesMultibinder = Multibinder.newSetBinder(binder(), Routes.class);
routesMultibinder.addBinding().to(CassandraMigrationRoutes.class);
MapBinder<Integer, Migration> allMigrationClazzBinder = MapBinder.newMapBinder(binder(), Integer.class, Migration.class);
- allMigrationClazzBinder.addBinding(FROM_V1_TO_V2).to(V1ToV2Migration.class);
+ allMigrationClazzBinder.addBinding(FROM_V2_TO_V3).toInstance(() -> Migration.MigrationResult.COMPLETED);
bindConstant()
.annotatedWith(Names.named(CassandraMigrationService.LATEST_VERSION))
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org