roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gma...@apache.org
Subject svn commit: r1551670 [2/2] - in /roller/trunk/app/src: main/java/org/apache/roller/planet/pojos/ main/java/org/apache/roller/planet/tasks/ main/java/org/apache/roller/weblogger/business/ main/java/org/apache/roller/weblogger/business/jpa/ main/java/org...
Date Tue, 17 Dec 2013 19:50:27 GMT
Modified: roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/FolderFunctionalityTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/FolderFunctionalityTest.java?rev=1551670&r1=1551669&r2=1551670&view=diff
==============================================================================
--- roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/FolderFunctionalityTest.java
(original)
+++ roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/FolderFunctionalityTest.java
Tue Dec 17 19:50:26 2013
@@ -106,7 +106,7 @@ public class FolderFunctionalityTest ext
         WeblogBookmarkFolder root = bmgr.getRootFolder(TestUtils.getManagedWebsite(testWeblog));
         
         // walk first level
-        Set folders = root.getFolders();
+        Set<WeblogBookmarkFolder> folders = root.getFolders();
         assertEquals(2, folders.size());
         assertTrue(folders.contains(testFolder));
         
@@ -118,7 +118,7 @@ public class FolderFunctionalityTest ext
                 break;
             }
         }
-        
+
         // walk second level
         folders = folder.getFolders();
         assertEquals(1, folders.size());

Modified: roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/FolderParentDeletesTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/FolderParentDeletesTest.java?rev=1551670&r1=1551669&r2=1551670&view=diff
==============================================================================
--- roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/FolderParentDeletesTest.java
(original)
+++ roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/FolderParentDeletesTest.java
Tue Dec 17 19:50:26 2013
@@ -18,9 +18,6 @@
 
 package org.apache.roller.weblogger.business;
 
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
 import junit.framework.TestCase;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;

Modified: roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/WeblogCategoryFunctionalityTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/WeblogCategoryFunctionalityTest.java?rev=1551670&r1=1551669&r2=1551670&view=diff
==============================================================================
--- roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/WeblogCategoryFunctionalityTest.java
(original)
+++ roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/WeblogCategoryFunctionalityTest.java
Tue Dec 17 19:50:26 2013
@@ -366,8 +366,6 @@ public class WeblogCategoryFunctionality
 
             // need to query for cats again since session was closed
             c1 = mgr.getWeblogCategory(c1.getId());
-            c2 = mgr.getWeblogCategory(c2.getId());
-            c3 = mgr.getWeblogCategory(c3.getId());
             dest = mgr.getWeblogCategory(dest.getId());
 
             // verify number of entries in each category

Modified: roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java?rev=1551670&r1=1551669&r2=1551670&view=diff
==============================================================================
--- roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java
(original)
+++ roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java
Tue Dec 17 19:50:26 2013
@@ -275,7 +275,7 @@ public class WeblogEntryTest extends Tes
         
         // get pinned entries only
         entries = null;
-        entries = mgr.getWeblogEntriesPinnedToMain(new Integer(5));
+        entries = mgr.getWeblogEntriesPinnedToMain(5);
         assertNotNull(entries);
         assertEquals(1, entries.size());
         assertEquals(entry1, entries.get(0));
@@ -310,8 +310,7 @@ public class WeblogEntryTest extends Tes
         TestUtils.teardownWeblogEntry(entry3.getId());
         TestUtils.endSession(true);
     }
-    
-    
+
     /**
      * Test that the createAnchor() method actually ensures unique anchors.
      */
@@ -345,7 +344,7 @@ public class WeblogEntryTest extends Tes
         TestUtils.teardownWeblogEntry(entry2.getId());
         TestUtils.endSession(true);
     }
-    
+
     public void testCreateAnEntryWithTagsShortcut() throws Exception {
         try {
             WeblogEntryManager mgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
@@ -450,7 +449,7 @@ public class WeblogEntryTest extends Tes
         TestUtils.teardownWeblogEntry(id);
         TestUtils.endSession(true);
     }    
-    
+
     public void testRemoveTagsViaShortcut() throws Exception {
         try {
             WeblogEntryManager mgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
@@ -578,7 +577,7 @@ public class WeblogEntryTest extends Tes
         }
     }
         
-    
+
     public void testRemoveEntryTagCascading() throws Exception {
 
         WeblogEntryManager mgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
@@ -614,7 +613,6 @@ public class WeblogEntryTest extends Tes
     } 
     
     public void testUpdateTags() throws Exception {
-
         WeblogEntryManager mgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
 
         // setup some test entries to use
@@ -640,9 +638,8 @@ public class WeblogEntryTest extends Tes
         TestUtils.endSession(true);
 
         entry = mgr.getWeblogEntry(id);
-        HashSet tagNames = new HashSet();
-        for (Iterator it = entry.getTags().iterator(); it.hasNext();) {
-            WeblogEntryTag tagData = (WeblogEntryTag) it.next();
+        HashSet<String> tagNames = new HashSet<String>();
+        for (WeblogEntryTag tagData : entry.getTags()) {
             tagNames.add(tagData.getName());
         }
 
@@ -663,9 +660,8 @@ public class WeblogEntryTest extends Tes
      * 
      * @throws Exception
      */
-    public void testUpdateTagTime() throws Exception {
-
-        WeblogEntryManager mgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
+     public void testUpdateTagTime() throws Exception {
+         WeblogEntryManager mgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
 
         // setup some test entries to use
         testWeblog = TestUtils.getManagedWebsite(testWeblog);
@@ -684,13 +680,12 @@ public class WeblogEntryTest extends Tes
 
         Timestamp original = null;
 
-        for (Iterator it = entry.getTags().iterator(); it.hasNext();) {
-            WeblogEntryTag tagData = (WeblogEntryTag) it.next();
+        for (WeblogEntryTag tagData : entry.getTags()) {
             if (tagData.getName().equals("testwillstaytag"))
                 original = tagData.getTime();
         }
 
-        List updateTags = new ArrayList();
+        List<String> updateTags = new ArrayList<String>();
         updateTags.add("testwillstaytag");
         updateTags.add("testnewtag");
         updateTags.add("testnewtag3");
@@ -699,12 +694,12 @@ public class WeblogEntryTest extends Tes
         TestUtils.endSession(true);
 
         entry = mgr.getWeblogEntry(id);
-        HashSet tagNames = new HashSet();
-        for (Iterator it = entry.getTags().iterator(); it.hasNext();) {
-            WeblogEntryTag tagData = (WeblogEntryTag) it.next();
+        HashSet<String> tagNames = new HashSet<String>();
+        for (WeblogEntryTag tagData : entry.getTags()) {
             tagNames.add(tagData.getName());
-            if (tagData.getName().equals("testwillstaytag"))
+            if (tagData.getName().equals("testwillstaytag")) {
                 assertEquals(original, tagData.getTime());
+            }
         }
 
         assertEquals(3, entry.getTags().size());
@@ -720,18 +715,17 @@ public class WeblogEntryTest extends Tes
 
     public void testTagAggregates() throws Exception {
         log.info("BEGIN");
-        
         WeblogEntryManager mgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
 
         testWeblog = TestUtils.getManagedWebsite(testWeblog);
         testUser = TestUtils.getManagedUser(testUser);
         Weblog testWeblog2 = TestUtils.setupWeblog("entryTestWeblog2", testUser);
-        
+
         try {
             // let's make sure we are starting from scratch
 
             // site-wide
-            List tags = mgr.getTags(null, null, null, 0, -1);
+            List<TagStat> tags = mgr.getTags(null, null, null, 0, -1);
             assertEquals(0, tags.size());
 
             // first weblog
@@ -749,7 +743,7 @@ public class WeblogEntryTest extends Tes
             entry.addTag("two");
             mgr.saveWeblogEntry(entry);
 
-            entry = TestUtils.setupWeblogEntry("entry2", 
+            entry = TestUtils.setupWeblogEntry("entry2",
                     testWeblog.getDefaultCategory(), testWeblog, testUser);
             entry.addTag("one");
             entry.addTag("two");
@@ -762,16 +756,15 @@ public class WeblogEntryTest extends Tes
             tags = mgr.getTags(testWeblog, null, null, 0, -1);
             assertEquals(3, tags.size());
 
-            HashMap expectedWeblogTags = new HashMap();
-            expectedWeblogTags.put("one", new Integer(2));
-            expectedWeblogTags.put("two", new Integer(2));
-            expectedWeblogTags.put("three", new Integer(1));
-
-            for (Iterator it = tags.iterator(); it.hasNext();) {
-                TagStat stat = (TagStat) it.next();
-                if (!expectedWeblogTags.containsKey(stat.getName()))
-                    fail("Unexpected tagName.");
+            HashMap<String,Integer> expectedWeblogTags = new HashMap<String,Integer>();
+            expectedWeblogTags.put("one", 2);
+            expectedWeblogTags.put("two", 2);
+            expectedWeblogTags.put("three", 1);
 
+            for (TagStat stat : tags) {
+                if (!expectedWeblogTags.containsKey(stat.getName())) {
+                    fail("Unexpected tagName.");
+                }
                 Integer expectedCount = (Integer)expectedWeblogTags.get(stat.getName());
                 assertEquals(expectedCount.intValue(), stat.getCount());
             }
@@ -792,14 +785,13 @@ public class WeblogEntryTest extends Tes
             tags = mgr.getTags(null, null, null, 0, -1);
             assertEquals(4, tags.size());
 
-            HashMap expectedSiteTags = new HashMap();
-            expectedSiteTags.put("one", new Integer(3));
-            expectedSiteTags.put("two", new Integer(2));
-            expectedSiteTags.put("three", new Integer(2));
-            expectedSiteTags.put("four", new Integer(1));
+            HashMap<String, Integer> expectedSiteTags = new HashMap<String, Integer>();
+            expectedSiteTags.put("one", 3);
+            expectedSiteTags.put("two", 2);
+            expectedSiteTags.put("three", 2);
+            expectedSiteTags.put("four", 1);
 
-            for (Iterator it = tags.iterator(); it.hasNext();) {
-                TagStat stat = (TagStat) it.next();
+            for (TagStat stat : tags) {
                 if (!expectedSiteTags.containsKey(stat.getName()))
                     fail("Unexpected tagName.");
 
@@ -811,7 +803,7 @@ public class WeblogEntryTest extends Tes
 
             testWeblog = TestUtils.getManagedWebsite(testWeblog);
             entry = mgr.getWeblogEntryByAnchor(testWeblog, "entry2");
-            List updateTags = new ArrayList();
+            List<String> updateTags = new ArrayList<String>();
             updateTags.add("one");
             updateTags.add("three");
             updateTags.add("five");
@@ -824,50 +816,49 @@ public class WeblogEntryTest extends Tes
             tags = mgr.getTags(testWeblog, null, null, 0, -1);
             assertEquals(4, tags.size());
 
-            expectedWeblogTags = new HashMap();
-            expectedWeblogTags.put("one", new Integer(2));
-            expectedWeblogTags.put("two", new Integer(1));
-            expectedWeblogTags.put("three", new Integer(1));
-            expectedWeblogTags.put("five", new Integer(1));
-
-            for (Iterator it = tags.iterator(); it.hasNext();) {
-                TagStat stat = (TagStat) it.next();
-                if (!expectedWeblogTags.containsKey(stat.getName()))
-                    fail("Unexpected tagName.");
+            expectedWeblogTags = new HashMap<String, Integer>();
+            expectedWeblogTags.put("one", 2);
+            expectedWeblogTags.put("two", 1);
+            expectedWeblogTags.put("three", 1);
+            expectedWeblogTags.put("five", 1);
 
-                Integer expectedCount = 
+            for (TagStat stat : tags) {
+                if (!expectedWeblogTags.containsKey(stat.getName())) {
+                    fail("Unexpected tagName.");
+                }
+                Integer expectedCount =
                         (Integer)expectedWeblogTags.get(stat.getName());
-                assertEquals(stat.getName(), 
+                assertEquals(stat.getName(),
                         expectedCount.intValue(), stat.getCount());
             }
 
             tags = mgr.getTags(null, null, null, 0, -1);
             assertEquals(5, tags.size());
 
-            expectedSiteTags = new HashMap();
-            expectedSiteTags.put("one", new Integer(3));
-            expectedSiteTags.put("two", new Integer(1));
-            expectedSiteTags.put("three", new Integer(2));
-            expectedSiteTags.put("four", new Integer(1));
-            expectedSiteTags.put("five", new Integer(1));
+            expectedSiteTags = new HashMap<String, Integer>();
+            expectedSiteTags.put("one", 3);
+            expectedSiteTags.put("two", 1);
+            expectedSiteTags.put("three", 2);
+            expectedSiteTags.put("four", 1);
+            expectedSiteTags.put("five", 1);
 
-            for (Iterator it = tags.iterator(); it.hasNext();) {
-                TagStat stat = (TagStat) it.next();
-                if (!expectedSiteTags.containsKey(stat.getName()))
+            for (TagStat stat : tags) {
+                if (!expectedSiteTags.containsKey(stat.getName())) {
                     fail("Unexpected tagName.");
-
+                }
                 Integer expectedCount = (Integer)expectedSiteTags.get(stat.getName());
                 assertEquals(stat.getName(), expectedCount.intValue(), stat.getCount());
             }
-            
+
             TestUtils.teardownWeblog(testWeblog2.getId());
             TestUtils.endSession(true);
-            
+
         } catch (Throwable t) {
             StringWriter sw = new StringWriter();
             PrintWriter pw = new PrintWriter(sw); 
             t.printStackTrace(pw);
-            log.info(sw.toString());
+            log.error(sw.toString());
+            System.out.println(sw.toString());
         }
         
         log.info("END");
@@ -885,7 +876,7 @@ public class WeblogEntryTest extends Tes
         // let's make sure we are starting from scratch
 
         // site-wide
-        List tags = mgr.getTags(null, null, null, 0, -1);
+        List<TagStat> tags = mgr.getTags(null, null, null, 0, -1);
         assertEquals(0, tags.size());
 
         // first weblog
@@ -909,12 +900,11 @@ public class WeblogEntryTest extends Tes
         tags = mgr.getTags(testWeblog, null, null, 0, -1);
         assertEquals(2, tags.size());
 
-        HashMap expectedWeblogTags = new HashMap();
-        expectedWeblogTags.put("one", new Integer(1));
-        expectedWeblogTags.put("two", new Integer(1));
+        HashMap<String, Integer> expectedWeblogTags = new HashMap<String, Integer>();
+        expectedWeblogTags.put("one", 1);
+        expectedWeblogTags.put("two", 1);
 
-        for (Iterator it = tags.iterator(); it.hasNext();) {
-            TagStat stat = (TagStat) it.next();
+        for (TagStat stat : tags) {
             if (!expectedWeblogTags.containsKey(stat.getName()))
                 fail("Unexpected tagName.");
 
@@ -935,13 +925,12 @@ public class WeblogEntryTest extends Tes
         tags = mgr.getTags(null, null, null, 0, -1);
         assertEquals(3, tags.size());
 
-        HashMap expectedSiteTags = new HashMap();
-        expectedSiteTags.put("one", new Integer(2));
-        expectedSiteTags.put("two", new Integer(1));
-        expectedSiteTags.put("three", new Integer(1));
+        HashMap<String, Integer> expectedSiteTags = new HashMap<String, Integer>();
+        expectedSiteTags.put("one", 2);
+        expectedSiteTags.put("two", 1);
+        expectedSiteTags.put("three", 1);
 
-        for (Iterator it = tags.iterator(); it.hasNext();) {
-            TagStat stat = (TagStat) it.next();
+        for (TagStat stat : tags) {
             if (!expectedSiteTags.containsKey(stat.getName()))
                 fail("Unexpected tagName.");
 
@@ -955,13 +944,13 @@ public class WeblogEntryTest extends Tes
         TestUtils.teardownWeblog(testWeblog2.getId());
         TestUtils.endSession(true);
     }
-           
+
   
     
     /**
      * Test that we can add and remove entry attributes for an entry.
      */
-    public void testEntryAttributeCRUD() throws Exception {
+     public void testEntryAttributeCRUD() throws Exception {
         
         WeblogManager mgr = WebloggerFactory.getWeblogger().getWeblogManager();
         WeblogEntryManager emgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
@@ -1028,8 +1017,7 @@ public class WeblogEntryTest extends Tes
     
     
     public void testWeblogStats() throws Exception {
-        
-        
+
         WeblogEntryManager emgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
         WeblogManager wmgr = WebloggerFactory.getWeblogger().getWeblogManager();
         UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();

Modified: roller/trunk/app/src/test/java/org/apache/roller/weblogger/ui/ApplicationResourcesTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/test/java/org/apache/roller/weblogger/ui/ApplicationResourcesTest.java?rev=1551670&r1=1551669&r2=1551670&view=diff
==============================================================================
--- roller/trunk/app/src/test/java/org/apache/roller/weblogger/ui/ApplicationResourcesTest.java
(original)
+++ roller/trunk/app/src/test/java/org/apache/roller/weblogger/ui/ApplicationResourcesTest.java
Tue Dec 17 19:50:26 2013
@@ -23,7 +23,6 @@
 package org.apache.roller.weblogger.ui;
 
 import java.io.FileInputStream;
-import java.util.Iterator;
 import java.util.Properties;
 import java.util.Set;
 
@@ -54,7 +53,7 @@ public class ApplicationResourcesTest ex
 	private Properties baseProps = null; 
 
 	/**
-	 * @param arg0
+	 * @param name
 	 */
 	public ApplicationResourcesTest(String name)
 	{
@@ -129,16 +128,13 @@ public class ApplicationResourcesTest ex
 		verifyResourceBundle("ApplicationResources_vi");
 	}
 
-	public void testSystemProperties()
-	{
-		Properties sysProps = System.getProperties();
-		Set keys = sysProps.keySet();
-		for (Iterator iter = keys.iterator(); iter.hasNext();)
-		{
-			String key = (String) iter.next();
-			System.out.println(key + " = " + sysProps.getProperty(key));
-		}
-	}
+    public void testSystemProperties()
+    {
+        Properties sysProps = System.getProperties();
+        for (Object key : sysProps.keySet()) {
+            System.out.println(key + " = " + sysProps.getProperty((String)key));
+        }
+    }
 
 	/**
 	 * Helper method to do the actual testing.
@@ -166,15 +162,13 @@ public class ApplicationResourcesTest ex
 
 		// check Chinese
 		System.out.println("Veriyfing " + bundle + "...");
-		for (Iterator iter = keys.iterator(); iter.hasNext();)
-		{
-			String key = (String) iter.next();
-			if (props.getProperty(key) == null)
-			{
-				System.err.println(key + " = " + baseProps.getProperty(key));
-				missingMessage = true;
-			}
-		}
+        for (Object key : baseProps.keySet()) {
+            if (props.getProperty((String) key) == null)
+            {
+                System.err.println(key + " = " + baseProps.getProperty((String) key));
+                missingMessage = true;
+            }
+        }
 
 		assertFalse(missingMessage);
 	}



Mime
View raw message