You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2023/09/01 09:33:46 UTC
[james-project] 08/14: JAMES-3926 Register CassandraCurrentQuotaManagerMigration
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 5269b11eea9769455e5906a2de633f831b88340e
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Mon Aug 28 16:53:56 2023 +0700
JAMES-3926 Register CassandraCurrentQuotaManagerMigration
---
.../cassandra/versions/CassandraSchemaVersionManager.java | 2 +-
.../cassandra/quota/FakeCassandraCurrentQuotaManager.java | 14 ++++++++------
.../james/modules/webadmin/CassandraRoutesModule.java | 3 +++
.../rabbitmq/RabbitMQWebAdminServerIntegrationTest.java | 2 +-
4 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/versions/CassandraSchemaVersionManager.java b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/versions/CassandraSchemaVersionManager.java
index a976df9cd4..dc518119b0 100644
--- a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/versions/CassandraSchemaVersionManager.java
+++ b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/versions/CassandraSchemaVersionManager.java
@@ -36,7 +36,7 @@ import reactor.core.publisher.Mono;
public class CassandraSchemaVersionManager {
public static final SchemaVersion MIN_VERSION = new SchemaVersion(8);
- public static final SchemaVersion MAX_VERSION = new SchemaVersion(12);
+ public static final SchemaVersion MAX_VERSION = new SchemaVersion(13);
public static final SchemaVersion DEFAULT_VERSION = MIN_VERSION;
private static final Logger LOGGER = LoggerFactory.getLogger(CassandraSchemaVersionManager.class);
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/FakeCassandraCurrentQuotaManager.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/FakeCassandraCurrentQuotaManager.java
index 0392af55a9..54e1c09dbb 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/FakeCassandraCurrentQuotaManager.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/FakeCassandraCurrentQuotaManager.java
@@ -32,6 +32,8 @@ import org.apache.james.mailbox.quota.CurrentQuotaManager;
import reactor.core.publisher.Mono;
public class FakeCassandraCurrentQuotaManager implements CurrentQuotaManager {
+ private static final String MESSAGE = "Use quota compatility mode in cassandra.properties for running the 12 -> 13 migration";
+
@Inject
public FakeCassandraCurrentQuotaManager() {
@@ -39,31 +41,31 @@ public class FakeCassandraCurrentQuotaManager implements CurrentQuotaManager {
@Override
public Mono<QuotaCountUsage> getCurrentMessageCount(QuotaRoot quotaRoot) {
- return Mono.error(new NotImplementedException());
+ return Mono.error(new NotImplementedException(MESSAGE));
}
@Override
public Mono<QuotaSizeUsage> getCurrentStorage(QuotaRoot quotaRoot) {
- return Mono.error(new NotImplementedException());
+ return Mono.error(new NotImplementedException(MESSAGE));
}
@Override
public Mono<CurrentQuotas> getCurrentQuotas(QuotaRoot quotaRoot) {
- return Mono.error(new NotImplementedException());
+ return Mono.error(new NotImplementedException(MESSAGE));
}
@Override
public Mono<Void> increase(QuotaOperation quotaOperation) {
- return Mono.error(new NotImplementedException());
+ return Mono.error(new NotImplementedException(MESSAGE));
}
@Override
public Mono<Void> decrease(QuotaOperation quotaOperation) {
- return Mono.error(new NotImplementedException());
+ return Mono.error(new NotImplementedException(MESSAGE));
}
@Override
public Mono<Void> setCurrentQuotas(QuotaOperation quotaOperation) {
- return Mono.error(new NotImplementedException());
+ return Mono.error(new NotImplementedException(MESSAGE));
}
}
diff --git a/server/container/guice/cassandra/src/main/java/org/apache/james/modules/webadmin/CassandraRoutesModule.java b/server/container/guice/cassandra/src/main/java/org/apache/james/modules/webadmin/CassandraRoutesModule.java
index 77e63bbd6a..867c63996f 100644
--- a/server/container/guice/cassandra/src/main/java/org/apache/james/modules/webadmin/CassandraRoutesModule.java
+++ b/server/container/guice/cassandra/src/main/java/org/apache/james/modules/webadmin/CassandraRoutesModule.java
@@ -29,6 +29,7 @@ import org.apache.james.mailbox.cassandra.mail.migration.AclV2Migration;
import org.apache.james.mailbox.cassandra.mail.migration.AttachmentMessageIdMigration;
import org.apache.james.mailbox.cassandra.mail.migration.MessageDenormalizationMigration;
import org.apache.james.mailbox.cassandra.mail.migration.MessageV3Migration;
+import org.apache.james.mailbox.cassandra.quota.migration.CassandraCurrentQuotaManagerMigration;
import org.apache.james.webadmin.Routes;
import org.apache.james.webadmin.routes.CassandraMailboxMergingRoutes;
import org.apache.james.webadmin.routes.CassandraMigrationRoutes;
@@ -44,6 +45,7 @@ public class CassandraRoutesModule extends AbstractModule {
private static final SchemaTransition FROM_V9_TO_V10 = SchemaTransition.to(new SchemaVersion(10));
private static final SchemaTransition FROM_V10_TO_V11 = SchemaTransition.to(new SchemaVersion(11));
private static final SchemaTransition FROM_V11_TO_V12 = SchemaTransition.to(new SchemaVersion(12));
+ private static final SchemaTransition FROM_V12_TO_V13 = SchemaTransition.to(new SchemaVersion(13));
@Override
protected void configure() {
@@ -63,6 +65,7 @@ public class CassandraRoutesModule extends AbstractModule {
allMigrationClazzBinder.addBinding(FROM_V9_TO_V10).to(AclV2Migration.class);
allMigrationClazzBinder.addBinding(FROM_V10_TO_V11).to(MessageDenormalizationMigration.class);
allMigrationClazzBinder.addBinding(FROM_V11_TO_V12).to(AttachmentMessageIdMigration.class);
+ allMigrationClazzBinder.addBinding(FROM_V12_TO_V13).to(CassandraCurrentQuotaManagerMigration.class);
bind(SchemaVersion.class)
.annotatedWith(Names.named(CassandraMigrationService.LATEST_VERSION))
diff --git a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQWebAdminServerIntegrationTest.java b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQWebAdminServerIntegrationTest.java
index 03f904a9d3..21ebee4aab 100644
--- a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQWebAdminServerIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQWebAdminServerIntegrationTest.java
@@ -136,7 +136,7 @@ class RabbitMQWebAdminServerIntegrationTest extends WebAdminServerIntegrationTes
.then()
.statusCode(HttpStatus.OK_200)
.contentType(JSON_CONTENT_TYPE)
- .body(is("{\"version\":12}"));
+ .body(is("{\"version\":13}"));
}
@Test
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org