roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r216016 - in /incubator/roller/branches/roller_2.0: metadata/database/ src/org/roller/business/ src/org/roller/business/hibernate/ src/org/roller/model/ src/org/roller/pojos/ src/org/roller/presentation/website/actions/ tests/org/roller/ te...
Date Tue, 12 Jul 2005 20:43:05 GMT
Author: snoopdave
Date: Tue Jul 12 13:43:04 2005
New Revision: 216016

URL: http://svn.apache.org/viewcvs?rev=216016&view=rev
Log:
Most unit tests working now. Still working on a couple of sticklers.

Added:
    incubator/roller/branches/roller_2.0/metadata/database/130-to-200-migration-raw.sql
Modified:
    incubator/roller/branches/roller_2.0/metadata/database/createdb-raw.sql
    incubator/roller/branches/roller_2.0/src/org/roller/business/UserManagerImpl.java
    incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateUserManagerImpl.java
    incubator/roller/branches/roller_2.0/src/org/roller/model/UserManager.java
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/UserData.java
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogEntryData.java
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/WebsiteData.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/UserNewAction.java
    incubator/roller/branches/roller_2.0/tests/org/roller/RollerTestBase.java
    incubator/roller/branches/roller_2.0/tests/org/roller/business/FileManagerTest.java
    incubator/roller/branches/roller_2.0/tests/org/roller/business/PermissionsTest.java
    incubator/roller/branches/roller_2.0/tests/org/roller/business/TestAll.java
    incubator/roller/branches/roller_2.0/tests/org/roller/business/UserManagerTest.java
    incubator/roller/branches/roller_2.0/tests/org/roller/business/WeblogManagerTest.java

Added: incubator/roller/branches/roller_2.0/metadata/database/130-to-200-migration-raw.sql
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/metadata/database/130-to-200-migration-raw.sql?rev=216016&view=auto
==============================================================================
--- incubator/roller/branches/roller_2.0/metadata/database/130-to-200-migration-raw.sql (added)
+++ incubator/roller/branches/roller_2.0/metadata/database/130-to-200-migration-raw.sql Tue Jul 12 13:43:04 2005
@@ -0,0 +1,30 @@
+-- User permissions within a website
+create table roller_user_permissions (
+    id              varchar(48) not null primary key,
+    website_id      varchar(48) not null,
+    user_id         varchar(48) not null,
+    permission_mask integer not null, -- bitmask 001 limited, 011 author, 100 admin
+    pending         @BOOLEAN_SQL_TYPE_TRUE@ not null -- pending user acceptance of invitation to join website
+);
+
+-- Audit log records time and comment about change
+create table roller_audit_log (
+    id              varchar(48) not null primary key,
+    user_id         varchar(48) not null,  -- user that made change
+    object_id       varchar(48),           -- id of associated object, if any
+    object_class    varchar(255),          -- name of associated object class (e.g. WeblogEntryData)
+    comment         varchar(255) not null, -- description of change
+    change_time     timestamp             -- time that change was made
+);
+
+-- Add new handle field to uniquely identify websites in URLs
+alter table website add column (handle varchar(255) not null);
+create index website_handle_index on userrole(handle);
+alter table website add constraint website_handle_uq unique (handle@INDEXSIZE@);
+
+-- Add userid to weblogentry so we can track original creator of entry
+alter table weblogentry add column (userid varchar(48) not null);
+create index weblogentry_userid_index on weblogentry(userid);
+
+alter table rolleruser isenabled @BOOLEAN_SQL_TYPE_TRUE@ not null;
+create index user_isenabled_index on rolleruser( isenabled );

Modified: incubator/roller/branches/roller_2.0/metadata/database/createdb-raw.sql
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/metadata/database/createdb-raw.sql?rev=216016&r1=216015&r2=216016&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/metadata/database/createdb-raw.sql (original)
+++ incubator/roller/branches/roller_2.0/metadata/database/createdb-raw.sql Tue Jul 12 13:43:04 2005
@@ -19,7 +19,8 @@
     passphrase      varchar(255) not null,
     fullname        varchar(255) not null,
     emailaddress    varchar(255) not null,
-    datecreated     timestamp not null
+    datecreated     timestamp not null,
+    isenabled       @BOOLEAN_SQL_TYPE_TRUE@ not null
 );
 alter table rolleruser add constraint rolleruser_username_uq unique ( username@INDEXSIZE@ );
 
@@ -97,10 +98,10 @@
     pinnedtomain      @BOOLEAN_SQL_TYPE_FALSE@ not null,
     isenabled         @BOOLEAN_SQL_TYPE_TRUE@ not null
 );
-create index website_id_index on website( id );
-create index website_userid_index on website( userid );
-create index website_isenabled_index on website( isenabled );
-create index website_handle_index on userrole(handle);
+create index website_id_index        on website(id);
+create index website_userid_index    on website(userid);
+create index website_isenabled_index on website(isenabled);
+create index website_handle_index    on website(handle);
 alter table website add constraint website_handle_uq unique (handle@INDEXSIZE@);
 
 create table folder (

Modified: incubator/roller/branches/roller_2.0/src/org/roller/business/UserManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/business/UserManagerImpl.java?rev=216016&r1=216015&r2=216016&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/business/UserManagerImpl.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/business/UserManagerImpl.java Tue Jul 12 13:43:04 2005
@@ -8,8 +8,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -23,7 +21,6 @@
 import org.roller.pojos.FolderData;
 import org.roller.pojos.PageData;
 import org.roller.pojos.PermissionsData;
-import org.roller.pojos.PlanetGroupSubscriptionAssoc;
 import org.roller.pojos.RoleData;
 import org.roller.pojos.UserCookieData;
 import org.roller.pojos.UserData;
@@ -197,13 +194,11 @@
      * @param ud  User object representing the new user.
      * @param themeDir Directory containing the theme for this user
      */
-    public void addUser(UserData ud, Map pages, String theme, 
-                        String locale, String timezone)
+    public void addUser(UserData ud)
         throws RollerException
     {        
         Roller mRoller = RollerFactory.getRoller();
         UserManager umgr = mRoller.getUserManager();
-        WeblogManager wmgr = mRoller.getWeblogManager();
         if (    umgr.getUser(ud.getUserName()) != null 
              || umgr.getUser(ud.getUserName().toLowerCase()) != null) 
         {
@@ -216,33 +211,42 @@
         {
             // Make first user an admin
             adminUser = true;
-        }
-        
+        }        
         mStrategy.store(ud);
+        if (adminUser) ud.grantRole("admin");
         
         RoleData rd = new RoleData(null, ud, "editor");
         mStrategy.store(rd);
-        
-        //
-        // CREATE WEBSITE AND CATEGORIES FOR USER
-        //
-        
+    }
+    
+    public WebsiteData createWebsite(
+            UserData ud, 
+            Map pages, 
+            String theme, 
+            String locale, 
+            String timezone) throws RollerException
+    {
+        Roller mRoller = RollerFactory.getRoller();
+        UserManager umgr = mRoller.getUserManager();
+        WeblogManager wmgr = mRoller.getWeblogManager();
+
         WebsiteData website = new WebsiteData(null,
             ud.getFullName()+"'s Weblog", // name
             ud.getUserName(),             // handle
             ud.getFullName()+"'s Weblog", // description
-            ud,                // userId
-            "dummy",           // defaultPageId
-            "dummy",           // weblogDayPageId
-            Boolean.TRUE,      // enableBloggerApi
-            null,                // bloggerCategory
-            null,                // defaultCategory
-            "editor-text.jsp", // editorPage
-            "",                // ignoreWords
-            Boolean.TRUE,      // allowComments  
-            Boolean.FALSE,     // emailComments
-            "",                // emailFromAddress
-            Boolean.TRUE);     // isEnabled
+            ud,                 // userId
+            "dummy",            // defaultPageId
+            "dummy",            // weblogDayPageId
+            Boolean.TRUE,       // enableBloggerApi
+            null,               // bloggerCategory
+            null,               // defaultCategory
+            "editor-text.jsp",  // editorPage
+            "",                 // ignoreWords
+            Boolean.TRUE,       // allowComments  
+            Boolean.FALSE,      // emailComments
+            "",                 // emailFromAddress
+            Boolean.TRUE,       // isEnabled
+            "dummy@example.com");  // emailAddress
         website.setEditorTheme(theme);
         website.setLocale(locale);
         website.setTimezone(timezone);
@@ -364,13 +368,18 @@
                 website.setWeblogDayPageId(pd.getId());                 
             }                
         }
+        mStrategy.store(website); 
         
-        if (adminUser) ud.grantRole("admin");
         
-        // Save website with blogger cat id, defauld page id and day id
-        mStrategy.store(website); 
+        PermissionsData perms = new PermissionsData();
+        perms.setUser(ud);
+        perms.setWebsite(website);
+        perms.setPermissionMask(PermissionsData.ADMIN);
+        perms.save();
+
+        return website;
     }
-    
+
     /**
      * @see org.roller.model.UserManager#createLoginCookie(java.lang.String)
      */

Modified: incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateUserManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateUserManagerImpl.java?rev=216016&r1=216015&r2=216016&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateUserManagerImpl.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateUserManagerImpl.java Tue Jul 12 13:43:04 2005
@@ -376,28 +376,25 @@
         }
     }
 
-    /** 
-     * @see org.roller.model.UserManager#removeUserWebsites(org.roller.pojos.UserData)
-     */
-    public void removeUserWebsites(UserData user) throws RollerException
-    {
-        Session session = ((HibernateStrategy)mStrategy).getSession();
-        Criteria criteria = session.createCriteria(WebsiteData.class);
-        criteria.add(Expression.eq("user", user));
-        try
-        {
-            List websites = criteria.list();
-            for (Iterator iter = websites.iterator(); iter.hasNext();) 
-            {
-                WebsiteData website = (WebsiteData)iter.next();
-                website.remove();
-            }            
-        }
-        catch (HibernateException e)
-        {
-            throw new RollerException(e);
-        }
-    }
+//    public void removeUserWebsites(UserData user) throws RollerException
+//    {
+//        Session session = ((HibernateStrategy)mStrategy).getSession();
+//        Criteria criteria = session.createCriteria(WebsiteData.class);
+//        criteria.add(Expression.eq("user", user));
+//        try
+//        {
+//            List websites = criteria.list();
+//            for (Iterator iter = websites.iterator(); iter.hasNext();) 
+//            {
+//                WebsiteData website = (WebsiteData)iter.next();
+//                website.remove();
+//            }            
+//        }
+//        catch (HibernateException e)
+//        {
+//            throw new RollerException(e);
+//        }
+//    }
 
     /** 
      * @see org.roller.model.UserManager#removeWebsiteContents(org.roller.pojos.WebsiteData)

Modified: incubator/roller/branches/roller_2.0/src/org/roller/model/UserManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/model/UserManager.java?rev=216016&r1=216015&r2=216016&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/model/UserManager.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/model/UserManager.java Tue Jul 12 13:43:04 2005
@@ -18,6 +18,9 @@
  * 
  * @author David M Johnson
  */
+/**
+ * @author dave
+ */
 public interface UserManager extends Serializable
 {
     /** 
@@ -104,13 +107,32 @@
 	/** Get user object by user name, optionally include dis-enabled users */
 	public UserData getUser( String userName, boolean enabledOnly ) throws RollerException;
 
-    /** Add a new user with pages, bookmarks, folders...
-     * @param user New user object to be added to database
-     * @param themeDir Directory containing theme for user
-     */
-    public void addUser( UserData user, Map page, String theme,
-            String locale, String timezone)
-        throws RollerException;
+
+    /**
+     * Add new user object to Roller. User will be given the global editor role, 
+     * unless it's the first user, who will get the global admin role.
+     * @param user User object to be added, initialized with name, password, etc.
+     * @throws RollerException
+     */
+    public void addUser(UserData user) throws RollerException;
+
+    /**
+     * @param ud
+     * @param pages
+     * @param theme
+     * @param locale
+     * @param timezone
+     * @param mRoller
+     * @param wmgr
+     * @return
+     * @throws RollerException
+     */
+    public WebsiteData createWebsite(
+            UserData ud, 
+            Map pages, 
+            String theme, 
+            String locale, 
+            String timezone) throws RollerException;
 
     public UserData retrieveUser(String id)throws RollerException;
     public void storeUser( UserData data ) throws RollerException;
@@ -197,11 +219,6 @@
      * @param username
      */
     public void removeLoginCookies(String username) throws RollerException;
-
-    /**
-     * Remove website(s) associated with user.
-     */
-    public void removeUserWebsites(UserData data) throws RollerException;
 
     /**
      * Remove contents of website.

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/UserData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/UserData.java?rev=216016&r1=216015&r2=216016&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/UserData.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/UserData.java Tue Jul 12 13:43:04 2005
@@ -1,6 +1,7 @@
 
 package org.roller.pojos;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
@@ -28,11 +29,11 @@
    extends org.roller.pojos.PersistentObject
    implements java.io.Serializable
 {
-    public static final UserData SYSTEM_USER = 
-        new UserData("n/a","systemuser","n/a","systemuser","n/a",new Date());
+    public static final UserData SYSTEM_USER = new UserData(
+        "n/a","systemuser","n/a","systemuser","n/a",new Date(), Boolean.TRUE);
        
-    public static final UserData ANONYMOUS_USER = 
-        new UserData("n/a","anonymoususer","n/a","anonymoususer","n/a",new Date());
+    public static final UserData ANONYMOUS_USER = new UserData(
+        "n/a","anonymoususer","n/a","anonymoususer","n/a",new Date(), Boolean.TRUE);
    
    static final long serialVersionUID = -6354583200913127874L;
 
@@ -43,8 +44,9 @@
    protected java.lang.String emailAddress;
    protected java.util.Date dateCreated;
    protected Boolean isEnabled;
+   
    private Set roles = new TreeSet();
-   private List permissions;
+   private List permissions = new ArrayList();
 
    public UserData()
    {
@@ -52,14 +54,16 @@
 
 	public UserData( java.lang.String id, java.lang.String userName,
                      java.lang.String password, java.lang.String fullName,
-                     java.lang.String emailAddress, java.util.Date dateCreated)
+                     java.lang.String emailAddress, java.util.Date dateCreated,
+                     Boolean isEnabled)
 	{
-		this.id = id;
-		this.userName = userName;
-		this.password = password;
-		this.fullName = fullName;
-		this.emailAddress = emailAddress;
-		this.dateCreated = (Date)dateCreated.clone();
+         this.id = id;
+         this.userName = userName;
+         this.password = password;
+         this.fullName = fullName;
+         this.emailAddress = emailAddress;
+         this.dateCreated = (Date)dateCreated.clone();
+         this.isEnabled = isEnabled;
 	}
 
 	public UserData( UserData otherData )
@@ -336,7 +340,6 @@
     public void remove() throws RollerException
     {
         UserManager uMgr = RollerFactory.getRoller().getUserManager();
-        uMgr.removeUserWebsites(this);
         
         // remove user roles
         Iterator roles = uMgr.getUserRoles(this).iterator();
@@ -344,7 +347,6 @@
         {
             ((RoleData)roles.next()).remove();
         }
-        
         super.remove();
     }
     

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogEntryData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogEntryData.java?rev=216016&r1=216015&r2=216016&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogEntryData.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogEntryData.java Tue Jul 12 13:43:04 2005
@@ -40,28 +40,32 @@
  */
 public class WeblogEntryData extends WebsiteObject implements Serializable
 {
-    private static Log mLogger = LogFactory.getFactory()
-                                           .getInstance(WeblogEntryData.class);
+    private static Log mLogger = 
+        LogFactory.getFactory().getInstance(WeblogEntryData.class);
                                            
     static final long serialVersionUID = 2341505386843044125L;
     
-    protected String id=null;
-    protected org.roller.pojos.WeblogCategoryData category=null;
-    protected String title=null;
-    protected String link=null;
-    protected String text=null;
-    protected String anchor=null;
-    protected Timestamp pubTime=null;
-    protected Timestamp updateTime=null;
-    protected Boolean publishEntry=null;
-    protected UserData mCreator=null;
-    protected WebsiteData mWebsite=null;
-    protected String mPlugins;
-    protected Boolean allowComments = Boolean.TRUE;
-    protected Integer commentDays = new Integer(7);
-    protected Boolean rightToLeft = Boolean.FALSE;
-    protected Boolean pinnedToMain = Boolean.FALSE;
-    
+    // Simple properies
+    protected String    id            = null;
+    protected String    title         = null;
+    protected String    link          = null;
+    protected String    text          = null;
+    protected String    anchor        = null;
+    protected Timestamp pubTime       = null;
+    protected Timestamp updateTime    = null;
+    protected Boolean   publishEntry  = null;
+    protected String    plugins       = null;
+    protected Boolean   allowComments = Boolean.TRUE;
+    protected Integer   commentDays   = new Integer(7);
+    protected Boolean   rightToLeft   = Boolean.FALSE;
+    protected Boolean   pinnedToMain  = Boolean.FALSE;
+    
+    // Associated objects
+    protected UserData           creator  = null;
+    protected WebsiteData        website  = null;
+    protected WeblogCategoryData category = null;
+        
+    // Collection of name/value entry attributes
     private Map attMap = new HashMap();
     private Set attSet = new TreeSet();
     
@@ -73,8 +77,9 @@
 
     public WeblogEntryData(
        java.lang.String id, 
-       org.roller.pojos.WeblogCategoryData category, 
+       WeblogCategoryData category, 
        WebsiteData website, 
+       UserData creator,
        java.lang.String title, 
        java.lang.String link,
        java.lang.String text, 
@@ -85,7 +90,8 @@
     {
         this.id = id;
         this.category = category;
-        this.mWebsite = website;
+        this.website = website;
+        this.creator = creator;
         this.title = title;
         this.link = link;
         this.text = text;
@@ -110,7 +116,8 @@
         WeblogEntryData other = (WeblogEntryData)otherData;
         this.id = other.id;
         this.category = other.category;
-        this.mWebsite = other.mWebsite;
+        this.website = other.website;
+        this.creator = other.creator;
         this.title = other.title;
         this.link = other.link;
         this.text = other.text;
@@ -118,7 +125,7 @@
         this.pubTime = other.pubTime;
         this.updateTime = other.updateTime;
         this.publishEntry = other.publishEntry;
-        this.mPlugins = other.mPlugins;
+        this.plugins = other.plugins;
         this.allowComments = other.allowComments;
         this.commentDays = other.commentDays;
         this.rightToLeft = other.rightToLeft;
@@ -174,13 +181,13 @@
      */
     public WebsiteData getWebsite()
     {
-        return this.mWebsite;
+        return this.website;
     }
 
     /** @ejb:persistent-field */
     public void setWebsite(WebsiteData website)
     {
-        this.mWebsite = website;
+        this.website = website;
     }
 
     /** 
@@ -189,13 +196,13 @@
      */
     public UserData getCreator()
     {
-        return this.mCreator;
+        return this.creator;
     }
 
     /** @ejb:persistent-field */
     public void setCreator(UserData creator)
     {
-        this.mCreator = creator;
+        this.creator = creator;
     }
     
     /** 
@@ -406,13 +413,13 @@
      */
     public java.lang.String getPlugins()
     {
-        return mPlugins;
+        return plugins;
     }
 
     /** @ejb:persistent-field */
     public void setPlugins(java.lang.String string)
     {
-        mPlugins = string;
+        plugins = string;
     }
 
     
@@ -755,7 +762,7 @@
                     "pubTime=" + pubTime + " " + 
                     "updateTime=" + updateTime + " " + 
                     "publishEntry=" + publishEntry + " " + 
-                    "plugins=" + mPlugins);
+                    "plugins=" + plugins);
         str.append('}');
 
         return (str.toString());
@@ -788,13 +795,13 @@
                 lEquals = lEquals && this.category.equals(lTest.category);
             }
 
-            if (this.mWebsite == null)
+            if (this.website == null)
             {
-                lEquals = lEquals && (lTest.mWebsite == null);
+                lEquals = lEquals && (lTest.website == null);
             }
             else
             {
-                lEquals = lEquals && this.mWebsite.equals(lTest.mWebsite);
+                lEquals = lEquals && this.website.equals(lTest.website);
             }
 
             if (this.title == null)
@@ -853,14 +860,14 @@
                           this.publishEntry.equals(lTest.publishEntry);
             }
 
-            if (this.mPlugins == null)
+            if (this.plugins == null)
             {
-                lEquals = lEquals && (lTest.mPlugins == null);
+                lEquals = lEquals && (lTest.plugins == null);
             }
             else
             {
                 lEquals = lEquals && 
-                          this.mPlugins.equals(lTest.mPlugins);
+                          this.plugins.equals(lTest.plugins);
             }
 
 
@@ -882,7 +889,7 @@
         result = (37 * result) + 
                  ((this.category != null) ? this.category.hashCode() : 0);
         result = (37 * result) + 
-                 ((this.mWebsite != null) ? this.mWebsite.hashCode() : 0);
+                 ((this.website != null) ? this.website.hashCode() : 0);
         result = (37 * result) + 
                  ((this.title != null) ? this.title.hashCode() : 0);
         result = (37 * result) + 
@@ -896,7 +903,7 @@
         result = (37 * result) + 
                  ((this.publishEntry != null) ? this.publishEntry.hashCode() : 0);
         result = (37 * result) + 
-                 ((this.mPlugins != null) ? this.mPlugins.hashCode() : 0);
+                 ((this.plugins != null) ? this.plugins.hashCode() : 0);
 
         return result;
     }
@@ -1002,9 +1009,9 @@
      */
     public List getPluginsList()
     {
-        if (mPlugins != null)
+        if (plugins != null)
         {
-            return Arrays.asList( StringUtils.split(mPlugins, ",") );
+            return Arrays.asList( StringUtils.split(plugins, ",") );
         }
         return new ArrayList();
     }

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/WebsiteData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/WebsiteData.java?rev=216016&r1=216015&r2=216016&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/WebsiteData.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/WebsiteData.java Tue Jul 12 13:43:04 2005
@@ -1,28 +1,36 @@
 package org.roller.pojos;
 
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.TimeZone;
+
 import org.apache.commons.lang.StringUtils;
 import org.roller.RollerException;
 import org.roller.model.Roller;
 import org.roller.model.RollerFactory;
 import org.roller.util.PojoUtil;
 
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.TimeZone;
 /**
- * A user's website is a weweblog, newsfeed channels and bookmarks.
+ * Website has many-to-many association with users. Website has one-to-many and 
+ * one-direction associations with weblog entries, weblog categories, folders and
+ * other objects. Use UserManager to create, fetch, update and retreive websites.
+ * 
  * @author David M Johnson
  *
  * @ejb:bean name="WebsiteData"
  * @struts.form include-all="true"
  * @hibernate.class table="website"
+ * 
  * hibernate.jcs-cache usage="read-write"
  */
 public class WebsiteData extends org.roller.pojos.PersistentObject
     implements java.io.Serializable
 {
     static final long serialVersionUID = 206437645033737127L;
+    
+    // Simple properties
     protected String  id;
     protected String  handle;
     protected String  name;
@@ -41,11 +49,13 @@
     protected String  timezone;
     protected String  mDefaultPlugins;
     protected Boolean isEnabled;
-    protected List    permissions;
+    
+    // Associated objects
+    protected UserData mUser = null; // TODO: decide if website.user is needed
+    protected List     permissions = new ArrayList();    
     protected WeblogCategoryData bloggerCategory;
     protected WeblogCategoryData defaultCategory;
 
-    protected UserData mUser = null;
 
     public WebsiteData()
     {
@@ -66,7 +76,8 @@
                        final Boolean  allowComments,
                        final Boolean  emailComments,
                        final String   emailFromAddress,
-                       final Boolean  isEnabled)
+                       final Boolean  isEnabled,
+                       final String   emailAddress)
     {
         this.id = id;
         this.name = name;
@@ -84,6 +95,7 @@
         this.emailComments = emailComments;
         this.emailFromAddress = emailFromAddress;
         this.isEnabled = isEnabled;
+        this.emailAddress = emailAddress;
     }
 
     public WebsiteData(WebsiteData otherData)
@@ -133,7 +145,7 @@
     /**
      * Short URL safe string that uniquely identifies the website.
      * @ejb:persistent-field
-     * @hibernate.property column="name" non-null="true" unique="true"
+     * @hibernate.property column="handle" non-null="true" unique="true"
      */
     public String getHandle()
     {
@@ -358,7 +370,7 @@
     
     /**
      * @ejb:persistent-field
-     * @hibernate.property column="emailfromaddress" non-null="true" unique="false"
+     * @hibernate.property column="emailaddress" non-null="true" unique="false"
      */
     public String getEmailAddress()
     {
@@ -366,7 +378,7 @@
     }
 
     /** @ejb:persistent-field */
-    public void setEmailAddress(String emailFromAddress)
+    public void setEmailAddress(String emailAddress)
     {
         this.emailAddress = emailAddress;
     }
@@ -464,6 +476,7 @@
                    "editorPage=" + editorPage + " " +
                    "ignoreWords=" + ignoreWords + " " +
                    "allowComments=" + allowComments + " " +
+                   "emailAddress=" + emailAddress + " " + 
                    "emailComments=" + emailComments + " " + 
                    "emailFromAddress=" + emailFromAddress + " " +
                    "editorTheme=" + editorTheme + " " +
@@ -508,6 +521,8 @@
             
             lEquals = PojoUtil.equals(lEquals, this.emailComments, lTest.emailComments);
             
+            lEquals = PojoUtil.equals(lEquals, this.emailAddress, lTest.emailAddress);
+            
             lEquals = PojoUtil.equals(lEquals, this.emailFromAddress, lTest.emailFromAddress);
 
             lEquals = PojoUtil.equals(lEquals, this.editorTheme, lTest.editorTheme);
@@ -542,6 +557,7 @@
         result = PojoUtil.addHashCode(result, this.ignoreWords);
         result = PojoUtil.addHashCode(result, this.allowComments);
         result = PojoUtil.addHashCode(result, this.emailComments);
+        result = PojoUtil.addHashCode(result, this.emailAddress);
         result = PojoUtil.addHashCode(result, this.emailFromAddress);
         result = PojoUtil.addHashCode(result, this.editorTheme);
         result = PojoUtil.addHashCode(result, this.locale);
@@ -572,6 +588,7 @@
         this.ignoreWords = other.ignoreWords;
         this.allowComments = other.allowComments;
         this.emailComments = other.emailComments;
+        this.emailAddress = other.emailAddress;
         this.emailFromAddress = other.emailFromAddress;
         this.editorTheme = other.editorTheme;
         this.locale = other.locale;
@@ -673,7 +690,7 @@
                 break;
             }
         }
-        if (!userPerms.isPending())
+        if (userPerms != null && !userPerms.isPending())
         {
             if (userPerms != null && (userPerms.getPermissionMask() & mask) > 0) 
             {

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/UserNewAction.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/UserNewAction.java?rev=216016&r1=216015&r2=216016&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/UserNewAction.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/UserNewAction.java Tue Jul 12 13:43:04 2005
@@ -141,7 +141,8 @@
             
             String theme = form.getTheme();
             HashMap pages = rollerContext.readThemeMacros(theme);
-            mgr.addUser( ud, pages, theme, form.getLocale(), form.getTimezone() );
+            mgr.addUser(ud);
+            mgr.createWebsite(ud, pages, theme, form.getLocale(), form.getTimezone());
             rreq.getRoller().commit();
 
 			// Flush cache so user will immediately appear on index page

Modified: incubator/roller/branches/roller_2.0/tests/org/roller/RollerTestBase.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/tests/org/roller/RollerTestBase.java?rev=216016&r1=216015&r2=216016&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/tests/org/roller/RollerTestBase.java (original)
+++ incubator/roller/branches/roller_2.0/tests/org/roller/RollerTestBase.java Tue Jul 12 13:43:04 2005
@@ -21,6 +21,7 @@
 import org.roller.model.UserManager;
 import org.roller.model.WeblogManager;
 import org.roller.pojos.CommentData;
+import org.roller.pojos.PermissionsData;
 import org.roller.pojos.UserData;
 import org.roller.pojos.WeblogCategoryData;
 import org.roller.pojos.WeblogEntryData;
@@ -38,7 +39,8 @@
 
     private Roller mRoller = null;
 
-    /** Simple website created by addUser(), no frills. */
+    /** Simple user and website */
+    protected UserData mUser = null;
     protected WebsiteData mWebsite = null;
     protected String testUsername = "testuser";
 
@@ -95,42 +97,47 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        UserManager umgr = getRoller().getUserManager();
-
         getRoller().begin(UserData.SYSTEM_USER);
-
-        // create User
-        UserData user = createUser(umgr,
+        mUser = createUser(
                    testUsername,
                    "password",
                    "TestUser",
                    "testuser@example.com");
-
-        // get website
-        mWebsite = (WebsiteData)umgr.getWebsites(user, null).get(0);
+        UserManager umgr = getRoller().getUserManager();
+        mWebsite = (WebsiteData)umgr.getWebsites(mUser, null).get(0);
         getRoller().commit();
     }
 
     //-----------------------------------------------------------------------
     protected UserData createUser(
-                    UserManager umgr,
                     String username,
                     String password,
                     String fullName,
                     String email) throws RollerException
     {
+        UserManager umgr = getRoller().getUserManager();
+        WeblogManager wmgr = getRoller().getWeblogManager();
+
+        // Create and add new new user
         UserData ud = new UserData(null,
-            username,         // userName
-            password,           // password
+            username,      // userName
+            password,      // password
             fullName,      // fullName
-            email, // emailAddress
-            new java.util.Date()  // dateCreated
-            );
+            email,         // emailAddress
+            new java.util.Date(), // dateCreated
+            Boolean.TRUE);
+        umgr.addUser(ud);
+
+        // Create list of pages to be loaded into website
         Map pages = new HashMap();
         pages.put("Weblog","Weblog page content");
         pages.put("_day","Day page content");
         pages.put("css","CSS page content");
-        umgr.addUser(ud, pages, "basic", "en_US_WIN", "America/Los_Angeles");
+        
+        // Create website for user with those pages
+        umgr.createWebsite(
+           ud, pages, "basic", "en_US_WIN", "America/Los_Angeles");
+        
         return ud;
     }
 
@@ -146,7 +153,7 @@
         {
             getRoller().begin(UserData.SYSTEM_USER);
 
-            UserData ud = createUser(umgr,
+            UserData ud = createUser(
                 "testuser"+i,         // userName
                 "password",           // password
                 "Test User #"+i,      // fullName
@@ -168,7 +175,7 @@
             getRoller().begin(UserData.SYSTEM_USER);
             website  = umgr.retrieveWebsite(website.getId());
             WeblogCategoryData rootCat = wmgr.getRootWeblogCategory(website);
-            createCategoryPostsAndComments(0, wmgr, website, rootCat);
+            createCategoryPostsAndComments(0, wmgr, ud, website, rootCat);
             getRoller().commit();
         }
 
@@ -178,6 +185,7 @@
     private void createCategoryPostsAndComments(
             int depth,
             WeblogManager wmgr,
+            UserData user,
             WebsiteData website,
             WeblogCategoryData rootCat) throws RollerException
     {
@@ -195,6 +203,7 @@
                  null,      // id
                  rootCat,    // category
                  website,    // websiteId
+                 user,
                  "Future Blog", // title
                  null,
                  "Blog to the Future", // text
@@ -220,6 +229,7 @@
                     null,      // id
                     rootCat,    // category
                     website,    // websiteId
+                    user,
                     rootCat.getName() + ":entry"+k, // title
                     null,
                     rootCat.getName() + ":entry"+k, // text
@@ -273,7 +283,7 @@
 
             if (depth < mCatDepth)
             {
-                createCategoryPostsAndComments(depth+1, wmgr, website, cat);
+                createCategoryPostsAndComments(depth+1, wmgr, user, website, cat);
             }
         }
     }
@@ -284,11 +294,18 @@
     {
         getRoller().begin(UserData.SYSTEM_USER);
         UserManager umgr = getRoller().getUserManager();
-        for (Iterator iter = mUsersCreated.iterator(); iter.hasNext();)
+        for (Iterator siteIter = mWebsites.iterator(); siteIter.hasNext();)
+        {
+            WebsiteData site = (WebsiteData) siteIter.next();
+            site = umgr.retrieveWebsite(site.getId());
+            if (site != null) site.remove();
+        }
+        
+        for (Iterator userIter = mUsersCreated.iterator(); userIter.hasNext();)
         {
-            UserData element = (UserData) iter.next();
-            element = umgr.retrieveUser(element.getId());
-            element.remove();
+            UserData user = (UserData) userIter.next();
+            user = umgr.retrieveUser(user.getId());
+            user.remove();
         }
         getRoller().commit();
     }

Modified: incubator/roller/branches/roller_2.0/tests/org/roller/business/FileManagerTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/tests/org/roller/business/FileManagerTest.java?rev=216016&r1=216015&r2=216016&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/tests/org/roller/business/FileManagerTest.java (original)
+++ incubator/roller/branches/roller_2.0/tests/org/roller/business/FileManagerTest.java Tue Jul 12 13:43:04 2005
@@ -113,8 +113,7 @@
     
     private WebsiteData createTestUser() throws Exception {
         // do some setup for our test
-        Roller mRoller = RollerFactory.getRoller();
-        
+        Roller mRoller = RollerFactory.getRoller();       
         UserManager umgr = mRoller.getUserManager();
         mRoller.begin(UserData.SYSTEM_USER);
         UserData user = new UserData(null,
@@ -122,16 +121,15 @@
                 "FileManagerTest_password",       
                 "FileManagerTest_description",      
                 "FileManagerTest@example.com", 
-                new java.util.Date());
+                new java.util.Date(), Boolean.TRUE);
         Map pages = new HashMap();
         pages.put("Weblog","Weblog page content");
         pages.put("_day","Day page content");
         pages.put("css","CSS page content");
-        umgr.addUser(user, pages, "basic", "en_US_WIN", "America/Los_Angeles");
+        umgr.addUser(user);
+        umgr.createWebsite(user, pages, "basic", "en_US_WIN", "America/Los_Angeles");
         mRoller.commit();
-        
         WebsiteData website = (WebsiteData)umgr.getWebsites(user,null).get(0);
-
         return website;
     }
 

Modified: incubator/roller/branches/roller_2.0/tests/org/roller/business/PermissionsTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/tests/org/roller/business/PermissionsTest.java?rev=216016&r1=216015&r2=216016&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/tests/org/roller/business/PermissionsTest.java (original)
+++ incubator/roller/branches/roller_2.0/tests/org/roller/business/PermissionsTest.java Tue Jul 12 13:43:04 2005
@@ -337,7 +337,7 @@
      * <li> when website is deleted, permissions are deleted too </li>
      * </ul>
      */
-     public void testPermissionsRemoval() throws Exception
+     public void testRemoveWebsiteCascade() throws Exception
      {
          try 
          {
@@ -373,7 +373,8 @@
                  assertNull(getRoller().getPersistenceStrategy().load(
                          permsId, PermissionsData.class));                 
              }
-             getRoller().commit();    
+             getRoller().commit();   
+                         
          }
          catch (Exception e)
          {
@@ -381,5 +382,56 @@
              fail();
          }               
      }
+     
+     /**
+      * Test permissions removal and related cascades, specifically:
+      * <ul>
+      * <li> when user is deleted, permissions are deleted too </li>
+      * <li> when website is deleted, permissions are deleted too </li>
+      * </ul>
+      */
+      public void testRemoveUserCascade() throws Exception
+      {
+          try 
+          {
+              UserManager umgr = getRoller().getUserManager();
+              String userName = "testuser0";
+              String permsId = null;
+              
+              // Create add user to website
+              getRoller().begin();
+              {
+                  UserData tuser = umgr.getUser(userName);       
+                  WebsiteData tsite = (WebsiteData)umgr.getWebsites(tuser, null).get(0);                
+                  PermissionsData perms = new PermissionsData();
+                  perms.setUser(tuser);
+                  perms.setWebsite(tsite);
+                  perms.save();
+                  permsId = perms.getId();
+              }
+              getRoller().commit();    
+              
+              // delete user
+              getRoller().begin(UserData.SYSTEM_USER);
+              {
+                  UserData tuser = umgr.getUser(userName);       
+                  tuser.remove();              
+              }
+              getRoller().commit(); 
+              
+              // ensure that permission was deleted too
+              getRoller().begin();
+              {
+                  assertNull(getRoller().getPersistenceStrategy().load(
+                          permsId, PermissionsData.class));                 
+              }
+              getRoller().commit();   
+          }
+          catch (Exception e)
+          {
+              e.printStackTrace();
+              fail();
+          }               
+      }
 }
 

Modified: incubator/roller/branches/roller_2.0/tests/org/roller/business/TestAll.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/tests/org/roller/business/TestAll.java?rev=216016&r1=216015&r2=216016&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/tests/org/roller/business/TestAll.java (original)
+++ incubator/roller/branches/roller_2.0/tests/org/roller/business/TestAll.java Tue Jul 12 13:43:04 2005
@@ -15,15 +15,15 @@
     public static Test suite()
     {
         TestSuite suite = new TestSuite();
-//        suite.addTest(BookmarkManagerTest.suite());
-//        suite.addTest(ConfigManagerTest.suite());
-//        suite.addTest(FileManagerTest.suite());
-//        suite.addTest(IndexManagerTest.suite());             
+        suite.addTest(ConfigManagerTest.suite());
         suite.addTest(PermissionsTest.suite());
-//        suite.addTest(PlanetManagerTest.suite());
-//        suite.addTest(RefererManagerTest.suite());
         suite.addTest(UserManagerTest.suite());
-//        suite.addTest(WeblogManagerTest.suite());
+        suite.addTest(WeblogManagerTest.suite());
+        suite.addTest(RefererManagerTest.suite());
+        suite.addTest(IndexManagerTest.suite());             
+        suite.addTest(BookmarkManagerTest.suite());
+        suite.addTest(FileManagerTest.suite());
+        suite.addTest(PlanetManagerTest.suite());
         return suite;
     }
     public TestAll(String testName)

Modified: incubator/roller/branches/roller_2.0/tests/org/roller/business/UserManagerTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/tests/org/roller/business/UserManagerTest.java?rev=216016&r1=216015&r2=216016&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/tests/org/roller/business/UserManagerTest.java (original)
+++ incubator/roller/branches/roller_2.0/tests/org/roller/business/UserManagerTest.java Tue Jul 12 13:43:04 2005
@@ -29,10 +29,13 @@
  */
 public class UserManagerTest  extends RollerTestBase
 {
-    UserData enabledUser = null;
-    UserData disabledUser = null;
-    String enabledUserName = "enabledUser";
-    String disabledUserName = "disabledUser";
+    WebsiteData enabledSite = null;
+    UserData    enabledUser = null;
+    String      enabledUserName = "enabledUser";
+
+    WebsiteData disabledSite = null;
+    UserData    disabledUser = null;
+    String      disabledUserName = "disabledUser";
 
     //------------------------------------------------------------------------
     public UserManagerTest()
@@ -68,21 +71,22 @@
         getRoller().begin(UserData.SYSTEM_USER);
         UserManager umgr = getRoller().getUserManager();
 
-        enabledUser = createUser(umgr,
-                                 enabledUserName,
+        enabledUser = createUser(enabledUserName,
                                  "password",
                                  "EnabledUser",
                                  "enabledUser@example.com"
         );
 
-        disabledUser = createUser(umgr,
-                                 disabledUserName,
+        disabledUser = createUser(disabledUserName,
                                  "password",
                                  "DisabledUser",
                                  "disabledUser@example.com"
         );
-        ((WebsiteData)umgr.getWebsites(disabledUser, null)
-                .get(0)).setIsEnabled(Boolean.FALSE);
+        enabledSite = ((WebsiteData)umgr.getWebsites(enabledUser, null).get(0));
+        enabledSite.setIsEnabled(Boolean.TRUE);
+        
+        disabledSite = ((WebsiteData)umgr.getWebsites(disabledUser, null).get(0));
+        disabledSite.setIsEnabled(Boolean.FALSE);
 
         getRoller().commit();
     }
@@ -97,9 +101,15 @@
         getRoller().begin(UserData.SYSTEM_USER);
         UserManager umgr = getRoller().getUserManager();
 
+        enabledSite = umgr.retrieveWebsite(enabledSite.getId());
+        enabledSite.remove();
+        
         enabledUser = umgr.retrieveUser(enabledUser.getId());
         enabledUser.remove();
 
+        disabledSite = umgr.retrieveWebsite(disabledSite.getId());
+        disabledSite.remove();
+        
         disabledUser = umgr.retrieveUser(disabledUser.getId());
         disabledUser.remove();
 
@@ -120,7 +130,7 @@
             "password2",
             "TestUser2",
             "testuser2@example.com",
-            new java.util.Date());
+            new java.util.Date(), Boolean.TRUE);
         umgr.storeUser(stored);
         getRoller().commit();
 
@@ -155,7 +165,7 @@
             "password3",
             "TestUser3",
             "testuser3@example.com",
-            new java.util.Date());
+            new java.util.Date(), Boolean.TRUE);
         umgr.storeUser( user );
 
         stored = new WebsiteData(
@@ -174,7 +184,8 @@
             Boolean.TRUE,
             Boolean.FALSE,
             null,
-            Boolean.TRUE);
+            Boolean.TRUE, 
+            "");
         umgr.storeWebsite(stored);
 
         FolderData rootFolder = getRoller().getBookmarkManager()
@@ -220,12 +231,13 @@
             "password4",
             "TestUser4",
             "testuser4@example.com",
-            new java.util.Date());
+            new java.util.Date(), Boolean.TRUE);
         Map pages = new HashMap();
         pages.put("Weblog","Weblog page content");
         pages.put("_day","Day page content");
         pages.put("css","CSS page content");
-        umgr.addUser(user, pages, "basic", "en_US_WIN", "America/Los_Angeles");
+        umgr.addUser(user);
+        umgr.createWebsite(user, pages, "basic", "en_US_WIN", "America/Los_Angeles");
         getRoller().commit();
 
         // Verify that user has all the goodies

Modified: incubator/roller/branches/roller_2.0/tests/org/roller/business/WeblogManagerTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/tests/org/roller/business/WeblogManagerTest.java?rev=216016&r1=216015&r2=216016&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/tests/org/roller/business/WeblogManagerTest.java (original)
+++ incubator/roller/branches/roller_2.0/tests/org/roller/business/WeblogManagerTest.java Tue Jul 12 13:43:04 2005
@@ -73,10 +73,12 @@
         getRoller().begin(UserData.SYSTEM_USER);
         
         WebsiteData wd = null;
+        UserData ud = null;
         WeblogCategoryData root = null;
         WeblogManager wmgr = getRoller().getWeblogManager();
 
         wd = getRoller().getUserManager().retrieveWebsite(mWebsite.getId());
+        ud = getRoller().getUserManager().retrieveUser(mUser.getId());
         root = wmgr.getRootWeblogCategory(wd);
 
         // create empty destination folder
@@ -94,7 +96,7 @@
         c1.save();
         
         WeblogEntryData e1 = new WeblogEntryData(
-            null, c1, wd, "title1", null, "text", "anchor", 
+            null, c1, wd, ud, "title1", null, "text", "anchor", 
             new Timestamp(0), new Timestamp(0), Boolean.FALSE);
         e1.save();
         
@@ -105,7 +107,7 @@
         c2.save();
       
         WeblogEntryData e2 = new WeblogEntryData(
-            null, c2, wd, "title2", null, "text", "anchor", 
+            null, c2, wd, ud, "title2", null, "text", "anchor", 
             new Timestamp(0), new Timestamp(0), Boolean.FALSE);
         e2.save();
         
@@ -116,7 +118,7 @@
         c3.save();
         
         WeblogEntryData e3 = new WeblogEntryData(
-            null, c3, wd, "title3", null, "text", "anchor", 
+            null, c3, wd, ud, "title3", null, "text", "anchor", 
             new Timestamp(0), new Timestamp(0), Boolean.FALSE);
         e3.save();
         
@@ -146,10 +148,12 @@
         getRoller().begin(UserData.SYSTEM_USER);
         
         WebsiteData wd = null;
+        UserData ud = null;
         WeblogCategoryData root = null;
         WeblogManager wmgr = getRoller().getWeblogManager();
 
         wd = getRoller().getUserManager().retrieveWebsite(mWebsite.getId());
+        ud = getRoller().getUserManager().retrieveUser(mUser.getId());
         root = wmgr.getRootWeblogCategory(wd);
 
         // create top level folders
@@ -181,22 +185,22 @@
         
         // Create four entries in 1st category
         WeblogEntryData e1 = new WeblogEntryData(
-                null, t1, wd, "title1", null, "text1", "anchor", 
+                null, t1, wd, ud, "title1", null, "text1", "anchor", 
                 new Timestamp(0), new Timestamp(0), Boolean.FALSE);
         e1.save();
         
         WeblogEntryData e2 = new WeblogEntryData(
-                null, t1, wd, "title2", null, "text2", "anchor", 
+                null, t1, wd, ud, "title2", null, "text2", "anchor", 
                 new Timestamp(0), new Timestamp(0), Boolean.FALSE);
         e2.save();
         
         WeblogEntryData e3 = new WeblogEntryData(
-                null, t1, wd, "title3", null, "text3", "anchor", 
+                null, t1, wd, ud, "title3", null, "text3", "anchor", 
                 new Timestamp(0), new Timestamp(0), Boolean.FALSE);
         e3.save();
         
         WeblogEntryData e4 = new WeblogEntryData(
-                null, t1, wd, "title4", null, "text4", "anchor", 
+                null, t1, wd, ud, "title4", null, "text4", "anchor", 
                 new Timestamp(0), new Timestamp(0), Boolean.FALSE);
         e4.save();
         
@@ -731,11 +735,12 @@
         getRoller().begin(UserData.SYSTEM_USER);
         WeblogManager wmgr = getRoller().getWeblogManager();
         WebsiteData website = (WebsiteData)mWebsites.get(0); 
+        UserData user = (UserData)mUsersCreated.get(0);
         
         WeblogCategoryData cat = wmgr.getRootWeblogCategory(website);       
 
         WeblogEntryData entry = new WeblogEntryData(
-                null, cat, website, "title2", null, "text2", "attributetest", 
+                null, cat, website, user, "title2", null, "text2", "attributetest", 
                 new Timestamp(0), new Timestamp(0), Boolean.FALSE);
         entry.save();
         assertNotNull(entry.getId());



Mime
View raw message