Mercurial > stress-tester
changeset 602:11c54e86b80d
CsvUsernamePasswordCredentialsProvider - bugfix
author | Devel 1 |
---|---|
date | Fri, 06 Oct 2017 09:12:38 +0200 |
parents | a5ac65b99326 |
children | c70bc3304737 |
files | stress-tester/src/main/java/com/passus/st/client/credentials/CsvUsernamePasswordCredentialsProvider.java stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFormLoginFilter.java |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/credentials/CsvUsernamePasswordCredentialsProvider.java Fri Oct 06 09:11:34 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/credentials/CsvUsernamePasswordCredentialsProvider.java Fri Oct 06 09:12:38 2017 +0200 @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.List; import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.atomic.AtomicInteger; /** * @@ -60,7 +61,7 @@ private List<Credentials> credentialsList; - private int index; + private AtomicInteger index = new AtomicInteger(); @Override public String getType() { @@ -107,7 +108,7 @@ return null; } - int current = (readMode.index(index++) & 0x7f_ff_ff_ff) % credentialsList.size(); + int current = (readMode.index(index.getAndIncrement()) & 0x7f_ff_ff_ff) % credentialsList.size(); return credentialsList.get(current); }
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFormLoginFilter.java Fri Oct 06 09:11:34 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFormLoginFilter.java Fri Oct 06 09:12:38 2017 +0200 @@ -64,6 +64,7 @@ ParametersBag conversation = context.scopes().getConversation(request); if (credentials != null) { + LOGGER.debug("Credentials provided for user '{}'.", credentials.getUser()); parameters.set(userField, credentials.getUser()); parameters.set(passwordField, credentials.getPassword()); helper.setFormUrlencoded(request, parameters); @@ -87,13 +88,18 @@ if (loginOk) { ParametersBag conversation = context.scopes().getConversation(request, false); if (conversation != null) { + LOGGER.debug("Login succeeded for user '{}'.", conversation.get(PARAM_USERNAME)); ParametersBag session = context.scopes().getSession(request); if (session == null) { LOGGER.debug("Session not found."); } else { session.set(PARAM_USERNAME, conversation.get(PARAM_USERNAME)); } + } else { + LOGGER.debug("Login succeeded for unknown user."); } + } else { + LOGGER.debug("Login failed."); } }