Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-37778] Use class FQN instead of String literal
  • Loading branch information
rsandell committed Nov 7, 2016
1 parent 8287a8a commit 1617729
Showing 1 changed file with 8 additions and 4 deletions.
Expand Up @@ -37,6 +37,10 @@
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException;
import org.jenkinsci.plugins.credentialsbinding.impl.FileBinding;
import org.jenkinsci.plugins.credentialsbinding.impl.StringBinding;
import org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordBinding;
import org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding;
import org.jenkinsci.plugins.plaincredentials.FileCredentials;
import org.jenkinsci.plugins.plaincredentials.StringCredentials;

Expand Down Expand Up @@ -156,11 +160,11 @@ public Class<? extends StandardCredentials> type() {
@Override
public List<Map<String, Object>> getWithCredentialsParameters(String credentialsId) {
Map<String, Object> map = new HashMap<>();
map.put("$class", "UsernamePasswordBinding");
map.put("$class", UsernamePasswordBinding.class.getName());
map.put("variable", new EnvVarResolver());
map.put("credentialsId", credentialsId);
Map<String, Object> map2 = new HashMap<>();
map2.put("$class", "UsernamePasswordMultiBinding");
map2.put("$class", UsernamePasswordMultiBinding.class.getName());
map2.put("usernameVariable", new EnvVarResolver("%s_USR"));
map2.put("passwordVariable", new EnvVarResolver("%s_PSW"));
map2.put("credentialsId", credentialsId);
Expand All @@ -182,7 +186,7 @@ public Class<? extends StandardCredentials> type() {
@Override
public List<Map<String, Object>> getWithCredentialsParameters(String credentialsId) {
Map<String, Object> map = new HashMap<>();
map.put("$class", "FileBinding");
map.put("$class", FileBinding.class.getName());
map.put("variable", new EnvVarResolver());
map.put("credentialsId", credentialsId);
return Collections.singletonList(map);
Expand All @@ -202,7 +206,7 @@ public Class<? extends StandardCredentials> type() {
@Override
public List<Map<String, Object>> getWithCredentialsParameters(String credentialsId) {
Map<String, Object> map = new HashMap<>();
map.put("$class", "StringBinding");
map.put("$class", StringBinding.class.getName());
map.put("variable", new EnvVarResolver());
map.put("credentialsId", credentialsId);
return Collections.singletonList(map);
Expand Down

0 comments on commit 1617729

Please sign in to comment.