@Test public void deleteMessage() throws Exception { String batchId = UUID.randomUUID().toString(); String messageId = "ar1vm0Wca42E/dDn3dsH8ogs3/s="; File batchDirectory = new File(new File(this.tmpDir, this.store.ROOT_DIRECTORY), URLEncoder.encode(batchId, "UTF-8")); batchDirectory.mkdirs(); File messageFile = new File(batchDirectory, URLEncoder.encode(messageId, "UTF-8")); messageFile.createNewFile(); this.store.delete(batchId, messageId); assertTrue(!messageFile.exists()); }
@Override public void delete(String batchId, String uniqueMessageId) throws MailStoreException { File messageFile = null; try { messageFile = getMessageFile(batchId, uniqueMessageId); if (messageFile.exists()) { messageFile.delete(); } if (messageFile.getParentFile().exists()) { messageFile.getParentFile().delete(); } } catch (Exception e) { throw new MailStoreException(String.format( "Failed to delete message (id [%s], batch id [%s]) file [%s]", uniqueMessageId, batchId, messageFile), e); } }
FileSystemMailContentStore implements MailContentStore, Initializable { @Override public void delete(String batchId, String uniqueMessageId) throws MailStoreException { File messageFile = null; try { messageFile = getMessageFile(batchId, uniqueMessageId); if (messageFile.exists()) { messageFile.delete(); } if (messageFile.getParentFile().exists()) { messageFile.getParentFile().delete(); } } catch (Exception e) { throw new MailStoreException(String.format( "Failed to delete message (id [%s], batch id [%s]) file [%s]", uniqueMessageId, batchId, messageFile), e); } } }
FileSystemMailContentStore implements MailContentStore, Initializable { @Override public void delete(String batchId, String uniqueMessageId) throws MailStoreException { File messageFile = null; try { messageFile = getMessageFile(batchId, uniqueMessageId); if (messageFile.exists()) { messageFile.delete(); } if (messageFile.getParentFile().exists()) { messageFile.getParentFile().delete(); } } catch (Exception e) { throw new MailStoreException(String.format( "Failed to delete message (id [%s], batch id [%s]) file [%s]", uniqueMessageId, batchId, messageFile), e); } }  }
FileSystemMailContentStore implements MailContentStore, Initializable { @Override public void delete(String batchId, String uniqueMessageId) throws MailStoreException { File messageFile = null; try { messageFile = getMessageFile(batchId, uniqueMessageId); if (messageFile.exists()) { messageFile.delete(); } if (messageFile.getParentFile().exists()) { messageFile.getParentFile().delete(); } } catch (Exception e) { throw new MailStoreException(String.format( "Failed to delete message (id [%s], batch id [%s]) file [%s]", uniqueMessageId, batchId, messageFile), e); } }  @Override void initialize(); @Override void save(String batchId, ExtendedMimeMessage message); @Override ExtendedMimeMessage load(Session session, String batchId, String uniqueMessageId); @Override void delete(String batchId, String uniqueMessageId); }
FileSystemMailContentStore implements MailContentStore, Initializable { @Override public void delete(String batchId, String uniqueMessageId) throws MailStoreException { File messageFile = null; try { messageFile = getMessageFile(batchId, uniqueMessageId); if (messageFile.exists()) { messageFile.delete(); } if (messageFile.getParentFile().exists()) { messageFile.getParentFile().delete(); } } catch (Exception e) { throw new MailStoreException(String.format( "Failed to delete message (id [%s], batch id [%s]) file [%s]", uniqueMessageId, batchId, messageFile), e); } }  @Override void initialize(); @Override void save(String batchId, ExtendedMimeMessage message); @Override ExtendedMimeMessage load(Session session, String batchId, String uniqueMessageId); @Override void delete(String batchId, String uniqueMessageId); static final String ROOT_DIRECTORY; }