01: /*
02: * Created on Jan 13, 2006
03: */
04: package com.openedit.blog;
05:
06: import org.openedit.blog.modules.BlogAdminModule;
07:
08: import com.openedit.BaseTestCase;
09: import com.openedit.WebPageRequest;
10: import com.openedit.page.Page;
11:
12: public class NotifyTest extends BaseTestCase {
13: public void XtestNotify() throws Exception {
14: BlogAdminModule module = (BlogAdminModule) getFixture()
15: .getModuleManager().getModule("BlogAdminModule");
16: WebPageRequest req = getFixture().createPageRequest();
17: module.sendNotification(req);
18:
19: String output = req.getWriter().toString();
20: assertTrue(output.length() > 100);
21: }
22:
23: public void testFixContent() throws Exception {
24: Notify notify = new Notify();
25: notify.setRootDirectory(getFixture().getWebServer()
26: .getRootDirectory());
27: notify.setPageManager(getFixture().getPageManager());
28: notify.setUserManager(getFixture().getUserManager());
29:
30: //copy blank story
31: Page good = getFixture().getPageManager().getPage(
32: "/yetanotherblog/permalink/2005/2/17/112302clean.html");
33: Page page = getFixture().getPageManager().getPage(
34: "/yetanotherblog/permalink/2005/2/17/112302.html");
35: getFixture().getPageManager().copyPage(good, page);
36: notify.fixLinks(page, "http://localhost:8080");
37: page = getFixture().getPageManager().getPage(
38: "/yetanotherblog/permalink/2005/2/17/112302.html");
39: String content = page.getContent();
40: assertEquals(-1, content
41: .indexOf("<img src=/yetanotherblog/images/"));
42: assertTrue(content
43: .indexOf("<img src=http://localhost:8080/yetanotherblog/images/") > 0);
44: assertTrue(content
45: .indexOf("<img src=\"http://localhost:8080/yetanotherblog/images/logobar.gif\"") > 0);
46: assertTrue(content
47: .indexOf("url('http://localhost:8080/yetanotherblog/images/logobar.gif')") > 0);
48:
49: assertTrue(content
50: .indexOf("<img src=\"http://localhost:8080/yetanotherblog/images/home.gif\"") > 0);
51:
52: }
53: }
|