Skip to content

Commit

Permalink
ISSUE-1469 Implement JMAP download all attachments (#1486)
Browse files Browse the repository at this point in the history
Co-authored-by: hung phan <[email protected]>
Co-authored-by: Benoit TELLIER <[email protected]>
  • Loading branch information
3 people authored Jan 29, 2025
1 parent ca6cd37 commit 8fd1a89
Show file tree
Hide file tree
Showing 7 changed files with 763 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
import com.linagora.tmail.james.jmap.oidc.WebFingerModule;
import com.linagora.tmail.james.jmap.publicAsset.CassandraPublicAssetRepositoryModule;
import com.linagora.tmail.james.jmap.publicAsset.PublicAssetsModule;
import com.linagora.tmail.james.jmap.routes.DownloadAllRoutesModule;
import com.linagora.tmail.james.jmap.service.discovery.LinagoraServicesDiscoveryModule;
import com.linagora.tmail.james.jmap.service.discovery.LinagoraServicesDiscoveryModuleChooserConfiguration;
import com.linagora.tmail.james.jmap.settings.CassandraJmapSettingsRepositoryModule;
Expand Down Expand Up @@ -281,7 +282,8 @@ protected void configure() {
new WebFingerModule(),
new LabelMethodModule(),
new JmapSettingsMethodModule(),
new ContactSupportCapabilitiesModule())
new ContactSupportCapabilitiesModule(),
new DownloadAllRoutesModule())
.with(new CassandraTicketStoreModule(), new TeamMailboxJmapModule());

public static final Module PROTOCOLS = Modules.combine(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
import com.linagora.tmail.james.jmap.method.MessageVaultCapabilitiesModule;
import com.linagora.tmail.james.jmap.oidc.WebFingerModule;
import com.linagora.tmail.james.jmap.publicAsset.PublicAssetsModule;
import com.linagora.tmail.james.jmap.routes.DownloadAllRoutesModule;
import com.linagora.tmail.james.jmap.service.discovery.LinagoraServicesDiscoveryModule;
import com.linagora.tmail.james.jmap.service.discovery.LinagoraServicesDiscoveryModuleChooserConfiguration;
import com.linagora.tmail.james.jmap.team.mailboxes.TeamMailboxJmapModule;
Expand Down Expand Up @@ -170,7 +171,8 @@ public class MemoryServer {
new MessageVaultCapabilitiesModule(),
new MailboxesCleanupModule(),
new InboxArchivalTaskModule(),
new ContactSupportCapabilitiesModule())
new ContactSupportCapabilitiesModule(),
new DownloadAllRoutesModule())
.with(new TeamMailboxJmapModule());

public static final Module MODULES = Modules.override(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/********************************************************************
* As a subpart of Twake Mail, this file is edited by Linagora. *
* *
* https://twake-mail.com/ *
* https://linagora.com *
* *
* This file is subject to The Affero Gnu Public License *
* version 3. *
* *
* https://www.gnu.org/licenses/agpl-3.0.en.html *
* *
* This program is distributed in the hope that it will be *
* useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR *
* PURPOSE. See the GNU Affero General Public License for *
* more details. *
********************************************************************/

package com.linagora.tmail.james;

import org.apache.james.JamesServerBuilder;
import org.apache.james.JamesServerExtension;
import org.apache.james.SearchConfiguration;
import org.apache.james.backends.redis.RedisExtension;
import org.apache.james.jmap.rfc8621.contract.probe.DelegationProbeModule;
import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
import org.apache.james.mailbox.model.MessageId;
import org.apache.james.modules.AwsS3BlobStoreExtension;
import org.junit.jupiter.api.extension.RegisterExtension;

import com.datastax.oss.driver.api.core.uuid.Uuids;
import com.linagora.tmail.blob.guice.BlobStoreConfiguration;
import com.linagora.tmail.james.app.CassandraExtension;
import com.linagora.tmail.james.app.DistributedJamesConfiguration;
import com.linagora.tmail.james.app.DistributedServer;
import com.linagora.tmail.james.app.EventBusKeysChoice;
import com.linagora.tmail.james.app.RabbitMQExtension;
import com.linagora.tmail.james.common.DownloadAllContract;
import com.linagora.tmail.james.jmap.firebase.FirebaseModuleChooserConfiguration;
import com.linagora.tmail.module.LinagoraTestJMAPServerModule;

public class DistributedDownloadAllRouteTest implements DownloadAllContract {
public static final CassandraMessageId.Factory MESSAGE_ID_FACTORY = new CassandraMessageId.Factory();

@RegisterExtension
static JamesServerExtension testExtension = new JamesServerBuilder<DistributedJamesConfiguration>(tmpDir ->
DistributedJamesConfiguration.builder()
.workingDirectory(tmpDir)
.configurationFromClasspath()
.blobStore(BlobStoreConfiguration.builder()
.s3()
.noSecondaryS3BlobStore()
.disableCache()
.deduplication()
.noCryptoConfig()
.disableSingleSave())
.eventBusKeysChoice(EventBusKeysChoice.REDIS)
.firebaseModuleChooserConfiguration(FirebaseModuleChooserConfiguration.DISABLED)
.searchConfiguration(SearchConfiguration.scanning())
.build())
.extension(new CassandraExtension())
.extension(new RabbitMQExtension())
.extension(new RedisExtension())
.extension(new AwsS3BlobStoreExtension())
.server(configuration -> DistributedServer.createServer(configuration)
.overrideWith(new LinagoraTestJMAPServerModule())
.overrideWith(new DelegationProbeModule()))
.build();

@Override
public MessageId randomMessageId() {
return MESSAGE_ID_FACTORY.of(Uuids.timeBased());
}
}
Loading

0 comments on commit 8fd1a89

Please sign in to comment.