Search in sources :

Example 76 with Attachment

use of org.apache.wiki.api.core.Attachment in project jspwiki by apache.

the class MarkdownRendererTest method testAttachmentLink.

@Test
public void testAttachmentLink() throws Exception {
    final String src = "This should be an [attachment link](Test/TestAtt.txt)";
    newPage("Test");
    final Attachment att = Wiki.contents().attachment(testEngine, "Test", "TestAtt.txt");
    att.setAuthor("FirstPost");
    testEngine.getManager(AttachmentManager.class).storeAttachment(att, testEngine.makeAttachmentFile());
    Assertions.assertEquals("<p>This should be an <a href=\"/test/attach/Test/TestAtt.txt\" class=\"attachment\">attachment link</a>" + "<a href=\"/test/PageInfo.jsp?page=Test/TestAtt.txt\" class=\"infolink\">" + "<img src=\"/test/images/attachment_small.png\" border=\"0\" alt=\"(info)\" />" + "</a></p>\n", translate(src));
}
Also used : Attachment(org.apache.wiki.api.core.Attachment) AttachmentManager(org.apache.wiki.attachment.AttachmentManager) Test(org.junit.jupiter.api.Test)

Aggregations

Attachment (org.apache.wiki.api.core.Attachment)76 Test (org.junit.jupiter.api.Test)37 AttachmentManager (org.apache.wiki.attachment.AttachmentManager)35 Page (org.apache.wiki.api.core.Page)27 ProviderException (org.apache.wiki.api.exceptions.ProviderException)20 PageManager (org.apache.wiki.pages.PageManager)19 File (java.io.File)15 Date (java.util.Date)10 Engine (org.apache.wiki.api.core.Engine)10 ReferenceManager (org.apache.wiki.references.ReferenceManager)9 InputStream (java.io.InputStream)8 FileInputStream (java.io.FileInputStream)6 IOException (java.io.IOException)6 InputStreamReader (java.io.InputStreamReader)6 StringWriter (java.io.StringWriter)6 Vector (java.util.Vector)6 WikiContext (org.apache.wiki.WikiContext)6 Permission (java.security.Permission)4 ArrayList (java.util.ArrayList)4 Hashtable (java.util.Hashtable)4