@Test public void documentUpdateOnDeleteTest() throws Exception { final List<XWikiAttachment> attachList = new ArrayList<XWikiAttachment>(); attachList.add(this.mockAttach); this.doc.setAttachmentList(attachList); getMockery().checking(new Expectations() { { oneOf(mockAttachVersionStore).deleteArchive(mockAttach, mockContext, false); exactly(2).of(mockHibernateSession).delete(with(any(Object.class))); oneOf(mockHibernate).saveXWikiDoc(doc, mockContext, false); will(new CustomAction("Make sure the attachment has been removed from the list.") { public Object invoke(final Invocation invoc) { final XWikiDocument document = (XWikiDocument) invoc.getParameter(0); Assert.assertTrue("Attachment was not removed from the list.", document.getAttachmentList().size() == 0); return null; } }); } }); this.createFile(); this.attachStore.deleteXWikiAttachment(this.mockAttach, true, this.mockContext, false); }
@Override public void deleteXWikiAttachment(final XWikiAttachment attachment, final XWikiContext context, final boolean bTransaction) throws XWikiException { this.deleteXWikiAttachment(attachment, true, context, bTransaction); }
FilesystemAttachmentStore implements XWikiAttachmentStoreInterface { @Override public void deleteXWikiAttachment(final XWikiAttachment attachment, final XWikiContext context, final boolean bTransaction) throws XWikiException { this.deleteXWikiAttachment(attachment, true, context, bTransaction); } }
FilesystemAttachmentStore implements XWikiAttachmentStoreInterface { @Override public void deleteXWikiAttachment(final XWikiAttachment attachment, final XWikiContext context, final boolean bTransaction) throws XWikiException { this.deleteXWikiAttachment(attachment, true, context, bTransaction); }  }
FilesystemAttachmentStore implements XWikiAttachmentStoreInterface { @Override public void deleteXWikiAttachment(final XWikiAttachment attachment, final XWikiContext context, final boolean bTransaction) throws XWikiException { this.deleteXWikiAttachment(attachment, true, context, bTransaction); }  @Override String getHint(); @Override void saveAttachmentContent(final XWikiAttachment attachment, final XWikiContext context,
        final boolean bTransaction); @Override void saveAttachmentContent(final XWikiAttachment attachment, final boolean updateDocument,
        final XWikiContext context, final boolean bTransaction); @Override void saveAttachmentsContent(final List<XWikiAttachment> attachments, final XWikiDocument doc,
        final boolean updateDocument, final XWikiContext context, final boolean bTransaction); @Override void loadAttachmentContent(final XWikiAttachment attachment, final XWikiContext context,
        final boolean bTransaction); @Override void deleteXWikiAttachment(final XWikiAttachment attachment, final XWikiContext context,
        final boolean bTransaction); @Override void deleteXWikiAttachment(final XWikiAttachment attachment, final boolean parentUpdate,
        final XWikiContext context, final boolean bTransaction); @Override void cleanUp(XWikiContext context); }
FilesystemAttachmentStore implements XWikiAttachmentStoreInterface { @Override public void deleteXWikiAttachment(final XWikiAttachment attachment, final XWikiContext context, final boolean bTransaction) throws XWikiException { this.deleteXWikiAttachment(attachment, true, context, bTransaction); }  @Override String getHint(); @Override void saveAttachmentContent(final XWikiAttachment attachment, final XWikiContext context,
        final boolean bTransaction); @Override void saveAttachmentContent(final XWikiAttachment attachment, final boolean updateDocument,
        final XWikiContext context, final boolean bTransaction); @Override void saveAttachmentsContent(final List<XWikiAttachment> attachments, final XWikiDocument doc,
        final boolean updateDocument, final XWikiContext context, final boolean bTransaction); @Override void loadAttachmentContent(final XWikiAttachment attachment, final XWikiContext context,
        final boolean bTransaction); @Override void deleteXWikiAttachment(final XWikiAttachment attachment, final XWikiContext context,
        final boolean bTransaction); @Override void deleteXWikiAttachment(final XWikiAttachment attachment, final boolean parentUpdate,
        final XWikiContext context, final boolean bTransaction); @Override void cleanUp(XWikiContext context);  }