From b87ca1b33a013ad6fc11c71d1e1b9795864606f1 Mon Sep 17 00:00:00 2001 From: Timur Alperovich Date: Mon, 24 Aug 2015 14:33:03 -0700 Subject: [PATCH] JCLOUDS-217: CloudStack do not encode parameters. Parameters when creating an HTTP request should not be encoded in the CloudStack tests, as they end up being doubly encoded. --- .../org/jclouds/cloudstack/features/SSHKeyPairApiTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SSHKeyPairApiTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SSHKeyPairApiTest.java index b8492e17b3..3a78a5acb8 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SSHKeyPairApiTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SSHKeyPairApiTest.java @@ -20,7 +20,6 @@ import static org.jclouds.reflect.Reflection2.method; import static org.testng.Assert.assertEquals; import java.io.IOException; -import java.net.URLEncoder; import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; import org.jclouds.Fallbacks.NullOnNotFoundOr404; @@ -34,6 +33,7 @@ import org.jclouds.http.functions.ParseFirstJsonValueNamed; import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.rest.internal.GeneratedHttpRequest; import org.jclouds.ssh.SshKeys; +import org.jclouds.util.Strings2; import org.testng.annotations.Test; import com.google.common.base.Functions; @@ -99,11 +99,11 @@ public class SSHKeyPairApiTest extends BaseCloudStackApiTest { public void testRegisterSSHKeyPair() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(SSHKeyPairApi.class, "registerSSHKeyPair", String.class, String.class); - String publicKey = URLEncoder.encode(SshKeys.generate().get("public"), "UTF-8"); + String publicKey = SshKeys.generate().get("public"); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("jclouds-keypair", publicKey)); assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=registerSSHKeyPair&name=jclouds-keypair&publickey=" - + publicKey + + Strings2.urlEncode(publicKey, '/') + " HTTP/1.1"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertPayloadEquals(httpRequest, null, null, false);