Skip to content

Commit

Permalink
CLDR-17248 Add logging for webdriver simulated users (#3455)
Browse files Browse the repository at this point in the history
-Log whether enabled/disabled and why, and log success/failure for user creation
  • Loading branch information
btangmu authored Jan 17, 2024
1 parent 2674fb3 commit 8b05d24
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public class AuthSurveyDriver {
private static final int INVALID_USER_INDEX = -1;
private static final int FIRST_VALID_USER_INDEX = 0;

public static final java.util.logging.Logger logger =
SurveyLog.forClass(AuthSurveyDriver.class);

private static boolean isInitialized = false;
private static boolean isEnabled = false;
private static String realPassword = null;
Expand All @@ -46,12 +49,19 @@ public static User createTestUser(String password, String email) {
}

private static void initialize() {
String status;
if (SurveyMain.isUnofficial()) {
realPassword = CLDRConfig.getInstance().getProperty("CLDR_WEBDRIVER_PASSWORD", "");
if (realPassword != null && !realPassword.isBlank()) {
isEnabled = true;
status = "enabled";
} else {
status = "disabled, no property";
}
} else {
status = "disabled, official";
}
logger.info("Webdriver simulated users are " + status);
isInitialized = true;
}

Expand Down Expand Up @@ -87,8 +97,10 @@ private static User addTestUser(String password, String email, int userIndex) {
u.setPassword(password);
User registeredUser = reg.newUser(null, u);
if (registeredUser == null || registeredUser.id <= 0) {
logger.severe("Failed to add webdriver simulated user " + email);
return null;
}
logger.info("Added webdriver simulated user " + email);
return registeredUser;
}
}

0 comments on commit 8b05d24

Please sign in to comment.