Ensures the Swift container list call requests JSON as per spec

This commit is contained in:
Zack Shoylev 2016-02-18 11:56:59 -06:00
parent 5e3924947a
commit 8bbcfed312
3 changed files with 5 additions and 2 deletions

View File

@ -46,6 +46,7 @@ import org.jclouds.openstack.swift.v1.options.ListContainerOptions;
import org.jclouds.openstack.swift.v1.options.UpdateContainerOptions;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
@ -77,6 +78,7 @@ public interface ContainerApi {
@Named("container:list")
@GET
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
@QueryParams(keys = "format", values = "json")
FluentIterable<Container> list();
/**

View File

@ -18,6 +18,7 @@ package org.jclouds.openstack.swift.v1;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.assertj.core.api.Assertions.assertThat;
import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
@ -65,7 +66,7 @@ public class TempAuthMockTest {
// list request went to the destination specified in X-Storage-Url.
RecordedRequest listContainers = swiftServer.takeRequest();
assertEquals(listContainers.getMethod(), "GET");
assertEquals(listContainers.getPath(), "/");
assertThat(listContainers.getPath().contains("?format=json"));
assertEquals(listContainers.getHeader("Accept"), APPLICATION_JSON);
assertEquals(listContainers.getHeader("X-Auth-Token"), "token");
}

View File

@ -67,7 +67,7 @@ public class ContainerApiMockTest extends BaseOpenStackMockTest<SwiftApi> {
assertEquals(server.getRequestCount(), 2);
assertAuthentication(server);
assertRequest(server.takeRequest(), "GET", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9");
assertRequest(server.takeRequest(), "GET", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9?format=json");
} finally {
server.shutdown();
}