コード例 #1
0
ファイル: ContainerMockTest.java プロジェクト: jasoncwik/joss
 @Test
 public void deleteObject() throws IOException {
   object.uploadObject(new byte[] {});
   assertEquals(1, container.list().size());
   object.delete();
   assertEquals(0, container.list().size());
 }
コード例 #2
0
 /**
  * Delete an object if it exists.
  *
  * @param object object handle to delete
  * @return true if object deletion was successful
  */
 private boolean deleteObject(final StoredObject object) {
   try {
     object.delete();
     return true;
   } catch (NotFoundException e) {
     LOG.debug("Object {} not found", object.getPath());
   }
   return false;
 }
コード例 #3
0
 @Override
 public boolean deleteById(String fileId) throws IOException {
   try {
     StoredObject swiftObject = container.getObject(fileId);
     swiftObject.delete();
     return true;
   } catch (NotFoundException e) {
     return false;
   }
 }
コード例 #4
0
 /**
  * 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();
   }
 }
コード例 #5
0
 @Test
 public void deleteObject() {
   expectStatusCode(204);
   object.delete();
 }