From f037440f1caa5f091871c5d81ad2ba5fc00c22e5 Mon Sep 17 00:00:00 2001 From: atakavci Date: Sun, 17 Nov 2024 18:38:15 +0300 Subject: [PATCH] -update submodule ref -change exception message --- redis-authx | 2 +- .../jedis/authentication/JedisAuthXManager.java | 2 +- .../TokenBasedAuthenticationIntegrationTests.java | 2 +- .../TokenBasedAuthenticationUnitTests.java | 10 ++++++---- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/redis-authx b/redis-authx index 8f56584858..7285ce7857 160000 --- a/redis-authx +++ b/redis-authx @@ -1 +1 @@ -Subproject commit 8f5658485897d2ca56af5238af25fc709cd0eaa9 +Subproject commit 7285ce78578652ed8b8132814792b806e7b78a26 diff --git a/src/main/java/redis/clients/jedis/authentication/JedisAuthXManager.java b/src/main/java/redis/clients/jedis/authentication/JedisAuthXManager.java index 57a3bab894..a210f7fb42 100644 --- a/src/main/java/redis/clients/jedis/authentication/JedisAuthXManager.java +++ b/src/main/java/redis/clients/jedis/authentication/JedisAuthXManager.java @@ -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) { diff --git a/src/test/java/redis/clients/jedis/authentication/TokenBasedAuthenticationIntegrationTests.java b/src/test/java/redis/clients/jedis/authentication/TokenBasedAuthenticationIntegrationTests.java index 51eb61d617..4cbf155dd3 100644 --- a/src/test/java/redis/clients/jedis/authentication/TokenBasedAuthenticationIntegrationTests.java +++ b/src/test/java/redis/clients/jedis/authentication/TokenBasedAuthenticationIntegrationTests.java @@ -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(); diff --git a/src/test/java/redis/clients/jedis/authentication/TokenBasedAuthenticationUnitTests.java b/src/test/java/redis/clients/jedis/authentication/TokenBasedAuthenticationUnitTests.java index 8a0720906e..7ac68361aa 100644 --- a/src/test/java/redis/clients/jedis/authentication/TokenBasedAuthenticationUnitTests.java +++ b/src/test/java/redis/clients/jedis/authentication/TokenBasedAuthenticationUnitTests.java @@ -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(), @@ -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, @@ -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