diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/v2_0/internal/BaseOpenStackMockTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/v2_0/internal/BaseOpenStackMockTest.java index 1ec2c620cb..d6fb2f9fdc 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/v2_0/internal/BaseOpenStackMockTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/v2_0/internal/BaseOpenStackMockTest.java @@ -34,6 +34,7 @@ import org.jclouds.ContextBuilder; import org.jclouds.concurrent.config.ExecutorServiceModule; import org.jclouds.util.Strings2; +import com.google.common.base.Charsets; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableSet; import com.google.common.net.HttpHeaders; @@ -223,7 +224,7 @@ public class BaseOpenStackMockTest { JsonElement requestJson = null; // to be compared JsonElement resourceJson; // to be compared try { - requestJson = parser.parse(new String(request.getBody(), "UTF-8")); + requestJson = parser.parse(new String(request.getBody(), Charsets.UTF_8)); } catch (Exception e) { Throwables.propagate(e); } diff --git a/core/src/test/java/org/jclouds/http/BaseHttpCommandExecutorServiceIntegrationTest.java b/core/src/test/java/org/jclouds/http/BaseHttpCommandExecutorServiceIntegrationTest.java index 708301ccff..4d047041a9 100644 --- a/core/src/test/java/org/jclouds/http/BaseHttpCommandExecutorServiceIntegrationTest.java +++ b/core/src/test/java/org/jclouds/http/BaseHttpCommandExecutorServiceIntegrationTest.java @@ -42,6 +42,7 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import com.google.common.base.Charsets; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableList; import com.google.common.collect.Multimap; @@ -299,7 +300,7 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base String result = client.post("", "foo"); // Verify that the body is properly populated RecordedRequest request = server.takeRequest(); - assertEquals(new String(request.getBody(), "UTF-8"), "foo"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "foo"); assertEquals(result, "fooPOST"); } finally { close(client, true); @@ -315,7 +316,7 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base client.postNothing(""); assertEquals(server.getRequestCount(), 1); RecordedRequest request = server.takeRequest(); - assertEquals(new String(request.getBody(), "UTF-8"), ""); + assertEquals(new String(request.getBody(), Charsets.UTF_8), ""); } finally { close(client, true); server.shutdown(); @@ -333,9 +334,9 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base assertEquals(result, "fooPOST"); // Verify that the body was properly sent in the two requests RecordedRequest request = server.takeRequest(); - assertEquals(new String(request.getBody(), "UTF-8"), "foo"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "foo"); request = server.takeRequest(); - assertEquals(new String(request.getBody(), "UTF-8"), "foo"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "foo"); } finally { close(client, true); server.shutdown(); @@ -356,9 +357,9 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base assertEquals(redirectTarget.getRequestCount(), 1); // Verify that the body was populated after the redirect RecordedRequest request = server.takeRequest(); - assertEquals(new String(request.getBody(), "UTF-8"), "foo"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "foo"); request = redirectTarget.takeRequest(); - assertEquals(new String(request.getBody(), "UTF-8"), "foo"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "foo"); } finally { close(client, true); redirectTarget.shutdown(); @@ -374,7 +375,7 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base String result = client.postAsInputStream("", "foo"); // Verify that the body is properly populated RecordedRequest request = server.takeRequest(); - assertEquals(new String(request.getBody(), "UTF-8"), "foo"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "foo"); assertEquals(result, "fooPOST"); } finally { close(client, true); @@ -405,7 +406,7 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base String result = client.postJson("", "foo"); // Verify that the body is properly populated RecordedRequest request = server.takeRequest(); - assertEquals(new String(request.getBody(), "UTF-8"), "{\"key\":\"foo\"}"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "{\"key\":\"foo\"}"); assertEquals(result, "fooPOSTJSON"); } finally { close(client, true); @@ -491,7 +492,7 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base String result = client.upload("", "foo"); // Verify that the body is properly populated RecordedRequest request = server.takeRequest(); - assertEquals(new String(request.getBody(), "UTF-8"), "foo"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "foo"); assertEquals(result, "fooPUT"); } finally { close(client, true); @@ -513,9 +514,9 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base assertEquals(redirectTarget.getRequestCount(), 1); // Verify that the body was populated after the redirect RecordedRequest request = server.takeRequest(); - assertEquals(new String(request.getBody(), "UTF-8"), "foo"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "foo"); request = redirectTarget.takeRequest(); - assertEquals(new String(request.getBody(), "UTF-8"), "foo"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "foo"); } finally { close(client, true); redirectTarget.shutdown(); @@ -531,7 +532,7 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base client.putNothing(""); assertEquals(server.getRequestCount(), 1); RecordedRequest request = server.takeRequest(); - assertEquals(new String(request.getBody(), "UTF-8"), ""); + assertEquals(new String(request.getBody(), Charsets.UTF_8), ""); } finally { close(client, true); server.shutdown(); @@ -549,9 +550,9 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base assertEquals(result, "fooPUT"); // Verify that the body was properly sent in the two requests RecordedRequest request = server.takeRequest(); - assertEquals(new String(request.getBody(), "UTF-8"), "foo"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "foo"); request = server.takeRequest(); - assertEquals(new String(request.getBody(), "UTF-8"), "foo"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "foo"); } finally { close(client, true); server.shutdown(); diff --git a/drivers/okhttp/src/test/java/org/jclouds/http/okhttp/OkHttpCommandExecutorServiceTest.java b/drivers/okhttp/src/test/java/org/jclouds/http/okhttp/OkHttpCommandExecutorServiceTest.java index 20c1cdc3b5..deb2106b42 100644 --- a/drivers/okhttp/src/test/java/org/jclouds/http/okhttp/OkHttpCommandExecutorServiceTest.java +++ b/drivers/okhttp/src/test/java/org/jclouds/http/okhttp/OkHttpCommandExecutorServiceTest.java @@ -36,6 +36,7 @@ import org.jclouds.rest.annotations.PATCH; import org.jclouds.rest.binders.BindToStringPayload; import org.testng.annotations.Test; +import com.google.common.base.Charsets; import com.google.inject.Module; import com.squareup.okhttp.mockwebserver.MockResponse; import com.squareup.okhttp.mockwebserver.MockWebServer; @@ -80,7 +81,7 @@ public class OkHttpCommandExecutorServiceTest extends BaseHttpCommandExecutorSer // Verify that the body is properly populated RecordedRequest request = server.takeRequest(); assertEquals(request.getMethod(), "PATCH"); - assertEquals(new String(request.getBody(), "UTF-8"), "foo"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "foo"); assertEquals(result, "fooPATCH"); } finally { close(api, true); @@ -100,10 +101,10 @@ public class OkHttpCommandExecutorServiceTest extends BaseHttpCommandExecutorSer // Verify that the body was properly sent in the two requests RecordedRequest request = server.takeRequest(); assertEquals(request.getMethod(), "PATCH"); - assertEquals(new String(request.getBody(), "UTF-8"), "foo"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "foo"); request = server.takeRequest(); assertEquals(request.getMethod(), "PATCH"); - assertEquals(new String(request.getBody(), "UTF-8"), "foo"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "foo"); } finally { close(api, true); server.shutdown(); @@ -125,10 +126,10 @@ public class OkHttpCommandExecutorServiceTest extends BaseHttpCommandExecutorSer // Verify that the body was populated after the redirect RecordedRequest request = server.takeRequest(); assertEquals(request.getMethod(), "PATCH"); - assertEquals(new String(request.getBody(), "UTF-8"), "foo"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "foo"); request = redirectTarget.takeRequest(); assertEquals(request.getMethod(), "PATCH"); - assertEquals(new String(request.getBody(), "UTF-8"), "foo"); + assertEquals(new String(request.getBody(), Charsets.UTF_8), "foo"); } finally { close(api, true); redirectTarget.shutdown(); @@ -145,7 +146,7 @@ public class OkHttpCommandExecutorServiceTest extends BaseHttpCommandExecutorSer assertEquals(server.getRequestCount(), 1); RecordedRequest request = server.takeRequest(); assertEquals(request.getMethod(), "PATCH"); - assertEquals(new String(request.getBody(), "UTF-8"), ""); + assertEquals(new String(request.getBody(), Charsets.UTF_8), ""); } finally { close(api, true); server.shutdown();