01: package com.ecyrd.jspwiki.dav;
02:
03: import java.util.Properties;
04:
05: import com.ecyrd.jspwiki.TestEngine;
06: import com.ecyrd.jspwiki.dav.items.DavItem;
07: import com.ecyrd.jspwiki.dav.items.DirectoryItem;
08:
09: import junit.framework.Test;
10: import junit.framework.TestCase;
11: import junit.framework.TestSuite;
12:
13: public class HTMLPagesDavProviderTest extends TestCase {
14:
15: Properties props = new Properties();
16:
17: TestEngine engine;
18:
19: HTMLPagesDavProvider m_provider;
20:
21: protected void setUp() throws Exception {
22: props.load(TestEngine.findTestProperties());
23:
24: engine = new TestEngine(props);
25:
26: m_provider = new HTMLPagesDavProvider(engine);
27: }
28:
29: protected void tearDown() throws Exception {
30: TestEngine.deleteTestPage("TestPage");
31: }
32:
33: public void testGetPageURL() throws Exception {
34: engine.saveText("TestPage", "foobar");
35:
36: DavItem di = m_provider.getItem(new DavPath("t/TestPage.html"));
37:
38: assertNotNull("No di", di);
39: assertEquals("URL",
40: "http://localhost/dav/html/t/TestPage.html", di
41: .getHref());
42: }
43:
44: public void testDirURL() throws Exception {
45: engine.saveText("TestPage", "foobar");
46:
47: DavItem di = m_provider.getItem(new DavPath(""));
48:
49: assertNotNull("No di", di);
50: assertTrue("DI is of wrong type", di instanceof DirectoryItem);
51: assertEquals("URL", "http://localhost/dav/html/", di.getHref());
52: }
53:
54: public void testDirURL2() throws Exception {
55: engine.saveText("TestPage", "foobar");
56:
57: DavItem di = m_provider.getItem(new DavPath("t/"));
58:
59: assertNotNull("No di", di);
60: assertTrue("DI is of wrong type", di instanceof DirectoryItem);
61: assertEquals("URL", "http://localhost/dav/html/t/", di
62: .getHref());
63: }
64:
65: public static Test suite() {
66: return new TestSuite(HTMLPagesDavProviderTest.class);
67: }
68:
69: }
|