⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 attachmentdavprovidertest.java

📁 jspwiki source code,jspwiki source code
💻 JAVA
字号:
package com.ecyrd.jspwiki.dav;import java.util.Properties;import com.ecyrd.jspwiki.TestEngine;import com.ecyrd.jspwiki.attachment.Attachment;import com.ecyrd.jspwiki.dav.items.DavItem;import com.ecyrd.jspwiki.dav.items.DirectoryItem;import junit.framework.Test;import junit.framework.TestCase;import junit.framework.TestSuite;public class AttachmentDavProviderTest extends TestCase{    Properties props = new Properties();    TestEngine engine;    AttachmentDavProvider m_provider;        protected void setUp() throws Exception    {        props.load( TestEngine.findTestProperties() );        engine = new TestEngine(props);        m_provider = new AttachmentDavProvider(engine);    }    protected void tearDown() throws Exception    {        engine.deleteAttachments( "TestPage" );        TestEngine.deleteTestPage("TestPage");    }    public void testGetPageURL()        throws Exception    {        engine.saveText("TestPage", "foobar");        Attachment att = new Attachment(engine,"TestPage","deceit of the tribbles.txt");                engine.getAttachmentManager().storeAttachment( att, engine.makeAttachmentFile() );                DavItem di = m_provider.getItem( new DavPath("TestPage/deceit of the tribbles.txt") );                assertNotNull( "No di", di );        assertEquals("URL", "http://localhost/attach/TestPage/deceit%20of%20the%20tribbles.txt",                      di.getHref() );    }    public void testDirURL()        throws Exception    {        engine.saveText("TestPage", "foobar");            DavItem di = m_provider.getItem( new DavPath("") );            assertNotNull( "No di", di );        assertTrue( "DI is of wrong type", di instanceof DirectoryItem );        assertEquals("URL", "http://localhost/attach/", di.getHref() );    }    public void testDirURL2()        throws Exception    {        engine.saveText("TestPage", "foobar");        DavItem di = m_provider.getItem( new DavPath("TestPage/") );        assertNotNull( "No di", di );        assertTrue( "DI is of wrong type", di instanceof DirectoryItem );        assertEquals("URL", "http://localhost/attach/TestPage/", di.getHref() );    }    public static Test suite()    {        return new TestSuite( AttachmentDavProviderTest.class );    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -