You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2005/12/18 23:16:57 UTC

svn commit: r357525 - in /incubator/roller/trunk: src/org/roller/presentation/RollerRequest.java src/org/roller/util/Blacklist.java tests/org/roller/presentation/TestAll.java

Author: snoopdave
Date: Sun Dec 18 14:16:51 2005
New Revision: 357525

URL: http://svn.apache.org/viewcvs?rev=357525&view=rev
Log:
More unit test fixes

Modified:
    incubator/roller/trunk/src/org/roller/presentation/RollerRequest.java
    incubator/roller/trunk/src/org/roller/util/Blacklist.java
    incubator/roller/trunk/tests/org/roller/presentation/TestAll.java

Modified: incubator/roller/trunk/src/org/roller/presentation/RollerRequest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/RollerRequest.java?rev=357525&r1=357524&r2=357525&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/RollerRequest.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/RollerRequest.java Sun Dec 18 14:16:51 2005
@@ -103,7 +103,7 @@
     
     public static final String OWNING_WEBSITE         = "OWNING_WEBSITE";
     
-    private static final String ROLLER_REQUEST        = "roller_request";
+    public static final String ROLLER_REQUEST        = "roller_request";
     
     private SimpleDateFormat mFmt = DateUtil.get8charDateFormat();
 

Modified: incubator/roller/trunk/src/org/roller/util/Blacklist.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/util/Blacklist.java?rev=357525&r1=357524&r2=357525&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/util/Blacklist.java (original)
+++ incubator/roller/trunk/src/org/roller/util/Blacklist.java Sun Dec 18 14:16:51 2005
@@ -52,7 +52,6 @@
     /** We no longer have a blacklist update URL */
     private static final String blacklistURL = null; 
 
-    private String uploadDir = null;
     private Date lastModified = null;
     private List blacklistStr = new LinkedList();
     private List blacklistRegex = new LinkedList();
@@ -61,12 +60,11 @@
     static {
         mLogger.info("Initializing MT Blacklist");
         blacklist = new Blacklist();
-        blacklist.loadBlacklistFromFile();
+        blacklist.loadBlacklistFromFile(null);
     }
     
     /** Hide constructor */
     private Blacklist() {
-        this.uploadDir = RollerConfig.getProperty("uploads.dir");
     }
       
     /** Singleton factory method. */
@@ -84,7 +82,7 @@
         if (this.blacklistURL != null) {
             boolean blacklist_updated = this.downloadBlacklist();
             if (blacklist_updated) {
-                this.loadBlacklistFromFile();
+                this.loadBlacklistFromFile(null);
             }
         }
     }
@@ -135,7 +133,8 @@
                 // save the new blacklist
                 InputStream instream = connection.getInputStream();
                 
-                String path = this.uploadDir + File.separator + blacklistFile;
+                String uploadDir = RollerConfig.getProperty("uploads.dir");
+                String path = uploadDir + File.separator + blacklistFile;
                 FileOutputStream outstream = new FileOutputStream(path);
                 
                 mLogger.debug("writing updated MT blacklist to "+path);
@@ -168,16 +167,21 @@
      * Load the MT blacklist from the file system.
      * We look for a previously downloaded version of the blacklist first and
      * if it's not found then we load the default blacklist packed with Roller.
+     * Only public for purposes of unit testing.
      */
-    private void loadBlacklistFromFile() {
+    public void loadBlacklistFromFile(String blacklistFilePath) {
         
         InputStream txtStream = null;
         try {
-            String path = this.uploadDir + File.separator + blacklistFile;
+            String path = blacklistFilePath;
+            if (path == null) {
+                String uploadDir = RollerConfig.getProperty("uploads.dir");
+                path = uploadDir + File.separator + blacklistFile;
+            }
             File blacklistFile = new File(path);
             
             // check our lastModified date to see if we need to re-read the file
-            if(this.lastModified != null &&
+            if (this.lastModified != null &&
                     this.lastModified.getTime() >= blacklistFile.lastModified()) {               
                 mLogger.debug("Blacklist is current, no need to load again");
                 return;

Modified: incubator/roller/trunk/tests/org/roller/presentation/TestAll.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/TestAll.java?rev=357525&r1=357524&r2=357525&view=diff
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/TestAll.java (original)
+++ incubator/roller/trunk/tests/org/roller/presentation/TestAll.java Sun Dec 18 14:16:51 2005
@@ -27,20 +27,20 @@
     public static Test suite()
     {
         TestSuite suite = new TestSuite();
-        //suite.addTest(BookmarksActionTest.suite());
-        //suite.addTest(WeblogEntryActionTest.suite());
-        //suite.addTest(BlacklistTest.suite());
-        //suite.addTest(DateTest.suite());
-        //suite.addTest(RequestFilterTest.suite());
+        suite.addTest(BookmarksActionTest.suite());
+        suite.addTest(WeblogEntryActionTest.suite());
+        suite.addTest(BlacklistTest.suite());
+        suite.addTest(DateTest.suite());
+        suite.addTest(RequestFilterTest.suite());
         suite.addTest(SearchServletTest.suite());
         suite.addTest(SmileysTest.suite());
         suite.addTest(TextileTest.suite());
-        //suite.addTest(RollerXmlRpcServerTest.suite());
-        //suite.addTest(LinkbackExtractorTest.suite());
-        //suite.addTest(LRUCache2Test.suite());
-        //suite.addTest(RegexUtilTest.suite());
+        suite.addTest(RollerXmlRpcServerTest.suite());
+        suite.addTest(LinkbackExtractorTest.suite());
+        suite.addTest(LRUCache2Test.suite());
+        suite.addTest(RegexUtilTest.suite());
         suite.addTest(DiskFeedInfoCacheTest.suite());
-        //suite.addTest(UtilitiesTest.suite());  
+        suite.addTest(UtilitiesTest.suite());  
         
         // TODO: suite.addTest(ApplicationResourcesTest.suite());
         // TODO: suite.addTest(ArchiveParserTest.suite());