File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1515 */
1616package org .labkey .test .util ;
1717
18+ import org .apache .commons .lang3 .ArrayUtils ;
1819import org .apache .hc .client5 .http .classic .methods .HttpPost ;
1920import org .apache .hc .client5 .http .entity .UrlEncodedFormEntity ;
2021import org .apache .hc .core5 .http .message .BasicNameValuePair ;
@@ -239,15 +240,17 @@ private void deleteUser(@NotNull Integer userId)
239240 protected void _deleteUsers (boolean failIfNotFound , String ... userEmails )
240241 {
241242 Map <String , Integer > userIds = getUserIds (Arrays .asList (userEmails ), true );
242- // TODO: instead of calling deleteUser() one-by-one, should build an array of userIds and call deleteUsers(int...)
243+ List < Integer > validUserIds = new ArrayList <>();
243244 for (String userEmail : new HashSet <>(Arrays .asList (userEmails )))
244245 {
245246 Integer userId = userIds .get (userEmail );
246247 if (failIfNotFound )
247248 assertNotNull (userEmail + " was not present" , userId );
248249 if (userId != null )
249- deleteUser (userId );
250+ validUserIds . add (userId );
250251 }
252+ if (!validUserIds .isEmpty ())
253+ deleteUsers (ArrayUtils .toPrimitive (validUserIds .toArray (new Integer [0 ])));
251254 }
252255
253256 private static final Pattern regEmailVerification = Pattern .compile ("verification=([A-Za-z0-9]+)" );
You can’t perform that action at this time.
0 commit comments