}
}
/** upper-cases first char, and lower-cases rest!! **/
public void getKnowingServerMessesWithMetadataKeyCaseFormat() throws Exception {
MockWebServer server = mockOpenStackServer();
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
server.enqueue(addCommonHeaders(containerResponse() //
// note silly casing
.addHeader("X-Container-Meta-Apiname", "swift") //
.addHeader("X-Container-Meta-Apiversion", "v1.1")));
try {
SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
Container container = api.containerApiInRegion("DFW").get("myContainer");
assertEquals(container.name(), "myContainer");
assertEquals(container.objectCount(), 42l);
assertEquals(container.bytesUsed(), 323479l);
for (Entry<String, String> entry : container.metadata().entrySet()) {
assertEquals(container.metadata().get(entry.getKey().toLowerCase()), entry.getValue());
}
assertEquals(server.getRequestCount(), 2);
assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
assertEquals(server.takeRequest().getRequestLine(),
"HEAD /v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer HTTP/1.1");
} finally {
server.shutdown();
}
}