Skip to content

Commit

Permalink
-update submodule ref
Browse files Browse the repository at this point in the history
-change exception message
  • Loading branch information
atakavci committed Nov 17, 2024
1 parent 392b3b0 commit f037440
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion redis-authx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void authenticateConnections(Token token) {

public void onError(Exception reason) {
throw new JedisAuthenticationException(
"Token request/renewal failed with message:" + reason.getMessage(), reason);
"Token manager failed to acquire new token!", reason);
}

public Connection addConnection(Connection connection) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void testJedisPooledAuth() {

TokenAuthConfig tokenAuthConfig = TokenAuthConfig.builder()
.identityProviderConfig(idProviderConfig).expirationRefreshRatio(0.8F)
.lowerRefreshBoundMillis(10000).tokenRequestExecutionTimeoutInMs(1000).build();
.lowerRefreshBoundMillis(10000).tokenRequestExecTimeoutInMs(1000).build();

JedisClientConfig clientConfig = DefaultJedisClientConfig.builder()
.tokenAuthConfig(tokenAuthConfig).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ public void testCalculateRenewalDelay() {
}

@Test
public void testAuthXManagerReceivesNewToken() throws InterruptedException, ExecutionException, TimeoutException {
public void testAuthXManagerReceivesNewToken()
throws InterruptedException, ExecutionException, TimeoutException {

IdentityProvider identityProvider = () -> new SimpleToken("tokenVal",
System.currentTimeMillis() + 5 * 1000, System.currentTimeMillis(),
Expand All @@ -204,8 +205,9 @@ public void testAuthXManagerReceivesNewToken() throws InterruptedException, Exec

@Test
public void testBlockForInitialToken() {
String exceptionMessage = "Test exception from identity provider!";
IdentityProvider identityProvider = () -> {
throw new RuntimeException("Test exception from identity provider!");
throw new RuntimeException(exceptionMessage);
};

TokenManager tokenManager = new TokenManager(identityProvider,
Expand All @@ -214,8 +216,8 @@ public void testBlockForInitialToken() {
JedisAuthXManager manager = new JedisAuthXManager(tokenManager);
ExecutionException e = assertThrows(ExecutionException.class, () -> manager.start(true));

assertEquals("java.lang.RuntimeException: Test exception from identity provider!",
e.getCause().getCause().getMessage());
assertEquals(exceptionMessage,
e.getCause().getCause().getCause().getCause().getMessage());
}

@Test
Expand Down

0 comments on commit f037440

Please sign in to comment.