1 4 package com.openedit.blog; 5 6 import org.openedit.blog.modules.BlogAdminModule; 7 8 import com.openedit.BaseTestCase; 9 import com.openedit.WebPageRequest; 10 import com.openedit.page.Page; 11 12 public class NotifyTest extends BaseTestCase 13 { 14 public void XtestNotify() throws Exception 15 { 16 BlogAdminModule module = (BlogAdminModule)getFixture().getModuleManager().getModule("BlogAdminModule"); 17 WebPageRequest req = getFixture().createPageRequest(); 18 module.sendNotification(req); 19 20 String output = req.getWriter().toString(); 21 assertTrue(output.length() > 100); 22 } 23 24 public void testFixContent() throws Exception 25 { 26 Notify notify = new Notify(); 27 notify.setRootDirectory(getFixture().getWebServer().getRootDirectory()); 28 notify.setPageManager(getFixture().getPageManager()); 29 notify.setUserManager(getFixture().getUserManager()); 30 31 Page good = getFixture().getPageManager().getPage("/yetanotherblog/permalink/2005/2/17/112302clean.html"); 33 Page page = getFixture().getPageManager().getPage("/yetanotherblog/permalink/2005/2/17/112302.html"); 34 getFixture().getPageManager().copyPage(good, page); 35 notify.fixLinks(page,"http://localhost:8080"); 36 page = getFixture().getPageManager().getPage("/yetanotherblog/permalink/2005/2/17/112302.html"); 37 String content = page.getContent(); 38 assertEquals( -1,content.indexOf("<img SRC=/yetanotherblog/images/")); 39 assertTrue( content.indexOf("<img SRC=http://localhost:8080/yetanotherblog/images/") > 0); 40 assertTrue( content.indexOf("<img SRC=\"http://localhost:8080/yetanotherblog/images/logobar.gif\"") > 0); 41 assertTrue( content.indexOf("url('http://localhost:8080/yetanotherblog/images/logobar.gif')") > 0); 42 43 assertTrue( content.indexOf("<img SRC=\"http://localhost:8080/yetanotherblog/images/home.gif\"") > 0); 44 45 46 47 } 48 } 49 | Popular Tags |