portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r731466 [11/12] - in /portals/jetspeed-2/portal/branches/JPA_BRANCH: ./ components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/ components/jetspeed-cm/src/main/java/org/apache/jetspeed/test/ components/jetspeed-page-manager/ co...
Date Mon, 05 Jan 2009 06:04:18 GMT
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/JETSPEED-INF/castor/page-mapping.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/JETSPEED-INF/castor/page-mapping.xml?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/JETSPEED-INF/castor/page-mapping.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/JETSPEED-INF/castor/page-mapping.xml Sun Jan  4 22:04:13 2009
@@ -29,8 +29,8 @@
       <bind-xml name="hidden" node="attribute"/>
     </field>
 
-    <field name="securityConstraints"
-           type="org.apache.jetspeed.om.page.psml.SecurityConstraintsImpl">
+    <field name="securityConstraintsContext"
+           type="org.apache.jetspeed.om.page.psml.SecurityConstraintsContextImpl">
       <bind-xml name="security-constraints"/>
     </field>
 
@@ -116,8 +116,8 @@
       <bind-xml name="decorator" node="attribute"/>
     </field>
 
-    <field name="securityConstraints"
-           type="org.apache.jetspeed.om.page.psml.SecurityConstraintsImpl">
+    <field name="securityConstraintsContext"
+           type="org.apache.jetspeed.om.page.psml.SecurityConstraintsContextImpl">
       <bind-xml name="security-constraints"/>
     </field>
 
@@ -165,8 +165,8 @@
       <bind-xml name="version" node="attribute"/>
     </field>
 
-    <field name="securityConstraints"
-           type="org.apache.jetspeed.om.page.psml.SecurityConstraintsImpl">
+    <field name="securityConstraintsContext"
+           type="org.apache.jetspeed.om.page.psml.SecurityConstraintsContextImpl">
       <bind-xml name="security-constraints"/>
     </field>
     
@@ -196,8 +196,8 @@
       <bind-xml name="hidden" node="attribute"/>
     </field>    
 
-    <field name="securityConstraints"
-           type="org.apache.jetspeed.om.page.psml.SecurityConstraintsImpl">
+    <field name="securityConstraintsContext"
+           type="org.apache.jetspeed.om.page.psml.SecurityConstraintsContextImpl">
       <bind-xml name="security-constraints"/>
     </field>
 
@@ -436,7 +436,7 @@
     </field>
   </class>
 
-  <class name="org.apache.jetspeed.om.page.psml.SecurityConstraintsImpl">
+  <class name="org.apache.jetspeed.om.page.psml.SecurityConstraintsContextImpl">
     <map-to xml="security-constraints"/>
 
     <field name="owner" type="string">

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/JETSPEED-INF/ojb/page-manager-repository.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/JETSPEED-INF/ojb/page-manager-repository.xml?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/JETSPEED-INF/ojb/page-manager-repository.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/JETSPEED-INF/ojb/page-manager-repository.xml Sun Jan  4 22:04:13 2009
@@ -165,13 +165,13 @@
       />
 
       <field-descriptor
-         name="constraints::owner"
+         name="constraintsContext::owner"
          column="OWNER_PRINCIPAL"
          jdbc-type="VARCHAR"
       />
 
       <collection-descriptor
-          name="constraints::constraints"
+          name="constraintsContext::constraints"
           element-class-ref="org.apache.jetspeed.om.folder.impl.FolderSecurityConstraintImpl"
           auto-retrieve="true"
           auto-delete="object"
@@ -182,7 +182,7 @@
       </collection-descriptor>
 
       <collection-descriptor
-          name="constraints::constraintsRefs"
+          name="constraintsContext::constraintsRefs"
           element-class-ref="org.apache.jetspeed.om.folder.impl.FolderSecurityConstraintsRef"
           auto-retrieve="true"
           auto-delete="object"
@@ -919,13 +919,13 @@
       />
 
       <field-descriptor
-         name="constraints::owner"
+         name="constraintsContext::owner"
          column="OWNER_PRINCIPAL"
          jdbc-type="VARCHAR"
       />
 
       <collection-descriptor
-          name="constraints::constraints"
+          name="constraintsContext::constraints"
           element-class-ref="org.apache.jetspeed.om.page.impl.PageSecurityConstraintImpl"
           auto-retrieve="true"
           auto-delete="object"
@@ -936,7 +936,7 @@
       </collection-descriptor>
 
       <collection-descriptor
-          name="constraints::constraintsRefs"
+          name="constraintsContext::constraintsRefs"
           element-class-ref="org.apache.jetspeed.om.page.impl.PageSecurityConstraintsRef"
           auto-retrieve="true"
           auto-delete="object"
@@ -1634,13 +1634,13 @@
       />
 
       <field-descriptor
-         name="constraints::owner"
+         name="constraintsContext::owner"
          column="OWNER_PRINCIPAL"
          jdbc-type="VARCHAR"
       />
 
       <collection-descriptor
-          name="constraints::constraints"
+          name="constraintsContext::constraints"
           element-class-ref="org.apache.jetspeed.om.page.impl.FragmentSecurityConstraintImpl"
           auto-retrieve="true"
           auto-delete="object"
@@ -1651,7 +1651,7 @@
       </collection-descriptor>
 
       <collection-descriptor
-          name="constraints::constraintsRefs"
+          name="constraintsContext::constraintsRefs"
           element-class-ref="org.apache.jetspeed.om.page.impl.FragmentSecurityConstraintsRef"
           auto-retrieve="true"
           auto-delete="object"
@@ -1981,13 +1981,13 @@
       />
 
       <field-descriptor
-         name="constraints::owner"
+         name="constraintsContext::owner"
          column="OWNER_PRINCIPAL"
          jdbc-type="VARCHAR"
       />
 
       <collection-descriptor
-          name="constraints::constraints"
+          name="constraintsContext::constraints"
           element-class-ref="org.apache.jetspeed.om.page.impl.LinkSecurityConstraintImpl"
           auto-retrieve="true"
           auto-delete="object"
@@ -1998,7 +1998,7 @@
       </collection-descriptor>
 
       <collection-descriptor
-          name="constraints::constraintsRefs"
+          name="constraintsContext::constraintsRefs"
           element-class-ref="org.apache.jetspeed.om.page.impl.LinkSecurityConstraintsRef"
           auto-retrieve="true"
           auto-delete="object"

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/META-INF/persistence.xml?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/META-INF/persistence.xml (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/resources/META-INF/persistence.xml Sun Jan  4 22:04:13 2009
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
+
+    <persistence-unit name="jetspeed-page-manager">
+
+        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+
+        <non-jta-data-source>jetspeed</non-jta-data-source>
+
+        <class>org.apache.jetspeed.om.folder.jpa.FolderBaseMenuDefinitionElement</class>
+        <class>org.apache.jetspeed.om.folder.jpa.FolderBaseMenuDefinitionMetadata</class>
+        <class>org.apache.jetspeed.om.folder.jpa.FolderImpl</class>
+        <class>org.apache.jetspeed.om.folder.jpa.FolderMenuDefinitionImpl</class>
+        <class>org.apache.jetspeed.om.folder.jpa.FolderMenuExcludeDefinitionImpl</class>
+        <class>org.apache.jetspeed.om.folder.jpa.FolderMenuIncludeDefinitionImpl</class>
+        <class>org.apache.jetspeed.om.folder.jpa.FolderMenuMetadataLocalizedFieldImpl</class>
+        <class>org.apache.jetspeed.om.folder.jpa.FolderMenuOptionsDefinitionImpl</class>
+        <class>org.apache.jetspeed.om.folder.jpa.FolderMenuSeparatorDefinitionImpl</class>
+        <class>org.apache.jetspeed.om.folder.jpa.FolderMetadataLocalizedFieldImpl</class>
+        <class>org.apache.jetspeed.om.folder.jpa.FolderOrder</class>
+        <class>org.apache.jetspeed.om.folder.jpa.FolderSecurityConstraintImpl</class>
+        <class>org.apache.jetspeed.om.folder.jpa.FolderSecurityConstraintsRef</class>
+        <class>org.apache.jetspeed.om.page.jpa.BaseElementImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.BaseMetadataLocalizedFieldImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.BaseSecurityConstraintImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.BaseSecurityConstraintsRef</class>
+        <class>org.apache.jetspeed.om.page.jpa.FragmentImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.FragmentPreferenceImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.FragmentPreferenceValue</class>
+        <class>org.apache.jetspeed.om.page.jpa.FragmentSecurityConstraintImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.FragmentSecurityConstraintsRef</class>
+        <class>org.apache.jetspeed.om.page.jpa.LinkImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.LinkMetadataLocalizedFieldImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.LinkSecurityConstraintImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.LinkSecurityConstraintsRef</class>
+        <class>org.apache.jetspeed.om.page.jpa.PageBaseMenuDefinitionElement</class>
+        <class>org.apache.jetspeed.om.page.jpa.PageBaseMenuDefinitionMetadata</class>
+        <class>org.apache.jetspeed.om.page.jpa.PageImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.PageMenuDefinitionImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.PageMenuExcludeDefinitionImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.PageMenuIncludeDefinitionImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.PageMenuMetadataLocalizedFieldImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.PageMenuOptionsDefinitionImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.PageMenuSeparatorDefinitionImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.PageMetadataLocalizedFieldImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.PageSecurityConstraintImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.PageSecurityConstraintsRef</class>
+        <class>org.apache.jetspeed.om.page.jpa.PageSecurityGlobalSecurityConstraintsRef</class>
+        <class>org.apache.jetspeed.om.page.jpa.PageSecurityImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.PageSecuritySecurityConstraintImpl</class>
+        <class>org.apache.jetspeed.om.page.jpa.SecurityConstraintsDefImpl</class>
+        <class>org.apache.jetspeed.page.document.jpa.DocumentImpl</class>
+        <class>org.apache.jetspeed.page.document.jpa.NodeImpl</class>
+
+        <exclude-unlisted-classes>true</exclude-unlisted-classes>
+
+    </persistence-unit>
+
+</persistence>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/PageManagerTestShared.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/PageManagerTestShared.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/PageManagerTestShared.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/PageManagerTestShared.java Sun Jan  4 22:04:13 2009
@@ -47,7 +47,7 @@
 import org.apache.jetspeed.idgenerator.IdGenerator;
 import org.apache.jetspeed.idgenerator.JetspeedIdGenerator;
 import org.apache.jetspeed.om.common.SecurityConstraint;
-import org.apache.jetspeed.om.common.SecurityConstraints;
+import org.apache.jetspeed.om.common.SecurityConstraintsContext;
 import org.apache.jetspeed.om.folder.Folder;
 import org.apache.jetspeed.om.folder.FolderNotFoundException;
 import org.apache.jetspeed.om.folder.psml.FolderMetaDataImpl;
@@ -66,6 +66,7 @@
 import org.apache.jetspeed.page.document.psml.DocumentHandlerFactoryImpl;
 import org.apache.jetspeed.page.document.psml.FileSystemFolderHandler;
 import org.apache.jetspeed.page.psml.CastorXmlPageManager;
+import org.apache.jetspeed.page.document.Node;
 import org.apache.jetspeed.security.JSSubject;
 import org.apache.jetspeed.security.JetspeedPermission;
 import org.apache.jetspeed.security.JetspeedPrincipal;
@@ -90,9 +91,9 @@
  * @version $Id: $
  *          
  */
-interface PageManagerTestShared
+public interface PageManagerTestShared
 {
-    class Shared
+    public class Shared
     {
         /**
          * makeCastorXMLPageManager
@@ -275,12 +276,12 @@
 
                             // create test documents and folders
                             Folder folder = pageManager.newFolder("/");
-                            SecurityConstraints constraints = pageManager.newSecurityConstraints();
-                            constraints.setOwner("admin");
+                            SecurityConstraintsContext constraintsContext = pageManager.newSecurityConstraintsContext();
+                            constraintsContext.setOwner("admin");
                             List constraintsRefs = new ArrayList(1);
                             constraintsRefs.add("public-view");
-                            constraints.setSecurityConstraintsRefs(constraintsRefs);
-                            folder.setSecurityConstraints(constraints);
+                            constraintsContext.setSecurityConstraintsRefs(constraintsRefs);
+                            folder.setSecurityConstraintsContext(constraintsContext);
                             pageManager.updateFolder(folder);
                         
                             PageSecurity pageSecurity = pageManager.newPageSecurity();
@@ -310,18 +311,18 @@
                             pageManager.updatePageSecurity(pageSecurity);
                         
                             Page page = pageManager.newPage("/default-page.psml");
-                            constraints = pageManager.newSecurityConstraints();
-                            constraints.setOwner("admin");
+                            constraintsContext = pageManager.newSecurityConstraintsContext();
+                            constraintsContext.setOwner("admin");
                             List inlineConstraints = new ArrayList(1);
                             SecurityConstraint constraint = pageManager.newPageSecurityConstraint();
                             constraint.setRoles(Shared.makeListFromCSV("manager"));
                             constraint.setPermissions(Shared.makeListFromCSV("edit"));
                             inlineConstraints.add(constraint);
-                            constraints.setSecurityConstraints(inlineConstraints);
+                            constraintsContext.setSecurityConstraints(inlineConstraints);
                             constraintsRefs = new ArrayList(1);
                             constraintsRefs.add("public-view");
-                            constraints.setSecurityConstraintsRefs(constraintsRefs);
-                            page.setSecurityConstraints(constraints);                        
+                            constraintsContext.setSecurityConstraintsRefs(constraintsRefs);
+                            page.setSecurityConstraintsContext(constraintsContext);
                             Fragment root = page.getRootFragment();
                             root.setName("jetspeed-layouts::VelocityTwoColumns");
                             Fragment portlet = pageManager.newPortletFragment();
@@ -329,9 +330,9 @@
                             root.getFragments().add(portlet);
                             portlet = pageManager.newPortletFragment();
                             portlet.setName("some-app::SomePortlet");
-                            SecurityConstraints fragmentConstraints = pageManager.newSecurityConstraints();
-                            fragmentConstraints.setOwner("user");
-                            portlet.setSecurityConstraints(fragmentConstraints);
+                            SecurityConstraintsContext fragmentConstraintsContext = pageManager.newSecurityConstraintsContext();
+                            fragmentConstraintsContext.setOwner("user");
+                            portlet.setSecurityConstraintsContext(fragmentConstraintsContext);
                             root.getFragments().add(portlet);
                             pageManager.updatePage(page);
                             TestCase.assertNotNull(page.getRootFragment());
@@ -342,27 +343,27 @@
                             somePortletId[0] = ((Fragment)page.getRootFragment().getFragments().get(1)).getId();
                         
                             page = pageManager.newPage("/user-page.psml");
-                            constraints = pageManager.newSecurityConstraints();
+                            constraintsContext = pageManager.newSecurityConstraintsContext();
                             inlineConstraints = new ArrayList(1);
                             constraint = pageManager.newPageSecurityConstraint();
                             constraint.setUsers(Shared.makeListFromCSV("user"));
                             constraint.setPermissions(Shared.makeListFromCSV("view,edit"));
                             inlineConstraints.add(constraint);
-                            constraints.setSecurityConstraints(inlineConstraints);
-                            page.setSecurityConstraints(constraints);
+                            constraintsContext.setSecurityConstraints(inlineConstraints);
+                            page.setSecurityConstraintsContext(constraintsContext);
                             pageManager.updatePage(page);
 
                             Link link = pageManager.newLink("/default.link");
                             link.setUrl("http://www.default.org/");
-                            constraints = pageManager.newSecurityConstraints();
-                            constraints.setOwner("admin");
+                            constraintsContext = pageManager.newSecurityConstraintsContext();
+                            constraintsContext.setOwner("admin");
                             inlineConstraints = new ArrayList(1);
                             constraint = pageManager.newLinkSecurityConstraint();
                             constraint.setRoles(Shared.makeListFromCSV("manager"));
                             constraint.setPermissions(Shared.makeListFromCSV("edit"));
                             inlineConstraints.add(constraint);
-                            constraints.setSecurityConstraints(inlineConstraints);
-                            link.setSecurityConstraints(constraints);                        
+                            constraintsContext.setSecurityConstraints(inlineConstraints);
+                            link.setSecurityConstraintsContext(constraintsContext);                        
                             pageManager.updateLink(link);
 
                             return null;
@@ -676,12 +677,18 @@
         private static PermissionFactory pf = new TestPermissionFactory();
         static 
         {
+            // psml
+            org.apache.jetspeed.om.folder.psml.FolderImpl.setPermissionsFactory(pf);
             org.apache.jetspeed.om.page.psml.AbstractBaseElement.setPermissionsFactory(pf);
-            org.apache.jetspeed.om.page.impl.BaseElementImpl.setPermissionsFactory(pf);
+            org.apache.jetspeed.om.page.psml.FragmentImpl.setPermissionsFactory(pf);
+            // dbpsml
             org.apache.jetspeed.om.folder.impl.FolderImpl.setPermissionsFactory(pf);
-            org.apache.jetspeed.om.folder.psml.FolderImpl.setPermissionsFactory(pf);
+            org.apache.jetspeed.om.page.impl.BaseElementImpl.setPermissionsFactory(pf);
             org.apache.jetspeed.om.page.impl.FragmentImpl.setPermissionsFactory(pf);
-            org.apache.jetspeed.om.page.psml.FragmentImpl.setPermissionsFactory(pf);
+            // JPA dbpsml
+            org.apache.jetspeed.om.folder.jpa.FolderImpl.setPermissionsFactory(pf);
+            org.apache.jetspeed.om.page.jpa.BaseElementImpl.setPermissionsFactory(pf);
+            org.apache.jetspeed.om.page.jpa.FragmentImpl.setPermissionsFactory(pf);
         }
 
         public PageManagerPermissionsPolicy(Policy defaultPolicy)
@@ -767,7 +774,7 @@
         public PermissionCollection getPermissions(ProtectionDomain domain)
         {
             // return default permissions only since
-            // domain and permsission not available
+            // domain and permission not available
             if (defaultPolicy != null)
             {
                 return defaultPolicy.getPermissions(domain);
@@ -778,7 +785,7 @@
         public PermissionCollection getPermissions(CodeSource codesource)
         {
             // return default permissions only since
-            // domain and permsission not available
+            // domain and permission not available
             if (defaultPolicy != null)
             {
                 return defaultPolicy.getPermissions(codesource);
@@ -796,7 +803,7 @@
         }
     }
     
-    static class AbstractTestPrincipal extends TransientJetspeedPrincipal
+    public static class AbstractTestPrincipal extends TransientJetspeedPrincipal
     {
         private static final SecurityAttributeTypes attributeTypes = new SecurityAttributeTypes()
         {
@@ -861,7 +868,7 @@
         }
     }
     
-    static class TestUser extends AbstractTestPrincipal implements User
+    public static class TestUser extends AbstractTestPrincipal implements User
     {
         private static final long serialVersionUID = 1L;
 
@@ -871,7 +878,7 @@
         }
     }
 
-    static class TestRole extends AbstractTestPrincipal implements Role
+    public static class TestRole extends AbstractTestPrincipal implements Role
     {
         private static final long serialVersionUID = 1L;
 
@@ -881,7 +888,7 @@
         }
     }
     
-    static class TestPermissionFactory implements PermissionFactory
+    public static class TestPermissionFactory implements PermissionFactory
     {
         private static Map<String, JetspeedPermissionFactory> factories = new HashMap<String, JetspeedPermissionFactory>();
         static
@@ -906,4 +913,74 @@
             return JetspeedActions.getContainerActionsMask(actions);
         }
     }
+
+    /**
+     * PageManagerEventListenerImpl
+     * 
+     * Listener used in test cases to verify page manager events.
+     */
+    public static class PageManagerEventListenerImpl implements PageManagerEventListener
+    {
+        private int newNodeCount;
+        private int updatedNodeCount;
+        private int removedNodeCount;
+
+        /* (non-Javadoc)
+         * @see org.apache.jetspeed.page.PageManagerEventListener#newNode(org.apache.jetspeed.page.document.Node)
+         */
+        public void newNode(Node node)
+        {
+            newNodeCount++;
+        }
+
+        /* (non-Javadoc)
+         * @see org.apache.jetspeed.page.PageManagerEventListener#newNode(org.apache.jetspeed.page.document.Node)
+         */
+        public void updatedNode(Node node)
+        {
+            updatedNodeCount++;
+        }
+
+        /* (non-Javadoc)
+         * @see org.apache.jetspeed.page.PageManagerEventListener#newNode(org.apache.jetspeed.page.document.Node)
+         */
+        public void removedNode(Node node)
+        {
+            removedNodeCount++;
+        }
+        
+        /**
+         * Reset listener counts.
+         */
+        public void reset()
+        {
+            newNodeCount = 0;
+            updatedNodeCount = 0;
+            removedNodeCount = 0;            
+        }
+
+        /**
+         * @return new node listener count.
+         */
+        public int getNewNodeCount()
+        {
+            return newNodeCount;
+        }
+
+        /**
+         * @return updated node listener count.
+         */
+        public int getUpdatedNodeCount()
+        {
+            return updatedNodeCount;
+        }
+
+        /**
+         * @return removed node listener count.
+         */
+        public int getRemovedNodeCount()
+        {
+            return removedNodeCount;
+        }
+    }
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestCastorXmlPageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestCastorXmlPageManager.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestCastorXmlPageManager.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestCastorXmlPageManager.java Sun Jan  4 22:04:13 2009
@@ -30,7 +30,7 @@
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.om.common.SecurityConstraint;
-import org.apache.jetspeed.om.common.SecurityConstraints;
+import org.apache.jetspeed.om.common.SecurityConstraintsContext;
 import org.apache.jetspeed.om.folder.Folder;
 import org.apache.jetspeed.om.folder.FolderNotFoundException;
 import org.apache.jetspeed.om.folder.MenuDefinition;
@@ -274,19 +274,19 @@
         properties.put(Fragment.COLUMN_PROPERTY_NAME, "0");
         root.getFragments().add(f);
 
-        SecurityConstraints constraints = page.newSecurityConstraints();
-        constraints.setOwner("new-user");
+        SecurityConstraintsContext constraintsContext = page.newSecurityConstraintsContext();
+        constraintsContext.setOwner("new-user");
         List constraintsList = new ArrayList(1);
         SecurityConstraint constraint = page.newSecurityConstraint();
         constraint.setUsers(Shared.makeListFromCSV("user10,user11"));
         constraint.setRoles(Shared.makeListFromCSV("*"));
         constraint.setPermissions(Shared.makeListFromCSV(JetspeedActions.EDIT + "," + JetspeedActions.VIEW));
         constraintsList.add(constraint);
-        constraints.setSecurityConstraints(constraintsList);
+        constraintsContext.setSecurityConstraints(constraintsList);
         List constraintsRefsList = new ArrayList(1);
         constraintsRefsList.add("public-view");
-        constraints.setSecurityConstraintsRefs(constraintsRefsList);
-        page.setSecurityConstraints(constraints);
+        constraintsContext.setSecurityConstraintsRefs(constraintsRefsList);
+        page.setSecurityConstraintsContext(constraintsContext);
 
         try
         {
@@ -958,10 +958,10 @@
         assertTrue(cf.getFragments().size() == 2);
         
         // security testing
-        SecurityConstraints constraints = clone.getSecurityConstraints();
-        assertNotNull(constraints); 
-        assertTrue(constraints.getOwner().equals("new-user"));
-        List secs = constraints.getSecurityConstraints();
+        SecurityConstraintsContext constraintsContext = clone.getSecurityConstraintsContext();
+        assertNotNull(constraintsContext); 
+        assertTrue(constraintsContext.getOwner().equals("new-user"));
+        List secs = constraintsContext.getSecurityConstraints();
         assertNotNull(secs);
         assertTrue(secs.size() == 1);
         SecurityConstraint constraint = (SecurityConstraint)secs.get(0);
@@ -975,7 +975,7 @@
         assertTrue(constraint.getPermissions() != null);
         assertTrue(constraint.getPermissions().size() == 2);
         assertTrue(Shared.makeCSVFromList(constraint.getPermissions()).equals("edit,view"));
-        List refs = constraints.getSecurityConstraintsRefs();
+        List refs = constraintsContext.getSecurityConstraintsRefs();
         assertNotNull(refs);
         assertTrue(refs.size() == 1);
         String ref = (String)refs.get(0);

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestDatabasePageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestDatabasePageManager.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestDatabasePageManager.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestDatabasePageManager.java Sun Jan  4 22:04:13 2009
@@ -22,7 +22,7 @@
 import java.util.Locale;
 import org.apache.jetspeed.components.util.DatasourceEnabledSpringTestCase;
 import org.apache.jetspeed.om.common.SecurityConstraint;
-import org.apache.jetspeed.om.common.SecurityConstraints;
+import org.apache.jetspeed.om.common.SecurityConstraintsContext;
 import org.apache.jetspeed.om.folder.Folder;
 import org.apache.jetspeed.om.folder.FolderNotFoundException;
 import org.apache.jetspeed.om.folder.MenuDefinition;
@@ -44,7 +44,7 @@
 import junit.framework.Test;
 
 /**
- * TestPageXmlPersistence
+ * TestDatabasePageManager
  * 
  * @author <a href="taylor@apache.org">David Sean Taylor</a>
  * @version $Id: $
@@ -55,57 +55,64 @@
     private static final String deepFolderPath = "/__subsite-rootx/_user/userx/_role/rolex/_group/groupx/_mediatype/xhtml/_language/en/_country/us/_custom/customx";
     private static final String deepPagePath = deepFolderPath + "/default-page.psml";       
 
-    private static class PageManagerEventListenerImpl implements PageManagerEventListener
+    /**
+     * Get ordered test suite.
+     * 
+     * @return test suite to execute.
+     */
+    public static Test suite()
     {
-        int newNodeCount;
-        int updatedNodeCount;
-        int removedNodeCount;
-
-        /* (non-Javadoc)
-         * @see org.apache.jetspeed.page.PageManagerEventListener#newNode(org.apache.jetspeed.page.document.Node)
-         */
-        public void newNode(Node node)
-        {
-            newNodeCount++;
-        }
-
-        /* (non-Javadoc)
-         * @see org.apache.jetspeed.page.PageManagerEventListener#newNode(org.apache.jetspeed.page.document.Node)
-         */
-        public void updatedNode(Node node)
-        {
-            updatedNodeCount++;
-        }
-
-        /* (non-Javadoc)
-         * @see org.apache.jetspeed.page.PageManagerEventListener#newNode(org.apache.jetspeed.page.document.Node)
-         */
-        public void removedNode(Node node)
-        {
-            removedNodeCount++;
-        }
+        return createFixturedTestSuite(TestDatabasePageManager.class, new String[]{"firstTestSetup", "testCreates", "testGets", "testUpdates", "testIsolation", "testRemoves"});
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.util.DatasourceEnabledSpringTestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        // setup
+        super.setUp();
+        // start test conversational transaction
+        startConversationalTxn();
     }
 
-    public static void main(String args[])
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.test.AbstractSpringTestCase#getConfigurations()
+     */
+    protected String[] getConfigurations()
     {
-        junit.awtui.TestRunner.main(new String[]
-        { TestDatabasePageManager.class.getName() });
+        return new String[]{"database-page-manager.xml", "transaction.xml"};
     }
-    
-    
-    public static Test suite()
+
+    /**
+     * Start conversational transaction for current thread.
+     */
+    protected void startConversationalTxn()
     {
-        return createFixturedTestSuite(TestDatabasePageManager.class, "firstTestSetup", null);
+        // N/A for OJB based implementation with detached object caches.
     }
     
-    protected String[] getConfigurations()
+    /**
+     * End conversational transaction for current thread.
+     */
+    protected void endConversationalTxn()
     {
-        return new String[]{"database-page-manager.xml", "transaction.xml"};
+        // N/A for OJB based implementation with detached object caches.
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.util.DatasourceEnabledSpringTestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+        // end test conversational transaction
+        endConversationalTxn();
+        // teardown
+        super.tearDown();
+    }
+    
     public void firstTestSetup() throws Exception
     {
-        System.out.println("Running firstTestSetup");
         try
         {
             PageManager pageManager = (PageManager)scm.getComponent("pageManager");
@@ -135,7 +142,7 @@
         folder.setShortTitle("Root");
         GenericMetadata metadata = folder.getMetadata();
         metadata.addField(Locale.FRENCH, "title", "[fr] Root Folder");
-        SecurityConstraints folderConstraints = pageManager.newSecurityConstraints();
+        SecurityConstraintsContext folderConstraints = pageManager.newSecurityConstraintsContext();
         folderConstraints.setOwner("admin");
         List inlineFolderConstraints = new ArrayList(2);
         SecurityConstraint folderConstraint = pageManager.newFolderSecurityConstraint();
@@ -152,7 +159,7 @@
         folderConstraintsRefs.add("public-view");
         folderConstraintsRefs.add("public-edit");
         folderConstraints.setSecurityConstraintsRefs(folderConstraintsRefs);
-        folder.setSecurityConstraints(folderConstraints);
+        folder.setSecurityConstraintsContext(folderConstraints);
         List documentOrder = new ArrayList(2);
         documentOrder.add("some-other-page.psml");
         documentOrder.add("default-page.psml");
@@ -221,18 +228,18 @@
         metadata = page.getMetadata();
         metadata.addField(Locale.FRENCH, "title", "[fr] Default Page");
         metadata.addField(Locale.JAPANESE, "title", "[ja] Default Page");
-        SecurityConstraints pageConstraints = page.newSecurityConstraints();
-        pageConstraints.setOwner("user");
+        SecurityConstraintsContext pageConstraintsContext = page.newSecurityConstraintsContext();
+        pageConstraintsContext.setOwner("user");
         List inlinePageConstraints = new ArrayList(1);
         SecurityConstraint pageConstraint = page.newSecurityConstraint();
         pageConstraint.setUsers(Shared.makeListFromCSV("jetspeed"));
         pageConstraint.setPermissions(Shared.makeListFromCSV("edit"));
         inlinePageConstraints.add(pageConstraint);
-        pageConstraints.setSecurityConstraints(inlinePageConstraints);
+        pageConstraintsContext.setSecurityConstraints(inlinePageConstraints);
         List pageConstraintsRefs = new ArrayList(1);
         pageConstraintsRefs.add("manager-edit");
-        pageConstraints.setSecurityConstraintsRefs(pageConstraintsRefs);
-        page.setSecurityConstraints(pageConstraints);
+        pageConstraintsContext.setSecurityConstraintsRefs(pageConstraintsRefs);
+        page.setSecurityConstraintsContext(pageConstraintsContext);
         List pageMenus = new ArrayList();
         newMenu = page.newMenuDefinition();
         newMenu.setName("page-menu-1");
@@ -314,9 +321,9 @@
         portlet.setLayoutZ(33.33F);
         portlet.setLayoutWidth(44.44F);
         portlet.setLayoutHeight(55.55F);
-        SecurityConstraints fragmentConstraints = portlet.newSecurityConstraints();
-        fragmentConstraints.setOwner("user");
-        portlet.setSecurityConstraints(fragmentConstraints);
+        SecurityConstraintsContext fragmentConstraintsContext = portlet.newSecurityConstraintsContext();
+        fragmentConstraintsContext.setOwner("user");
+        portlet.setSecurityConstraintsContext(fragmentConstraintsContext);
         root.getFragments().add(portlet);
 
         pageManager.updatePage(page);
@@ -353,18 +360,18 @@
         metadata = link.getMetadata();
         metadata.addField(Locale.FRENCH, "title", "[fr] Default Link");
         metadata.addField(Locale.GERMAN, "title", "[de] Default Link");
-        SecurityConstraints linkConstraints = link.newSecurityConstraints();
-        linkConstraints.setOwner("user");
+        SecurityConstraintsContext linkConstraintsContext = link.newSecurityConstraintsContext();
+        linkConstraintsContext.setOwner("user");
         List inlineLinkConstraints = new ArrayList(1);
         SecurityConstraint linkConstraint = link.newSecurityConstraint();
         linkConstraint.setUsers(Shared.makeListFromCSV("jetspeed"));
         linkConstraint.setPermissions(Shared.makeListFromCSV("edit"));
         inlineLinkConstraints.add(linkConstraint);
-        linkConstraints.setSecurityConstraints(inlineLinkConstraints);
+        linkConstraintsContext.setSecurityConstraints(inlineLinkConstraints);
         List linkConstraintsRefs = new ArrayList(1);
         linkConstraintsRefs.add("manager-edit");
-        linkConstraints.setSecurityConstraintsRefs(linkConstraintsRefs);
-        link.setSecurityConstraints(linkConstraints);
+        linkConstraintsContext.setSecurityConstraintsRefs(linkConstraintsRefs);
+        link.setSecurityConstraintsContext(linkConstraintsContext);
 
         pageManager.updateLink(link);
 
@@ -504,9 +511,9 @@
         assertEquals(3, folder.getAll().exclusiveSubset(".*-page.psml").size());
         
         // verify listener functionality and operation counts
-        assertEquals(22, pmel.newNodeCount);
-        assertEquals(0, pmel.updatedNodeCount);
-        assertEquals(0, pmel.removedNodeCount);
+        assertEquals(22, pmel.getNewNodeCount());
+        assertEquals(0, pmel.getUpdatedNodeCount());
+        assertEquals(0, pmel.getRemovedNodeCount());
     }
 
     public void testGets() throws Exception
@@ -556,14 +563,14 @@
             assertNotNull(check.getMetadata());
             assertEquals("[fr] Default Link", check.getTitle(Locale.FRENCH));
             assertEquals("[de] Default Link", check.getTitle(Locale.GERMAN));
-            assertNotNull(check.getSecurityConstraints());
-            assertEquals("user", check.getSecurityConstraints().getOwner());
-            assertNotNull(check.getSecurityConstraints().getSecurityConstraintsRefs());
-            assertEquals(1, check.getSecurityConstraints().getSecurityConstraintsRefs().size());
-            assertEquals("manager-edit", (String)check.getSecurityConstraints().getSecurityConstraintsRefs().get(0));
-            assertNotNull(check.getSecurityConstraints().getSecurityConstraints());
-            assertEquals(1, check.getSecurityConstraints().getSecurityConstraints().size());
-            assertEquals("jetspeed", Shared.makeCSVFromList(((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(0)).getUsers()));
+            assertNotNull(check.getSecurityConstraintsContext());
+            assertEquals("user", check.getSecurityConstraintsContext().getOwner());
+            assertNotNull(check.getSecurityConstraintsContext().getSecurityConstraintsRefs());
+            assertEquals(1, check.getSecurityConstraintsContext().getSecurityConstraintsRefs().size());
+            assertEquals("manager-edit", (String)check.getSecurityConstraintsContext().getSecurityConstraintsRefs().get(0));
+            assertNotNull(check.getSecurityConstraintsContext().getSecurityConstraints());
+            assertEquals(1, check.getSecurityConstraintsContext().getSecurityConstraints().size());
+            assertEquals("jetspeed", Shared.makeCSVFromList(((SecurityConstraint)check.getSecurityConstraintsContext().getSecurityConstraints().get(0)).getUsers()));
             assertNotNull(check.getParent());
         }
         catch (PageNotFoundException e)
@@ -586,14 +593,14 @@
             assertNotNull(check.getMetadata());
             assertEquals("[fr] Default Page", check.getTitle(Locale.FRENCH));
             assertEquals("[ja] Default Page", check.getTitle(Locale.JAPANESE));
-            assertNotNull(check.getSecurityConstraints());
-            assertEquals("user", check.getSecurityConstraints().getOwner());
-            assertNotNull(check.getSecurityConstraints().getSecurityConstraintsRefs());
-            assertEquals(1, check.getSecurityConstraints().getSecurityConstraintsRefs().size());
-            assertEquals("manager-edit", (String)check.getSecurityConstraints().getSecurityConstraintsRefs().get(0));
-            assertNotNull(check.getSecurityConstraints().getSecurityConstraints());
-            assertEquals(1, check.getSecurityConstraints().getSecurityConstraints().size());
-            assertEquals("jetspeed", Shared.makeCSVFromList(((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(0)).getUsers()));
+            assertNotNull(check.getSecurityConstraintsContext());
+            assertEquals("user", check.getSecurityConstraintsContext().getOwner());
+            assertNotNull(check.getSecurityConstraintsContext().getSecurityConstraintsRefs());
+            assertEquals(1, check.getSecurityConstraintsContext().getSecurityConstraintsRefs().size());
+            assertEquals("manager-edit", (String)check.getSecurityConstraintsContext().getSecurityConstraintsRefs().get(0));
+            assertNotNull(check.getSecurityConstraintsContext().getSecurityConstraints());
+            assertEquals(1, check.getSecurityConstraintsContext().getSecurityConstraints().size());
+            assertEquals("jetspeed", Shared.makeCSVFromList(((SecurityConstraint)check.getSecurityConstraintsContext().getSecurityConstraints().get(0)).getUsers()));
             assertNotNull(check.getMenuDefinitions());
             assertEquals(2, check.getMenuDefinitions().size());
             MenuDefinition checkMenu = (MenuDefinition)check.getMenuDefinitions().get(0);
@@ -630,6 +637,14 @@
             assertNotNull(check.getRootFragment().getFragments());
             assertEquals(2, check.getRootFragment().getFragments().size());
             Fragment check0 = (Fragment)check.getRootFragment().getFragments().get(0);
+            Fragment check1 = (Fragment)check.getRootFragment().getFragments().get(1);
+            assertTrue(Integer.parseInt(check0.getId()) < Integer.parseInt(check1.getId()));
+            if (!check0.getName().equals("security::LoginPortlet"))
+            {
+                Fragment swap = check0;
+                check0 = check1;
+                check1 = swap;
+            }
             assertEquals("security::LoginPortlet", check0.getName());
             assertEquals("Portlet", check0.getShortTitle());
             assertEquals("Portlet Fragment", check0.getTitle());
@@ -659,7 +674,6 @@
             assertNotNull(((FragmentPreference)check0.getPreferences().get(1)).getValueList());
             assertEquals(1, ((FragmentPreference)check0.getPreferences().get(1)).getValueList().size());
             assertEquals("pref1-value", (String)((FragmentPreference)check0.getPreferences().get(1)).getValueList().get(0));
-            Fragment check1 = (Fragment)check.getRootFragment().getFragments().get(1);
             assertEquals("some-app::SomePortlet", check1.getName());
             assertEquals("Some Portlet", check1.getShortTitle());
             assertEquals("Some Portlet Fragment", check1.getTitle());
@@ -671,8 +685,8 @@
             assertTrue((check1.getLayoutZ() > 33.0F) && (check1.getLayoutZ() < 34.0F));
             assertTrue((check1.getLayoutWidth() > 44.0F) && (check1.getLayoutWidth() < 45.0F));
             assertTrue((check1.getLayoutHeight() > 55.0F) && (check1.getLayoutWidth() < 56.0F));
-            assertNotNull(check1.getSecurityConstraints());
-            assertEquals("user", check1.getSecurityConstraints().getOwner());
+            assertNotNull(check1.getSecurityConstraintsContext());
+            assertEquals("user", check1.getSecurityConstraintsContext().getOwner());
             assertNotNull(check.getFragmentById(check0.getId()));
             assertNotNull(check.getFragmentsByName("some-app::SomePortlet"));
             assertEquals(1, check.getFragmentsByName("some-app::SomePortlet").size());
@@ -697,17 +711,17 @@
             assertEquals("Root", check.getShortTitle());
             assertNotNull(check.getMetadata());
             assertEquals("[fr] Root Folder", check.getTitle(Locale.FRENCH));
-            assertNotNull(check.getSecurityConstraints());
-            assertEquals("admin", check.getSecurityConstraints().getOwner());
-            assertNotNull(check.getSecurityConstraints().getSecurityConstraintsRefs());
-            assertEquals(2, check.getSecurityConstraints().getSecurityConstraintsRefs().size());
-            assertEquals("public-edit", (String)check.getSecurityConstraints().getSecurityConstraintsRefs().get(1));
-            assertNotNull(check.getSecurityConstraints().getSecurityConstraints());
-            assertEquals(2, check.getSecurityConstraints().getSecurityConstraints().size());
-            assertEquals("user,admin", Shared.makeCSVFromList(((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(0)).getUsers()));
-            assertEquals("manager", Shared.makeCSVFromList(((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(0)).getRoles()));
-            assertEquals("*", Shared.makeCSVFromList(((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(0)).getGroups()));
-            assertEquals("edit", Shared.makeCSVFromList(((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(1)).getPermissions()));
+            assertNotNull(check.getSecurityConstraintsContext());
+            assertEquals("admin", check.getSecurityConstraintsContext().getOwner());
+            assertNotNull(check.getSecurityConstraintsContext().getSecurityConstraintsRefs());
+            assertEquals(2, check.getSecurityConstraintsContext().getSecurityConstraintsRefs().size());
+            assertEquals("public-edit", (String)check.getSecurityConstraintsContext().getSecurityConstraintsRefs().get(1));
+            assertNotNull(check.getSecurityConstraintsContext().getSecurityConstraints());
+            assertEquals(2, check.getSecurityConstraintsContext().getSecurityConstraints().size());
+            assertEquals("user,admin", Shared.makeCSVFromList(((SecurityConstraint)check.getSecurityConstraintsContext().getSecurityConstraints().get(0)).getUsers()));
+            assertEquals("manager", Shared.makeCSVFromList(((SecurityConstraint)check.getSecurityConstraintsContext().getSecurityConstraints().get(0)).getRoles()));
+            assertEquals("*", Shared.makeCSVFromList(((SecurityConstraint)check.getSecurityConstraintsContext().getSecurityConstraints().get(0)).getGroups()));
+            assertEquals("edit", Shared.makeCSVFromList(((SecurityConstraint)check.getSecurityConstraintsContext().getSecurityConstraints().get(1)).getPermissions()));
             assertNotNull(check.getDocumentOrder());
             assertEquals(2, check.getDocumentOrder().size());
             assertEquals("some-other-page.psml", (String)check.getDocumentOrder().get(0));
@@ -819,9 +833,9 @@
         }
         
         // verify listener functionality and operation counts
-        assertEquals(0, pmel.newNodeCount);
-        assertEquals(0, pmel.updatedNodeCount);
-        assertEquals(0, pmel.removedNodeCount);
+        assertEquals(0, pmel.getNewNodeCount());
+        assertEquals(0, pmel.getUpdatedNodeCount());
+        assertEquals(0, pmel.getRemovedNodeCount());
     }
 
     public void testUpdates() throws Exception
@@ -847,13 +861,13 @@
         assertNotNull(page.removeFragmentById(removeId));
         SecurityConstraint pageConstraint = page.newSecurityConstraint();
         pageConstraint.setUsers(Shared.makeListFromCSV("UPDATED"));
-        page.getSecurityConstraints().getSecurityConstraints().add(0, pageConstraint);
+        page.getSecurityConstraintsContext().getSecurityConstraints().add(0, pageConstraint);
         pageManager.updatePage(page);
 
         Link link = pageManager.getLink("/default.link");
         assertEquals("/default.link", link.getPath());
         link.setTitle("UPDATED");
-        link.getSecurityConstraints().setOwner("UPDATED");
+        link.getSecurityConstraintsContext().setOwner("UPDATED");
         pageManager.updateLink(link);
 
         Folder folder = pageManager.getFolder("/");
@@ -884,9 +898,145 @@
         pageManager.updateFolder(folder, true);
 
         // verify listener functionality and operation counts
-        assertEquals(0, pmel.newNodeCount);
-        assertEquals(26, pmel.updatedNodeCount);
-        assertEquals(0, pmel.removedNodeCount);
+        assertEquals(0, pmel.getNewNodeCount());
+        assertEquals(26, pmel.getUpdatedNodeCount());
+        assertEquals(0, pmel.getRemovedNodeCount());
+    }
+    
+    public void testIsolation() throws Exception
+    {
+        // session tests in separate threads
+        class TestSession extends Thread
+        {
+            public boolean continueTest = false;
+            public boolean waitForTest = true;
+            public Exception sessionException;
+            public String initialPageTitle;
+            public String finalPageTitle;
+            
+            public TestSession(String name)
+            {
+                super("TestSession-"+name);
+                setDaemon(true);
+            }
+            
+            public synchronized void run()
+            {
+                try
+                {
+                    // start transaction
+                    startConversationalTxn();
+                    
+                    // wait to continue
+                    waitToContinue();
+                    
+                    // get page title
+                    PageManager pageManager = (PageManager)scm.getComponent("pageManager");
+                    Page page = pageManager.getPage("/another-page.psml");
+                    initialPageTitle = page.getTitle();
+                    
+                    // wait to continue
+                    waitToContinue();
+                    
+                    // test page title
+                    finalPageTitle = page.getTitle();
+
+                    // end transaction
+                    endConversationalTxn();
+                    
+                    // done
+                    waitForTest = false;
+                    notifyAll();
+                }
+                catch (Exception e)
+                {
+                    sessionException = e;
+                }
+            }
+
+            private synchronized void waitToContinue()
+            {
+                // notify waiting on continue
+                waitForTest = false;
+                notifyAll();
+                // wait to continue
+                try
+                {
+                    if (!continueTest)
+                    {
+                        wait();
+                    }
+                    continueTest = false;
+                    waitForTest = true;
+                }
+                catch (InterruptedException ie)
+                {
+                }
+            }
+
+            public synchronized void continueTest()
+            {
+                // notify waiting to continue
+                continueTest = true;
+                notifyAll();
+                // wait until continue completed
+                try
+                {
+                    if (waitForTest)
+                    {
+                        wait();
+                    }
+                }
+                catch (InterruptedException ie)
+                {
+                }                
+            }
+
+            public void complete()
+            {
+                // join to complete
+                try
+                {
+                    join();
+                }
+                catch (InterruptedException ie)
+                {
+                }
+            }
+        }        
+        TestSession session0 = new TestSession("Session0");
+        TestSession session1 = new TestSession("Session1");
+        TestSession session2 = new TestSession("Session2");
+        
+        // test session isolation
+        session0.start();
+        session0.continueTest();
+        session1.start();
+        PageManager pageManager = (PageManager)scm.getComponent("pageManager");
+        Page page = pageManager.getPage("/another-page.psml");
+        assertEquals("Another Page", page.getTitle());
+        page.setTitle("UPDATED");
+        pageManager.updatePage(page);        
+        session1.continueTest();
+        session2.start();
+        session2.continueTest();
+        session0.continueTest();
+        session1.continueTest();
+        session2.continueTest();
+        session0.complete();
+        session1.complete();
+        session2.complete();
+        assertNull(session0.sessionException);
+        assertNull(session1.sessionException);
+        assertNull(session2.sessionException);
+
+        // validate session isolation
+        assertEquals("Another Page", session0.initialPageTitle);
+        assertEquals("UPDATED", session1.initialPageTitle);
+        assertEquals("UPDATED", session2.initialPageTitle);
+        assertTrue(session0.finalPageTitle.equals("UPDATED") || session0.finalPageTitle.equals("Another Page"));
+        assertEquals("UPDATED", session1.finalPageTitle);
+        assertEquals("UPDATED", session2.finalPageTitle);
     }
 
     public void testRemoves() throws Exception
@@ -968,8 +1118,18 @@
         {
         }
         // verify listener functionality and operation counts
-        assertEquals(0, pmel.newNodeCount);
-        assertEquals(0, pmel.updatedNodeCount);
-        assertEquals(22, pmel.removedNodeCount);
+        assertEquals(0, pmel.getNewNodeCount());
+        assertEquals(0, pmel.getUpdatedNodeCount());
+        assertEquals(22, pmel.getRemovedNodeCount());
+    }
+
+    /**
+     * Test main entry point.
+     * 
+     * @param args process args
+     */
+    public static void main(String args[])
+    {
+        junit.awtui.TestRunner.main(new String[]{TestDatabasePageManager.class.getName()});
     }
 }

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPADatabasePageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPADatabasePageManager.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPADatabasePageManager.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPADatabasePageManager.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.page;
+
+import org.apache.jetspeed.page.jpa.DatabasePageManagerContext;
+
+import junit.framework.Test;
+
+/**
+ * TestOpenJPADatabasePageManager
+ * 
+ * @author <a href="rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ *          
+ */
+public class TestOpenJPADatabasePageManager extends TestDatabasePageManager
+{
+    private DatabasePageManagerContext context;
+    
+    /**
+     * Get ordered test suite.
+     * 
+     * @return test suite execute.
+     */
+    public static Test suite()
+    {
+        return createFixturedTestSuite(TestOpenJPADatabasePageManager.class, new String[]{"firstTestSetup", "testCreates", "testGets", "testUpdates", "testIsolation", "testRemoves"});
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.TestDatabasePageManager#getConfigurations()
+     */
+    protected String[] getConfigurations()
+    {
+        return new String[]{"openjpa-database-page-manager.xml"};
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.TestDatabasePageManager#startConversationalTxn()
+     */
+    protected void startConversationalTxn()
+    {
+        // create scoped context bean for thread transaction
+        context = (DatabasePageManagerContext)scm.createPrototypeComponent("pageManagerContext");
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.TestDatabasePageManager#endConversationalTxn()
+     */
+    protected void endConversationalTxn()
+    {
+        // destroy scoped context bean for thread transaction
+        scm.destroyPrototypeComponent("pageManagerContext", context);
+    }
+
+    /**
+     * Test main entry point.
+     * 
+     * @param args process args
+     */
+    public static void main(String args[])
+    {
+        junit.awtui.TestRunner.main(new String[]{TestOpenJPADatabasePageManager.class.getName()});
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPATransactions.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPATransactions.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPATransactions.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestOpenJPATransactions.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.page;
+
+import org.apache.jetspeed.page.jpa.DatabasePageManagerContext;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * TestOpenJPATransactions
+ * 
+ * @author <a href="rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ *          
+ */
+public class TestOpenJPATransactions extends TestTransactions
+{
+    private DatabasePageManagerContext context;
+    
+    /**
+     * Create test suite.
+     * 
+     * @return test suite to execute.
+     */
+    public static Test suite()
+    {
+        // All methods starting with "test" will be executed in the test suite.
+        return new TestSuite(TestOpenJPATransactions.class);
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.TestDatabasePageManager#getConfigurations()
+     */
+    protected String[] getConfigurations()
+    {
+        return new String[]{"openjpa-database-page-manager.xml"};
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.TestDatabasePageManager#startConversationalTxn()
+     */
+    protected void startConversationalTxn()
+    {
+        // create scoped context bean for thread transaction
+        context = (DatabasePageManagerContext)scm.createPrototypeComponent("pageManagerContext");
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.TestDatabasePageManager#endConversationalTxn()
+     */
+    protected void endConversationalTxn()
+    {
+        // destroy scoped context bean for thread transaction
+        scm.destroyPrototypeComponent("pageManagerContext", context);
+    }
+
+    /**
+     * Test main entry point.
+     * 
+     * @param args process args
+     */
+    public static void main(String args[])
+    {
+        junit.awtui.TestRunner.main(new String[]{TestOpenJPATransactions.class.getName()});
+    }
+}

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureDatabasePageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureDatabasePageManager.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureDatabasePageManager.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureDatabasePageManager.java Sun Jan  4 22:04:13 2009
@@ -17,6 +17,7 @@
 package org.apache.jetspeed.page;
 
 import org.apache.jetspeed.components.util.DatasourceEnabledSpringTestCase;
+
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
@@ -29,26 +30,76 @@
  */
 public class TestSecureDatabasePageManager extends DatasourceEnabledSpringTestCase implements PageManagerTestShared
 {
-    public static void main(String args[])
-    {
-        junit.awtui.TestRunner.main(new String[]
-        { TestSecureDatabasePageManager.class.getName() });
-    }
-    
+    /**
+     * Create test suite.
+     * 
+     * @return test suite to execute.
+     */
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
         return new TestSuite(TestSecureDatabasePageManager.class);
     }
     
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.util.DatasourceEnabledSpringTestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        // setup
+        super.setUp();
+        // start test conversational transaction
+        startConversationalTxn();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.test.AbstractSpringTestCase#getConfigurations()
+     */
     protected String[] getConfigurations()
     {
         return new String[]{"secure-database-page-manager.xml", "transaction.xml"};
     }
 
+    /**
+     * Start conversational transaction for current thread.
+     */
+    protected void startConversationalTxn()
+    {
+        // N/A for OJB based implementation with detached object caches.
+    }
+    
+    /**
+     * End conversational transaction for current thread.
+     */
+    protected void endConversationalTxn()
+    {
+        // N/A for OJB based implementation with detached object caches.
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.util.DatasourceEnabledSpringTestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+        // end test conversational transaction
+        endConversationalTxn();
+        // teardown
+        super.tearDown();
+    }    
+    
     public void testSecurePageManager() throws Exception
     {
         // utilize standard secure page manager test
         Shared.testSecurePageManager(this, (PageManager)scm.getComponent("pageManager"));
     }
+
+    /**
+     * Test main entry point.
+     * 
+     * @param args process args
+     */
+    public static void main(String args[])
+    {
+        junit.awtui.TestRunner.main(new String[] {TestSecureDatabasePageManager.class.getName()});
+    }
 }

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureOpenJPADatabasePageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureOpenJPADatabasePageManager.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureOpenJPADatabasePageManager.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureOpenJPADatabasePageManager.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.page;
+
+import org.apache.jetspeed.page.jpa.DatabasePageManagerContext;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * TestSecureOpenJPADatabasePageManager
+ * 
+ * @author <a href="rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ *          
+ */
+public class TestSecureOpenJPADatabasePageManager extends TestSecureDatabasePageManager
+{
+    private DatabasePageManagerContext context;
+    
+    /**
+     * Create test suite.
+     * 
+     * @return test suite to execute.
+     */
+    public static Test suite()
+    {
+        // All methods starting with "test" will be executed in the test suite.
+        return new TestSuite(TestSecureOpenJPADatabasePageManager.class);
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.TestDatabasePageManager#getConfigurations()
+     */
+    protected String[] getConfigurations()
+    {
+        return new String[]{"secure-openjpa-database-page-manager.xml"};
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.TestDatabasePageManager#startConversationalTxn()
+     */
+    protected void startConversationalTxn()
+    {
+        // create scoped context bean for thread transaction
+        context = (DatabasePageManagerContext)scm.createPrototypeComponent("pageManagerContext");
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.TestDatabasePageManager#endConversationalTxn()
+     */
+    protected void endConversationalTxn()
+    {
+        // destroy scoped context bean for thread transaction
+        scm.destroyPrototypeComponent("pageManagerContext", context);
+    }
+
+    /**
+     * Test main entry point.
+     * 
+     * @param args process args
+     */
+    public static void main(String args[])
+    {
+        junit.awtui.TestRunner.main(new String[]{TestSecureOpenJPADatabasePageManager.class.getName()});
+    }
+}

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecurePermissionsDatabasePageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecurePermissionsDatabasePageManager.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecurePermissionsDatabasePageManager.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecurePermissionsDatabasePageManager.java Sun Jan  4 22:04:13 2009
@@ -30,12 +30,20 @@
  */
 public class TestSecurePermissionsDatabasePageManager extends TestSecureDatabasePageManager
 {
-    public static void main(String args[])
+    /**
+     * Create test suite.
+     * 
+     * @return test suite to execute.
+     */
+    public static Test suite()
     {
-        junit.awtui.TestRunner.main(new String[]
-        { TestSecurePermissionsDatabasePageManager.class.getName() });
+        // All methods starting with "test" will be executed in the test suite.
+        return new TestSuite(TestSecurePermissionsDatabasePageManager.class);
     }
     
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.TestSecureDatabasePageManager#setUp()
+     */
     protected void setUp() throws Exception
     {
         super.setUp();
@@ -45,14 +53,22 @@
         Policy.getPolicy().refresh();
     }
 
-    public static Test suite()
-    {
-        // All methods starting with "test" will be executed in the test suite.
-        return new TestSuite(TestSecurePermissionsDatabasePageManager.class);
-    }
-    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.TestSecureDatabasePageManager#getConfigurations()
+     */
     protected String[] getConfigurations()
     {
         return new String[]{"secure-permissions-database-page-manager.xml", "transaction.xml"};
     }
+
+    /**
+     * Test main entry point.
+     * 
+     * @param args process args
+     */
+    public static void main(String args[])
+    {
+        junit.awtui.TestRunner.main(new String[]
+        { TestSecurePermissionsDatabasePageManager.class.getName() });
+    }
 }

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecurePermissionsOpenJPADatabasePageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecurePermissionsOpenJPADatabasePageManager.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecurePermissionsOpenJPADatabasePageManager.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecurePermissionsOpenJPADatabasePageManager.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.page;
+
+import org.apache.jetspeed.page.jpa.DatabasePageManagerContext;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * TestSecurePermissionsOpenJPADatabasePageManager
+ * 
+ * @author <a href="rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ *          
+ */
+public class TestSecurePermissionsOpenJPADatabasePageManager extends TestSecurePermissionsDatabasePageManager
+{
+    private DatabasePageManagerContext context;
+    
+    /**
+     * Create test suite.
+     * 
+     * @return test suite to execute.
+     */
+    public static Test suite()
+    {
+        // All methods starting with "test" will be executed in the test suite.
+        return new TestSuite(TestSecurePermissionsOpenJPADatabasePageManager.class);
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.TestDatabasePageManager#getConfigurations()
+     */
+    protected String[] getConfigurations()
+    {
+        return new String[]{"secure-permissions-openjpa-database-page-manager.xml"};
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.TestDatabasePageManager#startConversationalTxn()
+     */
+    protected void startConversationalTxn()
+    {
+        // create scoped context bean for thread transaction
+        context = (DatabasePageManagerContext)scm.createPrototypeComponent("pageManagerContext");
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.TestDatabasePageManager#endConversationalTxn()
+     */
+    protected void endConversationalTxn()
+    {
+        // destroy scoped context bean for thread transaction
+        scm.destroyPrototypeComponent("pageManagerContext", context);
+    }
+
+    /**
+     * Test main entry point.
+     * 
+     * @param args process args
+     */
+    public static void main(String args[])
+    {
+        junit.awtui.TestRunner.main(new String[]{TestSecurePermissionsOpenJPADatabasePageManager.class.getName()});
+    }
+}
\ No newline at end of file

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestTransactions.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestTransactions.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestTransactions.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestTransactions.java Sun Jan  4 22:04:13 2009
@@ -22,7 +22,6 @@
 import org.apache.jetspeed.components.util.DatasourceEnabledSpringTestCase;
 import org.apache.jetspeed.om.folder.Folder;
 import org.apache.jetspeed.om.page.Page;
-import org.apache.jetspeed.page.impl.DatabasePageManagerCache;
 
 /**
  * Test Transactions
@@ -32,25 +31,65 @@
  * @version $Id: $
  *          
  */
-public class TestTransactions extends  DatasourceEnabledSpringTestCase implements PageManagerTestShared
+public class TestTransactions extends DatasourceEnabledSpringTestCase implements PageManagerTestShared
 {
-    public static void main(String args[])
-    {
-        junit.awtui.TestRunner.main(new String[]
-        { TestTransactions.class.getName() });
-    }
-    
+    /**
+     * Create test suite.
+     * 
+     * @return test suite to execute.
+     */
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
         return new TestSuite(TestTransactions.class);
     }
     
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.util.DatasourceEnabledSpringTestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        // setup
+        super.setUp();
+        // start test conversational transaction
+        startConversationalTxn();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.test.AbstractSpringTestCase#getConfigurations()
+     */
     protected String[] getConfigurations()
     {
         return new String[]{"database-page-manager.xml", "transaction.xml"}; 
     }
 
+    /**
+     * Start conversational transaction for current thread.
+     */
+    protected void startConversationalTxn()
+    {
+        // N/A for OJB based implementation with detached object caches.
+    }
+    
+    /**
+     * End conversational transaction for current thread.
+     */
+    protected void endConversationalTxn()
+    {
+        // N/A for OJB based implementation with detached object caches.
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.util.DatasourceEnabledSpringTestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+        // end test conversational transaction
+        endConversationalTxn();
+        // teardown
+        super.tearDown();
+    }
+    
     public void testTx() throws Exception
     {
         PageManager pageManager = (PageManager)scm.getComponent("pageManager");
@@ -62,31 +101,43 @@
         Folder root = pageManager.newFolder("/");
         pageManager.updateFolder(root);
         
-        System.out.println("--- before new Page");
-        DatabasePageManagerCache.dump();
+        //System.out.println("--- before new Page");
+        //DatabasePageManagerCache.dump();
         
         Page[] pages = new Page[3];
         pages[0] = pageManager.newPage("/tx__test1.psml");
         pages[1] = pageManager.newPage("/tx__test2.psml");
         pages[2] = pageManager.newPage("/tx__test3.psml");
         
-        System.out.println("--- after new Page");
-        DatabasePageManagerCache.dump();
+        //System.out.println("--- after new Page");
+        //DatabasePageManagerCache.dump();
         
+        boolean addPagesException = false;
         try
         {
             pageManager.addPages(pages);
         }
         catch (Exception e)
         {
-            System.out.println("Exception adding pages" + e);
+            addPagesException = true;
         }
+        assertTrue("addPages exception expected", addPagesException);
 
-        System.out.println("--- after rollback");
-        DatabasePageManagerCache.dump();
+        //System.out.println("--- after rollback");
+        //DatabasePageManagerCache.dump();
 
         assertFalse("page 1 found", pageManager.pageExists("/tx__test1.psml"));
         assertFalse("page 2 found", pageManager.pageExists("/tx__test2.psml"));
         assertFalse("page 3 found", pageManager.pageExists("/tx__test3.psml"));
     }
+    
+    /**
+     * Test main entry point.
+     * 
+     * @param args process args
+     */
+    public static void main(String args[])
+    {
+        junit.awtui.TestRunner.main(new String[]{TestTransactions.class.getName()});
+    }
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java Sun Jan  4 22:04:13 2009
@@ -30,6 +30,7 @@
 import org.apache.jetspeed.components.SpringComponentManager;
 import org.apache.jetspeed.components.jndi.JetspeedTestJNDIComponent;
 import org.apache.jetspeed.page.PageManager;
+import org.apache.jetspeed.page.PageManagerTestShared;
 
 /**
  * DatabasePageManagerServer
@@ -40,17 +41,18 @@
 public class DatabasePageManagerServer
 {
     protected static Log log = LogFactory.getLog(DatabasePageManagerServer.class);
-    
+
     // Constants
     
     public static final String SCRIPT_RESULT_LINE_PREFIX = "> ";
     
     // Members
     
+    private SpringComponentManager scm;
     private JetspeedTestJNDIComponent jndiDS;
     private String baseDir;
-    private SpringComponentManager scm;
     private PageManager pageManager;
+    private PageManagerTestShared.PageManagerEventListenerImpl pageManagerListener;
     private JexlContext jexlContext;
     private boolean exit;
     
@@ -68,28 +70,56 @@
         jndiDS.setup();
         final JetspeedBeanDefinitionFilter beanDefinitionFilter = new JetspeedBeanDefinitionFilter("default,jdbcDS");
         final String [] bootConfigurations = new String[]{"boot/datasource.xml"};
-        final String [] configurations = new String[]{"database-page-manager.xml", "transaction.xml"};
         baseDir = System.getProperty("basedir");
         if ((baseDir == null) || (baseDir.length() == 0))
         {
             baseDir = System.getProperty("user.dir");
         }
         final String appRoot = baseDir+"/target/test-classes/webapp";
-        scm = new SpringComponentManager(beanDefinitionFilter, bootConfigurations, configurations, appRoot, false);
+        scm = new SpringComponentManager(beanDefinitionFilter, bootConfigurations, getConfigurations(), appRoot, false);
         scm.start();
 
-        // access page manager
+        // access page manager and configure listener
         pageManager = (PageManager)scm.getComponent("pageManager");
+        pageManagerListener = new PageManagerTestShared.PageManagerEventListenerImpl();
+        pageManager.addListener(pageManagerListener);
         
-        // craete jexl context
+        // create jexl context
         jexlContext = JexlHelper.createContext();
         jexlContext.getVars().put("pageManager", pageManager);
+        jexlContext.getVars().put("pageManagerListener", pageManagerListener);
         jexlContext.getVars().put("pageManagerServer", this);
         
         log.info( "DatabasePageManager server initialized");
     }
     
     /**
+     * Get Spring page manager server configurations.
+     * 
+     * @return server configurations.
+     */
+    protected String [] getConfigurations()
+    {
+        return new String[]{"database-page-manager.xml", "transaction.xml"};        
+    }
+    
+    /**
+     * Start conversational page manager transaction for current thread.
+     */
+    protected void startConversationalTxn()
+    {
+        // N/A for OJB based implementation with detached object caches.
+    }
+    
+    /**
+     * End conversational page manager transaction for current thread.
+     */
+    protected void endConversationalTxn()
+    {
+        // N/A for OJB based implementation with detached object caches.
+    }
+
+    /**
      * Terminate page manager server instance.
      * 
      * @throws Exception
@@ -142,30 +172,47 @@
         exit = true;
     }
     
+    /**
+     * Reset current conversational page manager transaction.
+     */
+    public void resetConversationalTxn()
+    {
+        endConversationalTxn();
+        startConversationalTxn();
+    }
+    
     // Data access
     
     /**
-     * @return server exit flag
+     * @return server exit flag.
      */
     public boolean isExit()
     {
         return exit;
     }
     
+    /**
+     * @return server component manager.
+     */
+    public SpringComponentManager getComponentManager()
+    {
+        return scm;
+    }
+    
     // Application entry point
     
     /**
      * Server main entry point.
      * 
-     * @param args not used
+     * @param server server instance to run.
      */
-    public static void main(final String [] args)
+    public static void main(final DatabasePageManagerServer server)
     {
         try
         {
-            // create and initialize server
-            final DatabasePageManagerServer server = new DatabasePageManagerServer();
+            // initialize server and transaction
             server.initialize();
+            server.startConversationalTxn();
             
             // simple server reads script lines from standard
             // input and writes results on standard output
@@ -196,7 +243,8 @@
             }
             while (!server.isExit());
             
-            // terminate server
+            // terminate transaction and server
+            server.endConversationalTxn();
             server.terminate();
         }
         catch (final Throwable t)
@@ -204,4 +252,14 @@
             log.error( "Unexpected exception: "+t, t);
         }
     }
+
+    /**
+     * Server main entry point.
+     * 
+     * @param args not used
+     */
+    public static void main(final String [] args)
+    {
+        main(new DatabasePageManagerServer());
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message