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 af011d914ac41b5e9ebafd82227622ae5b058fd1 Author: Rene Cordier <rcord...@linagora.com> AuthorDate: Wed Apr 2 17:13:16 2025 +0700 [JAMES-3693] Remove unnecessary TLS tests Only one is enough for testing TLS settings --- .../redis/RedisMasterReplicaExtension.java | 82 +++++-------------- .../backends/redis/RedisSentinelExtension.java | 95 ++++------------------ .../RedisTLSMasterReplicaHealthCheckTest.java | 61 -------------- .../redis/RedisTLSSentinelHealthCheckTest.java | 61 -------------- ...ateLimiterWithTLSMasterReplicaTopologyTest.java | 33 -------- .../RedisRateLimiterWithTLSSentinelTest.java | 34 -------- .../rate/limiter/RedisRateLimiterWithTLSTest.scala | 37 --------- 7 files changed, 37 insertions(+), 366 deletions(-) diff --git a/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisMasterReplicaExtension.java b/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisMasterReplicaExtension.java index f535cc6bc7..a37457b8c7 100644 --- a/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisMasterReplicaExtension.java +++ b/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisMasterReplicaExtension.java @@ -34,12 +34,10 @@ import java.util.function.Function; import jakarta.inject.Singleton; import org.apache.james.GuiceModuleTestExtension; -import org.apache.james.filesystem.api.FileSystem; import org.apache.james.util.Runnables; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ParameterContext; import org.junit.jupiter.api.extension.ParameterResolutionException; -import org.testcontainers.containers.BindMode; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -55,29 +53,20 @@ import scala.jdk.javaapi.OptionConverters; public class RedisMasterReplicaExtension implements GuiceModuleTestExtension { public static final String START_REPLICA_COMMAND = "redis-server --appendonly yes --port 6379 --slaveof redis1 6379 --requirepass 123 --masterauth 123"; public static final String START_MASTER_COMMAND = "redis-server --appendonly yes --port 6379 --requirepass 123 --masterauth 123"; - public static final String TLS_REPLICA_COMMAND = "redis-server --appendonly yes --port 0 --slaveof redis1 6379 --requirepass 123 --masterauth 123" + - " --tls-port 6379 --tls-cert-file /etc/redis/certificate.crt --tls-key-file /etc/redis/private.key --tls-ca-cert-file /etc/redis/rootCA.crt --tls-replication yes"; - public static final String TLS_MASTER_COMMAND = "redis-server --appendonly yes --port 0 --requirepass 123 --masterauth 123" + - " --tls-port 6379 --tls-cert-file /etc/redis/certificate.crt --tls-key-file /etc/redis/private.key --tls-ca-cert-file /etc/redis/rootCA.crt --tls-replication yes"; public static class RedisMasterReplicaContainer extends ArrayList<GenericContainer> { private final MasterReplicaRedisConfiguration masterReplicaRedisConfiguration; - public RedisMasterReplicaContainer(Collection<? extends GenericContainer> c, boolean tlsEnabled) { + public RedisMasterReplicaContainer(Collection<? extends GenericContainer> c) { super(c); String[] redisUris = this.stream() - .map(redisURIFunction(tlsEnabled)) + .map(redisURIFunction()) .toArray(String[]::new); - if (tlsEnabled) { - masterReplicaRedisConfiguration = MasterReplicaRedisConfiguration.from(redisUris, - SSLConfiguration.from(FileSystem.CLASSPATH_PROTOCOL + "keystore.p12", "secret"), - ReadFrom.MASTER); - } else { - masterReplicaRedisConfiguration = MasterReplicaRedisConfiguration.from(redisUris, - ReadFrom.MASTER, - OptionConverters.toScala(Optional.empty()), - OptionConverters.toScala(Optional.empty())); - } + masterReplicaRedisConfiguration = MasterReplicaRedisConfiguration.from(redisUris, + ReadFrom.MASTER, + OptionConverters.toScala(Optional.empty()), + OptionConverters.toScala(Optional.empty())); + } public MasterReplicaRedisConfiguration getRedisConfiguration() { @@ -99,19 +88,11 @@ public class RedisMasterReplicaExtension implements GuiceModuleTestExtension { } } - private Function<GenericContainer, String> redisURIFunction(boolean tlsEnabled) { - if (tlsEnabled) { - return redisContainer -> "rediss://123@" + - redisContainer.getHost() + - ":" + - redisContainer.getMappedPort(DEFAULT_PORT) + - "?verifyPeer=NONE"; - } else { - return redisContainer -> "redis://123@" + - redisContainer.getHost() + - ":" + - redisContainer.getMappedPort(DEFAULT_PORT); - } + private Function<GenericContainer, String> redisURIFunction() { + return redisContainer -> "redis://123@" + + redisContainer.getHost() + + ":" + + redisContainer.getMappedPort(DEFAULT_PORT); } } @@ -120,20 +101,10 @@ public class RedisMasterReplicaExtension implements GuiceModuleTestExtension { final GenericContainer redis3; private RedisMasterReplicaContainer redisMasterReplicaContainer; - private final boolean tlsEnabled; private final Network network; public RedisMasterReplicaExtension() { - this(false, Network.newNetwork()); - } - - public RedisMasterReplicaExtension(boolean tlsEnable) { - this(tlsEnable, Network.newNetwork()); - } - - public RedisMasterReplicaExtension(boolean tlsEnable, Network network) { - this.tlsEnabled = tlsEnable; - this.network = network; + network = Network.newNetwork();; redis1 = createRedisContainer("redis1", false); redis2 = createRedisContainer("redis2", true); redis3 = createRedisContainer("redis3", true); @@ -147,7 +118,7 @@ public class RedisMasterReplicaExtension implements GuiceModuleTestExtension { redis1.start(); redis2.start(); redis3.start(); - redisMasterReplicaContainer = new RedisMasterReplicaContainer(List.of(redis1, redis2, redis3), tlsEnabled); + redisMasterReplicaContainer = new RedisMasterReplicaContainer(List.of(redis1, redis2, redis3)); } @Override @@ -196,28 +167,13 @@ public class RedisMasterReplicaExtension implements GuiceModuleTestExtension { .withNetworkAliases(alias) .waitingFor(Wait.forLogMessage(".*Ready to accept connections.*", 1) .withStartupTimeout(Duration.ofMinutes(2))); - if (tlsEnabled) { - genericContainer.withClasspathResourceMapping("certificate.crt", - "/etc/redis/certificate.crt", - BindMode.READ_ONLY) - .withClasspathResourceMapping("private.key", - "/etc/redis/private.key", - BindMode.READ_ONLY) - .withClasspathResourceMapping("rootCA.crt", - "/etc/redis/rootCA.crt", - BindMode.READ_ONLY); - if (isSlave) { - genericContainer.withCommand(TLS_REPLICA_COMMAND); - } else { - genericContainer.withCommand(TLS_MASTER_COMMAND); - } + + if (isSlave) { + genericContainer.withCommand(START_REPLICA_COMMAND); } else { - if (isSlave) { - genericContainer.withCommand(START_REPLICA_COMMAND); - } else { - genericContainer.withCommand(START_MASTER_COMMAND); - } + genericContainer.withCommand(START_MASTER_COMMAND); } + return genericContainer; } } \ No newline at end of file diff --git a/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisSentinelExtension.java b/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisSentinelExtension.java index 60bde6c80a..e6f4114694 100644 --- a/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisSentinelExtension.java +++ b/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisSentinelExtension.java @@ -31,7 +31,6 @@ import java.util.stream.Collectors; import jakarta.inject.Singleton; import org.apache.james.GuiceModuleTestExtension; -import org.apache.james.filesystem.api.FileSystem; import org.apache.james.util.Runnables; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ParameterContext; @@ -53,10 +52,6 @@ public class RedisSentinelExtension implements GuiceModuleTestExtension { public static final String SENTINEL_PASSWORD = "321"; public static final String START_REPLICA_COMMAND = "redis-server --appendonly yes --port 6379 --slaveof redis1 6379 --requirepass 123 --masterauth 123"; public static final String START_MASTER_COMMAND = "redis-server --appendonly yes --port 6379 --requirepass 123 --masterauth 123"; - public static final String TLS_REPLICA_COMMAND = "redis-server --appendonly yes --port 0 --slaveof redis1 6379 --requirepass 123 --masterauth 123" + - " --tls-port 6379 --tls-cert-file /etc/redis/certificate.crt --tls-key-file /etc/redis/private.key --tls-ca-cert-file /etc/redis/rootCA.crt --tls-replication yes"; - public static final String TLS_MASTER_COMMAND = "redis-server --appendonly yes --port 0 --requirepass 123 --masterauth 123" + - " --tls-port 6379 --tls-cert-file /etc/redis/certificate.crt --tls-key-file /etc/redis/private.key --tls-ca-cert-file /etc/redis/rootCA.crt --tls-replication yes"; public static class RedisMasterReplicaContainerList extends ArrayList<GenericContainer> { public RedisMasterReplicaContainerList(Collection<? extends GenericContainer> c) { @@ -82,18 +77,12 @@ public class RedisSentinelExtension implements GuiceModuleTestExtension { public static class RedisSentinelContainerList extends ArrayList<GenericContainer> { private final SentinelRedisConfiguration sentinelRedisConfiguration; - public RedisSentinelContainerList(Collection<? extends GenericContainer> c, boolean tlsEnabled) { + public RedisSentinelContainerList(Collection<? extends GenericContainer> c) { super(c); - String sentinelURI = createRedisSentinelURI(tlsEnabled); - if (tlsEnabled) { - sentinelRedisConfiguration = SentinelRedisConfiguration.from(sentinelURI, - SSLConfiguration.from(FileSystem.CLASSPATH_PROTOCOL + "keystore.p12", "secret"), - ReadFrom.MASTER); - } else { - sentinelRedisConfiguration = SentinelRedisConfiguration.from(sentinelURI, - ReadFrom.MASTER, - SENTINEL_PASSWORD); - } + String sentinelURI = createRedisSentinelURI(); + sentinelRedisConfiguration = SentinelRedisConfiguration.from(sentinelURI, + ReadFrom.MASTER, + SENTINEL_PASSWORD); } public SentinelRedisConfiguration getRedisConfiguration() { @@ -115,20 +104,12 @@ public class RedisSentinelExtension implements GuiceModuleTestExtension { } } - private String createRedisSentinelURI(boolean tlsEnabled) { + private String createRedisSentinelURI() { StringBuilder sb = new StringBuilder(); - if (tlsEnabled) { - sb.append("rediss-sentinel://123@"); - } else { - sb.append("redis-sentinel://123@"); - } + sb.append("redis-sentinel://123@"); sb.append(this.stream().map(container -> container.getHost() + ":" + container.getMappedPort(SENTINEL_PORT)) .collect(Collectors.joining(","))); - if (tlsEnabled) { - sb.append("?sentinelMasterId=mymaster&verifyPeer=NONE"); - } else { - sb.append("?sentinelMasterId=mymaster"); - } + sb.append("?sentinelMasterId=mymaster"); return sb.toString(); } } @@ -147,20 +128,10 @@ public class RedisSentinelExtension implements GuiceModuleTestExtension { private RedisMasterReplicaContainerList redisMasterReplicaContainerList; private RedisSentinelContainerList redisSentinelContainerList; private RedisSentinelCluster redisSentinelCluster; - private final boolean tlsEnabled; private final Network network; public RedisSentinelExtension() { - this(false, Network.newNetwork()); - } - - public RedisSentinelExtension(boolean tlsEnable) { - this(tlsEnable, Network.newNetwork()); - } - - public RedisSentinelExtension(boolean tlsEnable, Network network) { - this.tlsEnabled = tlsEnable; - this.network = network; + network = Network.newNetwork(); redis1 = createRedisContainer("redis1", false); redis2 = createRedisContainer("redis2", true); redis3 = createRedisContainer("redis3", true); @@ -184,7 +155,7 @@ public class RedisSentinelExtension implements GuiceModuleTestExtension { sentinel2.start(); sentinel3.start(); redisMasterReplicaContainerList = new RedisMasterReplicaContainerList(List.of(redis1, redis2, redis3)); - redisSentinelContainerList = new RedisSentinelContainerList(List.of(sentinel1, sentinel2, sentinel3), tlsEnabled); + redisSentinelContainerList = new RedisSentinelContainerList(List.of(sentinel1, sentinel2, sentinel3)); redisSentinelCluster = new RedisSentinelCluster(redisMasterReplicaContainerList, redisSentinelContainerList); } @@ -236,28 +207,12 @@ public class RedisSentinelExtension implements GuiceModuleTestExtension { .withNetworkAliases(alias) .waitingFor(Wait.forLogMessage(".*Ready to accept connections.*", 1) .withStartupTimeout(Duration.ofMinutes(2))); - if (tlsEnabled) { - genericContainer.withClasspathResourceMapping("certificate.crt", - "/etc/redis/certificate.crt", - BindMode.READ_ONLY) - .withClasspathResourceMapping("private.key", - "/etc/redis/private.key", - BindMode.READ_ONLY) - .withClasspathResourceMapping("rootCA.crt", - "/etc/redis/rootCA.crt", - BindMode.READ_ONLY); - if (isSlave) { - genericContainer.withCommand(TLS_REPLICA_COMMAND); - } else { - genericContainer.withCommand(TLS_MASTER_COMMAND); - } + if (isSlave) { + genericContainer.withCommand(START_REPLICA_COMMAND); } else { - if (isSlave) { - genericContainer.withCommand(START_REPLICA_COMMAND); - } else { - genericContainer.withCommand(START_MASTER_COMMAND); - } + genericContainer.withCommand(START_MASTER_COMMAND); } + return genericContainer; } @@ -265,28 +220,14 @@ public class RedisSentinelExtension implements GuiceModuleTestExtension { GenericContainer genericContainer = new GenericContainer<>(DEFAULT_IMAGE_NAME) .withExposedPorts(SENTINEL_PORT) .withCreateContainerCmdModifier(createContainerCmd -> createContainerCmd.withName("james-" + alias + "-test-" + UUID.randomUUID())) + .withClasspathResourceMapping("sentinel.conf", + "/etc/redis/sentinel.conf", + BindMode.READ_ONLY) .withCommand("redis-sentinel /etc/redis/sentinel.conf") .withNetworkAliases(alias) .waitingFor(Wait.forLogMessage(".*monitor master.*", 1) .withStartupTimeout(Duration.ofMinutes(2))); - if (tlsEnabled) { - genericContainer.withClasspathResourceMapping("sentinel_tls.conf", - "/etc/redis/sentinel.conf", - BindMode.READ_ONLY) - .withClasspathResourceMapping("certificate.crt", - "/etc/redis/certificate.crt", - BindMode.READ_ONLY) - .withClasspathResourceMapping("private.key", - "/etc/redis/private.key", - BindMode.READ_ONLY) - .withClasspathResourceMapping("rootCA.crt", - "/etc/redis/rootCA.crt", - BindMode.READ_ONLY); - } else { - genericContainer.withClasspathResourceMapping("sentinel.conf", - "/etc/redis/sentinel.conf", - BindMode.READ_ONLY); - } + return genericContainer; } } \ No newline at end of file diff --git a/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisTLSMasterReplicaHealthCheckTest.java b/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisTLSMasterReplicaHealthCheckTest.java deleted file mode 100644 index 0af0192977..0000000000 --- a/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisTLSMasterReplicaHealthCheckTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************** - * 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.backends.redis; - -import org.apache.james.backends.redis.RedisMasterReplicaExtension.RedisMasterReplicaContainer; -import org.apache.james.server.core.filesystem.FileSystemImpl; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.extension.RegisterExtension; - -class RedisTLSMasterReplicaHealthCheckTest extends RedisHealthCheckTest { - @RegisterExtension - private static final RedisMasterReplicaExtension redisMasterReplicaExtension = new RedisMasterReplicaExtension(true); - - private RedisHealthCheck redisHealthCheck; - private RedisMasterReplicaContainer redisMasterReplicaContainer; - - @BeforeEach - void setup() { - MasterReplicaRedisConfiguration redisConfiguration = redisMasterReplicaExtension.getRedisMasterReplicaContainer().getRedisConfiguration(); - redisHealthCheck = new RedisHealthCheck(new RedisClientFactory(FileSystemImpl.forTesting(), redisConfiguration), redisConfiguration); - redisMasterReplicaContainer = redisMasterReplicaExtension.getRedisMasterReplicaContainer(); - } - - @AfterEach - void afterEach() { - redisMasterReplicaContainer.unPauseOne(); - } - - @Override - public RedisHealthCheck getRedisHealthCheck() { - return redisHealthCheck; - } - - @Override - public void pauseRedis() { - redisMasterReplicaContainer.pauseOne(); - } - - @Override - public void unpauseRedis() { - redisMasterReplicaContainer.unPauseOne(); - } -} diff --git a/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisTLSSentinelHealthCheckTest.java b/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisTLSSentinelHealthCheckTest.java deleted file mode 100644 index 9eff3cd19a..0000000000 --- a/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisTLSSentinelHealthCheckTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************** - * 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.backends.redis; - -import org.apache.james.backends.redis.RedisSentinelExtension.RedisSentinelCluster; -import org.apache.james.server.core.filesystem.FileSystemImpl; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.extension.RegisterExtension; - -class RedisTLSSentinelHealthCheckTest extends RedisHealthCheckTest { - @RegisterExtension - private static final RedisSentinelExtension redisSentinelExtension = new RedisSentinelExtension(true); - - private RedisHealthCheck redisHealthCheck; - private RedisSentinelCluster redisSentinelCluster; - - @BeforeEach - public void setup() { - SentinelRedisConfiguration redisConfiguration = redisSentinelExtension.getRedisSentinelCluster().redisSentinelContainerList().getRedisConfiguration(); - redisHealthCheck = new RedisHealthCheck(new RedisClientFactory(FileSystemImpl.forTesting(), redisConfiguration), redisConfiguration); - redisSentinelCluster = redisSentinelExtension.getRedisSentinelCluster(); - } - - @AfterEach - public void afterEach() { - redisSentinelCluster.redisMasterReplicaContainerList().unPauseMasterNode(); - } - - @Override - public RedisHealthCheck getRedisHealthCheck() { - return redisHealthCheck; - } - - @Override - public void pauseRedis() { - redisSentinelCluster.redisMasterReplicaContainerList().pauseMasterNode(); - } - - @Override - public void unpauseRedis() { - redisSentinelCluster.redisMasterReplicaContainerList().unPauseMasterNode(); - } -} diff --git a/server/mailet/rate-limiter-redis/src/test/java/org/apache/james/rate/limiter/RedisRateLimiterWithTLSMasterReplicaTopologyTest.java b/server/mailet/rate-limiter-redis/src/test/java/org/apache/james/rate/limiter/RedisRateLimiterWithTLSMasterReplicaTopologyTest.java deleted file mode 100644 index 7106b82d06..0000000000 --- a/server/mailet/rate-limiter-redis/src/test/java/org/apache/james/rate/limiter/RedisRateLimiterWithTLSMasterReplicaTopologyTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/**************************************************************** - * 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.rate.limiter; - -import org.apache.james.backends.redis.RedisConfiguration; -import org.apache.james.backends.redis.RedisMasterReplicaExtension; -import org.junit.jupiter.api.extension.RegisterExtension; - -public class RedisRateLimiterWithTLSMasterReplicaTopologyTest implements TopologyRedisRateLimiterTest { - @RegisterExtension - private static final RedisMasterReplicaExtension redisMasterReplicaExtension = new RedisMasterReplicaExtension(true); - - public RedisConfiguration getRedisConfiguration() { - return redisMasterReplicaExtension.getRedisMasterReplicaContainer().getRedisConfiguration(); - } -} diff --git a/server/mailet/rate-limiter-redis/src/test/java/org/apache/james/rate/limiter/RedisRateLimiterWithTLSSentinelTest.java b/server/mailet/rate-limiter-redis/src/test/java/org/apache/james/rate/limiter/RedisRateLimiterWithTLSSentinelTest.java deleted file mode 100644 index fa7f0a1362..0000000000 --- a/server/mailet/rate-limiter-redis/src/test/java/org/apache/james/rate/limiter/RedisRateLimiterWithTLSSentinelTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/**************************************************************** - * 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.rate.limiter; - -import org.apache.james.backends.redis.RedisConfiguration; -import org.apache.james.backends.redis.RedisSentinelExtension; -import org.junit.jupiter.api.extension.RegisterExtension; - -public class RedisRateLimiterWithTLSSentinelTest implements TopologyRedisRateLimiterTest { - @RegisterExtension - private static final RedisSentinelExtension redisSentinelExtension = new RedisSentinelExtension(true); - - @Override - public RedisConfiguration getRedisConfiguration() { - return redisSentinelExtension.getRedisSentinelCluster().redisSentinelContainerList().getRedisConfiguration(); - } -} diff --git a/server/mailet/rate-limiter-redis/src/test/java/org/apache/james/rate/limiter/RedisRateLimiterWithTLSTest.scala b/server/mailet/rate-limiter-redis/src/test/java/org/apache/james/rate/limiter/RedisRateLimiterWithTLSTest.scala deleted file mode 100644 index 29a8e7153c..0000000000 --- a/server/mailet/rate-limiter-redis/src/test/java/org/apache/james/rate/limiter/RedisRateLimiterWithTLSTest.scala +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************** - * 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.rate.limiter - -import org.apache.james.backends.redis.RedisTLSExtension.RedisContainer -import org.apache.james.backends.redis.{RedisConfiguration, RedisTLSExtension} -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(Array(classOf[RedisTLSExtension])) -class RedisRateLimiterWithTLSTest extends TopologyRedisRateLimiterTest { - var redisContainer: RedisContainer = _ - - def getRedisConfiguration(): RedisConfiguration = redisContainer.getConfiguration - - @BeforeEach - def beforeEach(redisContainer: RedisContainer): Unit = { - this.redisContainer = redisContainer - } -} --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org