@Test(timeout = SWIFT_TEST_TIMEOUT) public void testPutAndDelete() throws Throwable { assumeEnabled(); SwiftRestClient client = createClient(); client.authenticate(); Path path = new Path("restTestPutAndDelete"); SwiftObjectPath sobject = SwiftObjectPath.fromPath(serviceURI, path); byte[] stuff = new byte[1]; stuff[0] = 'a'; client.upload(sobject, new ByteArrayInputStream(stuff), stuff.length); //check file exists Duration head = new Duration(); Header[] responseHeaders = client.headRequest("expect success", sobject, SwiftRestClient.NEWEST); head.finished(); LOG.info("head request duration " + head); for (Header header: responseHeaders) { LOG.info(header.toString()); } //delete the file client.delete(sobject); //check file is gone try { Header[] headers = client.headRequest("expect fail", sobject, SwiftRestClient.NEWEST); Assert.fail("Expected deleted file, but object is still present: " + sobject); } catch (FileNotFoundException e) { //expected } for (DurationStats stats: client.getOperationStatistics()) { LOG.info(stats); } }