This is an automated email from the ASF dual-hosted git repository. rouazana pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 4524b237da30357f8bce4c24646c521d690d93c8 Author: Benoit Tellier <[email protected]> AuthorDate: Fri Jul 12 15:29:08 2019 +0200 JAMES-2812 Memory integration tests for Blob Store DeletedMessageVault This improves DEV experience. Because it is just so much faster compare to starting a docker hell. --- .../mailbox/MemoryDeletedMessageVaultModule.java | 45 +++++++++++++ .../MemoryBlobStoreDeletedMessagesVaultTest.java | 78 ++++++++++++++++++++++ 2 files changed, 123 insertions(+) diff --git a/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/mailbox/MemoryDeletedMessageVaultModule.java b/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/mailbox/MemoryDeletedMessageVaultModule.java new file mode 100644 index 0000000..882e578 --- /dev/null +++ b/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/mailbox/MemoryDeletedMessageVaultModule.java @@ -0,0 +1,45 @@ +/**************************************************************** + * 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.modules.mailbox; + +import org.apache.james.modules.vault.BlobStoreDeletedMessageVaultModule; +import org.apache.james.vault.DeletedMessageVault; +import org.apache.james.vault.blob.BlobStoreDeletedMessageVault; +import org.apache.james.vault.blob.BucketNameGenerator; +import org.apache.james.vault.memory.metadata.MemoryDeletedMessageMetadataVault; +import org.apache.james.vault.metadata.DeletedMessageMetadataVault; + +import com.google.inject.AbstractModule; +import com.google.inject.Scopes; + +public class MemoryDeletedMessageVaultModule extends AbstractModule { + @Override + protected void configure() { + install(new BlobStoreDeletedMessageVaultModule()); + + bind(MemoryDeletedMessageMetadataVault.class).in(Scopes.SINGLETON); + bind(DeletedMessageMetadataVault.class).to(MemoryDeletedMessageMetadataVault.class); + + bind(BucketNameGenerator.class).in(Scopes.SINGLETON); + bind(BlobStoreDeletedMessageVault.class).in(Scopes.SINGLETON); + bind(DeletedMessageVault.class) + .to(BlobStoreDeletedMessageVault.class); + } +} diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryBlobStoreDeletedMessagesVaultTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryBlobStoreDeletedMessagesVaultTest.java new file mode 100644 index 0000000..0e0ca36 --- /dev/null +++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryBlobStoreDeletedMessagesVaultTest.java @@ -0,0 +1,78 @@ +/**************************************************************** + * 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.jmap.memory; + +import java.io.IOException; +import java.time.Clock; + +import org.apache.james.GuiceJamesServer; +import org.apache.james.MemoryJmapTestRule; +import org.apache.james.filesystem.api.FileSystem; +import org.apache.james.jmap.methods.integration.DeletedMessagesVaultTest; +import org.apache.james.mailrepository.api.MailRepositoryUrl; +import org.apache.james.modules.mailbox.MemoryDeletedMessageVaultModule; +import org.apache.james.modules.vault.TestDeleteMessageVaultPreDeletionHookModule; +import org.apache.james.vault.MailRepositoryDeletedMessageVault; +import org.apache.james.webadmin.WebAdminConfiguration; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; + +public class MemoryBlobStoreDeletedMessagesVaultTest extends DeletedMessagesVaultTest { + @Rule + public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule(); + + @Override + protected GuiceJamesServer createJmapServer(FileSystem fileSystem, Clock clock) throws IOException { + return memoryJmap.jmapServer( + new MemoryDeletedMessageVaultModule(), + new TestDeleteMessageVaultPreDeletionHookModule(), + binder -> binder.bind(WebAdminConfiguration.class).toInstance(WebAdminConfiguration.TEST_CONFIGURATION), + binder -> binder.bind(MailRepositoryDeletedMessageVault.Configuration.class) + .toInstance(new MailRepositoryDeletedMessageVault.Configuration(MailRepositoryUrl.from("memory://var/deletedMessages/user"))), + binder -> binder.bind(FileSystem.class).toInstance(fileSystem), + binder -> binder.bind(Clock.class).toInstance(clock)); + } + + @Override + protected void awaitSearchUpToDate() { + + } + + @Ignore("Will be implemented latter") + @Test + public void vaultDeleteShouldDeleteMessageThenExportWithNoEntry() throws Exception { + } + + @Ignore("Will be implemented latter") + @Test + public void vaultDeleteShouldNotDeleteEmptyVaultThenExportNoEntry() throws Exception { + } + + @Ignore("Will be implemented latter") + @Test + public void vaultDeleteShouldNotDeleteNotMatchedMessageInVaultThenExportAnEntry() throws Exception { + } + + @Ignore("Will be implemented latter") + @Test + public void vaultDeleteShouldNotAppendMessageToTheUserMailbox() { + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
