You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by "chibenwa (via GitHub)" <gi...@apache.org> on 2023/08/24 15:15:17 UTC
[GitHub] [james-project] chibenwa opened a new pull request, #1700: JAMES-3926 Migrate Sieve quotas to mutalized quota system
chibenwa opened a new pull request, #1700:
URL: https://github.com/apache/james-project/pull/1700
(no comment)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
[GitHub] [james-project] Arsnael commented on pull request #1700: JAMES-3926 Migrate Sieve quotas to mutalized quota system
Posted by "Arsnael (via GitHub)" <gi...@apache.org>.
Arsnael commented on PR #1700:
URL: https://github.com/apache/james-project/pull/1700#issuecomment-1698399222
https://ci-builds.apache.org/job/james/job/ApacheJames/job/PR-1700/12/testReport/junit/org.apache.james.webadmin.integration.rabbitmq/RabbitMQWebAdminServerIntegrationTest/getCurrentVersionShouldReturnNullForCurrentVersionAsBeginning/
-> related
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
[GitHub] [james-project] quantranhong1999 commented on a diff in pull request #1700: JAMES-3926 Migrate Sieve quotas to mutalized quota system
Posted by "quantranhong1999 (via GitHub)" <gi...@apache.org>.
quantranhong1999 commented on code in PR #1700:
URL: https://github.com/apache/james-project/pull/1700#discussion_r1308519060
##########
server/apps/cassandra-app/src/main/java/org/apache/james/CassandraJamesServerConfiguration.java:
##########
@@ -142,6 +149,14 @@ public CassandraJamesServerConfiguration build() {
}
});
+ boolean quotaCompatibilityMode = this.quotaCompatibilityMode.orElseGet(() -> {
+ try {
+ return configurationProvider.getConfiguration("cassandra").getBoolean("quota.compatibility.mode", false);
Review Comment:
Missing docs (xml, adoc) for this property?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
[GitHub] [james-project] Arsnael commented on a diff in pull request #1700: JAMES-3926 Migrate Sieve quotas to mutalized quota system
Posted by "Arsnael (via GitHub)" <gi...@apache.org>.
Arsnael commented on code in PR #1700:
URL: https://github.com/apache/james-project/pull/1700#discussion_r1309850835
##########
server/data/data-cassandra/src/test/java/org/apache/james/sieve/cassandra/CassandraSieveRepositoryTest.java:
##########
@@ -21,22 +21,25 @@
import org.apache.james.backends.cassandra.CassandraCluster;
import org.apache.james.backends.cassandra.CassandraClusterExtension;
+import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.backends.cassandra.components.CassandraMutualizedQuotaModule;
import org.apache.james.sieverepository.api.SieveRepository;
import org.apache.james.sieverepository.lib.SieveRepositoryContract;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.RegisterExtension;
class CassandraSieveRepositoryTest implements SieveRepositoryContract {
@RegisterExtension
- static CassandraClusterExtension cassandraCluster = new CassandraClusterExtension(CassandraSieveRepositoryModule.MODULE);
+ static CassandraClusterExtension cassandraCluster = new CassandraClusterExtension(CassandraModule.aggregateModules(
+ CassandraSieveRepositoryModule.MODULE, CassandraMutualizedQuotaModule.MODULE, CassandraSieveQuotaModule.MODULE));
SieveRepository sieveRepository;
@BeforeEach
void setUp(CassandraCluster cassandra) {
sieveRepository = new CassandraSieveRepository(
new CassandraSieveDAO(cassandra.getConf()),
- new CassandraSieveQuotaDAO(cassandra.getConf()),
+ new CassandraSieveQuotaDAOV1(cassandra.getConf()),
Review Comment:
V2?
##########
mpt/impl/managesieve/cassandra/src/test/java/org/apache/james/mpt/managesieve/cassandra/host/CassandraHostSystem.java:
##########
@@ -43,7 +43,7 @@ public CassandraHostSystem(CassandraCluster cassandra) {
protected SieveRepository createSieveRepository() {
return new CassandraSieveRepository(
new CassandraSieveDAO(cassandra.getConf()),
- new CassandraSieveQuotaDAO(cassandra.getConf()),
+ new CassandraSieveQuotaDAOV1(cassandra.getConf()),
Review Comment:
V2?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
[GitHub] [james-project] Arsnael commented on a diff in pull request #1700: JAMES-3926 Migrate Sieve quotas to mutalized quota system
Posted by "Arsnael (via GitHub)" <gi...@apache.org>.
Arsnael commented on code in PR #1700:
URL: https://github.com/apache/james-project/pull/1700#discussion_r1306907108
##########
server/data/data-cassandra/src/test/java/org/apache/james/sieve/cassandra/migration/SieveQuotaMigrationTest.java:
##########
@@ -0,0 +1,142 @@
+/****************************************************************
+ * 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.sieve.cassandra.migration;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.commons.configuration2.BaseHierarchicalConfiguration;
+import org.apache.james.backends.cassandra.CassandraClusterExtension;
+import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.backends.cassandra.components.CassandraMutualizedQuotaModule;
+import org.apache.james.backends.cassandra.components.CassandraQuotaCurrentValueDao;
+import org.apache.james.backends.cassandra.components.CassandraQuotaLimitDao;
+import org.apache.james.core.Domain;
+import org.apache.james.core.Username;
+import org.apache.james.core.quota.QuotaSizeLimit;
+import org.apache.james.domainlist.api.DomainList;
+import org.apache.james.domainlist.api.mock.SimpleDomainList;
+import org.apache.james.domainlist.cassandra.CassandraDomainListModule;
+import org.apache.james.sieve.cassandra.CassandraSieveQuotaDAO;
+import org.apache.james.sieve.cassandra.CassandraSieveQuotaDAOV1;
+import org.apache.james.sieve.cassandra.CassandraSieveQuotaDAOV2;
+import org.apache.james.sieve.cassandra.CassandraSieveQuotaModule;
+import org.apache.james.sieve.cassandra.CassandraSieveRepositoryModule;
+import org.apache.james.user.api.UsersRepository;
+import org.apache.james.user.cassandra.CassandraUsersDAO;
+import org.apache.james.user.cassandra.CassandraUsersRepositoryModule;
+import org.apache.james.user.lib.UsersRepositoryImpl;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+class SieveQuotaMigrationTest {
+ public static final Username BOB = Username.of("bob");
+
+ private UsersRepositoryImpl<CassandraUsersDAO> getUsersRepository() throws Exception {
+ boolean enableVirtualHosting = false;
+ DomainList domainList = new SimpleDomainList();
+ domainList.addDomain(Domain.of("domain.tld"));
+ CassandraUsersDAO usersDAO = new CassandraUsersDAO(cassandraCluster.getCassandraCluster().getConf());
+ BaseHierarchicalConfiguration configuration = new BaseHierarchicalConfiguration();
+ configuration.addProperty("enableVirtualHosting", String.valueOf(enableVirtualHosting));
+
+ UsersRepositoryImpl<CassandraUsersDAO> usersRepository = new UsersRepositoryImpl<>(domainList, usersDAO);
+ usersRepository.configure(configuration);
+ return usersRepository;
+ }
+
+ @RegisterExtension
+ static CassandraClusterExtension cassandraCluster = new CassandraClusterExtension(CassandraModule.aggregateModules(
+ CassandraSieveQuotaModule.MODULE,
+ CassandraUsersRepositoryModule.MODULE,
+ CassandraDomainListModule.MODULE,
+ CassandraMutualizedQuotaModule.MODULE));
+
+ private CassandraSieveQuotaDAOV1 oldDAO;
+ private CassandraSieveQuotaDAOV2 newDAO;
+ private SieveQuotaMigration testee;
+
+ @BeforeEach
+ void setUp() throws Exception {
+ oldDAO = new CassandraSieveQuotaDAOV1(cassandraCluster.getCassandraCluster().getConf());
+ newDAO = new CassandraSieveQuotaDAOV2(new CassandraQuotaCurrentValueDao(cassandraCluster.getCassandraCluster().getConf()),
+ new CassandraQuotaLimitDao(cassandraCluster.getCassandraCluster().getConf()));
+ UsersRepository usersRepository = getUsersRepository();
+
+ usersRepository.addUser(BOB, "passBob");
+
+ testee = new SieveQuotaMigration(usersRepository, oldDAO, newDAO);
+ }
+
+ @Test
+ void shouldMigrateGlobalLimit() throws Exception {
+ oldDAO.setQuota(QuotaSizeLimit.size(32)).block();
+
+ testee.apply();
+
+ assertThat(oldDAO.getQuota().block())
+ .contains(QuotaSizeLimit.size(32));
+ }
+
+ @Test
+ void shouldNotFailWhenNoGlobalLimit() throws Exception {
+ testee.apply();
+
+ assertThat(oldDAO.getQuota().block())
+ .isEmpty();
+ }
+
+ @Test
+ void shouldNotFailWhenNoUserLimit() throws Exception {
+ testee.apply();
+
+ assertThat(oldDAO.getQuota(BOB).block())
Review Comment:
newDao?
##########
server/data/data-cassandra/src/test/java/org/apache/james/sieve/cassandra/migration/SieveQuotaMigrationTest.java:
##########
@@ -0,0 +1,142 @@
+/****************************************************************
+ * 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.sieve.cassandra.migration;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.commons.configuration2.BaseHierarchicalConfiguration;
+import org.apache.james.backends.cassandra.CassandraClusterExtension;
+import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.backends.cassandra.components.CassandraMutualizedQuotaModule;
+import org.apache.james.backends.cassandra.components.CassandraQuotaCurrentValueDao;
+import org.apache.james.backends.cassandra.components.CassandraQuotaLimitDao;
+import org.apache.james.core.Domain;
+import org.apache.james.core.Username;
+import org.apache.james.core.quota.QuotaSizeLimit;
+import org.apache.james.domainlist.api.DomainList;
+import org.apache.james.domainlist.api.mock.SimpleDomainList;
+import org.apache.james.domainlist.cassandra.CassandraDomainListModule;
+import org.apache.james.sieve.cassandra.CassandraSieveQuotaDAO;
+import org.apache.james.sieve.cassandra.CassandraSieveQuotaDAOV1;
+import org.apache.james.sieve.cassandra.CassandraSieveQuotaDAOV2;
+import org.apache.james.sieve.cassandra.CassandraSieveQuotaModule;
+import org.apache.james.sieve.cassandra.CassandraSieveRepositoryModule;
+import org.apache.james.user.api.UsersRepository;
+import org.apache.james.user.cassandra.CassandraUsersDAO;
+import org.apache.james.user.cassandra.CassandraUsersRepositoryModule;
+import org.apache.james.user.lib.UsersRepositoryImpl;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+class SieveQuotaMigrationTest {
+ public static final Username BOB = Username.of("bob");
+
+ private UsersRepositoryImpl<CassandraUsersDAO> getUsersRepository() throws Exception {
+ boolean enableVirtualHosting = false;
+ DomainList domainList = new SimpleDomainList();
+ domainList.addDomain(Domain.of("domain.tld"));
+ CassandraUsersDAO usersDAO = new CassandraUsersDAO(cassandraCluster.getCassandraCluster().getConf());
+ BaseHierarchicalConfiguration configuration = new BaseHierarchicalConfiguration();
+ configuration.addProperty("enableVirtualHosting", String.valueOf(enableVirtualHosting));
+
+ UsersRepositoryImpl<CassandraUsersDAO> usersRepository = new UsersRepositoryImpl<>(domainList, usersDAO);
+ usersRepository.configure(configuration);
+ return usersRepository;
+ }
+
+ @RegisterExtension
+ static CassandraClusterExtension cassandraCluster = new CassandraClusterExtension(CassandraModule.aggregateModules(
+ CassandraSieveQuotaModule.MODULE,
+ CassandraUsersRepositoryModule.MODULE,
+ CassandraDomainListModule.MODULE,
+ CassandraMutualizedQuotaModule.MODULE));
+
+ private CassandraSieveQuotaDAOV1 oldDAO;
+ private CassandraSieveQuotaDAOV2 newDAO;
+ private SieveQuotaMigration testee;
+
+ @BeforeEach
+ void setUp() throws Exception {
+ oldDAO = new CassandraSieveQuotaDAOV1(cassandraCluster.getCassandraCluster().getConf());
+ newDAO = new CassandraSieveQuotaDAOV2(new CassandraQuotaCurrentValueDao(cassandraCluster.getCassandraCluster().getConf()),
+ new CassandraQuotaLimitDao(cassandraCluster.getCassandraCluster().getConf()));
+ UsersRepository usersRepository = getUsersRepository();
+
+ usersRepository.addUser(BOB, "passBob");
+
+ testee = new SieveQuotaMigration(usersRepository, oldDAO, newDAO);
+ }
+
+ @Test
+ void shouldMigrateGlobalLimit() throws Exception {
+ oldDAO.setQuota(QuotaSizeLimit.size(32)).block();
+
+ testee.apply();
+
+ assertThat(oldDAO.getQuota().block())
+ .contains(QuotaSizeLimit.size(32));
+ }
+
+ @Test
+ void shouldNotFailWhenNoGlobalLimit() throws Exception {
+ testee.apply();
+
+ assertThat(oldDAO.getQuota().block())
Review Comment:
newDao?
##########
server/data/data-cassandra/src/test/java/org/apache/james/sieve/cassandra/migration/SieveQuotaMigrationTest.java:
##########
@@ -0,0 +1,142 @@
+/****************************************************************
+ * 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.sieve.cassandra.migration;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.commons.configuration2.BaseHierarchicalConfiguration;
+import org.apache.james.backends.cassandra.CassandraClusterExtension;
+import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.backends.cassandra.components.CassandraMutualizedQuotaModule;
+import org.apache.james.backends.cassandra.components.CassandraQuotaCurrentValueDao;
+import org.apache.james.backends.cassandra.components.CassandraQuotaLimitDao;
+import org.apache.james.core.Domain;
+import org.apache.james.core.Username;
+import org.apache.james.core.quota.QuotaSizeLimit;
+import org.apache.james.domainlist.api.DomainList;
+import org.apache.james.domainlist.api.mock.SimpleDomainList;
+import org.apache.james.domainlist.cassandra.CassandraDomainListModule;
+import org.apache.james.sieve.cassandra.CassandraSieveQuotaDAO;
+import org.apache.james.sieve.cassandra.CassandraSieveQuotaDAOV1;
+import org.apache.james.sieve.cassandra.CassandraSieveQuotaDAOV2;
+import org.apache.james.sieve.cassandra.CassandraSieveQuotaModule;
+import org.apache.james.sieve.cassandra.CassandraSieveRepositoryModule;
+import org.apache.james.user.api.UsersRepository;
+import org.apache.james.user.cassandra.CassandraUsersDAO;
+import org.apache.james.user.cassandra.CassandraUsersRepositoryModule;
+import org.apache.james.user.lib.UsersRepositoryImpl;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+class SieveQuotaMigrationTest {
+ public static final Username BOB = Username.of("bob");
+
+ private UsersRepositoryImpl<CassandraUsersDAO> getUsersRepository() throws Exception {
+ boolean enableVirtualHosting = false;
+ DomainList domainList = new SimpleDomainList();
+ domainList.addDomain(Domain.of("domain.tld"));
+ CassandraUsersDAO usersDAO = new CassandraUsersDAO(cassandraCluster.getCassandraCluster().getConf());
+ BaseHierarchicalConfiguration configuration = new BaseHierarchicalConfiguration();
+ configuration.addProperty("enableVirtualHosting", String.valueOf(enableVirtualHosting));
+
+ UsersRepositoryImpl<CassandraUsersDAO> usersRepository = new UsersRepositoryImpl<>(domainList, usersDAO);
+ usersRepository.configure(configuration);
+ return usersRepository;
+ }
+
+ @RegisterExtension
+ static CassandraClusterExtension cassandraCluster = new CassandraClusterExtension(CassandraModule.aggregateModules(
+ CassandraSieveQuotaModule.MODULE,
+ CassandraUsersRepositoryModule.MODULE,
+ CassandraDomainListModule.MODULE,
+ CassandraMutualizedQuotaModule.MODULE));
+
+ private CassandraSieveQuotaDAOV1 oldDAO;
+ private CassandraSieveQuotaDAOV2 newDAO;
+ private SieveQuotaMigration testee;
+
+ @BeforeEach
+ void setUp() throws Exception {
+ oldDAO = new CassandraSieveQuotaDAOV1(cassandraCluster.getCassandraCluster().getConf());
+ newDAO = new CassandraSieveQuotaDAOV2(new CassandraQuotaCurrentValueDao(cassandraCluster.getCassandraCluster().getConf()),
+ new CassandraQuotaLimitDao(cassandraCluster.getCassandraCluster().getConf()));
+ UsersRepository usersRepository = getUsersRepository();
+
+ usersRepository.addUser(BOB, "passBob");
+
+ testee = new SieveQuotaMigration(usersRepository, oldDAO, newDAO);
+ }
+
+ @Test
+ void shouldMigrateGlobalLimit() throws Exception {
+ oldDAO.setQuota(QuotaSizeLimit.size(32)).block();
+
+ testee.apply();
+
+ assertThat(oldDAO.getQuota().block())
+ .contains(QuotaSizeLimit.size(32));
+ }
+
+ @Test
+ void shouldNotFailWhenNoGlobalLimit() throws Exception {
+ testee.apply();
+
+ assertThat(oldDAO.getQuota().block())
+ .isEmpty();
+ }
+
+ @Test
+ void shouldNotFailWhenNoUserLimit() throws Exception {
+ testee.apply();
+
+ assertThat(oldDAO.getQuota(BOB).block())
+ .isEmpty();
+ }
+
+ @Test
+ void shouldNotFailWhenNoSpaceUsed() throws Exception {
+ testee.apply();
+
+ assertThat(oldDAO.spaceUsedBy(BOB).block())
Review Comment:
newDao?
##########
server/data/data-cassandra/src/test/java/org/apache/james/sieve/cassandra/migration/SieveQuotaMigrationTest.java:
##########
@@ -0,0 +1,142 @@
+/****************************************************************
+ * 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.sieve.cassandra.migration;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.commons.configuration2.BaseHierarchicalConfiguration;
+import org.apache.james.backends.cassandra.CassandraClusterExtension;
+import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.backends.cassandra.components.CassandraMutualizedQuotaModule;
+import org.apache.james.backends.cassandra.components.CassandraQuotaCurrentValueDao;
+import org.apache.james.backends.cassandra.components.CassandraQuotaLimitDao;
+import org.apache.james.core.Domain;
+import org.apache.james.core.Username;
+import org.apache.james.core.quota.QuotaSizeLimit;
+import org.apache.james.domainlist.api.DomainList;
+import org.apache.james.domainlist.api.mock.SimpleDomainList;
+import org.apache.james.domainlist.cassandra.CassandraDomainListModule;
+import org.apache.james.sieve.cassandra.CassandraSieveQuotaDAO;
+import org.apache.james.sieve.cassandra.CassandraSieveQuotaDAOV1;
+import org.apache.james.sieve.cassandra.CassandraSieveQuotaDAOV2;
+import org.apache.james.sieve.cassandra.CassandraSieveQuotaModule;
+import org.apache.james.sieve.cassandra.CassandraSieveRepositoryModule;
+import org.apache.james.user.api.UsersRepository;
+import org.apache.james.user.cassandra.CassandraUsersDAO;
+import org.apache.james.user.cassandra.CassandraUsersRepositoryModule;
+import org.apache.james.user.lib.UsersRepositoryImpl;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+class SieveQuotaMigrationTest {
+ public static final Username BOB = Username.of("bob");
+
+ private UsersRepositoryImpl<CassandraUsersDAO> getUsersRepository() throws Exception {
+ boolean enableVirtualHosting = false;
+ DomainList domainList = new SimpleDomainList();
+ domainList.addDomain(Domain.of("domain.tld"));
+ CassandraUsersDAO usersDAO = new CassandraUsersDAO(cassandraCluster.getCassandraCluster().getConf());
+ BaseHierarchicalConfiguration configuration = new BaseHierarchicalConfiguration();
+ configuration.addProperty("enableVirtualHosting", String.valueOf(enableVirtualHosting));
+
+ UsersRepositoryImpl<CassandraUsersDAO> usersRepository = new UsersRepositoryImpl<>(domainList, usersDAO);
+ usersRepository.configure(configuration);
+ return usersRepository;
+ }
+
+ @RegisterExtension
+ static CassandraClusterExtension cassandraCluster = new CassandraClusterExtension(CassandraModule.aggregateModules(
+ CassandraSieveQuotaModule.MODULE,
+ CassandraUsersRepositoryModule.MODULE,
+ CassandraDomainListModule.MODULE,
+ CassandraMutualizedQuotaModule.MODULE));
+
+ private CassandraSieveQuotaDAOV1 oldDAO;
+ private CassandraSieveQuotaDAOV2 newDAO;
+ private SieveQuotaMigration testee;
+
+ @BeforeEach
+ void setUp() throws Exception {
+ oldDAO = new CassandraSieveQuotaDAOV1(cassandraCluster.getCassandraCluster().getConf());
+ newDAO = new CassandraSieveQuotaDAOV2(new CassandraQuotaCurrentValueDao(cassandraCluster.getCassandraCluster().getConf()),
+ new CassandraQuotaLimitDao(cassandraCluster.getCassandraCluster().getConf()));
+ UsersRepository usersRepository = getUsersRepository();
+
+ usersRepository.addUser(BOB, "passBob");
+
+ testee = new SieveQuotaMigration(usersRepository, oldDAO, newDAO);
+ }
+
+ @Test
+ void shouldMigrateGlobalLimit() throws Exception {
+ oldDAO.setQuota(QuotaSizeLimit.size(32)).block();
+
+ testee.apply();
+
+ assertThat(oldDAO.getQuota().block())
Review Comment:
newDao?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
[GitHub] [james-project] chibenwa merged pull request #1700: JAMES-3926 Migrate Sieve quotas to mutalized quota system
Posted by "chibenwa (via GitHub)" <gi...@apache.org>.
chibenwa merged PR #1700:
URL: https://github.com/apache/james-project/pull/1700
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
[GitHub] [james-project] chibenwa commented on a diff in pull request #1700: JAMES-3926 Migrate Sieve quotas to mutalized quota system
Posted by "chibenwa (via GitHub)" <gi...@apache.org>.
chibenwa commented on code in PR #1700:
URL: https://github.com/apache/james-project/pull/1700#discussion_r1308843318
##########
server/apps/cassandra-app/src/main/java/org/apache/james/CassandraJamesServerConfiguration.java:
##########
@@ -142,6 +149,14 @@ public CassandraJamesServerConfiguration build() {
}
});
+ boolean quotaCompatibilityMode = this.quotaCompatibilityMode.orElseGet(() -> {
+ try {
+ return configurationProvider.getConfiguration("cassandra").getBoolean("quota.compatibility.mode", false);
Review Comment:
Was intentionnal as this is used only for migration purposes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
[GitHub] [james-project] Arsnael commented on pull request #1700: JAMES-3926 Migrate Sieve quotas to mutalized quota system
Posted by "Arsnael (via GitHub)" <gi...@apache.org>.
Arsnael commented on PR #1700:
URL: https://github.com/apache/james-project/pull/1700#issuecomment-1692743035
Needs a rebase though :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
[GitHub] [james-project] Arsnael commented on pull request #1700: JAMES-3926 Migrate Sieve quotas to mutalized quota system
Posted by "Arsnael (via GitHub)" <gi...@apache.org>.
Arsnael commented on PR #1700:
URL: https://github.com/apache/james-project/pull/1700#issuecomment-1694963992
```
18:38:57,047 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.3.0:check (check-style) on project james-server-guice-cassandra: You have 2 Checkstyle violations. -> [Help 1]
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
[GitHub] [james-project] Arsnael commented on pull request #1700: JAMES-3926 Migrate Sieve quotas to mutalized quota system
Posted by "Arsnael (via GitHub)" <gi...@apache.org>.
Arsnael commented on PR #1700:
URL: https://github.com/apache/james-project/pull/1700#issuecomment-1700276775
https://ci-builds.apache.org/job/james/job/ApacheJames/job/PR-1700/15/
related?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org