roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r515170 [2/2] - in /incubator/roller/branches/roller_4.0_newbackend: ./ components/core/dist/ components/core/src/java/org/apache/roller/business/jpa/ src/org/apache/roller/business/jpa/ src/org/apache/roller/pojos/ testdata/ testdata/WEB-I...
Date Tue, 06 Mar 2007 16:06:56 GMT
Modified: incubator/roller/branches/roller_4.0_newbackend/tests/org/apache/roller/business/WeblogEntryTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/tests/org/apache/roller/business/WeblogEntryTest.java?view=diff&rev=515170&r1=515169&r2=515170
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/tests/org/apache/roller/business/WeblogEntryTest.java
(original)
+++ incubator/roller/branches/roller_4.0_newbackend/tests/org/apache/roller/business/WeblogEntryTest.java
Tue Mar  6 08:06:54 2007
@@ -18,6 +18,8 @@
 
 package org.apache.roller.business;
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -154,6 +156,8 @@
         Map entryMap = null;
         
         // setup some test entries to use
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData entry1 = TestUtils.setupWeblogEntry("entry1", testWeblog.getDefaultCategory(),
testWeblog, testUser);
         WeblogEntryData entry2 = TestUtils.setupWeblogEntry("entry2", testWeblog.getDefaultCategory(),
testWeblog, testUser);
         WeblogEntryData entry3 = TestUtils.setupWeblogEntry("entry3", testWeblog.getDefaultCategory(),
testWeblog, testUser);
@@ -182,10 +186,19 @@
         
         TestUtils.endSession(true);
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
+
         log.debug("entry1 = "+entry1.getUpdateTime());
         log.debug("entry2 = "+entry2.getUpdateTime());
         log.debug("entry3 = "+entry3.getUpdateTime());
         
+        entry1 = TestUtils.getManagedWeblogEntry(entry1);
+        entry2 = TestUtils.getManagedWeblogEntry(entry2);
+        entry3 = TestUtils.getManagedWeblogEntry(entry3);
+        entry4 = TestUtils.getManagedWeblogEntry(entry4);
+        entry5 = TestUtils.getManagedWeblogEntry(entry5);
+        
         // get entry by id
         entry = null;
         entry = mgr.getWeblogEntry(entry1.getId());
@@ -299,15 +312,20 @@
         List entries = null;
         
         // setup some test entries to use
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData entry1 = TestUtils.setupWeblogEntry("entry1", testWeblog.getDefaultCategory(),
testWeblog, testUser);
         TestUtils.endSession(true);
         
         // make sure createAnchor gives us a new anchor value
+        entry1 = TestUtils.getManagedWeblogEntry(entry1);
         String anchor = mgr.createAnchor(entry1);
         assertNotNull(anchor);
         assertNotSame("entry1", anchor);
         
         // make sure we can create a new entry with specified anchor
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData entry2 = TestUtils.setupWeblogEntry(anchor, testWeblog.getDefaultCategory(),
testWeblog, testUser);
         TestUtils.endSession(true);
         assertNotNull(entry2);
@@ -319,43 +337,53 @@
     }
     
     public void testCreateAnEntryWithTagsShortcut() throws Exception {
+        try {
+            WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
+            WeblogEntryData entry = null;
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            testUser = TestUtils.getManagedUser(testUser);
+
+            WeblogEntryData testEntry = new WeblogEntryData();
+            testEntry.setTitle("entryTestEntry");
+            testEntry.setLink("testEntryLink");
+            testEntry.setText("blah blah entry");
+            testEntry.setAnchor("testEntryAnchor");
+            testEntry.setPubTime(
+                    new java.sql.Timestamp(new java.util.Date().getTime()));
+            testEntry.setUpdateTime(
+                    new java.sql.Timestamp(new java.util.Date().getTime()));
+            testEntry.setWebsite(testWeblog);
+            testEntry.setCreator(testUser);
+            testEntry.setCategory(testWeblog.getDefaultCategory());
+
+            // shortcut
+            testEntry.addTag("testTag");
+
+            // create a weblog entry
+            mgr.saveWeblogEntry(testEntry);
+            String id = testEntry.getId();
+            TestUtils.endSession(true);
 
-        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
-        WeblogEntryData entry = null;
-
-        WeblogEntryData testEntry = new WeblogEntryData();
-        testEntry.setTitle("entryTestEntry");
-        testEntry.setLink("testEntryLink");
-        testEntry.setText("blah blah entry");
-        testEntry.setAnchor("testEntryAnchor");
-        testEntry.setPubTime(new java.sql.Timestamp(new java.util.Date()
-                .getTime()));
-        testEntry.setUpdateTime(new java.sql.Timestamp(new java.util.Date()
-                .getTime()));
-        testEntry.setWebsite(TestUtils.getManagedWebsite(testWeblog));
-        testEntry.setCreator(TestUtils.getManagedUser(testUser));
-        testEntry.setCategory(TestUtils.getManagedWebsite(testWeblog).getDefaultCategory());
-
-        // shortcut
-        testEntry.addTag("testTag");
-
-        // create a weblog entry
-        mgr.saveWeblogEntry(testEntry);
-        String id = testEntry.getId();
-        TestUtils.endSession(true);
-
-        // make sure entry was created
-        entry = mgr.getWeblogEntry(id);
-        assertNotNull(entry);
-        assertEquals(testEntry, entry);
-        assertNotNull(entry.getTags());
-        assertEquals(1, entry.getTags().size());
-        assertEquals("testtag", ((WeblogEntryTagData) entry.getTags()
-                .iterator().next()).getName());
+            // make sure entry was created
+            entry = mgr.getWeblogEntry(id);
+            assertNotNull(entry);
+            assertEquals(testEntry, entry);
+            assertNotNull(entry.getTags());
+            assertEquals(1, entry.getTags().size());
+            assertEquals("testtag", ((WeblogEntryTagData) entry.getTags()
+                    .iterator().next()).getName());
+            TestUtils.endSession(true);
 
-        // teardown our test entry
-        TestUtils.teardownWeblogEntry(id);
-        TestUtils.endSession(true);
+            // teardown our test entry
+            TestUtils.teardownWeblogEntry(id);
+            TestUtils.endSession(true);
+        
+        } catch (Throwable t) {
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw); 
+            t.printStackTrace(pw);
+            log.info(sw.toString());
+        }
     }
         
     public void testAddMultipleTags() throws Exception {
@@ -363,6 +391,8 @@
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
         // setup some test entries to use
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
                 .getDefaultCategory(), testWeblog, testUser);
         entry.addTag("testTag");
@@ -389,6 +419,8 @@
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
         // setup some test entries to use
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
                 .getDefaultCategory(), testWeblog, testUser);
         entry.addTag("testTag");
@@ -410,54 +442,65 @@
     }    
     
     public void testRemoveTagsViaShortcut() throws Exception {
+        try {
+            WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
-        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
-
-        // setup some test entries to use
-        WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
-                .getDefaultCategory(), testWeblog, testUser);
-        entry.addTag("testTag");
-        entry.addTag("testTag2");
-        String id = entry.getId();
-        mgr.saveWeblogEntry(entry);
-        TestUtils.endSession(true);
+            // setup some test entries to use
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            testUser = TestUtils.getManagedUser(testUser);
+            WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
+                    .getDefaultCategory(), testWeblog, testUser);
+            entry.addTag("testTag");
+            entry.addTag("testTag2");
+            String id = entry.getId();
+            mgr.saveWeblogEntry(entry);
+            TestUtils.endSession(true);
 
-        entry = mgr.getWeblogEntry(id);
-        assertEquals(2, entry.getTags().size());
-        TestUtils.endSession(true);
+            entry = mgr.getWeblogEntry(id);
+            assertEquals(2, entry.getTags().size());
+            TestUtils.endSession(true);
 
-        entry = mgr.getWeblogEntry(id);
-        mgr.removeWeblogEntryTag("testtag", entry);
-        mgr.removeWeblogEntryTag("testtag2", entry);
-        mgr.saveWeblogEntry(entry);
-        TestUtils.endSession(true);
+            entry = mgr.getWeblogEntry(id);
+            mgr.removeWeblogEntryTag("testtag", entry);
+            mgr.removeWeblogEntryTag("testtag2", entry);
+            mgr.saveWeblogEntry(entry);
+            TestUtils.endSession(true);
 
-        entry = mgr.getWeblogEntry(id);
-        assertEquals(0, entry.getTags().size());
-        TestUtils.endSession(true);
+            entry = mgr.getWeblogEntry(id);
+            assertEquals(0, entry.getTags().size());
+            TestUtils.endSession(true);
 
-        // teardown our test entry
-        TestUtils.teardownWeblogEntry(id);
-        TestUtils.endSession(true);
+            // teardown our test entry
+            TestUtils.teardownWeblogEntry(id);
+            TestUtils.endSession(true);
+            
+        } catch (Throwable t) {
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw); 
+            t.printStackTrace(pw);
+            log.info(sw.toString());
+        }
     }
     
     public void testTagsExist() throws Exception {
         
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WebsiteData weblog = TestUtils.setupWeblog("tagsExistWeblog1", testUser);
         String wid = weblog.getId();
         
         // setup some test entries to use
-        WeblogEntryData entry = TestUtils.setupWeblogEntry("tagsExistEntry1", testWeblog
-                .getDefaultCategory(), testWeblog, testUser);
+        WeblogEntryData entry = TestUtils.setupWeblogEntry("tagsExistEntry1", 
+                testWeblog.getDefaultCategory(), testWeblog, testUser);
         String id1 = entry.getId();
         entry.addTag("blahTag");
         entry.addTag("fooTag");
         mgr.saveWeblogEntry(entry);
 
-        WeblogEntryData entry2 = TestUtils.setupWeblogEntry("tagsExistEntry2", weblog
-                .getDefaultCategory(), weblog, testUser);
+        WeblogEntryData entry2 = TestUtils.setupWeblogEntry("tagsExistEntry2", 
+                weblog.getDefaultCategory(), weblog, testUser);
         String id2 = entry2.getId();
         entry2.addTag("aaaTag");
         entry2.addTag("bbbTag");
@@ -476,6 +519,8 @@
         this.assertFalse(mgr.getTagComboExists(tags1, null));
         
         // test weblog specific
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        weblog = TestUtils.getManagedWebsite(weblog);
         this.assertTrue(mgr.getTagComboExists(tags2, testWeblog));
         this.assertFalse(mgr.getTagComboExists(tags1, testWeblog));
         this.assertFalse(mgr.getTagComboExists(tags2, weblog));
@@ -490,34 +535,46 @@
     }
     
     public void testGetEntriesByTag() throws Exception {
+        try {
+            WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
-        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
-
-        // setup some test entries to use
-        WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
-                .getDefaultCategory(), testWeblog, testUser);
-        entry.addTag("testTag");
-        String id = entry.getId();
-        mgr.saveWeblogEntry(entry);
-        TestUtils.endSession(true);
+            // setup some test entries to use
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            testUser = TestUtils.getManagedUser(testUser);
+            WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", 
+                    testWeblog.getDefaultCategory(), testWeblog, testUser);
+            String id = entry.getId();
+            entry.addTag("testTag");
+            mgr.saveWeblogEntry(entry);
+            TestUtils.endSession(true);
 
-        List results = mgr.getWeblogEntries(testWeblog, null, null, null, null,
-                Arrays.asList(new String[] { "testtag" }), null, null, null, null, 0,
-                -1);
-        assertEquals(1, results.size());
-        WeblogEntryData testEntry = (WeblogEntryData) results.iterator().next();
-        assertEquals(entry, testEntry);
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            List results = mgr.getWeblogEntries(testWeblog, null, null, null, null,
+                Arrays.asList(new String[] {"testtag"}), null, null, null, null, 0, -1);
+            assertEquals(1, results.size());
+            WeblogEntryData testEntry = (WeblogEntryData)results.iterator().next();
+            assertEquals(entry, testEntry);
+            TestUtils.endSession(true);
 
-        // teardown our test entry
-        TestUtils.teardownWeblogEntry(id);
-        TestUtils.endSession(true);
-    }  
+            // teardown our test entry
+            TestUtils.teardownWeblogEntry(id);
+            TestUtils.endSession(true);
+            
+        } catch (Throwable t) {
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw); 
+            t.printStackTrace(pw);
+            log.info(sw.toString());
+        }
+    }
     
     public void testRemoveEntryTagCascading() throws Exception {
 
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
         // setup some test entries to use
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
                 .getDefaultCategory(), testWeblog, testUser);
         entry.addTag("testTag");
@@ -525,9 +582,9 @@
         mgr.saveWeblogEntry(entry);
         TestUtils.endSession(true);
 
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         List results = mgr.getWeblogEntries(testWeblog, null, null, null, null,
-                Arrays.asList(new String[] { "testtag" }), null, null, null, null, 0,
-                -1);
+            Arrays.asList(new String[] { "testtag" }), null, null, null, null, 0, -1);
         assertEquals(1, results.size());
         WeblogEntryData testEntry = (WeblogEntryData) results.iterator().next();
         assertEquals(entry, testEntry);
@@ -536,20 +593,22 @@
         TestUtils.teardownWeblogEntry(id);
         TestUtils.endSession(true);
 
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         results = mgr.getWeblogEntries(testWeblog, null, null, null, null,
-                Arrays.asList(new String[] { "testtag" }), null, null, null, null, 0,
-                -1);
+            Arrays.asList(new String[] { "testtag" }), null, null, null, null, 0,-1);
         assertEquals(0, results.size());
 
         // terminate
         TestUtils.endSession(true);
-    }
+    } 
     
     public void testUpdateTags() throws Exception {
 
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
         // setup some test entries to use
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
                 .getDefaultCategory(), testWeblog, testUser);
         entry.addTag("testWillStayTag");
@@ -598,6 +657,8 @@
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
         // setup some test entries to use
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
                 .getDefaultCategory(), testWeblog, testUser);
         String id = entry.getId();
@@ -647,152 +708,166 @@
     }
 
     public void testTagAggregates() throws Exception {
-
-        WebsiteData testWeblog2 = TestUtils.setupWeblog("entryTestWeblog2",
-                testUser);
-
+        log.info("BEGIN");
+        
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
-        // let's make sure we are starting from scratch
-
-        // site-wide
-        List tags = mgr.getTags(null, null, null, -1);
-        assertEquals(0, tags.size());
-
-        // first weblog
-        tags = mgr.getTags(testWeblog, null, null, -1);
-        assertEquals(0, tags.size());
-
-        // second weblog
-        tags = mgr.getTags(testWeblog2, null, null, -1);
-        assertEquals(0, tags.size());
-
-        // setup some test entries to use
-        WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
-                .getDefaultCategory(), testWeblog, testUser);
-        entry.addTag("one");
-        entry.addTag("two");
-        mgr.saveWeblogEntry(entry);
-
-        entry = TestUtils.setupWeblogEntry("entry2", testWeblog
-                .getDefaultCategory(), testWeblog, testUser);
-        entry.addTag("one");
-        entry.addTag("two");
-        entry.addTag("three");
-        mgr.saveWeblogEntry(entry);
-
-        TestUtils.endSession(true);
-
-        tags = mgr.getTags(testWeblog, null, null, -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.");
-
-            Integer expectedCount = (Integer) expectedWeblogTags.get(stat
-                    .getName());
-            assertEquals(expectedCount.intValue(), stat.getCount());
-        }
-
-        // now add another entry in another blog
-        entry = TestUtils.setupWeblogEntry("entry3", testWeblog2
-                .getDefaultCategory(), testWeblog2, testUser);
-        entry.addTag("one");
-        entry.addTag("three");
-        entry.addTag("four");
-        mgr.saveWeblogEntry(entry);
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
+        WebsiteData testWeblog2 = TestUtils.setupWeblog("entryTestWeblog2", testUser);
         
-        TestUtils.endSession(true);
-        
-        // let's fetch "site" tags now
-        tags = mgr.getTags(null, null, null, -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));
-
-        for (Iterator it = tags.iterator(); it.hasNext();) {
-            TagStat stat = (TagStat) it.next();
-            if (!expectedSiteTags.containsKey(stat.getName()))
-                fail("Unexpected tagName.");
-
-            Integer expectedCount = (Integer) expectedSiteTags.get(stat
-                    .getName());
-            assertEquals(expectedCount.intValue(), stat.getCount());
-        }
+        try {
+            // let's make sure we are starting from scratch
 
-        TestUtils.endSession(true);
+            // site-wide
+            List tags = mgr.getTags(null, null, null, -1);
+            assertEquals(0, tags.size());
+
+            // first weblog
+            tags = mgr.getTags(testWeblog, null, null, -1);
+            assertEquals(0, tags.size());
+
+            // second weblog
+            tags = mgr.getTags(testWeblog2, null, null, -1);
+            assertEquals(0, tags.size());
+
+            // setup some test entries to use
+            WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", 
+                    testWeblog.getDefaultCategory(), testWeblog, testUser);
+            entry.addTag("one");
+            entry.addTag("two");
+            mgr.saveWeblogEntry(entry);
+
+            entry = TestUtils.setupWeblogEntry("entry2", 
+                    testWeblog.getDefaultCategory(), testWeblog, testUser);
+            entry.addTag("one");
+            entry.addTag("two");
+            entry.addTag("three");
+            mgr.saveWeblogEntry(entry);
 
-        entry = mgr.getWeblogEntryByAnchor(testWeblog, "entry2");
-        List updateTags = new ArrayList();
-        updateTags.add("one");
-        updateTags.add("three");
-        updateTags.add("five");
-        entry.updateTags(updateTags);
-        mgr.saveWeblogEntry(entry);
+            TestUtils.endSession(true);
 
-        TestUtils.endSession(true);
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            tags = mgr.getTags(testWeblog, null, null, -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.");
+
+                Integer expectedCount = (Integer)expectedWeblogTags.get(stat.getName());
+                assertEquals(expectedCount.intValue(), stat.getCount());
+            }
+
+            // now add another entry in another blog
+            testWeblog2 = TestUtils.getManagedWebsite(testWeblog2);
+            testUser = TestUtils.getManagedUser(testUser);
+            entry = TestUtils.setupWeblogEntry("entry3", 
+                    testWeblog2.getDefaultCategory(), testWeblog2, testUser);
+            entry.addTag("one");
+            entry.addTag("three");
+            entry.addTag("four");
+            mgr.saveWeblogEntry(entry);
 
-        tags = mgr.getTags(testWeblog, null, null, -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));
+            TestUtils.endSession(true);
 
-        for (Iterator it = tags.iterator(); it.hasNext();) {
-            TagStat stat = (TagStat) it.next();
-            if (!expectedWeblogTags.containsKey(stat.getName()))
-                fail("Unexpected tagName.");
+            // let's fetch "site" tags now
+            tags = mgr.getTags(null, null, null, -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));
+
+            for (Iterator it = tags.iterator(); it.hasNext();) {
+                TagStat stat = (TagStat) it.next();
+                if (!expectedSiteTags.containsKey(stat.getName()))
+                    fail("Unexpected tagName.");
+
+                Integer expectedCount = (Integer) expectedSiteTags.get(stat.getName());
+                assertEquals(expectedCount.intValue(), stat.getCount());
+            }
 
-            Integer expectedCount = (Integer) expectedWeblogTags.get(stat
-                    .getName());
-            assertEquals(stat.getName(), expectedCount.intValue(), stat
-                    .getCount());
-        }
+            TestUtils.endSession(true);
 
-        tags = mgr.getTags(null, null, null, -1);
-        assertEquals(5, tags.size());
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            entry = mgr.getWeblogEntryByAnchor(testWeblog, "entry2");
+            List updateTags = new ArrayList();
+            updateTags.add("one");
+            updateTags.add("three");
+            updateTags.add("five");
+            entry.updateTags(updateTags);
+            mgr.saveWeblogEntry(entry);
 
-        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));
-
-        for (Iterator it = tags.iterator(); it.hasNext();) {
-            TagStat stat = (TagStat) it.next();
-            if (!expectedSiteTags.containsKey(stat.getName()))
-                fail("Unexpected tagName.");
+            TestUtils.endSession(true);
 
-            Integer expectedCount = (Integer) expectedSiteTags.get(stat
-                    .getName());
-            assertEquals(stat.getName(), expectedCount.intValue(), stat
-                    .getCount());
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            tags = mgr.getTags(testWeblog, null, null, -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.");
+
+                Integer expectedCount = 
+                        (Integer)expectedWeblogTags.get(stat.getName());
+                assertEquals(stat.getName(), 
+                        expectedCount.intValue(), stat.getCount());
+            }
+
+            tags = mgr.getTags(null, null, null, -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));
+
+            for (Iterator it = tags.iterator(); it.hasNext();) {
+                TagStat stat = (TagStat) it.next();
+                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());
         }
-
-        // teardown our test blog 2
-        TestUtils.teardownWeblog(testWeblog2.getId());
-        TestUtils.endSession(true);
+        
+        log.info("END");
     }
 
     public void testTagAggregatesCaseSensitivity() throws Exception {
 
         WebsiteData testWeblog2 = TestUtils.setupWeblog("entryTestWeblog2",
                 testUser);
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
 
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
@@ -912,8 +987,12 @@
         CommentData comment3 = TestUtils.setupComment("comment3", entry3);
         CommentData comment4 = TestUtils.setupComment("comment4", entry3);
         CommentData comment5 = TestUtils.setupComment("comment5", entry3);
+        TestUtils.endSession(true);
 
         try {
+            blog1 = umgr.getWebsite(blog1.getId());
+            blog2 = umgr.getWebsite(blog2.getId());
+            
             assertEquals(2L, blog1.getEntryCount());
             assertEquals(3L, blog2.getEntryCount());
             assertEquals(5L, wmgr.getEntryCount());

Modified: incubator/roller/branches/roller_4.0_newbackend/tests/org/apache/roller/business/WeblogPageTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/tests/org/apache/roller/business/WeblogPageTest.java?view=diff&rev=515170&r1=515169&r2=515170
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/tests/org/apache/roller/business/WeblogPageTest.java
(original)
+++ incubator/roller/branches/roller_4.0_newbackend/tests/org/apache/roller/business/WeblogPageTest.java
Tue Mar  6 08:06:54 2007
@@ -106,6 +106,7 @@
         TestUtils.endSession(true);
         
         // check that create was successful
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         template = null;
         template = mgr.getPageByName(testWeblog, testPage.getName());
         assertNotNull(template);
@@ -118,6 +119,7 @@
         
         // check that update was successful
         template = null;
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         template = mgr.getPageByName(testWeblog, "testtesttest");
         assertNotNull(template);
         assertEquals(testPage.getContents(), template.getContents());
@@ -128,6 +130,7 @@
         
         // check that delete was successful
         template = null;
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         template = mgr.getPageByName(testWeblog, testPage.getName());
         assertNull(template);
     }
@@ -153,6 +156,7 @@
         
         // lookup by name
         page = null;
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         page = mgr.getPageByName(testWeblog, testPage.getName());
         assertNotNull(page);
         assertEquals(testPage.getContents(), page.getContents());

Modified: incubator/roller/branches/roller_4.0_newbackend/tools/roller-core/roller-core.jar
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/tools/roller-core/roller-core.jar?view=diff&rev=515170&r1=515169&r2=515170
==============================================================================
Binary files - no diff available.

Modified: incubator/roller/branches/roller_4.0_newbackend/tools/roller-planet/roller-planet-business.jar
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/tools/roller-planet/roller-planet-business.jar?view=diff&rev=515170&r1=515169&r2=515170
==============================================================================
Binary files - no diff available.

Modified: incubator/roller/branches/roller_4.0_newbackend/web/WEB-INF/classes/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/web/WEB-INF/classes/META-INF/persistence.xml?view=diff&rev=515170&r1=515169&r2=515170
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/web/WEB-INF/classes/META-INF/persistence.xml
(original)
+++ incubator/roller/branches/roller_4.0_newbackend/web/WEB-INF/classes/META-INF/persistence.xml
Tue Mar  6 08:06:54 2007
@@ -1,9 +1,8 @@
 <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
     
     <persistence-unit name ="RollerPU" transaction-type = "RESOURCE_LOCAL">
-        <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
-        <!--
         <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+        <!--
         <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
         <provider>org.hibernate.ejb.HibernatePersistence</provider>
         -->



Mime
View raw message