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 RawPagesDavProviderTest extends TestCase {
14: Properties props = new Properties();
15:
16: TestEngine engine;
17:
18: RawPagesDavProvider m_provider;
19:
20: protected void setUp() throws Exception {
21: props.load(TestEngine.findTestProperties());
22:
23: engine = new TestEngine(props);
24:
25: m_provider = new RawPagesDavProvider(engine);
26: }
27:
28: protected void tearDown() throws Exception {
29: TestEngine.deleteTestPage("TestPage");
30: }
31:
32: public void testGetPageURL() throws Exception {
33: engine.saveText("TestPage", "foobar");
34:
35: DavItem di = m_provider.getItem(new DavPath("t/TestPage.txt"));
36:
37: assertNotNull("No di", di);
38: assertEquals("URL", "http://localhost/dav/raw/t/TestPage.txt",
39: di.getHref());
40: }
41:
42: public void testDirURL() throws Exception {
43: engine.saveText("TestPage", "foobar");
44:
45: DavItem di = m_provider.getItem(new DavPath(""));
46:
47: assertNotNull("No di", di);
48: assertTrue("DI is of wrong type", di instanceof DirectoryItem);
49: assertEquals("URL", "http://localhost/dav/raw/", di.getHref());
50: }
51:
52: public void testDirURL2() throws Exception {
53: engine.saveText("TestPage", "foobar");
54:
55: DavItem di = m_provider.getItem(new DavPath("t/"));
56:
57: assertNotNull("No di", di);
58: assertTrue("DI is of wrong type", di instanceof DirectoryItem);
59: assertEquals("URL", "http://localhost/dav/raw/t/", di.getHref());
60: }
61:
62: public static Test suite() {
63: return new TestSuite(RawPagesDavProviderTest.class);
64: }
65:
66: }
|