diff --git a/rest-api/src/test/java/com/cloudbees/workflow/Util.java b/rest-api/src/test/java/com/cloudbees/workflow/Util.java index ed5a4420..16ad141a 100644 --- a/rest-api/src/test/java/com/cloudbees/workflow/Util.java +++ b/rest-api/src/test/java/com/cloudbees/workflow/Util.java @@ -29,7 +29,6 @@ import hudson.model.Result; import hudson.util.RunList; import jenkins.model.Jenkins; -import org.apache.commons.httpclient.NameValuePair; import org.jenkinsci.plugins.workflow.job.WorkflowJob; import org.jenkinsci.plugins.workflow.job.WorkflowRun; import org.junit.Assert; @@ -41,7 +40,9 @@ import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.Charset; +import java.util.AbstractMap; import java.util.Iterator; +import java.util.Map; /** * @author tom.fennelly@gmail.com @@ -65,8 +66,8 @@ public static int postToJenkins(Jenkins jenkins, String url, String content, Str conn.setRequestMethod("POST"); // Set the crumb header, otherwise the POST may be rejected. - NameValuePair crumbHeader = getCrumbHeaderNVP(jenkins); - conn.setRequestProperty(crumbHeader.getName(), crumbHeader.getValue()); + Map.Entry crumbHeader = getCrumbHeaderNVP(jenkins); + conn.setRequestProperty(crumbHeader.getKey(), crumbHeader.getValue()); if (contentType != null) { conn.setRequestProperty("Content-Type", contentType); @@ -156,8 +157,8 @@ public static T getJSON(String url, Class to, JenkinsRule jenkinsRule) th return jsonReadWrite.fromString(jsonResponse, to); } - private static NameValuePair getCrumbHeaderNVP(Jenkins jenkins) { - return new NameValuePair(jenkins.getCrumbIssuer().getDescriptor().getCrumbRequestField(), + private static Map.Entry getCrumbHeaderNVP(Jenkins jenkins) { + return new AbstractMap.SimpleEntry<>(jenkins.getCrumbIssuer().getDescriptor().getCrumbRequestField(), jenkins.getCrumbIssuer().getCrumb( null )); } }