Mercurial > stress-tester
changeset 593:2f8dfda084fe
CredentailsProvider.getType()
author | Devel 2 |
---|---|
date | Tue, 03 Oct 2017 15:17:58 +0200 |
parents | e3471e627962 |
children | 744c817abd6d |
files | stress-tester/src/main/java/com/passus/st/client/credentials/CredentialsProvider.java stress-tester/src/main/java/com/passus/st/client/credentials/CsvUsernamePasswordCredentialsProvider.java stress-tester/src/main/java/com/passus/st/client/credentials/MultiCredentialsProvider.java stress-tester/src/main/java/com/passus/st/client/credentials/SingleCredentialsProvider.java stress-tester/src/main/java/com/passus/st/client/credentials/UsernamePasswordCredentialsProvider.java |
diffstat | 5 files changed, 37 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/credentials/CredentialsProvider.java Tue Oct 03 15:10:31 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/credentials/CredentialsProvider.java Tue Oct 03 15:17:58 2017 +0200 @@ -11,7 +11,9 @@ */ public interface CredentialsProvider extends Configurable { - Credentials getCredentials(ProviderContext context); + public String getType(); + + public Credentials getCredentials(ProviderContext context); public static class ProviderContext {
--- a/stress-tester/src/main/java/com/passus/st/client/credentials/CsvUsernamePasswordCredentialsProvider.java Tue Oct 03 15:10:31 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/credentials/CsvUsernamePasswordCredentialsProvider.java Tue Oct 03 15:17:58 2017 +0200 @@ -4,6 +4,7 @@ import com.passus.commons.Assert; import com.passus.commons.annotations.Plugin; import com.passus.config.Configuration; +import static com.passus.st.client.credentials.UsernamePasswordCredentialsProvider.TYPE; import com.passus.st.plugin.PluginConstants; import java.io.File; import java.io.FileInputStream; @@ -49,6 +50,11 @@ private int index; + @Override + public String getType() { + return TYPE; + } + public ReadMode getReadMode() { return readMode; }
--- a/stress-tester/src/main/java/com/passus/st/client/credentials/MultiCredentialsProvider.java Tue Oct 03 15:10:31 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/credentials/MultiCredentialsProvider.java Tue Oct 03 15:17:58 2017 +0200 @@ -2,6 +2,7 @@ import com.passus.commons.Assert; import com.passus.config.Configuration; +import static com.passus.st.client.credentials.UsernamePasswordCredentialsProvider.TYPE; import java.util.List; /** @@ -10,8 +11,15 @@ */ public class MultiCredentialsProvider implements CredentialsProvider { + public static final String TYPE = "multi"; + private final List<CredentialsProvider> providers; + @Override + public String getType() { + return TYPE; + } + public MultiCredentialsProvider(List<CredentialsProvider> providers) { Assert.notContainsNull(providers, "providers"); this.providers = providers;
--- a/stress-tester/src/main/java/com/passus/st/client/credentials/SingleCredentialsProvider.java Tue Oct 03 15:10:31 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/credentials/SingleCredentialsProvider.java Tue Oct 03 15:17:58 2017 +0200 @@ -8,6 +8,8 @@ */ public class SingleCredentialsProvider implements CredentialsProvider { + public static final String TYPE = "single"; + private final Credentials credentials; public SingleCredentialsProvider(Credentials credentials) { @@ -19,6 +21,11 @@ } @Override + public String getType() { + return TYPE; + } + + @Override public Credentials getCredentials(ProviderContext context) { return credentials; }
--- a/stress-tester/src/main/java/com/passus/st/client/credentials/UsernamePasswordCredentialsProvider.java Tue Oct 03 15:10:31 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/credentials/UsernamePasswordCredentialsProvider.java Tue Oct 03 15:17:58 2017 +0200 @@ -30,14 +30,27 @@ this.password = password; } + @Override + public String getType() { + return TYPE; + } + public String getUsername() { return username; } + public void setUsername(String username) { + this.username = username; + } + public String getPassword() { return password; } + public void setPassword(String password) { + this.password = password; + } + @Override public Credentials getCredentials(ProviderContext context) { return new Credentials(username, password);