This is an automated email from the ASF dual-hosted git repository.

hqtran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit e93ef07fae5ae7760761b6a9292a4b1a01b00529
Author: Quan Tran <hqt...@linagora.com>
AuthorDate: Mon Mar 31 11:59:30 2025 +0700

    JAMES-4124 Rate limiting tests with Kvrocks standalone extension
---
 .../rate/limiter/KvrocksRateLimiterTest.scala      | 44 ++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git 
a/server/mailet/rate-limiter-redis/src/test/java/org/apache/james/rate/limiter/KvrocksRateLimiterTest.scala
 
b/server/mailet/rate-limiter-redis/src/test/java/org/apache/james/rate/limiter/KvrocksRateLimiterTest.scala
new file mode 100644
index 0000000000..16b1fc3bff
--- /dev/null
+++ 
b/server/mailet/rate-limiter-redis/src/test/java/org/apache/james/rate/limiter/KvrocksRateLimiterTest.scala
@@ -0,0 +1,44 @@
+/****************************************************************
+ * 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 java.time.Duration
+
+import org.apache.james.backends.redis.{DockerKvrocks, KvrocksExtension, 
RedisClientFactory, RedisConfiguration, StandaloneRedisConfiguration}
+import org.apache.james.rate.limiter.api.{RateLimiterContract, 
RateLimiterFactory}
+import org.apache.james.rate.limiter.redis.RedisRateLimiterFactory
+import org.apache.james.server.core.filesystem.FileSystemImpl
+import org.junit.jupiter.api.BeforeEach
+import org.junit.jupiter.api.extension.ExtendWith
+
+@ExtendWith(Array(classOf[KvrocksExtension]))
+class KvrocksRateLimiterTest extends RateLimiterContract {
+
+  var redisRateLimiterConfiguration: RedisConfiguration = _
+
+  @BeforeEach
+  def setup(kvrocks: DockerKvrocks): Unit = {
+    redisRateLimiterConfiguration = 
StandaloneRedisConfiguration.from(kvrocks.redisURI().toString)
+  }
+
+  override def testee(): RateLimiterFactory = new 
RedisRateLimiterFactory(redisRateLimiterConfiguration, new 
RedisClientFactory(FileSystemImpl.forTesting()))
+
+  override def sleep(duration: Duration): Unit = 
Thread.sleep(duration.toMillis)
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org

Reply via email to