]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/test/java/org/rocksdb/RateLimiterTest.java
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / rocksdb / java / src / test / java / org / rocksdb / RateLimiterTest.java
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same directory.
5 package org.rocksdb;
6
7 import org.junit.ClassRule;
8 import org.junit.Test;
9
10 import static org.assertj.core.api.Assertions.assertThat;
11
12 public class RateLimiterTest {
13
14 @ClassRule
15 public static final RocksMemoryResource rocksMemoryResource =
16 new RocksMemoryResource();
17
18 @Test
19 public void setBytesPerSecond() {
20 try(final RateLimiter rateLimiter =
21 new RateLimiter(1000, 100 * 1000, 1)) {
22 rateLimiter.setBytesPerSecond(2000);
23 }
24 }
25
26 @Test
27 public void getSingleBurstBytes() {
28 try(final RateLimiter rateLimiter =
29 new RateLimiter(1000, 100 * 1000, 1)) {
30 assertThat(rateLimiter.getSingleBurstBytes()).isEqualTo(100);
31 }
32 }
33
34 @Test
35 public void getTotalBytesThrough() {
36 try(final RateLimiter rateLimiter =
37 new RateLimiter(1000, 100 * 1000, 1)) {
38 assertThat(rateLimiter.getTotalBytesThrough()).isEqualTo(0);
39 }
40 }
41
42 @Test
43 public void getTotalRequests() {
44 try(final RateLimiter rateLimiter =
45 new RateLimiter(1000, 100 * 1000, 1)) {
46 assertThat(rateLimiter.getTotalRequests()).isEqualTo(0);
47 }
48 }
49 }