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 2019/11/11 08:05:01 UTC
[james-project] 01/09: [Refactoring] Small constant refactoring in
DomainQuotaRoutesTest
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 36e3e15d8faef2e473b9d7e4f5473ed28cbf3bbc
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Thu Nov 7 11:28:08 2019 +0700
[Refactoring] Small constant refactoring in DomainQuotaRoutesTest
Let's stop using french constants with accents and replace them by their english equivalent ones instead
---
.../DomainQuotaRoutesNoVirtualHostingTest.java | 20 ++--
.../webadmin/routes/DomainQuotaRoutesTest.java | 120 ++++++++++-----------
.../james/webadmin/routes/UserQuotaRoutesTest.java | 30 +++---
3 files changed, 85 insertions(+), 85 deletions(-)
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesNoVirtualHostingTest.java b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesNoVirtualHostingTest.java
index ec83566..1fc9ffc 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesNoVirtualHostingTest.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesNoVirtualHostingTest.java
@@ -44,7 +44,7 @@ import io.restassured.RestAssured;
class DomainQuotaRoutesNoVirtualHostingTest {
private static final String QUOTA_DOMAINS = "/quota/domains";
- private static final String FOUND_COM = "found.com";
+ private static final String FOUND_LOCAL = "found.local";
private static final String COUNT = "count";
private static final String SIZE = "size";
private WebAdminServer webAdminServer;
@@ -54,7 +54,7 @@ class DomainQuotaRoutesNoVirtualHostingTest {
InMemoryPerUserMaxQuotaManager maxQuotaManager = new InMemoryPerUserMaxQuotaManager();
MemoryDomainList memoryDomainList = new MemoryDomainList(new InMemoryDNSService());
memoryDomainList.setAutoDetect(false);
- memoryDomainList.addDomain(Domain.of(FOUND_COM));
+ memoryDomainList.addDomain(Domain.of(FOUND_LOCAL));
DomainQuotaService domainQuotaService = new DomainQuotaService(maxQuotaManager);
QuotaModule quotaModule = new QuotaModule();
MemoryUsersRepository usersRepository = MemoryUsersRepository.withoutVirtualHosting();
@@ -74,9 +74,9 @@ class DomainQuotaRoutesNoVirtualHostingTest {
@ParameterizedTest
@ValueSource(strings = {
- QUOTA_DOMAINS + "/" + FOUND_COM,
- QUOTA_DOMAINS + "/" + FOUND_COM + "/" + COUNT,
- QUOTA_DOMAINS + "/" + FOUND_COM + "/" + SIZE })
+ QUOTA_DOMAINS + "/" + FOUND_LOCAL,
+ QUOTA_DOMAINS + "/" + FOUND_LOCAL + "/" + COUNT,
+ QUOTA_DOMAINS + "/" + FOUND_LOCAL + "/" + SIZE })
void allGetEndpointsShouldReturnNotAllowed(String endpoint) {
given()
.get(endpoint)
@@ -86,9 +86,9 @@ class DomainQuotaRoutesNoVirtualHostingTest {
@ParameterizedTest
@ValueSource(strings = {
- QUOTA_DOMAINS + "/" + FOUND_COM,
- QUOTA_DOMAINS + "/" + FOUND_COM + "/" + COUNT,
- QUOTA_DOMAINS + "/" + FOUND_COM + "/" + SIZE })
+ QUOTA_DOMAINS + "/" + FOUND_LOCAL,
+ QUOTA_DOMAINS + "/" + FOUND_LOCAL + "/" + COUNT,
+ QUOTA_DOMAINS + "/" + FOUND_LOCAL + "/" + SIZE })
void allPutEndpointsShouldReturnNotAllowed(String endpoint) {
given()
.put(endpoint)
@@ -98,8 +98,8 @@ class DomainQuotaRoutesNoVirtualHostingTest {
@ParameterizedTest
@ValueSource(strings = {
- QUOTA_DOMAINS + "/" + FOUND_COM + "/" + COUNT,
- QUOTA_DOMAINS + "/" + FOUND_COM + "/" + SIZE })
+ QUOTA_DOMAINS + "/" + FOUND_LOCAL + "/" + COUNT,
+ QUOTA_DOMAINS + "/" + FOUND_LOCAL + "/" + SIZE })
void allDeleteEndpointsShouldReturnNotAllowed(String endpoint) {
given()
.delete(endpoint)
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesTest.java b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesTest.java
index 2c654e2..17c1770 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesTest.java
@@ -43,8 +43,8 @@ import io.restassured.path.json.JsonPath;
class DomainQuotaRoutesTest {
private static final String QUOTA_DOMAINS = "/quota/domains";
- private static final String PERDU_COM = "perdu.com";
- private static final Domain TROUVÉ_COM = Domain.of("trouvé.com");
+ private static final String LOST_LOCAL = "lost.local";
+ private static final Domain FOUND_LOCAL = Domain.of("found.local");
private static final String COUNT = "count";
private static final String SIZE = "size";
private MaxQuotaManager maxQuotaManager;
@@ -52,7 +52,7 @@ class DomainQuotaRoutesTest {
@BeforeEach
void setUp(WebAdminQuotaSearchTestSystem testSystem) throws Exception {
testSystem.getQuotaSearchTestSystem().getDomainList()
- .addDomain(TROUVÉ_COM);
+ .addDomain(FOUND_LOCAL);
maxQuotaManager = testSystem.getQuotaSearchTestSystem().getMaxQuotaManager();
@@ -63,7 +63,7 @@ class DomainQuotaRoutesTest {
@Test
void getCountShouldReturnNotFoundWhenDomainDoesntExist() {
when()
- .get(QUOTA_DOMAINS + "/" + PERDU_COM + "/" + COUNT)
+ .get(QUOTA_DOMAINS + "/" + LOST_LOCAL + "/" + COUNT)
.then()
.statusCode(HttpStatus.NOT_FOUND_404);
}
@@ -71,7 +71,7 @@ class DomainQuotaRoutesTest {
@Test
void getCountShouldReturnNoContentByDefault() {
given()
- .get(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name() + "/" + COUNT)
+ .get(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name() + "/" + COUNT)
.then()
.statusCode(HttpStatus.NO_CONTENT_204);
}
@@ -79,11 +79,11 @@ class DomainQuotaRoutesTest {
@Test
void getCountShouldReturnStoredValue() throws Exception {
int value = 42;
- maxQuotaManager.setDomainMaxMessage(TROUVÉ_COM, QuotaCount.count(value));
+ maxQuotaManager.setDomainMaxMessage(FOUND_LOCAL, QuotaCount.count(value));
Long actual =
given()
- .get(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name() + "/" + COUNT)
+ .get(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name() + "/" + COUNT)
.then()
.statusCode(HttpStatus.OK_200)
.contentType(ContentType.JSON)
@@ -98,7 +98,7 @@ class DomainQuotaRoutesTest {
given()
.body("123")
.when()
- .put(QUOTA_DOMAINS + "/" + PERDU_COM + "/" + COUNT)
+ .put(QUOTA_DOMAINS + "/" + LOST_LOCAL + "/" + COUNT)
.then()
.statusCode(HttpStatus.NOT_FOUND_404);
}
@@ -107,7 +107,7 @@ class DomainQuotaRoutesTest {
void putCountShouldRejectInvalid() {
Map<String, Object> errors = given()
.body("invalid")
- .put(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name() + "/" + COUNT)
+ .put(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name() + "/" + COUNT)
.then()
.statusCode(HttpStatus.BAD_REQUEST_400)
.contentType(ContentType.JSON)
@@ -128,18 +128,18 @@ class DomainQuotaRoutesTest {
given()
.body("-1")
.when()
- .put(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name() + "/" + COUNT)
+ .put(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name() + "/" + COUNT)
.then()
.statusCode(HttpStatus.NO_CONTENT_204);
- assertThat(maxQuotaManager.getDomainMaxMessage(TROUVÉ_COM)).contains(QuotaCount.unlimited());
+ assertThat(maxQuotaManager.getDomainMaxMessage(FOUND_LOCAL)).contains(QuotaCount.unlimited());
}
@Test
void putCountShouldRejectNegativeOtherThanMinusOne() {
Map<String, Object> errors = given()
.body("-2")
- .put(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name() + "/" + COUNT)
+ .put(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name() + "/" + COUNT)
.then()
.statusCode(HttpStatus.BAD_REQUEST_400)
.contentType(ContentType.JSON)
@@ -158,37 +158,37 @@ class DomainQuotaRoutesTest {
void putCountShouldAcceptValidValue() {
given()
.body("42")
- .put(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name() + "/" + COUNT)
+ .put(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name() + "/" + COUNT)
.then()
.statusCode(HttpStatus.NO_CONTENT_204);
- assertThat(maxQuotaManager.getDomainMaxMessage(TROUVÉ_COM)).contains(QuotaCount.count(42));
+ assertThat(maxQuotaManager.getDomainMaxMessage(FOUND_LOCAL)).contains(QuotaCount.count(42));
}
@Test
void deleteCountShouldReturnNotFoundWhenDomainDoesntExist() {
when()
- .delete(QUOTA_DOMAINS + "/" + PERDU_COM + "/" + COUNT)
+ .delete(QUOTA_DOMAINS + "/" + LOST_LOCAL + "/" + COUNT)
.then()
.statusCode(HttpStatus.NOT_FOUND_404);
}
@Test
void deleteCountShouldSetQuotaToEmpty() throws Exception {
- maxQuotaManager.setDomainMaxMessage(TROUVÉ_COM, QuotaCount.count(42));
+ maxQuotaManager.setDomainMaxMessage(FOUND_LOCAL, QuotaCount.count(42));
given()
- .delete(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name() + "/" + COUNT)
+ .delete(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name() + "/" + COUNT)
.then()
.statusCode(HttpStatus.NO_CONTENT_204);
- assertThat(maxQuotaManager.getDomainMaxMessage(TROUVÉ_COM)).isEmpty();
+ assertThat(maxQuotaManager.getDomainMaxMessage(FOUND_LOCAL)).isEmpty();
}
@Test
void getSizeShouldReturnNotFoundWhenDomainDoesntExist() {
when()
- .get(QUOTA_DOMAINS + "/" + PERDU_COM + "/" + SIZE)
+ .get(QUOTA_DOMAINS + "/" + LOST_LOCAL + "/" + SIZE)
.then()
.statusCode(HttpStatus.NOT_FOUND_404);
}
@@ -196,7 +196,7 @@ class DomainQuotaRoutesTest {
@Test
void getSizeShouldReturnNoContentByDefault() {
when()
- .get(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name() + "/" + SIZE)
+ .get(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name() + "/" + SIZE)
.then()
.statusCode(HttpStatus.NO_CONTENT_204);
}
@@ -204,11 +204,11 @@ class DomainQuotaRoutesTest {
@Test
void getSizeShouldReturnStoredValue() throws Exception {
long value = 42;
- maxQuotaManager.setDomainMaxStorage(TROUVÉ_COM, QuotaSize.size(value));
+ maxQuotaManager.setDomainMaxStorage(FOUND_LOCAL, QuotaSize.size(value));
long quota =
given()
- .get(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name() + "/" + SIZE)
+ .get(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name() + "/" + SIZE)
.then()
.statusCode(HttpStatus.OK_200)
.contentType(ContentType.JSON)
@@ -222,7 +222,7 @@ class DomainQuotaRoutesTest {
void putSizeShouldRejectInvalid() {
Map<String, Object> errors = given()
.body("invalid")
- .put(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name() + "/" + SIZE)
+ .put(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name() + "/" + SIZE)
.then()
.statusCode(HttpStatus.BAD_REQUEST_400)
.contentType(ContentType.JSON)
@@ -243,7 +243,7 @@ class DomainQuotaRoutesTest {
given()
.body("123")
.when()
- .put(QUOTA_DOMAINS + "/" + PERDU_COM + "/" + SIZE)
+ .put(QUOTA_DOMAINS + "/" + LOST_LOCAL + "/" + SIZE)
.then()
.statusCode(HttpStatus.NOT_FOUND_404);
}
@@ -253,18 +253,18 @@ class DomainQuotaRoutesTest {
given()
.body("-1")
.when()
- .put(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name() + "/" + SIZE)
+ .put(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name() + "/" + SIZE)
.then()
.statusCode(HttpStatus.NO_CONTENT_204);
- assertThat(maxQuotaManager.getDomainMaxStorage(TROUVÉ_COM)).contains(QuotaSize.unlimited());
+ assertThat(maxQuotaManager.getDomainMaxStorage(FOUND_LOCAL)).contains(QuotaSize.unlimited());
}
@Test
void putSizeShouldRejectNegativeOtherThanMinusOne() {
Map<String, Object> errors = given()
.body("-2")
- .put(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name() + "/" + SIZE)
+ .put(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name() + "/" + SIZE)
.then()
.statusCode(HttpStatus.BAD_REQUEST_400)
.contentType(ContentType.JSON)
@@ -284,37 +284,37 @@ class DomainQuotaRoutesTest {
given()
.body("42")
.when()
- .put(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name() + "/" + SIZE)
+ .put(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name() + "/" + SIZE)
.then()
.statusCode(HttpStatus.NO_CONTENT_204);
- assertThat(maxQuotaManager.getDomainMaxStorage(TROUVÉ_COM)).contains(QuotaSize.size(42));
+ assertThat(maxQuotaManager.getDomainMaxStorage(FOUND_LOCAL)).contains(QuotaSize.size(42));
}
@Test
void deleteSizeShouldReturnNotFoundWhenDomainDoesntExist() {
when()
- .delete(QUOTA_DOMAINS + "/" + PERDU_COM + "/" + SIZE)
+ .delete(QUOTA_DOMAINS + "/" + LOST_LOCAL + "/" + SIZE)
.then()
.statusCode(HttpStatus.NOT_FOUND_404);
}
@Test
void deleteSizeShouldSetQuotaToEmpty() throws Exception {
- maxQuotaManager.setDomainMaxStorage(TROUVÉ_COM, QuotaSize.size(42));
+ maxQuotaManager.setDomainMaxStorage(FOUND_LOCAL, QuotaSize.size(42));
given()
- .delete(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name() + "/" + SIZE)
+ .delete(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name() + "/" + SIZE)
.then()
.statusCode(HttpStatus.NO_CONTENT_204);
- assertThat(maxQuotaManager.getDomainMaxStorage(TROUVÉ_COM)).isEmpty();
+ assertThat(maxQuotaManager.getDomainMaxStorage(FOUND_LOCAL)).isEmpty();
}
@Test
void getQuotaShouldReturnNotFoundWhenDomainDoesntExist() {
when()
- .get(QUOTA_DOMAINS + "/" + PERDU_COM)
+ .get(QUOTA_DOMAINS + "/" + LOST_LOCAL)
.then()
.statusCode(HttpStatus.NOT_FOUND_404);
}
@@ -323,7 +323,7 @@ class DomainQuotaRoutesTest {
void getQuotaShouldReturnBothEmptyWhenDefaultValues() {
JsonPath jsonPath =
given()
- .get(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name())
+ .get(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name())
.then()
.statusCode(HttpStatus.OK_200)
.contentType(ContentType.JSON)
@@ -337,11 +337,11 @@ class DomainQuotaRoutesTest {
@Test
void getQuotaShouldReturnSizeWhenNoCount() throws Exception {
int maxStorage = 42;
- maxQuotaManager.setDomainMaxStorage(TROUVÉ_COM, QuotaSize.size(maxStorage));
+ maxQuotaManager.setDomainMaxStorage(FOUND_LOCAL, QuotaSize.size(maxStorage));
String json =
given()
- .get(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name())
+ .get(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name())
.then()
.statusCode(HttpStatus.OK_200)
.contentType(ContentType.JSON)
@@ -359,11 +359,11 @@ class DomainQuotaRoutesTest {
@Test
void getQuotaShouldReturnBothWhenNoSize() throws Exception {
int maxMessage = 42;
- maxQuotaManager.setDomainMaxMessage(TROUVÉ_COM, QuotaCount.count(maxMessage));
+ maxQuotaManager.setDomainMaxMessage(FOUND_LOCAL, QuotaCount.count(maxMessage));
String json =
given()
- .get(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name())
+ .get(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name())
.then()
.statusCode(HttpStatus.OK_200)
.contentType(ContentType.JSON)
@@ -383,12 +383,12 @@ class DomainQuotaRoutesTest {
int maxMessage = 42;
maxQuotaManager.setGlobalMaxMessage(QuotaCount.unlimited());
maxQuotaManager.setGlobalMaxStorage(QuotaSize.size(42));
- maxQuotaManager.setDomainMaxMessage(TROUVÉ_COM, QuotaCount.count(maxMessage));
- maxQuotaManager.setDomainMaxStorage(TROUVÉ_COM, QuotaSize.unlimited());
+ maxQuotaManager.setDomainMaxMessage(FOUND_LOCAL, QuotaCount.count(maxMessage));
+ maxQuotaManager.setDomainMaxStorage(FOUND_LOCAL, QuotaSize.unlimited());
String json =
given()
- .get(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name())
+ .get(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name())
.then()
.statusCode(HttpStatus.OK_200)
.contentType(ContentType.JSON)
@@ -406,13 +406,13 @@ class DomainQuotaRoutesTest {
@Test
void getQuotaShouldDisplayScopedInformation() throws Exception {
int maxMessage = 42;
- maxQuotaManager.setDomainMaxMessage(TROUVÉ_COM, QuotaCount.count(maxMessage));
+ maxQuotaManager.setDomainMaxMessage(FOUND_LOCAL, QuotaCount.count(maxMessage));
maxQuotaManager.setGlobalMaxMessage(QuotaCount.count(32));
maxQuotaManager.setGlobalMaxStorage(QuotaSize.size(36));
String json =
given()
- .get(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name())
+ .get(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name())
.then()
.statusCode(HttpStatus.OK_200)
.contentType(ContentType.JSON)
@@ -430,7 +430,7 @@ class DomainQuotaRoutesTest {
@Test
void putQuotaShouldReturnNotFoundWhenDomainDoesntExist() {
when()
- .put(QUOTA_DOMAINS + "/" + PERDU_COM)
+ .put(QUOTA_DOMAINS + "/" + LOST_LOCAL)
.then()
.statusCode(HttpStatus.NOT_FOUND_404);
}
@@ -439,69 +439,69 @@ class DomainQuotaRoutesTest {
void putQuotaShouldUpdateBothQuota() {
given()
.body("{\"count\":52,\"size\":42}")
- .put(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name())
+ .put(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name())
.then()
.statusCode(HttpStatus.NO_CONTENT_204);
- assertThat(maxQuotaManager.getDomainMaxMessage(TROUVÉ_COM)).contains(QuotaCount.count(52));
- assertThat(maxQuotaManager.getDomainMaxStorage(TROUVÉ_COM)).contains(QuotaSize.size(42));
+ assertThat(maxQuotaManager.getDomainMaxMessage(FOUND_LOCAL)).contains(QuotaCount.count(52));
+ assertThat(maxQuotaManager.getDomainMaxStorage(FOUND_LOCAL)).contains(QuotaSize.size(42));
}
@Test
void putQuotaShouldBeAbleToRemoveBothQuota() {
given()
.body("{\"count\":52,\"size\":42}")
- .put(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name())
+ .put(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name())
.then()
.statusCode(HttpStatus.NO_CONTENT_204);
given()
.body("{\"count\":null,\"size\":null}")
- .put(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name())
+ .put(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name())
.then()
.statusCode(HttpStatus.NO_CONTENT_204);
- assertThat(maxQuotaManager.getDomainMaxStorage(TROUVÉ_COM)).isEmpty();
- assertThat(maxQuotaManager.getDomainMaxMessage(TROUVÉ_COM)).isEmpty();
+ assertThat(maxQuotaManager.getDomainMaxStorage(FOUND_LOCAL)).isEmpty();
+ assertThat(maxQuotaManager.getDomainMaxMessage(FOUND_LOCAL)).isEmpty();
}
@Test
void putQuotaShouldBeAbleToRemoveCountQuota() {
given()
.body("{\"count\":52,\"size\":42}")
- .put(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name())
+ .put(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name())
.then()
.statusCode(HttpStatus.NO_CONTENT_204);
given()
.body("{\"count\":null,\"size\":42}")
- .put(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name())
+ .put(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name())
.then()
.statusCode(HttpStatus.NO_CONTENT_204);
- assertThat(maxQuotaManager.getDomainMaxStorage(TROUVÉ_COM)).contains(QuotaSize.size(42));
- assertThat(maxQuotaManager.getDomainMaxMessage(TROUVÉ_COM)).isEmpty();
+ assertThat(maxQuotaManager.getDomainMaxStorage(FOUND_LOCAL)).contains(QuotaSize.size(42));
+ assertThat(maxQuotaManager.getDomainMaxMessage(FOUND_LOCAL)).isEmpty();
}
@Test
void putQuotaShouldBeAbleToRemoveSizeQuota() {
given()
.body("{\"count\":52,\"size\":42}")
- .put(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name())
+ .put(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name())
.then()
.statusCode(HttpStatus.NO_CONTENT_204);
given()
.body("{\"count\":52,\"size\":null}")
- .put(QUOTA_DOMAINS + "/" + TROUVÉ_COM.name())
+ .put(QUOTA_DOMAINS + "/" + FOUND_LOCAL.name())
.then()
.statusCode(HttpStatus.NO_CONTENT_204);
- assertThat(maxQuotaManager.getDomainMaxStorage(TROUVÉ_COM)).isEmpty();
- assertThat(maxQuotaManager.getDomainMaxMessage(TROUVÉ_COM)).contains(QuotaCount.count(52));
+ assertThat(maxQuotaManager.getDomainMaxStorage(FOUND_LOCAL)).isEmpty();
+ assertThat(maxQuotaManager.getDomainMaxMessage(FOUND_LOCAL)).contains(QuotaCount.count(52));
}
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserQuotaRoutesTest.java b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserQuotaRoutesTest.java
index c65e891..e645f22 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserQuotaRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserQuotaRoutesTest.java
@@ -65,22 +65,22 @@ import io.restassured.path.json.JsonPath;
class UserQuotaRoutesTest {
private static final String QUOTA_USERS = "/quota/users";
- private static final String PERDU_COM = "perdu.com";
- private static final String STRANGE_ORG = "strange.org";
- private static final Username BOB = Username.of("bob@" + PERDU_COM);
- private static final Username ESCAPED_BOB = Username.of("bob%40" + PERDU_COM);
- private static final Username JOE = Username.of("joe@" + PERDU_COM);
- private static final Username JACK = Username.of("jack@" + PERDU_COM);
- private static final Username GUY_WITH_STRANGE_DOMAIN = Username.of("guy@" + STRANGE_ORG);
+ private static final String LOST_LOCAL = "lost.local";
+ private static final String STRANGE_LOCAL = "strange.local";
+ private static final Username BOB = Username.of("bob@" + LOST_LOCAL);
+ private static final Username ESCAPED_BOB = Username.of("bob%40" + LOST_LOCAL);
+ private static final Username JOE = Username.of("joe@" + LOST_LOCAL);
+ private static final Username JACK = Username.of("jack@" + LOST_LOCAL);
+ private static final Username GUY_WITH_STRANGE_DOMAIN = Username.of("guy@" + STRANGE_LOCAL);
private static final String PASSWORD = "secret";
private static final String COUNT = "count";
private static final String SIZE = "size";
@BeforeEach
- public void setUp(WebAdminQuotaSearchTestSystem testSystem) throws Exception {
+ void setUp(WebAdminQuotaSearchTestSystem testSystem) throws Exception {
DomainList domainList = testSystem.getQuotaSearchTestSystem().getDomainList();
- domainList.addDomain(Domain.of(PERDU_COM));
- domainList.addDomain(Domain.of(STRANGE_ORG));
+ domainList.addDomain(Domain.of(LOST_LOCAL));
+ domainList.addDomain(Domain.of(STRANGE_LOCAL));
UsersRepository usersRepository = testSystem.getQuotaSearchTestSystem().getUsersRepository();
usersRepository.addUser(BOB.asString(), PASSWORD);
@@ -121,7 +121,7 @@ class UserQuotaRoutesTest {
testSystem.getQuotaSearchTestSystem().await();
given()
- .param("domain", PERDU_COM)
+ .param("domain", LOST_LOCAL)
.when()
.get("/quota/users")
.then()
@@ -428,7 +428,7 @@ class UserQuotaRoutesTest {
" }" +
" }" +
" }," +
- " \"username\": \"guy@strange.org\"" +
+ " \"username\": \"guy@strange.local\"" +
" }" +
"]");
}
@@ -814,8 +814,8 @@ class UserQuotaRoutesTest {
maxQuotaManager.setGlobalMaxStorage(QuotaSize.size(1111));
maxQuotaManager.setGlobalMaxMessage(QuotaCount.count(22));
- maxQuotaManager.setDomainMaxStorage(Domain.of(PERDU_COM), QuotaSize.size(34));
- maxQuotaManager.setDomainMaxMessage(Domain.of(PERDU_COM), QuotaCount.count(23));
+ maxQuotaManager.setDomainMaxStorage(Domain.of(LOST_LOCAL), QuotaSize.size(34));
+ maxQuotaManager.setDomainMaxMessage(Domain.of(LOST_LOCAL), QuotaCount.count(23));
maxQuotaManager.setMaxStorage(userQuotaRootResolver.forUser(BOB), QuotaSize.size(42));
maxQuotaManager.setMaxMessage(userQuotaRootResolver.forUser(BOB), QuotaCount.count(52));
@@ -903,7 +903,7 @@ class UserQuotaRoutesTest {
maxQuotaManager.setGlobalMaxStorage(QuotaSize.size(1111));
maxQuotaManager.setMaxMessage(userQuotaRootResolver.forUser(BOB), QuotaCount.count(18));
- maxQuotaManager.setDomainMaxMessage(Domain.of(PERDU_COM), QuotaCount.count(52));
+ maxQuotaManager.setDomainMaxMessage(Domain.of(LOST_LOCAL), QuotaCount.count(52));
JsonPath jsonPath =
when()
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org