@@ -81,7 +81,7 @@ public void setup() throws Exception
8181 public void getGrantedRolesImplMinimizesReads ()
8282 {
8383 // IRoleManager::getRoleDetails was not in the initial API, so a default impl
84- // was added which uses the existing methods on IRoleManager as primitive to
84+ // was added which uses the existing methods on IRoleManager as primitives to
8585 // construct the Role objects. While this will work for any IRoleManager impl
8686 // it is inefficient, so CassandraRoleManager has its own implementation which
8787 // collects all of the necessary info with a single query for each granted role.
@@ -104,7 +104,7 @@ public void getGrantedRolesImplMinimizesReads()
104104 fetchRolesAndCheckReadCount (roleManager , ROLE_A );
105105
106106 // Check that when granted roles appear multiple times in parallel levels of the hierarchy, we don't
107- // do redundant reads. E.g. here role_b_1, role_b_2 and role_b3 are granted to both role_b and role_c
107+ // do redundant reads. E.g. here role_b_1, role_b_2 and role_b_3 are granted to both role_b and role_c
108108 // but we only want to actually read them once
109109 grantRolesTo (roleManager , ROLE_C , ROLE_B_1 , ROLE_B_2 , ROLE_B_3 );
110110 fetchRolesAndCheckReadCount (roleManager , ROLE_A );
@@ -165,6 +165,7 @@ public void warmCacheLoadsAllEntries()
165165 }
166166 }
167167
168+ @ Test
168169 public void testPasswordUpdateRateLimiting () throws Exception
169170 {
170171 try
@@ -194,7 +195,7 @@ public void testPasswordUpdateRateLimiting() throws Exception
194195 }
195196 catch (OverloadedException e )
196197 {
197- assertEquals ("Password for role test_password_role can only be changed every 100ms. " , e .getMessage ());
198+ assertEquals ("Password for role test_password_role can only be changed every 100ms." , e .getMessage ());
198199 }
199200
200201 // Wait for the rate limit interval to pass
@@ -301,6 +302,7 @@ public void ctorInvalidRoleDisconnectOptions()
301302 Assertions .assertThat (crm .getInvalidClientDisconnectMaxJitterMillis ()).isEqualTo (1000 );
302303 }
303304
305+ @ Test
304306 public void testPasswordUpdateRateLimitingDisabled () throws Exception
305307 {
306308 try
@@ -345,15 +347,12 @@ public void testPasswordUpdateRateLimitingPerRole() throws Exception
345347 RoleOptions options2 = getLoginRoleOptions ("password2" );
346348 roleManager .createRole (AuthenticatedUser .ANONYMOUS_USER , role2 , options2 );
347349
348- // Wait for the rate limit interval to pass
350+ // Wait for the rate limit interval to pass since creation
349351 Thread .sleep (150 );
350352
351353 RoleOptions newOptions1 = getLoginRoleOptions ("new_password1" );
352354 roleManager .alterRole (AuthenticatedUser .ANONYMOUS_USER , role1 , newOptions1 );
353355
354- RoleOptions newOptions2 = getLoginRoleOptions ("new_password2" );
355- roleManager .alterRole (AuthenticatedUser .ANONYMOUS_USER , role2 , newOptions2 );
356-
357356 try
358357 {
359358 RoleOptions newOptions1Again = getLoginRoleOptions ("another_password1" );
@@ -365,6 +364,20 @@ public void testPasswordUpdateRateLimitingPerRole() throws Exception
365364 assertEquals ("Password for role test_role_1 can only be changed every 100ms." , e .getMessage ());
366365 }
367366
367+ RoleOptions newOptions2 = getLoginRoleOptions ("new_password2" );
368+ roleManager .alterRole (AuthenticatedUser .ANONYMOUS_USER , role2 , newOptions2 );
369+
370+ try
371+ {
372+ RoleOptions newOptions2Again = getLoginRoleOptions ("another_password2" );
373+ roleManager .alterRole (AuthenticatedUser .ANONYMOUS_USER , role2 , newOptions2Again );
374+ fail ("Expected OverloadedException for test_role_2" );
375+ }
376+ catch (OverloadedException e )
377+ {
378+ assertEquals ("Password for role test_role_2 can only be changed every 100ms." , e .getMessage ());
379+ }
380+
368381 roleManager .dropRole (AuthenticatedUser .ANONYMOUS_USER , role1 );
369382 roleManager .dropRole (AuthenticatedUser .ANONYMOUS_USER , role2 );
370383 }
0 commit comments