roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r189602 [31/50] - in /incubator/roller/trunk: ./ contrib/ contrib/lib/ contrib/plugins/ contrib/plugins/src/ contrib/plugins/src/org/ contrib/plugins/src/org/roller/ contrib/plugins/src/org/roller/presentation/ contrib/plugins/src/org/roller/presentation/velocity/ contrib/plugins/src/org/roller/presentation/velocity/plugins/ contrib/plugins/src/org/roller/presentation/velocity/plugins/acronyms/ contrib/plugins/src/org/roller/presentation/velocity/plugins/bookmarks/ contrib/plugins/src/org/roller/presentation/velocity/plugins/email/ contrib/plugins/src/org/roller/presentation/velocity/plugins/jspwiki/ contrib/plugins/src/org/roller/presentation/velocity/plugins/radeox/ contrib/plugins/src/org/roller/presentation/velocity/plugins/readmore/ contrib/plugins/src/org/roller/presentation/velocity/plugins/smileys/ contrib/plugins/src/org/roller/presentation/velocity/plugins/textile/ docs/ docs/images/ docs/installguide/ docs/installguide/old/ docs/userguide/ docs/userguide/images/ docs/userguide/old/ metadata/ metadata/database/ metadata/database/hibernate/ metadata/xdoclet/ personal/ personal/eclipse/ personal/testing/ src/ src/org/ src/org/roller/ src/org/roller/business/ src/org/roller/business/hibernate/ src/org/roller/business/utils/ src/org/roller/model/ src/org/roller/pojos/ src/org/roller/presentation/ src/org/roller/presentation/atom/ src/org/roller/presentation/bookmarks/ src/org/roller/presentation/bookmarks/actions/ src/org/roller/presentation/bookmarks/formbeans/ src/org/roller/presentation/bookmarks/tags/ src/org/roller/presentation/filters/ src/org/roller/presentation/forms/ src/org/roller/presentation/newsfeeds/ src/org/roller/presentation/pagecache/ src/org/roller/presentation/pagecache/rollercache/ src/org/roller/presentation/tags/ src/org/roller/presentation/tags/calendar/ src/org/roller/presentation/tags/menu/ src/org/roller/presentation/velocity/ src/org/roller/presentation/weblog/ src/org/roller/presentation/weblog/actions/ src/org/roller/presentation/weblog/formbeans/ src/org/roller/presentation/weblog/search/ src/org/roller/presentation/weblog/search/operations/ src/org/roller/presentation/weblog/tags/ src/org/roller/presentation/website/ src/org/roller/presentation/website/actions/ src/org/roller/presentation/website/formbeans/ src/org/roller/presentation/website/tags/ src/org/roller/presentation/xmlrpc/ src/org/roller/util/ tests/ tests/org/ tests/org/roller/ tests/org/roller/business/ tests/org/roller/model/ tests/org/roller/persistence/ tests/org/roller/presentation/ tests/org/roller/presentation/atom/ tests/org/roller/presentation/bookmarks/ tests/org/roller/presentation/velocity/ tests/org/roller/presentation/velocity/plugins/ tests/org/roller/presentation/velocity/plugins/smileys/ tests/org/roller/presentation/velocity/plugins/textile/ tests/org/roller/presentation/xmlrpc/ tests/org/roller/util/ tools/ tools/buildtime/ tools/buildtime/mockrunner-0.2.6/ tools/buildtime/mockrunner-0.2.6/lib/ tools/buildtime/tomcat-4.1.24/ tools/buildtime/xdoclet-1.2/ tools/buildtime/xdoclet-1.2/lib/ tools/hibernate-2.1/ tools/hibernate-2.1/lib/ tools/lib/ tools/standard-1.0.3/ tools/standard-1.0.3/lib/ tools/standard-1.0.3/tld/ tools/struts-1.1/ tools/struts-1.1/lib/ web/ web/WEB-INF/ web/WEB-INF/classes/ web/WEB-INF/classes/flavors/ web/WEB-INF/classes/themes/ web/bookmarks/ web/images/ web/images/editor/ web/images/midas/ web/images/preview/ web/images/smileys/ web/tags/ web/templates/ web/theme/ web/theme/images/ web/theme/lavender/ web/theme/scripts/ web/theme/scripts/classes/ web/themes/ web/themes/basic/ web/themes/berkley/ web/themes/berkley/images/ web/themes/cheb/ web/themes/cheb/images/ web/themes/cheb/scripts/ web/themes/clean/ web/themes/currency-i18n/ web/themes/currency-i18n/images/ web/themes/currency/ web/themes/currency/images/ web/themes/grey2/ web/themes/moonshine/ web/themes/pacifica/ web/themes/robot/ web/themes/rolling/ web/themes/rolling/images/ web/themes/sotto/ web/themes/sotto/images/ web/themes/sotto/styles/ web/themes/sunsets/ web/themes/sunsets/images/ web/themes/sunsets/scripts/ web/themes/sunsets/styles/ web/themes/werner/ web/themes/x2/ web/themes/x2/images/ web/themes/x2/scripts/ web/themes/x2/styles/ web/weblog/ web/website/
Date Wed, 08 Jun 2005 16:06:46 GMT
Added: incubator/roller/trunk/tests/org/roller/model/MockWeblogManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/model/MockWeblogManager.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/model/MockWeblogManager.java (added)
+++ incubator/roller/trunk/tests/org/roller/model/MockWeblogManager.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,633 @@
+/*
+ * Created on Mar 4, 2004
+ */
+package org.roller.model;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.roller.RollerException;
+import org.roller.business.PersistenceStrategy;
+import org.roller.pojos.Assoc;
+import org.roller.pojos.CommentData;
+import org.roller.pojos.WeblogCategoryAssoc;
+import org.roller.pojos.WeblogCategoryData;
+import org.roller.pojos.WeblogEntryData;
+import org.roller.pojos.WebsiteData;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author lance.lavandowska
+ */
+public class MockWeblogManager implements WeblogManager
+{
+    private static Log mLogger =
+        LogFactory.getFactory().getInstance(MockUserManager.class);
+    
+    private PersistenceStrategy mStrategy = null;
+
+    /**
+     * @param strategy
+     * @param roller
+     */
+    public MockWeblogManager(PersistenceStrategy strategy, MockRoller roller)
+    {
+        mStrategy = strategy;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#release()
+     */
+    public void release()
+    {
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#createWeblogCategory()
+     */
+    public WeblogCategoryData createWeblogCategory()
+    {
+        WeblogCategoryData cat = new WeblogCategoryData();
+        try
+        {
+            mStrategy.store(cat);
+        }
+        catch (RollerException e)
+        {
+        }
+        return cat;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#createWeblogCategory(org.roller.pojos.WebsiteData, org.roller.pojos.WeblogCategoryData, java.lang.String, java.lang.String, java.lang.String)
+     */
+    public WeblogCategoryData createWeblogCategory(WebsiteData website,
+                                                   WeblogCategoryData parent,
+                                                   String name,
+                                                   String description,
+                                                   String image)
+            throws RollerException
+    {
+        WeblogCategoryData cat = new WeblogCategoryData(null, website, 
+                                                        parent, name, 
+                                                        description, image);
+        try
+        {
+            mStrategy.store(cat);
+        }
+        catch (RollerException e)
+        {
+        }
+        return cat;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#retrieveWeblogCategory(java.lang.String)
+     */
+    public WeblogCategoryData retrieveWeblogCategory(String id)
+            throws RollerException
+    { 
+        return (WeblogCategoryData)mStrategy.load(id, WeblogCategoryData.class);
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#moveWeblogCategoryContents(java.lang.String, java.lang.String)
+     */
+    public void moveWeblogCategoryContents(String srcId, String destId)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getWeblogCategories(java.lang.String)
+     */
+    public List getWeblogCategories(String userName) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getWeblogCategory(java.lang.String, java.lang.String)
+     */
+    public WeblogCategoryData getWeblogCategory(String catName, String userName)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getRootWeblogCategory(org.roller.pojos.WebsiteData)
+     */
+    public WeblogCategoryData getRootWeblogCategory(WebsiteData website)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getWeblogCategory(org.roller.pojos.WebsiteData, java.lang.String)
+     */
+    public WeblogCategoryData getWeblogCategory(WebsiteData website,
+                                                String categoryPath)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getPath(org.roller.pojos.WeblogCategoryData)
+     */
+    public String getPath(WeblogCategoryData category) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getWeblogCategoryByPath(org.roller.pojos.WebsiteData, org.roller.pojos.WeblogCategoryData, java.lang.String)
+     */
+    public WeblogCategoryData getWeblogCategoryByPath(
+                                                      WebsiteData wd,
+                                                      WeblogCategoryData category,
+                                                      String string)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#createWeblogCategoryAssoc()
+     */
+    public WeblogCategoryAssoc createWeblogCategoryAssoc()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#createWeblogCategoryAssoc(org.roller.pojos.WeblogCategoryData, org.roller.pojos.WeblogCategoryData, java.lang.String)
+     */
+    public WeblogCategoryAssoc createWeblogCategoryAssoc(
+                                                         WeblogCategoryData category,
+                                                         WeblogCategoryData ancestor,
+                                                         String relation)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#retrieveWeblogCategoryAssoc(java.lang.String)
+     */
+    public WeblogCategoryAssoc retrieveWeblogCategoryAssoc(String id)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getComments(java.lang.String)
+     */
+    public List getComments(String entryId) throws RollerException
+    {
+        return getComments(entryId, true);
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getComments(java.lang.String, boolean)
+     */
+    public List getComments(String entryId, boolean nospam) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#removeComment(java.lang.String)
+     */
+    public void removeComment(String id) throws RollerException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#removeComments(java.lang.String[])
+     */
+    public void removeComments(String[] ids) throws RollerException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#retrieveWeblogEntry(java.lang.String)
+     */
+    public WeblogEntryData retrieveWeblogEntry(String id)
+            throws RollerException
+    {
+        return (WeblogEntryData)mStrategy.load(id, WeblogEntryData.class);
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#removeWeblogEntry(java.lang.String)
+     */
+    public void removeWeblogEntry(String id) throws RollerException
+    {
+        mStrategy.remove(id, WeblogEntryData.class);
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getWeblogEntryByAnchor(java.lang.String, java.lang.String)
+     */
+    public WeblogEntryData getWeblogEntryByAnchor(String userName, String anchor)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getWeblogLastPublishTime(java.lang.String)
+     */
+    public Date getWeblogLastPublishTime(String userName)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getWeblogLastPublishTime(java.lang.String, java.lang.String)
+     */
+    public Date getWeblogLastPublishTime(String userName, String catName)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getRecentWeblogEntries(java.lang.String, java.util.Date, java.lang.String, int)
+     */
+    public Map getRecentWeblogEntries(String userName, Date date,
+                                      String catName, int count)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getRecentWeblogEntries(java.lang.String, java.util.Date, java.lang.String, int, boolean)
+     */
+    public Map getRecentWeblogEntries(String userName, Date date,
+                                      String catName, int count,
+                                      boolean publishedOnly)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getRecentWeblogEntriesArray(java.lang.String, java.util.Date, java.lang.String, int, boolean)
+     */
+    public List getRecentWeblogEntriesArray(String userName, Date date,
+                                            String catName, int count,
+                                            boolean pubOnly)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getWeblogEntriesInDateRange(java.lang.String, java.lang.String, java.util.Date, java.util.Date)
+     */
+    public List getWeblogEntriesInDateRange(String userName, String catName,
+                                            Date start, Date end)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getWeblogEntriesInDateRange(java.lang.String, java.lang.String, java.util.Date, java.util.Date, boolean)
+     */
+    public List getWeblogEntriesInDateRange(String userName, String catName,
+                                            Date start, Date end,
+                                            boolean pubOnly)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getWeblogEntriesGroupedByDay(java.lang.String, java.lang.String, java.util.Date, java.util.Date, boolean, boolean)
+     */
+    public Map getWeblogEntriesGroupedByDay(String userName, String catName,
+                                            Date start, Date end,
+                                            boolean daysOnly, boolean pubOnly)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getWeblogEntryMonthMap(java.lang.String, java.util.Date, java.lang.String, boolean, boolean)
+     */
+    public Map getWeblogEntryMonthMap(String userName, Date month, String cat,
+                                      boolean daysOnly, boolean publishedOnly)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getAllRecentWeblogEntries(java.util.Date, int)
+     */
+    public List getAllRecentWeblogEntries(Date endDate, int max)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getAllRecentWeblogEntries(java.util.Date, int, java.lang.String)
+     */
+    public List getAllRecentWeblogEntries(Date endDate, int max, String catName)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#retrieveWeblogEntries(org.roller.pojos.WeblogCategoryData, boolean)
+     */
+    public List retrieveWeblogEntries(WeblogCategoryData cat, boolean subcats)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.roller.model.WeblogManager#removeCommentsForEntry(java.lang.String)
+     */
+    public void removeCommentsForEntry(String entryId) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    /* (non-Javadoc)
+     * @see org.roller.model.WeblogManager#retrieveComment(java.lang.String)
+     */
+    public CommentData retrieveComment(String id) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#getRecentWeblogEntriesArray(java.lang.String, java.util.Date, java.lang.String, int, boolean, boolean)
+     */
+    public List getRecentWeblogEntriesArray(String userName, Date date, String catName, int count, boolean pubOnly, boolean draftOnly) throws RollerException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getNextEntry(org.roller.pojos.WeblogEntryData, java.lang.String)
+     */
+    public WeblogEntryData getNextEntry(WeblogEntryData current, String catName) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getPreviousEntry(org.roller.pojos.WeblogEntryData, java.lang.String)
+     */
+    public WeblogEntryData getPreviousEntry(WeblogEntryData current, String catName) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#getWeblogEntries(java.lang.String, java.util.Date, java.util.Date, java.lang.String, java.lang.String, java.lang.Integer)
+     */
+    public List getWeblogEntries(String userName, Date startDate, Date endDate, String catName, String status, Integer maxEntries) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#getWeblogEntryObjectMap(java.lang.String, java.util.Date, java.util.Date, java.lang.String, java.lang.String, java.lang.Integer)
+     */
+    public Map getWeblogEntryObjectMap(String userName, Date startDate, Date endDate, String catName, String status, Integer maxEntries) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#getWeblogEntryStringMap(java.lang.String, java.util.Date, java.util.Date, java.lang.String, java.lang.String, java.lang.Integer)
+     */
+    public Map getWeblogEntryStringMap(String userName, Date startDate, Date endDate, String catName, String status, Integer maxEntries) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#getWeblogEntriesPinnedToMain(int)
+     */
+    public List getWeblogEntriesPinnedToMain(Integer max)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#getWeblogCategories(org.roller.pojos.WebsiteData)
+     */
+    public List getWeblogCategories(WebsiteData website) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#getWeblogCategory(java.lang.String, org.roller.pojos.WebsiteData)
+     */
+    public WeblogCategoryData getWeblogCategory(String catName, WebsiteData website) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#getWeblogEntries(org.roller.pojos.WebsiteData, java.util.Date, java.util.Date, java.lang.String, java.lang.String, java.lang.Integer)
+     */
+    public List getWeblogEntries(WebsiteData website, Date startDate, Date endDate, String catName, String status, Integer maxEntries) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#getWeblogEntryObjectMap(org.roller.pojos.WebsiteData, java.util.Date, java.util.Date, java.lang.String, java.lang.String, java.lang.Integer)
+     */
+    public Map getWeblogEntryObjectMap(WebsiteData website, Date startDate, Date endDate, String catName, String status, Integer maxEntries) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#getWeblogEntryStringMap(org.roller.pojos.WebsiteData, java.util.Date, java.util.Date, java.lang.String, java.lang.String, java.lang.Integer)
+     */
+    public Map getWeblogEntryStringMap(WebsiteData website, Date startDate, Date endDate, String catName, String status, Integer maxEntries) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#getWeblogEntryByAnchor(org.roller.pojos.WebsiteData, java.lang.String)
+     */
+    public WeblogEntryData getWeblogEntryByAnchor(WebsiteData website, String anchor) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#removeWeblogEntryContents(org.roller.pojos.WeblogEntryData)
+     */
+    public void removeWeblogEntryContents(WeblogEntryData data) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#createAnchor(org.roller.pojos.WeblogEntryData)
+     */
+    public String createAnchor(WeblogEntryData data) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#isDuplicateWeblogCategoryName(org.roller.pojos.WeblogCategoryData)
+     */
+    public boolean isDuplicateWeblogCategoryName(WeblogCategoryData data) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#isWeblogCategoryInUse(org.roller.pojos.WeblogCategoryData)
+     */
+    public boolean isWeblogCategoryInUse(WeblogCategoryData data) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#getWeblogCategoryParentAssoc(org.roller.pojos.WeblogCategoryData)
+     */
+    public Assoc getWeblogCategoryParentAssoc(WeblogCategoryData data) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#getWeblogCategoryChildAssocs(org.roller.pojos.WeblogCategoryData)
+     */
+    public List getWeblogCategoryChildAssocs(WeblogCategoryData data) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#getAllWeblogCategoryDecscendentAssocs(org.roller.pojos.WeblogCategoryData)
+     */
+    public List getAllWeblogCategoryDecscendentAssocs(WeblogCategoryData data) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#getWeblogCategoryAncestorAssocs(org.roller.pojos.WeblogCategoryData)
+     */
+    public List getWeblogCategoryAncestorAssocs(WeblogCategoryData data) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /** 
+     * @see org.roller.model.WeblogManager#getWeblogCategories(org.roller.pojos.WebsiteData, boolean)
+     */
+    public List getWeblogCategories(WebsiteData website, boolean includeRoot) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* 
+     * @see org.roller.model.WeblogManager#getRecentComments(org.roller.pojos.WebsiteData)
+     */
+    public List getRecentComments(WebsiteData website) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+	/* (non-Javadoc)
+	 * @see org.roller.model.WeblogManager#getWeblogCategoryByPath(org.roller.pojos.WebsiteData, java.lang.String)
+	 */
+	public WeblogCategoryData getWeblogCategoryByPath(WebsiteData website, String categoryPath) throws RollerException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+    /* 
+     * @see org.roller.model.WeblogManager#getRecentComments(org.roller.pojos.WebsiteData, int)
+     */
+    public List getRecentComments(WebsiteData website, int maxCount) throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Added: incubator/roller/trunk/tests/org/roller/persistence/MockPersistenceStrategy.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/persistence/MockPersistenceStrategy.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/persistence/MockPersistenceStrategy.java (added)
+++ incubator/roller/trunk/tests/org/roller/persistence/MockPersistenceStrategy.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,147 @@
+package org.roller.persistence;
+import org.roller.RollerException;
+import org.roller.business.*;
+import org.roller.pojos.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/*
+ * Created on Mar 4, 2004
+ */
+
+/**
+ * @author lance.lavandowska
+ */
+public class MockPersistenceStrategy implements PersistenceStrategy
+{
+    private Map classMap = new HashMap();
+
+    /**
+     * 
+     */
+    public MockPersistenceStrategy()
+    {
+        classMap.put(org.roller.business.HitCountData.class, new HashMap());     
+        classMap.put(org.roller.pojos.BookmarkData.class, new HashMap());
+        classMap.put(org.roller.pojos.CommentData.class, new HashMap());
+        classMap.put(org.roller.pojos.FolderAssoc.class, new HashMap());
+        classMap.put(org.roller.pojos.FolderData.class, new HashMap());
+        classMap.put(org.roller.pojos.PageData.class, new HashMap());
+        classMap.put(org.roller.pojos.RefererData.class, new HashMap());
+        classMap.put(org.roller.pojos.RoleData.class, new HashMap());
+        classMap.put(org.roller.pojos.RollerConfig.class, new HashMap());
+        classMap.put(org.roller.pojos.UserData.class, new HashMap());
+        classMap.put(org.roller.pojos.WeblogCategoryData.class, new HashMap());
+        classMap.put(org.roller.pojos.WeblogCategoryAssoc.class, new HashMap());
+        classMap.put(org.roller.pojos.WeblogEntryData.class, new HashMap());
+        classMap.put(org.roller.pojos.WebsiteData.class, new HashMap());  
+    }
+
+    /**
+     * @return
+     */
+    private String randomStr()
+    {
+        // TODO Not-quite random:-)
+        return (new java.util.Date().toString());
+    }
+    
+    public Map getObjectStore(Class clazz) 
+    {
+        HashMap objMap = (HashMap)classMap.get(clazz);
+        if (objMap == null) 
+        {
+            objMap = new HashMap();
+            classMap.put(clazz, objMap);
+        }
+        return objMap;
+    }
+
+    /* 
+     * @see org.roller.persistence.PersistenceStrategy#store(org.roller.persistence.PersistentObject)
+     */
+    public PersistentObject store(PersistentObject data) throws RollerException
+    {
+        if (data.getId() == null)
+        {
+            data.setId( randomStr() );
+        }
+        Map objMap = getObjectStore(data.getClass());
+        objMap.put(data.getId(), data);
+        return data;
+    }
+
+    /* 
+     * @see org.roller.persistence.PersistenceStrategy#load(java.lang.String, java.lang.Class)
+     */
+    public PersistentObject load(String id, Class cls) throws RollerException
+    {
+        Map objMap = getObjectStore(cls);
+        return (PersistentObject)objMap.get(id);
+    }
+
+    /* 
+     * @see org.roller.persistence.PersistenceStrategy#remove(org.roller.persistence.PersistentObject)
+     */
+    public void remove(PersistentObject po) throws RollerException
+    {
+        remove(po.getId(), po.getClass());
+    }
+
+    /* 
+     * @see org.roller.persistence.PersistenceStrategy#remove(java.lang.String, java.lang.Class)
+     */
+    public void remove(String id, Class cls) throws RollerException
+    {
+        Map objMap = getObjectStore(cls);
+        objMap.remove(id);
+    }
+
+    /* 
+     * @see org.roller.persistence.PersistenceStrategy#begin()
+     */
+    public void begin() throws RollerException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* 
+     * @see org.roller.persistence.PersistenceStrategy#commit()
+     */
+    public void commit() throws RollerException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* 
+     * @see org.roller.persistence.PersistenceStrategy#rollback()
+     */
+    public void rollback() throws RollerException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* 
+     * @see org.roller.persistence.PersistenceStrategy#release()
+     */
+    public void release() throws RollerException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* 
+     * @see org.roller.persistence.PersistenceStrategy#query(java.lang.String, java.lang.Object[], java.lang.Object[])
+     */
+    public List query(String query, Object[] args, Object[] types)
+            throws RollerException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+}

Added: incubator/roller/trunk/tests/org/roller/presentation/ApplicationResourcesTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/ApplicationResourcesTest.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/ApplicationResourcesTest.java (added)
+++ incubator/roller/trunk/tests/org/roller/presentation/ApplicationResourcesTest.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,157 @@
+/*
+ * Filename: ApplicationResourcesTest.java
+ * 
+ * Created on 24-May-04
+ */
+package org.roller.presentation;
+
+import java.io.FileInputStream;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Set;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * The purpose of this class is to verify that all messages in
+ * the base ApplicationResources.properties file also appear
+ * in the localized properties files.
+ * 
+ * If messages do not appear, the test fails and the 'evil-doers' are
+ * printed to System.out.  
+ * 
+ * Note: we need to make sure that new property files are added to this
+ * test.
+ * 
+ * @author <a href="mailto:molen@mail.com">Jaap van der Molen</a>
+ * @version $Revision: 1.3 $
+ */
+public class ApplicationResourcesTest extends TestCase
+{
+	private String userDir = null;
+	private Properties baseProps = null; 
+
+	/**
+	 * @param arg0
+	 */
+	public ApplicationResourcesTest(String name)
+	{
+		super(name);
+	}
+	
+	public static Test suite() {
+		TestSuite suite = new TestSuite();
+		//suite.addTest(new ApplicationResourcesTest("testSystemProperties"));
+		suite.addTest(new ApplicationResourcesTest("testApplicationResources_nl"));
+		suite.addTest(new ApplicationResourcesTest("testApplicationResources_zh"));
+		suite.addTest(new ApplicationResourcesTest("testApplicationResources_vi"));
+		return suite;
+	}
+	
+	/**
+	 * @see junit.framework.TestCase#setUp()
+	 */
+	protected void setUp() throws Exception
+	{
+		super.setUp();
+		userDir = System.getProperty("user.dir");
+		
+		// load base ApplicationResources.properties file
+		baseProps = new Properties();
+		baseProps.load(new FileInputStream( userDir + "/src/org/roller/presentation/ApplicationResources.properties"));
+	}
+
+	
+	public void testApplicationResources_nl() throws Exception {
+		
+		// verify user-dir; should end with roller
+		assertNotNull(userDir);
+		assertTrue(userDir.endsWith("roller"));
+		
+		// load Dutch resource file
+		Properties nlProps = new Properties();
+		nlProps.load(new FileInputStream( userDir + "/src/org/roller/presentation/ApplicationResources_nl.properties"));
+		
+		Set keys = baseProps.keySet();
+		boolean missingMessage = false;
+		
+		// check Dutch
+		System.out.println("Veriyfing NL messages...");
+		for (Iterator iter = keys.iterator(); iter.hasNext();)
+		{
+			String key = (String) iter.next();
+			if (nlProps.getProperty(key)==null) {
+				System.err.println(key+" = "+baseProps.getProperty(key));
+				missingMessage=true;
+			}
+		}
+
+		assertFalse(missingMessage);
+	}
+
+	public void testApplicationResources_zh() throws Exception {
+
+		// verify user-dir; should end with roller
+		assertNotNull(userDir);
+		assertTrue(userDir.endsWith("roller"));
+		
+		// load Chinese resource file
+		Properties zhProps = new Properties();
+		zhProps.load(new FileInputStream( userDir + "/src/org/roller/presentation/ApplicationResources_zh.properties"));
+
+		Set keys = baseProps.keySet();
+		boolean missingMessage = false;
+
+		// check Chinese
+		System.out.println("Veriyfing ZH messages...");
+		for (Iterator iter = keys.iterator(); iter.hasNext();)
+		{
+			String key = (String) iter.next();
+			if (zhProps.getProperty(key)==null) {
+				System.err.println(key+" = "+baseProps.getProperty(key));
+				missingMessage=true;
+			}
+		}
+
+		assertFalse(missingMessage);
+	}
+	
+	public void testApplicationResources_vi() throws Exception {
+
+		// verify user-dir; should end with roller
+		assertNotNull(userDir);
+		assertTrue(userDir.endsWith("roller"));
+		
+		// load Chinese resource file
+		Properties zhProps = new Properties();
+		zhProps.load(new FileInputStream( userDir + "/src/org/roller/presentation/ApplicationResources_vi.properties"));
+
+		Set keys = baseProps.keySet();
+		boolean missingMessage = false;
+
+		// check Chinese
+		System.out.println("Veriyfing VI messages...");
+		for (Iterator iter = keys.iterator(); iter.hasNext();)
+		{
+			String key = (String) iter.next();
+			if (zhProps.getProperty(key)==null) {
+				System.err.println(key+" = "+baseProps.getProperty(key));
+				missingMessage=true;
+			}
+		}
+
+		assertFalse(missingMessage);
+	}
+
+	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));
+		}
+	}
+}

Added: incubator/roller/trunk/tests/org/roller/presentation/ArchiveParserTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/ArchiveParserTest.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/ArchiveParserTest.java (added)
+++ incubator/roller/trunk/tests/org/roller/presentation/ArchiveParserTest.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,83 @@
+/*
+ * Created on May 4, 2004
+ */
+package org.roller.presentation;
+
+import com.mockrunner.mock.web.MockServletContext;
+
+import org.roller.RollerException;
+import org.roller.pojos.RollerConfig;
+
+import java.io.File;
+
+/**
+ * @author lance.lavandowska
+ */
+public class ArchiveParserTest extends ServletTestBase
+{    
+    MockServletContext mContext = null;
+    RollerConfig  rollerConfig = null;
+    
+    private static String FILE_LOCATION = "./build/junk/";
+    private static String RSS_ARCHIVE = "export-test.rss.xml";
+    private static String ATOM_ARCHIVE = "export-test.atom.xml";
+    
+    public void testAtomParsing() throws RollerException 
+    {
+        File archiveFile = new File(FILE_LOCATION + 
+                                    mWebsite.getUser().getUserName() + 
+                                    "/" + ATOM_ARCHIVE);
+        parseFile(archiveFile);
+    }
+    
+    public void testRssParsing() throws RollerException 
+    {
+        File archiveFile = new File(FILE_LOCATION + 
+                                    mWebsite.getUser().getUserName() + 
+                                    "/" + RSS_ARCHIVE);
+        parseFile(archiveFile);
+    }
+    
+    /**
+     * @param archiveFile
+     * @throws RollerException
+     */
+    private void parseFile(File archiveFile) throws RollerException
+    {
+        if (archiveFile.exists())
+        {    
+            ArchiveParser parser = new ArchiveParser(getRoller(), mWebsite, archiveFile);
+            //getRoller().begin();
+            String result = parser.parse();
+            getRoller().commit();
+            assertTrue(result.length() > 0);
+            System.out.println(result);
+        }
+        else
+        {
+            fail(archiveFile.getAbsolutePath() + " does not exist.");
+        }
+    }
+
+    /*
+     * Need to change the UploadPath location for testing. 
+     * @see junit.framework.TestCase#setUp()
+     */
+    public void setUp() throws Exception
+    {
+        super.setUp();
+
+        rollerConfig = rollerContext.getRollerConfig();
+    }
+
+    /*
+     * Need to reset the UploadPath after testing. 
+     * @see junit.framework.TestCase#tearDown()
+     */
+    public void tearDown() throws Exception
+    {
+        super.tearDown();
+    }
+    
+
+}

Added: incubator/roller/trunk/tests/org/roller/presentation/MockPrincipal.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/MockPrincipal.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/MockPrincipal.java (added)
+++ incubator/roller/trunk/tests/org/roller/presentation/MockPrincipal.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,17 @@
+/*
+ * Created on Mar 8, 2004
+ */
+package org.roller.presentation;
+
+public class MockPrincipal implements java.security.Principal
+{
+    String mName;
+    public MockPrincipal(String name)
+    {
+        mName = name;
+    }
+    public String getName()
+    {
+        return mName;
+    }
+}
\ No newline at end of file

Added: incubator/roller/trunk/tests/org/roller/presentation/MockRollerContext.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/MockRollerContext.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/MockRollerContext.java (added)
+++ incubator/roller/trunk/tests/org/roller/presentation/MockRollerContext.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,12 @@
+/*
 * Created on Mar 4, 2004
 */
package org.roller.presentation;
+import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.roller.pojos.RollerConfig;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.http.HttpServletRequest;
+/**
 * @author lance.lavandowska
 */
public class MockRollerContext extends RollerContext
{
    private static Log mLogger =
        LogFactory.getFactory().getInstance(MockRollerContext.class);
+    private static ServletContext mContext = null;
+    public void init(ServletContext sc)
    {
        mLogger.debug("MockRollerContext initializing");
        
        // initialize super 
        super.contextInitialized(new ServletContextEvent(sc));
+        // Save context in self and self in context
        mContext = sc;
        mContext.setAttribute(ROLLER_CONTEXT, this);
        mContext.setAttribute("org.roller.absoluteContextURL", "/");
    }
+    //-----------------------------------------------------------------------
    /** Because I cannot set the super's values, I have to
     * overide the methods as well */  
    public static RollerContext getRollerContext(ServletContext sc)
    {
        // get roller from servlet context
        return (RollerContext) mContext.getAttribute(ROLLER_CONTEXT);
    }
+    //-----------------------------------------------------------------------
    /** Because I cannot set the super's values, I have to
     * overide the methods as well */  
    public static ServletContext getServletContext()
    {
        return mContext;
    }

    //-----------------------------------------------------------------------
    /** Because I cannot set the super's values, I have to
     * overide the methods as well */
    public String getRollerVersion()
    {
        return super.getRollerVersion();
    }
+    //-----------------------------------------------------------------------
    /** Because I cannot set the super's values, I have to
     * overide the methods as well */
    public String getRollerBuildTime()
    {
        return super.getRollerBuildTime();
    }
+    //-----------------------------------------------------------------------
    /** Because I cannot set the super's values, I have to
     * overide the methods as well */
    public String getRollerBuildUser()
    {
        return super.getRollerBuildUser();
    }

    //-----------------------------------------------------------------------
    /** Because I cannot set the super's values, I have to
     * overide the methods as well */
    public String getAbsoluteContextUrl()
    {
        return "";
    }
+    //-----------------------------------------------------------------------
    /** Because I cannot set the super's values, I have to
     * overide the methods as well */
    public String getAbsoluteContextUrl(HttpServletRequest request)
    {
        return request.getScheme() +"://" + request.getServerName() + "";
    }
+    //-----------------------------------------------------------------------
    /** Because I cannot set the super's values, I have to
     * overide the methods as well */
    public RollerConfig getRollerConfig()
    {
        return super.getRollerConfig();
    }
}

Added: incubator/roller/trunk/tests/org/roller/presentation/MockRollerRequest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/MockRollerRequest.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/MockRollerRequest.java (added)
+++ incubator/roller/trunk/tests/org/roller/presentation/MockRollerRequest.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,26 @@
+/*
+ * Created on Jun 8, 2004
+ */
+package org.roller.presentation;
+
+import org.roller.RollerException;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author lance.lavandowska
+ */
+public class MockRollerRequest extends RollerRequest
+{
+    /**
+     * @param req
+     * @param ctx
+     * @throws RollerException
+     */
+    public MockRollerRequest(HttpServletRequest req, ServletContext ctx) throws RollerException
+    {
+        super(req, ctx);
+    }
+
+}

Added: incubator/roller/trunk/tests/org/roller/presentation/ServletTestBase.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/ServletTestBase.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/ServletTestBase.java (added)
+++ incubator/roller/trunk/tests/org/roller/presentation/ServletTestBase.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,69 @@
+/*
+ * Created on Mar 9, 2004
+ */
+package org.roller.presentation;
+
+import com.mockrunner.mock.web.MockHttpServletRequest;
+import com.mockrunner.mock.web.MockServletContext;
+import com.mockrunner.mock.web.WebMockObjectFactory;
+
+import org.roller.business.RollerTestBase;
+
+/**
+ * @author lance.lavandowska
+ */
+public class ServletTestBase extends RollerTestBase
+{
+    protected WebMockObjectFactory mockFactory;
+    protected MockRollerContext rollerContext;
+    
+    public void setUp() throws Exception
+    {
+        // must do super.setup() before creating MockRollerContext
+        super.setUp();
+    
+        mockFactory = new WebMockObjectFactory();
+        
+        // have to set ServletContext init-param
+        MockServletContext mContext = mockFactory.getMockServletContext();
+        String persistence = System.getProperty("rollerImpl");
+        if (persistence == null || persistence.equals("hibernate") )
+        {
+            // Instantiate Hibernate version
+            persistence = "org.roller.business.hibernate.RollerImpl";
+        }
+        else
+        {
+            // Instantiate Castor version
+            persistence = "org.roller.business.castor.RollerImpl"; 
+        }
+        mContext.setInitParameter("org.roller.persistence", persistence);
+    
+        // create mock RollerContext
+        rollerContext = new MockRollerContext();
+        rollerContext.init(mContext);
+    }
+    
+    public void tearDown() throws Exception
+    {
+        rollerContext = null;
+        mockFactory = null;
+        super.tearDown();
+    }
+
+    //-----------------------------------------------------------------------
+    protected String authenticateUser()
+    {
+        String username = mWebsite.getUser().getUserName();
+
+        // in order to pass authentication check
+        MockHttpServletRequest mkRequest = mockFactory.getMockRequest();
+        mkRequest.setUserPrincipal(new MockPrincipal(username));
+        mkRequest.setUserInRole("editor", true);
+        
+        // for RollerRequest initialization, parseRequestParams()
+        mkRequest.setRemoteUser(username);
+
+        return username;
+    }
+}

Added: 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=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/TestAll.java (added)
+++ incubator/roller/trunk/tests/org/roller/presentation/TestAll.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,33 @@
+package org.roller.presentation;
+
+import org.roller.presentation.bookmarks.BookmarksActionTest;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+
+/**
+ * Run the essential presentation layer tests.
+ * @author Dave M Johnson
+ */
+public class TestAll extends TestCase
+{
+    public TestAll(String testName)
+    {
+        super(testName);
+    }
+
+    public static void main(String[] args)
+    {
+        String[] testCaseName = { TestAll.class.getName() };
+        junit.textui.TestRunner.main(testCaseName);
+    }
+
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite();
+        suite.addTest(BookmarksActionTest.suite());        
+        return suite;
+    }
+}
\ No newline at end of file

Added: incubator/roller/trunk/tests/org/roller/presentation/atom/AtomServletGetTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/atom/AtomServletGetTest.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/atom/AtomServletGetTest.java (added)
+++ incubator/roller/trunk/tests/org/roller/presentation/atom/AtomServletGetTest.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,107 @@
+package org.roller.presentation.atom;
+
+import com.mockrunner.base.VerifyFailedException;
+import com.mockrunner.mock.web.MockHttpServletRequest;
+import com.mockrunner.mock.web.WebMockObjectFactory;
+import com.mockrunner.servlet.ServletTestModule;
+
+import org.osjava.atom4j.pojo.Feed;
+import org.roller.RollerException;
+import org.roller.business.RollerTestBase;
+import org.roller.model.WeblogManager;
+import org.roller.pojos.UserData;
+import org.roller.presentation.MockRollerContext;
+import org.roller.presentation.RollerRequest;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * This class tests GET interations with RollerAtomServlet.
+ * 
+ * Created on Mar 5, 2004
+ * 
+ * @author lance.lavandowska
+ */
+public class AtomServletGetTest extends RollerTestBase
+{
+    protected WebMockObjectFactory mockFactory;
+    protected MockRollerContext rollerContext;
+    protected MockHttpServletRequest mkRequest;
+    protected ServletTestModule servletTestModule;
+
+    //-----------------------------------------------------------------------
+    public void testGetFeed() throws RollerException
+    {
+        String username = getUser().getUserName();
+
+        // set pathinfo
+        mkRequest.setPathInfo("/" + username + "/feed/" + mWebsite.getId());
+
+        servletTestModule.doGet();
+
+        // returns list of Atom Entries
+        List entries = getLatestEntries(username,
+            RollerRequest.getRollerRequest().getWeblogEntryCount());
+        Feed expectedFeed = AtomAssistant.convertToAtomFeed(mWebsite, entries, true);
+
+        try
+        {
+            // the output will contain XML header junk, so use Contains
+            servletTestModule.verifyOutputContains(expectedFeed.toString());
+        }
+        catch (VerifyFailedException vfe)
+        {
+            fail("Expected feed not returned");
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    protected UserData getUser()
+    {
+        return mWebsite.getUser();
+    }
+
+    //-----------------------------------------------------------------------
+    protected List getLatestEntries(String username, int i) throws RollerException
+    {
+        return getRoller().getWeblogManager().getWeblogEntries(
+                       mWebsite,               // userName
+                       null,                  // startDate
+                       new Date(),            // endDate
+                       null,                  // catName
+                       WeblogManager.PUB_ONLY, // status
+                       new Integer(RollerRequest.getRollerRequest().getWeblogEntryCount()));
+        
+    }
+    
+    //-----------------------------------------------------------------------
+    public void setUp() throws Exception
+    {
+        // must do super.setup() before creating MockRollerContext
+        super.setUp();
+
+        mockFactory = new WebMockObjectFactory();
+
+        // create mock RollerContext
+        rollerContext = new MockRollerContext();
+        rollerContext.init(mockFactory.getMockServletContext());
+
+        mkRequest = mockFactory.getMockRequest();
+
+        servletTestModule = new ServletTestModule(mockFactory);
+        servletTestModule.createServlet(RollerAtomServlet.class);
+    }
+
+    //-----------------------------------------------------------------------
+    public void tearDown() throws Exception
+    {
+        mkRequest = null;
+        servletTestModule.clearOutput();
+        servletTestModule.releaseFilters();
+        servletTestModule = null;
+        rollerContext = null;
+        mockFactory = null;
+        super.tearDown();
+    }
+}

Added: incubator/roller/trunk/tests/org/roller/presentation/atom/AtomServletTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/atom/AtomServletTest.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/atom/AtomServletTest.java (added)
+++ incubator/roller/trunk/tests/org/roller/presentation/atom/AtomServletTest.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,161 @@
+package org.roller.presentation.atom;
+
+import com.mockrunner.mock.web.MockHttpServletRequest;
+import com.mockrunner.mock.web.MockHttpServletResponse;
+import com.mockrunner.servlet.ServletTestModule;
+
+import org.osjava.atom4j.pojo.Content;
+import org.osjava.atom4j.pojo.Entry;
+import org.roller.pojos.WeblogCategoryData;
+import org.roller.pojos.WeblogEntryData;
+import org.roller.presentation.ServletTestBase;
+
+import java.sql.Timestamp;
+
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * This class tests interations with RollerAtomServlet
+ * which require authentication.
+ * 
+ * Created on Mar 3, 2004
+ *
+ * @author lance.lavandowska
+ */
+public class AtomServletTest extends ServletTestBase
+{    
+    protected MockHttpServletRequest mkRequest;
+    protected ServletTestModule servletTestModule;
+
+    //-----------------------------------------------------------------------
+    public void testPostEntry() throws Exception
+    {
+        String username = authenticateUser();
+
+        // set pathinfo
+        mkRequest.setPathInfo("/" + username + "/entry");
+
+        // set payload of new Atom Entry
+        Entry atomEntry = newEntry();
+        mkRequest.setBodyContent(atomEntry.toString());
+
+        servletTestModule.doPost();
+
+        MockHttpServletResponse response = mockFactory.getMockResponse();
+
+        // make sure it didn't return an error
+        //mLogger.debug("ResponseCode:" + response.getStatusCode());
+        assertFalse("Returned SC_BAD_REQUEST (Error)\n" + servletTestModule.getOutput(),
+                    HttpServletResponse.SC_BAD_REQUEST == response.getStatusCode());
+        assertTrue("Did not return SC_SEE_OTHER status",
+                   HttpServletResponse.SC_SEE_OTHER == response.getStatusCode());
+
+        // test that AtomServlet returned a proper Location header
+        String locationHeader = response.getHeader("Location");
+        assertNotNull("Should return a Location header", locationHeader);
+        String locWanted = "/atom/" + username + "/entry/";
+        int locIndex = locationHeader.indexOf(locWanted);
+        if (locIndex == -1)
+        {
+            fail("Location header does not contain URL of new Entry.");
+        }
+
+        // test that the Entry was persisted
+        String entryId = locationHeader.substring(locIndex+locWanted.length());
+        assertNotNull("New Entry Id not returned", entryId);
+
+        WeblogEntryData rEntry = getRoller().getWeblogManager().retrieveWeblogEntry(entryId);
+        assertNotNull("New Entry not found in database", rEntry);
+
+        assertEquals("Entry titles don't match",
+                     atomEntry.getTitle().getText(), rEntry.getTitle());
+
+        rEntry = null;
+        response = null;
+    }
+
+    //-----------------------------------------------------------------------
+    public void testPutEntry() throws Exception
+    {
+        String newTitle = "Entry edited with Atom";
+        String testAnchor = "test_new_entry";
+        String username = authenticateUser();
+        
+        // create an Entry for to be updated
+        WeblogCategoryData category = mWebsite.getBloggerCategory();
+        //getRoller().begin();
+        WeblogEntryData rEntry = new WeblogEntryData(
+            (String)null, category, mWebsite, "Test New Entry", "", 
+            "This is a test", testAnchor, 
+            new Timestamp(new java.util.Date().getTime()), 
+            (Timestamp)null, Boolean.FALSE);
+        rEntry.save();
+        getRoller().commit();
+        //getRoller().begin();
+        rEntry = getRoller().getWeblogManager().getWeblogEntryByAnchor(mWebsite, testAnchor);
+
+        // set pathinfo
+        mkRequest.setPathInfo("/" + username + "/entry/" + rEntry.getId());
+
+        // set payload of Atom Entry, with changed title
+        Entry atomEntry = AtomAssistant.convertToAtomEntry(rEntry, true);
+        atomEntry.getTitle().setText(newTitle);
+        mkRequest.setBodyContent(atomEntry.toString());
+
+        servletTestModule.doPut();
+
+        MockHttpServletResponse response = mockFactory.getMockResponse();
+
+        // make sure it didn't return an error
+        //mLogger.debug("ResponseCode:" + response.getStatusCode());
+        assertFalse("Returned SC_BAD_REQUEST (Error)\n" + servletTestModule.getOutput(),
+                    HttpServletResponse.SC_BAD_REQUEST == response.getStatusCode());
+        assertTrue("Did not return SC_RESET_CONTENT status",
+                   HttpServletResponse.SC_RESET_CONTENT == response.getStatusCode());
+        
+        // refetch Entry from db, confirm title changed
+        rEntry = getRoller().getWeblogManager().retrieveWeblogEntry(rEntry.getId());
+        assertEquals(newTitle, rEntry.getTitle());
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Create a new Atom Entry
+     * @return
+     */
+    private Entry newEntry()
+    {
+        Entry atomEntry = new Entry();
+        atomEntry.setTitle( new Content() );
+        atomEntry.getTitle().setText("Atom Test Post");
+        //atomEntry.setIssued( weblogEntry.getPubTime() ); // TODO: should test set pubTime
+
+        atomEntry.setContent( new Content() );
+        atomEntry.getContent().setText( "And all the world's a stage." );
+        atomEntry.getContent().setMimeType( "application/xhtml+xml" );
+        atomEntry.getContent().setLanguage( "en-us" );
+
+        return atomEntry;
+    }
+
+    //-----------------------------------------------------------------------
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        
+        mkRequest = mockFactory.getMockRequest();
+        
+        servletTestModule = new ServletTestModule(mockFactory);
+        servletTestModule.createServlet(RollerAtomServlet.class);
+    }
+
+    //-----------------------------------------------------------------------
+    public void tearDown() throws Exception
+    {
+        mkRequest = null;
+        servletTestModule.clearOutput();
+        servletTestModule.releaseFilters();
+        servletTestModule = null;
+        super.tearDown();
+    }
+}

Added: incubator/roller/trunk/tests/org/roller/presentation/bookmarks/BookmarksActionTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/bookmarks/BookmarksActionTest.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/bookmarks/BookmarksActionTest.java (added)
+++ incubator/roller/trunk/tests/org/roller/presentation/bookmarks/BookmarksActionTest.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,73 @@
+/*
+ * Created on Oct 27, 2003
+ */
+package org.roller.presentation.bookmarks;
+
+import com.mockrunner.mock.web.MockActionMapping;
+import com.mockrunner.struts.ActionTestModule;
+
+import org.roller.presentation.ServletTestBase;
+import org.roller.presentation.bookmarks.actions.BookmarksAction;
+import org.roller.presentation.bookmarks.formbeans.BookmarksForm;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author dmj
+ */
+public class BookmarksActionTest extends ServletTestBase
+{    
+    private ActionTestModule module;
+    private BookmarksForm form;
+    
+    //------------------------------------------------------------------------
+    public static Test suite() 
+    {
+        return new TestSuite(BookmarksActionTest.class);
+    }
+
+    public void testSelectFolder() 
+    {
+        MockActionMapping mapping = module.getMockActionMapping();
+        mapping.setForward("BookmarksForm");
+        mapping.setupForwards( new String[] {"access-denied"} );
+        mapping.setParameter("method");
+        
+        module.addRequestParameter("method","selectFolder");
+        
+        authenticateUser();
+
+        module.actionPerform(BookmarksAction.class, form);
+        
+        module.verifyNoActionMessages();
+        module.verifyForward("BookmarksForm");
+    }
+    
+    //------------------------------------------------------------------------
+    /**
+     * @see TestCase#setUp()
+     */
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        
+        module = new ActionTestModule(mockFactory); 
+        form = (BookmarksForm)module.createActionForm(BookmarksForm.class);
+        //module.setValidate(true);
+    }
+
+    //------------------------------------------------------------------------
+
+    /**
+     * Child TestCases should take care to tearDown() their own resources
+     * (including their own implementation).  RollerTestBase will clean up the
+     * getRoller() instance.
+     * 
+     * @see TestCase#tearDown()
+     */
+    public void tearDown() throws Exception
+    {      
+        super.tearDown();
+    }
+}

Added: incubator/roller/trunk/tests/org/roller/presentation/velocity/ExportRssTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/velocity/ExportRssTest.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/velocity/ExportRssTest.java (added)
+++ incubator/roller/trunk/tests/org/roller/presentation/velocity/ExportRssTest.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,133 @@
+/*
+ * Created on Mar 25, 2004
+ */
+package org.roller.presentation.velocity;
+
+import com.mockrunner.mock.web.MockServletContext;
+
+import org.roller.model.WeblogManager;
+import org.roller.pojos.RollerConfig;
+import org.roller.presentation.ServletTestBase;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Not really a servlet test, the ExportRss class does require
+ * that RollerContext has been loaded and initialized.
+ * 
+ * @author lance.lavandowska
+ */
+public class ExportRssTest extends ServletTestBase
+{    
+    private String oldUploadPath;
+    
+    /**
+     * Not sure how to test that the file was generated, so if
+     * there was no Exception we passed.
+     */
+    public void testExportRecent() throws Exception
+    {        
+        ExportRss exporter = new ExportRss(mWebsite);
+        
+        //List entries = getRoller().getWeblogManager().getAllRecentWeblogEntries(new Date(), 5);
+        
+        List entries = getRoller().getWeblogManager().getWeblogEntries(
+                        null,               // userName
+                        null,               // startDate
+                        new Date(),         // endDate
+                        null,               // catName
+                        WeblogManager.ALL,  // status
+                        new Integer(5));   // maxEntries
+        
+        try
+        {
+            // test RSS output
+            exporter.exportEntries(entries, "export-test.rss.xml");
+
+            // test Atom output
+            exporter.setExportAtom(true);
+            exporter.exportEntries(entries, "export-test.atom.xml");
+        }
+        catch (Exception e)
+        {
+            mLogger.error(e);
+            // I'm not sure how best to test the output!
+            // I guess no exceptions will have to do.
+            fail("Find a better way to test than checking Exceptions, bozo!");
+        }
+    }
+    
+    /*
+     * Need to change the UploadPath location for testing. 
+     * @see junit.framework.TestCase#setUp()
+     */
+    public void setUp() throws Exception
+    {
+        super.setUp();
+
+        //getRoller().begin();
+        RollerConfig  rollerConfig = rollerContext.getRollerConfig();
+        oldUploadPath = rollerConfig.getUploadPath();
+        rollerConfig.setUploadPath("build/junk");
+        rollerConfig.save();
+        getRoller().commit();        
+
+        MockServletContext mContext = mockFactory.getMockServletContext();
+        mContext.setRealPath("build/junk", "./build/junk");
+        
+        setupVelocityProperties(mContext);
+    }
+    
+    /**
+     * ExportRss needs to load velocity.properties from ServletContext.
+     * For the mock implementation we need to set the 'resource stream'.
+     * @param mContext
+     * @throws IOException
+     */
+    private void setupVelocityProperties(MockServletContext mContext) throws IOException
+    {
+        InputStream is = this.getClass().getClassLoader().getResourceAsStream("velocity.properties");
+        if (is == null) fail("Unable to find velocity.properties");
+        BufferedInputStream bis = new BufferedInputStream(is, 1);
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        int buf = bis.read();
+        do
+        {
+            bos.write(buf);
+            buf = bis.read();
+        }
+        while(buf != -1);
+        
+        byte[] bytes = bos.toByteArray();
+        mContext.setResourceAsStream("/WEB-INF/velocity.properties", bytes);
+        try
+        {
+            bos.close();
+            bis.close();
+        }
+        catch (IOException e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    /*
+     * Need to reset the UploadPath after testing. 
+     * @see junit.framework.TestCase#tearDown()
+     */
+    public void tearDown() throws Exception
+    {
+        //getRoller().begin();
+        RollerConfig  rollerConfig = rollerContext.getRollerConfig();
+        rollerConfig.setUploadPath(oldUploadPath);
+        rollerConfig.save();
+        getRoller().commit();
+        
+        super.tearDown();
+    }
+}

Added: incubator/roller/trunk/tests/org/roller/presentation/velocity/VelocityTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/velocity/VelocityTest.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/velocity/VelocityTest.java (added)
+++ incubator/roller/trunk/tests/org/roller/presentation/velocity/VelocityTest.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,50 @@
+/*
+ * Created on Oct 31, 2003
+ *
+ * To change the template for this generated file go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+package org.roller.presentation.velocity;
+
+import junit.framework.TestCase;
+
+import org.roller.presentation.velocity.plugins.textile.TextilePlugin;
+
+/**
+ * We really need to solve webtesting to adequately test our Presentation classes.
+ * 
+ * @author lance
+ */
+public class VelocityTest extends TestCase
+{
+    String textileStr = "*strong* plain _emphasis_ * _emphaticStrong_ * ";
+    String expected = "<p><strong>strong</strong>plain <em>emphasis</em> <strong> <em>emphaticStrong</em> </strong></p>";
+    
+    /* this is failing, but I think it is due to a problem in Textile4J:
+     * for instance, it is stripping a space after closing  a "strong" tag.
+     */
+    public void testTextile()
+    {
+        PagePlugin textile = new TextilePlugin();
+        
+        String result = textile.render(textileStr);
+        assertEquals("this will fail until Textile4J is fixed.", expected, result);         
+    }
+    
+	/* (non-Javadoc)
+	 * @see junit.framework.TestCase#setUp()
+	 */
+	protected void setUp() throws Exception
+	{
+        super.setUp();	       
+	}
+
+	/* (non-Javadoc)
+	 * @see junit.framework.TestCase#tearDown()
+	 */
+	protected void tearDown() throws Exception
+	{
+	   super.tearDown();
+	}
+
+}

Added: incubator/roller/trunk/tests/org/roller/presentation/velocity/plugins/smileys/SmileysTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/velocity/plugins/smileys/SmileysTest.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/velocity/plugins/smileys/SmileysTest.java (added)
+++ incubator/roller/trunk/tests/org/roller/presentation/velocity/plugins/smileys/SmileysTest.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,67 @@
+/*
+ * Created on Jun 8, 2004
+ */
+package org.roller.presentation.velocity.plugins.smileys;
+
+import com.mockrunner.mock.web.MockHttpServletRequest;
+import com.mockrunner.mock.web.MockServletContext;
+
+import org.roller.presentation.MockRollerRequest;
+
+import junit.framework.TestCase;
+
+/**
+ * @author lance.lavandowska
+ */
+public class SmileysTest extends TestCase
+{
+    SmileysPlugin plugin = new SmileysPlugin();
+    MockHttpServletRequest request = new MockHttpServletRequest();
+ 
+    public void testLoadProperties()
+    {        
+        assertTrue( plugin.smileyPatterns.length > 0 );
+        /*
+        for (int i=0; i<plugin.imageTags.length; i++) {
+            System.out.println(plugin.imageTags[i]);
+        }
+        */
+    }
+    
+    public void testSmileEmoticon()
+    {
+        String test = "put on a happy :-) face";
+        String expected = "put on a happy <img src=\"/roller/images/smileys/smile.gif" +
+            "\" height=\"20\" width=\"20\" alt=\":-)\" title=\":-)\"> face";
+        String result = plugin.render(test);
+        System.out.println(result);
+        assertEquals(expected, result);
+    }
+    
+    public void setUp() throws Exception
+    {
+        super.setUp();
+
+        request.setContextPath("/roller");
+        plugin.init( new MockRollerRequest(
+                           request,
+                           new MockServletContext()), null);
+    }
+    
+    /**
+     * 
+     */
+    public SmileysTest()
+    {
+        super();
+    }
+
+    /**
+     * @param arg0
+     */
+    public SmileysTest(String arg0)
+    {
+        super(arg0);
+    }
+
+}

Added: incubator/roller/trunk/tests/org/roller/presentation/velocity/plugins/textile/TextileTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/velocity/plugins/textile/TextileTest.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/velocity/plugins/textile/TextileTest.java (added)
+++ incubator/roller/trunk/tests/org/roller/presentation/velocity/plugins/textile/TextileTest.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,5 @@
+/*
+ * Created on Oct 31, 2003
+ */
package org.roller.presentation.velocity.plugins.textile;

import junit.framework.TestCase;
+import org.roller.presentation.velocity.PagePlugin;
+import org.roller.presentation.velocity.plugins.textile.TextilePlugin;

/**
 * We really need to solve webtesting to adequately test our Presentation classes.
 * 
 * @author lance
 */
public class TextileTest extends TestCase
{
    String textileStr = "*strong* plain _emphasis_ * _emphaticStrong_ * ";
    String expected = "<p><strong>strong</strong>plain <em>emphasis</em> <strong> <em>emphaticStrong</em> </strong></p>";
  
    /* this is failing, but I think it is due to a problem in Textile4J:
     * for instance, it is stripping a space after closing  a "strong" tag.
     */
    public void testTextile()
    {
        PagePlugin textile = new TextilePlugin();
        
        String result = textile.render(textileStr);
        assertEquals("this will fail until Textile4J is fixed.", expected, result);         
    }
    
	/* (non-Javadoc)
	 * @see junit.framework.TestCase#setUp()
	 */
	protected void setUp() throws Exception
	{
        super.setUp();	       
	}

	/* (non-Javadoc)
	 * @see junit.framework.TestCase#tearDown()
	 */
	protected void tearDown() throws Exception
	{
	   super.tearDown();
	}

}
\ No newline at end of file

Added: incubator/roller/trunk/tests/org/roller/presentation/xmlrpc/TestRollerXmlRpcClient.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/xmlrpc/TestRollerXmlRpcClient.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/xmlrpc/TestRollerXmlRpcClient.java (added)
+++ incubator/roller/trunk/tests/org/roller/presentation/xmlrpc/TestRollerXmlRpcClient.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,68 @@
+/*
+ * Created on Jun 10, 2003
+ */
+package org.roller.presentation.xmlrpc;
+
+import junit.framework.TestCase;
+
+/**
+ * @author llavandowska
+ */
+public class TestRollerXmlRpcClient extends TestCase
+{
+	/**
+	 * Constructor for LinkbackExtractorTest.
+	 * @param arg0
+	 */
+	public TestRollerXmlRpcClient(String arg0)
+	{
+		super(arg0);
+	}
+
+	public static void main(String[] args)
+	{
+	}
+
+	/**
+	 * @see TestCase#setUp()
+	 */
+	protected void setUp() throws Exception
+	{
+		super.setUp();
+	}
+
+	/**
+	 * @see TestCase#tearDown()
+	 */
+	protected void tearDown() throws Exception
+	{
+		super.tearDown();
+	}
+	
+	/**
+	 * Perform same ping twice to guarantee a getting the "Take a Break" message.
+	 *
+	 */
+	public void testSendWeblogsPing()
+	{
+		String testUrl = "http://www.brainopolis.com/roller/page/lance";
+		String testName = "Vanity Foul";
+		String TakeABreak = "Thanks for the ping, however we can only accept one ping every five minutes. It's cool that you're updating so often, however, if I may be so bold as to offer some advice -- take a break, you'll enjoy life more.";
+		
+		String response = RollerXmlRpcClient.sendWeblogsPing( testUrl, testName );
+		
+		response = RollerXmlRpcClient.sendWeblogsPing( testUrl, testName );
+			
+		System.out.print(response);
+		
+		// not an IOException
+		assertNotSame("IOException", RollerXmlRpcClient.IO_MESSAGE, response);
+		
+		// not an XmlRpcException
+		assertNotSame("XmlRpcException", RollerXmlRpcClient.XMLRPC_MESSAGE, response);
+		
+		// is "take a break" message
+		assertEquals(TakeABreak, response);
+	}
+
+}

Added: incubator/roller/trunk/tests/org/roller/presentation/xmlrpc/TestRollerXmlRpcServer.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/xmlrpc/TestRollerXmlRpcServer.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/xmlrpc/TestRollerXmlRpcServer.java (added)
+++ incubator/roller/trunk/tests/org/roller/presentation/xmlrpc/TestRollerXmlRpcServer.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,146 @@
+/*
+ * Created on Jun 15, 2004
+ */
+package org.roller.presentation.xmlrpc;
+
+import com.mockrunner.mock.web.MockHttpServletRequest;
+import com.mockrunner.mock.web.MockHttpServletResponse;
+import com.mockrunner.mock.web.WebMockObjectFactory;
+import com.mockrunner.servlet.ServletTestModule;
+
+import org.roller.business.RollerTestBase;
+import org.roller.presentation.MockRollerContext;
+import org.roller.presentation.RollerRequest;
+import org.roller.util.RegexUtil;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.regex.Pattern;
+
+/**
+ * Makes calls to the RollerXmlRpcServer, which should handle a
+ * post just as it would with a real XML-RPC call.
+ * 
+ * @author lance.lavandowska
+ */
+public class TestRollerXmlRpcServer extends RollerTestBase
+{
+    private static HashMap typeMap = new HashMap();
+    static {
+        typeMap.put(Boolean.class, "boolean");
+        typeMap.put(Double.class, "double");
+        typeMap.put(Date.class, "dateTime.iso8601");
+        typeMap.put(Integer.class, "int");
+    }
+
+    protected WebMockObjectFactory mockFactory;
+    protected MockRollerContext rollerContext;
+    protected MockHttpServletRequest mkRequest;
+    protected ServletTestModule servletTestModule;
+
+    public void testBloggerGetRecentPosts()
+    {
+        ArrayList params = new ArrayList();
+        params.add("roller"); // appkey
+        params.add("roller"); // blogid
+        params.add(testUsername); // userid
+        params.add("password"); // password
+        params.add(new Integer(5)); // numposts
+        String message = buildXmlRpcString("blogger.getRecentPosts", params);
+
+        mkRequest.setBodyContent(message);
+        servletTestModule.doPost();
+        MockHttpServletResponse response = mockFactory.getMockResponse();
+        String responseBody = response.getOutputStreamContent();
+
+        // assert no fault code
+        assertTrue(responseBody, responseBody.indexOf("<name>faultCode</name>") == -1);
+        
+        // make sure all/any userids returned belong to our test user
+        Pattern userPattern = Pattern.compile("<name>userid</name><value>(.*?)</value>");
+        ArrayList users = RegexUtil.getMatches(userPattern, responseBody, 1);
+        Iterator it = users.iterator();
+        while (it.hasNext()) 
+        {
+            String user = (String)it.next();
+            //System.out.println(user);
+            if (user.equals(testUsername))
+            {
+                continue;
+            }
+            else
+            {
+                fail("getRecentPosts() returned entry for a user [" + user + "] other than " + testUsername);
+            }
+        }
+    }
+    
+    /**
+     * Build an XML-RPC message from methodName and params.
+     * 
+     * @param methodName
+     * @param params
+     * @return
+     */
+    private String buildXmlRpcString(String methodName, ArrayList params)
+    {
+        StringBuffer buf = new StringBuffer("<?xml version=\"1.0\"?>");
+        buf.append("<methodCall>");
+        buf.append("<methodName>").append(methodName).append("</methodName>");
+        buf.append("<params>");
+        Iterator it = params.iterator();
+        while (it.hasNext()) {
+            buf.append("<param><value>");
+            Object param = it.next();
+            String paramType = (String)typeMap.get(param.getClass());
+            if (paramType != null)
+            {
+                buf.append("<").append(paramType).append(">")
+                   .append(param)
+                   .append("</").append(paramType).append(">");                    
+            }
+            else
+            {    
+                buf.append("<string>").append(param).append("</string>");
+            }
+            buf.append("</value></param>");
+        }
+        buf.append("</params> ");
+        buf.append("</methodCall>");
+        return buf.toString();
+    }
+    
+    //-----------------------------------------------------------------------
+    public void setUp() throws Exception
+    {
+        // must do super.setup() before creating MockRollerContext
+        super.setUp();
+        setUpTestWeblogs();
+
+        mockFactory = new WebMockObjectFactory();
+
+        // create mock RollerContext
+        rollerContext = new MockRollerContext();
+        rollerContext.init(mockFactory.getMockServletContext());
+
+        mkRequest = mockFactory.getMockRequest();
+        RollerRequest.getRollerRequest(mkRequest, mockFactory.getMockServletContext());
+
+        servletTestModule = new ServletTestModule(mockFactory);
+        servletTestModule.createServlet(RollerXMLRPCServlet.class);
+    }
+
+    //-----------------------------------------------------------------------
+    public void tearDown() throws Exception
+    {
+        mkRequest = null;
+        servletTestModule.clearOutput();
+        servletTestModule.releaseFilters();
+        servletTestModule = null;
+        rollerContext = null;
+        mockFactory = null;
+        super.tearDown();
+    }
+}
\ No newline at end of file

Added: incubator/roller/trunk/tests/org/roller/util/LRUCache2Test.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/util/LRUCache2Test.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/util/LRUCache2Test.java (added)
+++ incubator/roller/trunk/tests/org/roller/util/LRUCache2Test.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,105 @@
+/*
+ * Created on Jun 15, 2004
+ */
+package org.roller.util;
+
+import junit.framework.TestCase;
+
+/**
+ * @author dmj
+ */
+public class LRUCache2Test extends TestCase
+{
+    /** 
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        // TODO Auto-generated method stub
+        super.setUp();
+    }
+    
+    public void testTimeout() 
+    {
+        // Create cache with 100 item limit and 15 second timeout
+        TestEnvironment env = new TestEnvironment();
+        LRUCache2 cache = new LRUCache2(env, 100, 15000);
+            
+        env.time = 1000;
+        cache.put("key1", "string1");
+        cache.put("key2", "string2");
+        cache.put("key3", "string3");
+        assertNotNull(cache.get("key1"));
+        assertNotNull(cache.get("key2"));
+        assertNotNull(cache.get("key3"));
+
+        env.time = 16000;
+        assertNull(cache.get("key1"));
+        assertNull(cache.get("key2"));
+        assertNull(cache.get("key3"));
+    }
+    
+    public void testLRU() 
+    {
+        // Create cache with 3 item limit and 15 second timeout
+        TestEnvironment env = new TestEnvironment();
+        LRUCache2 cache = new LRUCache2(env, 3, 15000);
+            
+        env.time = 1000;
+        cache.put("key1", "string1");
+        cache.put("key2", "string2");
+        cache.put("key3", "string3");
+        assertNotNull(cache.get("key1"));
+        assertNotNull(cache.get("key2"));
+        assertNotNull(cache.get("key3"));
+        
+        try { Thread.sleep(200); } catch (InterruptedException ignored) {}
+        
+        // accessing key1 and key2 will make key3 LRU
+        cache.get("key1");
+        cache.get("key2");
+        
+        // adding a forth key will push out the LRU entry
+        cache.put("key4", "string4");    
+        assertNull(cache.get("key3"));     
+    }
+    
+    public void testPurge() 
+    {
+        // Create cache with 100 item limit and 15 second timeout
+        TestEnvironment env = new TestEnvironment();
+        LRUCache2 cache = new LRUCache2(env, 100, 15000);
+            
+        env.time = 1000;
+        cache.put("key1", "string1");
+        cache.put("key2", "string2");
+        cache.put("key3", "string3");
+        assertNotNull(cache.get("key1"));
+        assertNotNull(cache.get("key2"));
+        assertNotNull(cache.get("key3"));
+        
+        cache.purge(new String[] {"key1", "key2"});
+        assertEquals(1, cache.size());
+        
+        cache.purge();
+        assertEquals(0, cache.size());
+    }
+    
+    /** 
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+        // TODO Auto-generated method stub
+        super.tearDown();
+    }
+    
+    public class TestEnvironment implements LRUCache2.Environment 
+	{
+    	public long time = 0;
+		public long getCurrentTimeInMillis() 
+		{
+			return time;
+		}
+	}
+}

Added: incubator/roller/trunk/tests/org/roller/util/LinkbackExtractorTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/util/LinkbackExtractorTest.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/util/LinkbackExtractorTest.java (added)
+++ incubator/roller/trunk/tests/org/roller/util/LinkbackExtractorTest.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,65 @@
+
+package org.roller.util;
+
+import junit.framework.TestCase;
+
+/**
+ * @author davidj
+ */
+public class LinkbackExtractorTest extends TestCase
+{
+    /**
+     * Constructor for LinkbackExtractorTest.
+     * @param arg0
+     */
+    public LinkbackExtractorTest(String arg0)
+    {
+        super(arg0);
+    }
+
+    public static void main(String[] args)
+    {
+    }
+
+    /**
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+    }
+
+    /**
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+    }
+
+    public void testLinkbackExtractor() throws Exception
+    {
+		String[][] testrefs = new String[][] 
+		{
+            { 
+                "http://www.rollerweblogger.org/page/roller", 
+                "http://staff.develop.com/halloway/weblog/2003/01/23.html" 
+            },
+            { 
+                "http://postneo.com/", 
+                "http://www.rollerweblogger.org/page/roller/20030125" 
+            }
+		};
+		
+		for ( int i=0; i<testrefs.length; i++ )
+		{
+			String refurl = testrefs[i][0];
+			String requrl = testrefs[i][1];
+			LinkbackExtractor le = new LinkbackExtractor(refurl,requrl);
+			System.out.println(le.getTitle());
+			System.out.println(le.getPermalink());
+			System.out.println(le.getExcerpt());
+		}		
+    }
+
+}

Added: incubator/roller/trunk/tests/org/roller/util/RegexUtilTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/util/RegexUtilTest.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/util/RegexUtilTest.java (added)
+++ incubator/roller/trunk/tests/org/roller/util/RegexUtilTest.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,74 @@
+/*
+ * Created on Nov 8, 2003
+ */
+package org.roller.util;
+
+import junit.framework.TestCase;
+
+/**
+ * @author lance
+ */
+public class RegexUtilTest extends TestCase
+{
+
+	/**
+	 * 
+	 */
+	public RegexUtilTest()
+	{
+		super();
+	}
+
+	/**
+	 * @param arg0
+	 */
+	public RegexUtilTest(String arg0)
+	{
+		super(arg0);
+	}
+
+    /**
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+    }
+
+    /**
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+    }
+    
+    public void testEncodingEmail()
+    {
+        // test mailto: escaping
+        String test = "test <a href='mailto:this@email.com'>email</a> string";
+        String expect = "test <a href='mailto:%74%68%69%73%40%65%6d%61%69%6c%2e%63%6f%6d'>email</a> string";
+        String result = RegexUtil.encodeEmail(test) ;
+        //System.out.println(result);
+        assertEquals(expect, result);        
+    }
+    
+    public void testObfuscateEmail()
+    {
+        // test "plaintext" escaping
+        String test = "this@email.com";
+        String expect = "this-AT-email-DOT-com";
+        String result = RegexUtil.encodeEmail(test);
+        assertEquals(expect, result);        
+    }
+    
+    public void testHexEmail()
+    {
+        // test hex & obfuscate together
+        String test = "test <a href='mailto:this@email.com'>this@email.com</a> string, and this@email.com";
+        String expect = "test <a href='mailto:%74%68%69%73%40%65%6d%61%69%6c%2e%63%6f%6d'>this-AT-email-DOT-com</a> string, and this-AT-email-DOT-com";
+        String result = RegexUtil.encodeEmail(test);
+        assertEquals(expect, result);
+    }
+
+}

Added: incubator/roller/trunk/tests/org/roller/util/UtilitiesTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/util/UtilitiesTest.java?rev=189602&view=auto
==============================================================================
--- incubator/roller/trunk/tests/org/roller/util/UtilitiesTest.java (added)
+++ incubator/roller/trunk/tests/org/roller/util/UtilitiesTest.java Wed Jun  8 09:06:16 2005
@@ -0,0 +1,66 @@
+/*
+ * Created on Nov 2, 2003
+ */
+package org.roller.util;
+
+import junit.framework.TestCase;
+
+/**
+ * @author lance
+ */
+public class UtilitiesTest extends TestCase
+{
+    /**
+     * Constructor for LinkbackExtractorTest.
+     * @param arg0
+     */
+    public UtilitiesTest(String arg0)
+    {
+        super(arg0);
+    }
+
+    public static void main(String[] args)
+    {
+    }
+
+    /**
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+    }
+
+    /**
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+    }
+    
+    public void testExtractHTML()
+    {
+        String test = "<a>keep me</a>";
+        String expect = "<a></a>";
+        String result = Utilities.extractHTML(test);
+        assertEquals(expect, result);
+    }
+    
+    public void testTruncateNicely1()
+    {
+        String test = "blah blah blah blah blah";
+        String expect = "blah blah blah";
+        String result = Utilities.truncateNicely(test, 11, 15, "");
+        assertEquals(expect, result);
+    }
+    
+    public void testTruncateNicely2()
+    {
+        String test = "<p><b>blah1 blah2</b> <i>blah3 blah4 blah5</i></p>";
+        String expect = "<p><b>blah1 blah2</b> <i>blah3</i></p>";
+        String result = Utilities.truncateNicely(test, 15, 20, "");
+        //System.out.println(result);
+        assertEquals(expect, result);
+    }
+}

Added: incubator/roller/trunk/tools/buildtime/NetComponents1.3.8a.jar
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tools/buildtime/NetComponents1.3.8a.jar?rev=189602&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/roller/trunk/tools/buildtime/NetComponents1.3.8a.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/roller/trunk/tools/buildtime/ant-1.5.1.jar
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tools/buildtime/ant-1.5.1.jar?rev=189602&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/roller/trunk/tools/buildtime/ant-1.5.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/roller/trunk/tools/buildtime/ant-optional-1.5.1.jar
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tools/buildtime/ant-optional-1.5.1.jar?rev=189602&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/roller/trunk/tools/buildtime/ant-optional-1.5.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/roller/trunk/tools/buildtime/ejb-1.1.jar
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tools/buildtime/ejb-1.1.jar?rev=189602&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/roller/trunk/tools/buildtime/ejb-1.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/roller/trunk/tools/buildtime/junit-3.8.1.jar
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tools/buildtime/junit-3.8.1.jar?rev=189602&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/roller/trunk/tools/buildtime/junit-3.8.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/roller/trunk/tools/buildtime/mockrunner-0.2.6/lib/mockrunner.jar
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tools/buildtime/mockrunner-0.2.6/lib/mockrunner.jar?rev=189602&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/roller/trunk/tools/buildtime/mockrunner-0.2.6/lib/mockrunner.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/roller/trunk/tools/buildtime/strutstest-2.0.0.jar
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tools/buildtime/strutstest-2.0.0.jar?rev=189602&view=auto
==============================================================================
Binary file - no diff available.



Mime
View raw message