@Test public void getObject() throws IOException { StoredObject object1 = container.getObject("some-object"); assertFalse(object1.exists()); object1.uploadObject(new byte[] {0x01}); StoredObject object2 = container.getObject("some-object"); assertEquals(object1, object2); assertTrue(object1.exists()); }
/** * Delete an arbitrary BlobPath from our store. * * @param path The blob path to delete */ @Override public void delete(BlobPath path) { String keyPath = path.buildAsString("/"); if (!keyPath.isEmpty()) { keyPath = keyPath + "/"; } StoredObject obj = swift().getObject(keyPath); if (obj.exists()) { obj.delete(); } }
@Test(expected = CommandException.class) public void checkWhetherANonExistingFileExistsButThrowAnotherError() { expectStatusCode(500); object.exists(); }
@Test public void checkWhetherANonExistingFileExists() { expectStatusCode(404); assertFalse(object.exists()); }