Skip to content

Commit

Permalink
- review from @sazzad16 : make JedisSafeAuthenticator protected
Browse files Browse the repository at this point in the history
- fix failing unit tests
  • Loading branch information
atakavci committed Dec 20, 2024
1 parent 9da80c4 commit edf631a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import redis.clients.jedis.exceptions.JedisException;
import redis.clients.jedis.util.SafeEncoder;

public class JedisSafeAuthenticator {
class JedisSafeAuthenticator {

private static final Token PLACEHOLDER_TOKEN = new SimpleToken(null, null, 0, 0, null);
private static final Logger logger = LoggerFactory.getLogger(JedisSafeAuthenticator.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import redis.clients.authentication.core.TokenListener;
import redis.clients.authentication.core.TokenManager;
import redis.clients.authentication.core.TokenManagerConfig;
import redis.clients.authentication.core.TokenManagerConfig.RetryPolicy;
import redis.clients.jedis.ConnectionPool;
import redis.clients.jedis.EndpointConfig;
import redis.clients.jedis.HostAndPort;
Expand Down Expand Up @@ -67,7 +68,7 @@ public void withExpirationRefreshRatio_testJedisAuthXManagerTriggersEvict() thro
System.currentTimeMillis(), Collections.singletonMap("oid", "default")));

TokenManager tokenManager = new TokenManager(idProvider,
new TokenManagerConfig(0.4F, 100, 1000, null));
new TokenManagerConfig(0.4F, 100, 1000, new RetryPolicy(1, 1)));
AuthXManager jedisAuthXManager = new AuthXManager(tokenManager);

AtomicInteger numberOfEvictions = new AtomicInteger(0);
Expand All @@ -92,7 +93,7 @@ public void withLowerRefreshBounds_testJedisAuthXManagerTriggersEvict() throws E
System.currentTimeMillis(), Collections.singletonMap("oid", "default")));

TokenManager tokenManager = new TokenManager(idProvider,
new TokenManagerConfig(0.9F, 600, 1000, null));
new TokenManagerConfig(0.9F, 600, 1000, new RetryPolicy(1, 1)));
AuthXManager jedisAuthXManager = new AuthXManager(tokenManager);

AtomicInteger numberOfEvictions = new AtomicInteger(0);
Expand Down Expand Up @@ -126,6 +127,11 @@ public int getLowerRefreshBoundMillis() {
public float getExpirationRefreshRatio() {
return ratio;
}

@Override
public RetryPolicy getRetryPolicy() {
return new RetryPolicy(1, 1);
}
}

@Test
Expand Down Expand Up @@ -210,7 +216,7 @@ public void testAuthXManagerReceivesNewToken()
Collections.singletonMap("oid", "user1"));

TokenManager tokenManager = new TokenManager(identityProvider,
new TokenManagerConfig(0.7F, 200, 2000, null));
new TokenManagerConfig(0.7F, 200, 2000, new RetryPolicy(1, 1)));

AuthXManager manager = spy(new AuthXManager(tokenManager));

Expand Down

0 comments on commit edf631a

Please sign in to comment.