Skip to content

Instantly share code, notes, and snippets.

@jdaggett
Created January 10, 2014 19:09
Show Gist options
  • Save jdaggett/8360532 to your computer and use it in GitHub Desktop.
Save jdaggett/8360532 to your computer and use it in GitHub Desktop.
@Test(expectedExceptions = CopyObjectException.class)
public void copyObjectFail() throws InterruptedException, IOException {
MockWebServer server = mockOpenStackServer();
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(404)
.addHeader(SwiftHeaders.OBJECT_COPY_FROM, "/bogus/foo.txt")));
try {
SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
// the following line will throw the CopyObjectException
api.objectApiInRegionForContainer("DFW", "foo").copy("bar.txt", "bogus", "foo.txt");
} finally {
server.shutdown();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment