1 4 package org.roller.presentation; 5 6 import java.io.File ; 7 8 import junit.framework.Test; 9 import junit.framework.TestSuite; 10 11 import org.roller.RollerException; 12 import org.roller.RollerTestBase; 13 import org.roller.business.FileManagerTest; 14 import org.roller.pojos.RollerConfigData; 15 import org.roller.presentation.velocity.ExportRssTest; 16 17 import com.mockrunner.mock.web.MockServletContext; 18 19 23 public class ArchiveParserTest extends RollerTestBase 24 { 25 MockServletContext mContext = null; 26 RollerConfigData rollerConfig = null; 27 28 private static String FILE_LOCATION = "./build/junk/"; 29 private static String RSS_ARCHIVE = "export-test.rss.xml"; 30 private static String ATOM_ARCHIVE = "export-test.atom.xml"; 31 32 public void _testAtomParsing() throws RollerException 33 { 34 File archiveFile = new File (FILE_LOCATION + 35 mWebsite.getUser().getUserName() + 36 "/" + ATOM_ARCHIVE); 37 parseFile(archiveFile); 38 } 39 40 public void _testRssParsing() throws RollerException 41 { 42 File archiveFile = new File (FILE_LOCATION + 43 mWebsite.getUser().getUserName() + 44 "/" + RSS_ARCHIVE); 45 parseFile(archiveFile); 46 } 47 48 52 private void parseFile(File archiveFile) throws RollerException 53 { 54 if (archiveFile.exists()) 55 { 56 String result = null; getRoller().commit(); 60 assertTrue(result.length() > 0); 61 System.out.println(result); 62 } 63 else 64 { 65 ExportRssTest exportTest = new ExportRssTest(); 67 try 68 { 69 exportTest.setUp(); 70 exportTest.testExportRecent(); 71 exportTest.tearDown(); 72 73 parseFile(archiveFile); 74 } 75 catch (Exception e) 76 { 77 e.printStackTrace(); 79 } 80 81 if (!archiveFile.exists()) 83 { 84 fail(archiveFile.getAbsolutePath() + " does not exist."); 85 } 86 } 87 } 88 89 93 public void setUp() throws Exception 94 { 95 super.setUp(); 96 97 } 99 100 104 public void tearDown() throws Exception 105 { 106 super.tearDown(); 107 } 108 109 public static Test suite() 110 { 111 return new TestSuite(ArchiveParserTest.class); 112 } 113 } 114 | Popular Tags |