portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r725578 [2/3] - in /portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE: ./ components/cm/ components/cm/src/java/org/apache/jetspeed/cache/impl/ components/cm/src/test/org/apache/jetspeed/cache/ components/page-manager/ component...
Date Thu, 11 Dec 2008 05:03:11 GMT
Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/database-page-manager.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/database-page-manager.xml?rev=725578&r1=725577&r2=725578&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/database-page-manager.xml (original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/database-page-manager.xml Wed Dec 10 21:03:10 2008
@@ -1,82 +1,37 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<!--
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+<!--
 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.
--->
-<beans>
-
-    <!-- Page Manager -->
-    <bean id="org.apache.jetspeed.page.PageManagerImpl" 
-          name="pageManagerImpl"
-          init-method="init"
-          class="org.apache.jetspeed.page.impl.DatabasePageManager">
-        <!-- OJB configuration file resource path -->
-        <constructor-arg index="0"><value>JETSPEED-INF/ojb/page-manager-repository.xml</value></constructor-arg>       
-        <!-- folder/page/link cache size, default=128, min=128 -->
-        <constructor-arg index="1"><value>128</value></constructor-arg>
-        <!-- folder/page/link cache expires seconds, default=150, infinite=0, min=30 -->
-        <constructor-arg index="2"><value>0</value></constructor-arg>
-        <!-- permissions security enabled flag, default=false -->
-        <constructor-arg index="3"><value>false</value></constructor-arg>
-        <!-- constraints security enabled flag, default=true -->
-        <constructor-arg index="4"><value>false</value></constructor-arg>
-    </bean>
-
-    <!-- Transaction Proxying -->
-    <bean id="org.apache.jetspeed.page.PageManager" name="pageManager" parent="baseTransactionProxy">
-        <property name="proxyInterfaces">
-            <value>org.apache.jetspeed.page.PageManager</value>
-        </property>
-        <property name="target">
-            <ref bean="pageManagerImpl" />
-        </property>
-        <property name="transactionAttributes">
-            <props>
-              <prop key="getPage*">PROPAGATION_SUPPORTS</prop>  
-              <prop key="getLink*">PROPAGATION_SUPPORTS</prop>  
-              <prop key="getFolder*">PROPAGATION_SUPPORTS</prop>  
-              <prop key="getContentPage">PROPAGATION_SUPPORTS</prop>  
-              <prop key="getAll">PROPAGATION_SUPPORTS</prop>  
-              <prop key="getUserFolder">PROPAGATION_SUPPORTS</prop>  
-              <prop key="update*">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="removePage">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="removeFolder">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="removeLink">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="removePageSecurity">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>                            
-              <prop key="createUserHomePagesFromRoles">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="deepCopy*">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="addPages">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>              
-              <prop key="folderExists">PROPAGATION_SUPPORTS</prop>  
-              <prop key="pageExists">PROPAGATION_SUPPORTS</prop>  
-              <prop key="linkExists">PROPAGATION_SUPPORTS</prop>  
-              <prop key="userFolderExists">PROPAGATION_SUPPORTS</prop>  
-              <prop key="userPageExists">PROPAGATION_SUPPORTS</prop>  
-            </props>
-        </property>
-    </bean>
-
-    <!-- Inject Page Manager Proxy into Page Manager -->
-    <bean id="injectPageManagerProxy" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
-        <property name="targetObject"><ref bean="pageManagerImpl"/></property>
-        <property name="targetMethod"><value>setPageManagerProxy</value></property>
-        <property name="arguments">
-            <list>
-                <ref bean="pageManager"/>
-            </list>
-        </property>
-    </bean>
-
-</beans>
+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.
+-->
+<beans>
+
+    <import resource="database-page-manager-base.xml"/>
+
+    <!-- Page Manager -->
+    <bean id="pageManagerImpl" init-method="init" class="org.apache.jetspeed.page.impl.DatabasePageManager">
+        <!-- OJB configuration file resource path -->
+        <constructor-arg index="0"><value>JETSPEED-INF/ojb/page-manager-repository.xml</value></constructor-arg>
+        <!-- permissions security enabled flag, default=false -->
+        <constructor-arg index="1"><value>false</value></constructor-arg>
+        <!-- constraints security enabled flag, default=true -->
+        <constructor-arg index="2"><value>false</value></constructor-arg>
+        <!-- folder/page/link cache -->
+        <constructor-arg index="3"><ref bean="pageManagerOidCache"/></constructor-arg>
+        <!-- folder/page/link path cache -->
+        <constructor-arg index="4"><ref bean="pageManagerPathCache"/></constructor-arg>
+    </bean>
+
+</beans>

Added: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/distributed-ehcache.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/distributed-ehcache.xml?rev=725578&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/distributed-ehcache.xml (added)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/distributed-ehcache.xml Wed Dec 10 21:03:10 2008
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
+
+    <diskStore path="java.io.tmpdir"/>
+
+    <cacheManagerEventListenerFactory class=""
+                                      properties=""/>
+
+
+    <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+                                     properties="peerDiscovery=automatic,
+                                                 multicastGroupAddress=${org.apache.jetspeed.ehcache.group.address},
+                                                 multicastGroupPort=${org.apache.jetspeed.ehcache.group.port},
+                                                 timeToLive=${org.apache.jetspeed.ehcache.group.ttl}"/>
+
+    <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
+                                     properties="hostName=${org.apache.jetspeed.ehcache.hostname},
+                                                 port=${org.apache.jetspeed.ehcache.port}"/>
+
+    <defaultCache maxElementsInMemory="10000"
+                  eternal="false"
+                  timeToIdleSeconds="120"
+                  timeToLiveSeconds="120"
+                  overflowToDisk="true"
+                  maxElementsOnDisk="10000000"
+                  diskPersistent="false"
+                  diskExpiryThreadIntervalSeconds="120"
+                  memoryStoreEvictionPolicy="LRU"/>
+
+    <cache name="pageManagerOidCache"
+           maxElementsInMemory="${org.apache.jetspeed.ehcache.pagemanager.maxelements}"
+           eternal="false"
+           overflowToDisk="false"
+           timeToIdleSeconds="${org.apache.jetspeed.ehcache.pagemanager.element.ttl}"
+           timeToLiveSeconds="${org.apache.jetspeed.ehcache.pagemanager.element.ttl}"
+           memoryStoreEvictionPolicy="LFU"/>
+
+    <cache name="pageManagerPathCache"
+           maxElementsInMemory="${org.apache.jetspeed.ehcache.pagemanager.maxelements}"
+           eternal="false"
+           overflowToDisk="false"
+           timeToIdleSeconds="${org.apache.jetspeed.ehcache.pagemanager.element.ttl}"
+           timeToLiveSeconds="${org.apache.jetspeed.ehcache.pagemanager.element.ttl}"
+           memoryStoreEvictionPolicy="LFU">
+        <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
+                                   properties="replicateAsynchronously=true,
+                                               replicatePuts=false,
+                                               replicateUpdates=false,
+                                               replicateUpdatesViaCopy=false,
+                                               replicateRemovals=true"/>
+    </cache>
+
+</ehcache>

Added: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/ehcache.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/ehcache.xml?rev=725578&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/ehcache.xml (added)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/ehcache.xml Wed Dec 10 21:03:10 2008
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
+
+    <diskStore path="java.io.tmpdir"/>
+
+    <cacheManagerEventListenerFactory class=""
+                                      properties=""/>
+
+    <defaultCache maxElementsInMemory="10000"
+                  eternal="false"
+                  timeToIdleSeconds="120"
+                  timeToLiveSeconds="120"
+                  overflowToDisk="true"
+                  maxElementsOnDisk="10000000"
+                  diskPersistent="false"
+                  diskExpiryThreadIntervalSeconds="120"
+                  memoryStoreEvictionPolicy="LRU"/>
+
+    <cache name="pageManagerOidCache"
+           maxElementsInMemory="128"
+           eternal="false"
+           overflowToDisk="false"
+           timeToIdleSeconds="150"
+           timeToLiveSeconds="150"
+           memoryStoreEvictionPolicy="LFU"/>
+
+    <cache name="pageManagerPathCache"
+           maxElementsInMemory="128"
+           eternal="false"
+           overflowToDisk="false"
+           timeToIdleSeconds="150"
+           timeToLiveSeconds="150"
+           memoryStoreEvictionPolicy="LFU"/>
+
+</ehcache>

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/interceptors.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/interceptors.xml?rev=725578&r1=725577&r2=725578&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/interceptors.xml (original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/interceptors.xml Wed Dec 10 21:03:10 2008
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
@@ -15,69 +15,48 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<!--
-    Database PSML Manager Interception for handling Cache Rollback
-    We also have examples here of replay interception for failover to 
-    a second database on update failures
-   -->    
-<beans>
-
-    <bean id="pageManagerInterceptor" class="org.apache.jetspeed.util.interceptors.PageManagerInterceptor">
-    </bean>
-
-
-    <bean id="PageManagerTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
-                        abstract="true">
-        <property name="transactionManager"><ref bean="transactionManager"/></property>
-        <property name="transactionAttributes">
-            <props>
-                <prop key="*">PROPAGATION_REQUIRED</prop>
-            </props>
-        </property>
-        <property name="preInterceptors"> 
-            <list>
-                <ref local="pageManagerInterceptor" />
-            </list>
-        </property>
-    </bean>
-
-    <!--    
-        Replay support:
-        
-    <bean id="replayTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
-                        abstract="true">
-        <property name="transactionManager"><ref bean="transactionManager"/></property>
-        <property name="transactionAttributes">
-            <props>
-                <prop key="*">PROPAGATION_REQUIRED</prop>
-            </props>
-        </property>
-        <property name="preInterceptors"> 
-            <list>
-                <ref local="methodReplayInterceptor" />
-            </list>
-        </property>
-    </bean>
-        
-   <bean id="replayDecisionMakerBean"
-        class="org.apache.jetspeed.util.interceptors.TransactionalMethodReplayDecisionMaker">
-        <property name="sqlErrorCodes">
-            <value>9999, 400, -80</value> 
-             <value>9999</value>
-        </property>
-    </bean>
-
-    <bean id="methodReplayInterceptor" class="org.apache.jetspeed.util.interceptors.MethodReplayInterceptor">
-        <property name="retryCount">
-            <value>3</value>
-        </property>
-        <property name="retryInterval">
-            <value>500</value></property>  retry every 500 milliseconds 
-        <property name="replayDecisionMaker">
-            <ref bean="replayDecisionMakerBean"/>
-        </property>
-    </bean>
- -->
-            
-</beans>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+    <!--
+    Examples of replay interception for failover to
+    a second database on update failures
+    -->
+
+    <!--
+    <bean id="replayTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
+                        abstract="true">
+        <property name="transactionManager"><ref bean="transactionManager"/></property>
+        <property name="transactionAttributes">
+            <props>
+                <prop key="*">PROPAGATION_REQUIRED</prop>
+            </props>
+        </property>
+        <property name="preInterceptors">
+            <list>
+                <ref local="methodReplayInterceptor" />
+            </list>
+        </property>
+    </bean>
+
+    <bean id="replayDecisionMakerBean"
+        class="org.apache.jetspeed.util.interceptors.TransactionalMethodReplayDecisionMaker">
+        <property name="sqlErrorCodes">
+            <value>9999, 400, -80</value>
+             <value>9999</value>
+        </property>
+    </bean>
+
+    <bean id="methodReplayInterceptor" class="org.apache.jetspeed.util.interceptors.MethodReplayInterceptor">
+        <property name="retryCount">
+            <value>3</value>
+        </property>
+        <property name="retryInterval">
+            <value>500</value></property>  retry every 500 milliseconds
+        <property name="replayDecisionMaker">
+            <ref bean="replayDecisionMakerBean"/>
+        </property>
+    </bean>
+    -->
+
+</beans>

Added: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/log4j-stdout.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/log4j-stdout.properties?rev=725578&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/log4j-stdout.properties (added)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/log4j-stdout.properties Wed Dec 10 21:03:10 2008
@@ -0,0 +1,31 @@
+# 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.
+
+# ------------------------------------------------------------------------
+#
+# Stdout Logging Configuration
+#
+# $Id: log4j.properties 722139 2008-12-01 17:22:03Z rwatler $
+#
+# ------------------------------------------------------------------------
+
+log4j.rootLogger = ERROR, stdout
+
+log4j.category.org.apache.jetspeed = INFO, stdout
+log4j.additivity.org.apache.jetspeed = false
+
+log4j.appender.stdout = org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.conversionPattern = %d [%t] %-5p %c - %m%n

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/TestDatabasePageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/TestDatabasePageManager.java?rev=725578&r1=725577&r2=725578&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/TestDatabasePageManager.java (original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/TestDatabasePageManager.java Wed Dec 10 21:03:10 2008
@@ -126,8 +126,7 @@
     
     protected String[] getConfigurations()
     {
-        return new String[]
-        { "database-page-manager.xml", "transaction.xml" };
+        return new String[]{"database-page-manager.xml", "transaction.xml"};
     }
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/TestSecureDatabasePageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/TestSecureDatabasePageManager.java?rev=725578&r1=725577&r2=725578&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/TestSecureDatabasePageManager.java (original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/TestSecureDatabasePageManager.java Wed Dec 10 21:03:10 2008
@@ -53,8 +53,7 @@
     
     protected String[] getConfigurations()
     {
-        return new String[]
-        { "secure-database-page-manager.xml", "transaction.xml" };
+        return new String[]{"secure-database-page-manager.xml", "transaction.xml"};
     }
 
     public void testSecurePageManager() throws Exception

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/TestSecurePermissionsDatabasePageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/TestSecurePermissionsDatabasePageManager.java?rev=725578&r1=725577&r2=725578&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/TestSecurePermissionsDatabasePageManager.java (original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/TestSecurePermissionsDatabasePageManager.java Wed Dec 10 21:03:10 2008
@@ -53,7 +53,6 @@
     
     protected String[] getConfigurations()
     {
-        return new String[]
-        { "secure-permissions-database-page-manager.xml", "transaction.xml" };
+        return new String[]{"secure-permissions-database-page-manager.xml", "transaction.xml"};
     }
 }

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/TestTransactions.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/TestTransactions.java?rev=725578&r1=725577&r2=725578&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/TestTransactions.java (original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/TestTransactions.java Wed Dec 10 21:03:10 2008
@@ -63,16 +63,9 @@
     
     protected String[] getConfigurations()
     {
-        return new String[]
-        { "tx-page-manager.xml", "transaction.xml", "interceptors.xml" }; 
+        return new String[]{"database-page-manager.xml", "transaction.xml"}; 
     }
 
-    protected String[] getBootConfigurations()
-    {
-        return new String[]
-        { "boot/datasource.xml"};
-    }
-    
     public void testTx() throws Exception
     {
         if (pageManager.folderExists("/"))
@@ -100,11 +93,11 @@
         catch (Exception e)
         {
             System.out.println("Exception adding pages" + e);
-           // e.printStackTrace();
-            
         }
+
         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"));

Added: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java?rev=725578&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java (added)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/cache/DatabasePageManagerServer.java Wed Dec 10 21:03:10 2008
@@ -0,0 +1,213 @@
+/*
+ * 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.cache;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.util.Properties;
+
+import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import org.apache.commons.jexl.JexlContext;
+import org.apache.commons.jexl.JexlHelper;
+import org.apache.commons.jexl.Script;
+import org.apache.commons.jexl.ScriptFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.components.jndi.JetspeedTestJNDIComponent;
+import org.apache.jetspeed.engine.JetspeedEngineConstants;
+import org.apache.jetspeed.page.PageManager;
+
+/**
+ * DatabasePageManagerServer
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ */
+public class DatabasePageManagerServer
+{
+    protected static Log log = LogFactory.getLog(DatabasePageManagerServer.class);
+    
+    // Constants
+    
+    public static final String SCRIPT_RESULT_LINE_PREFIX = "> ";
+    
+    // Members
+    
+    private JetspeedTestJNDIComponent jndiDS;
+    protected ClassPathXmlApplicationContext ctx;
+    private String baseDir;
+    private PageManager pageManager;
+    private JexlContext jexlContext;
+    private boolean exit;
+    
+    // Life cycle
+    
+    /**
+     * Initialize page manager server instance and script context.
+     * 
+     * @throws Exception
+     */
+    public void initialize() throws Exception
+    {
+        // setup jetspeed test datasource and component manager
+        jndiDS = new JetspeedTestJNDIComponent();
+        jndiDS.setup();
+        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";
+        final ApplicationContext bootContext = new ClassPathXmlApplicationContext(bootConfigurations, true);
+        ctx = new ClassPathXmlApplicationContext(configurations, false, bootContext);
+        PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
+        Properties p = new Properties();
+        p.setProperty(JetspeedEngineConstants.APPLICATION_ROOT_KEY, appRoot);
+        ppc.setProperties(p);
+        ctx.addBeanFactoryPostProcessor(ppc);
+        ctx.refresh();
+
+        // access page manager
+        pageManager = (PageManager)ctx.getBean("pageManager");
+        
+        // craete jexl context
+        jexlContext = JexlHelper.createContext();
+        jexlContext.getVars().put("pageManager", pageManager);
+        jexlContext.getVars().put("pageManagerServer", this);
+        
+        log.info( "DatabasePageManager server initialized");
+    }
+    
+    /**
+     * Terminate page manager server instance.
+     * 
+     * @throws Exception
+     */
+    public void terminate() throws Exception
+    {
+        // tear down jetspeed component manager and test datasource
+        ctx.close();
+        jndiDS.tearDown();
+
+        log.info( "DatabasePageManager server terminated");
+    }
+    
+    // Implementation
+    
+    /**
+     * Execute a single line script against page manager server context.
+     * 
+     * @param scriptLine jexl script
+     * @return script result line
+     */
+    public String execute(final String scriptLine)
+    {
+        // execute script line and return result line
+        String resultLine = scriptLine;
+        try
+        {
+            final Script jexlScript = ScriptFactory.createScript(scriptLine);
+            final Object result = jexlScript.execute(jexlContext);
+            if (result != null)
+            {
+                resultLine += " -> "+result;
+            }
+        }
+        catch (final Exception e)
+        {
+            resultLine += " -> "+e;            
+        }
+        return resultLine;
+    }
+
+    /**
+     * Sets server exit flag.
+     */
+    public void exit()
+    {
+        exit = true;
+    }
+    
+    // Data access
+    
+    /**
+     * @return server exit flag
+     */
+    public boolean isExit()
+    {
+        return exit;
+    }
+    
+    // Application entry point
+    
+    /**
+     * Server main entry point.
+     * 
+     * @param args not used
+     */
+    public static void main(final String [] args)
+    {
+        try
+        {
+            // create and initialize server
+            final DatabasePageManagerServer server = new DatabasePageManagerServer();
+            server.initialize();
+            
+            // simple server reads script lines from standard
+            // input and writes results on standard output
+            final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
+            final PrintWriter out = new PrintWriter(System.out, true);
+            do
+            {
+                // read single line scripts to execute
+                String scriptLine = in.readLine();
+                if (scriptLine != null)
+                {
+                    scriptLine = scriptLine.trim();
+                    String resultLine = "";
+                    if (scriptLine.length() > 0)
+                    {
+                        // execute script
+                        resultLine = server.execute(scriptLine);
+                    }
+
+                    // write prefixed single line results
+                    out.println(SCRIPT_RESULT_LINE_PREFIX+resultLine);
+                }
+                else
+                {
+                    // exit server on input EOF
+                    server.exit();
+                }
+            }
+            while (!server.isExit());
+            
+            // terminate server
+            server.terminate();
+        }
+        catch (final Throwable t)
+        {
+            log.error( "Unexpected exception: "+t, t);
+        }
+    }
+}

Added: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/cache/TestDatabasePageManagerCache.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/cache/TestDatabasePageManagerCache.java?rev=725578&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/cache/TestDatabasePageManagerCache.java (added)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/org/apache/jetspeed/page/cache/TestDatabasePageManagerCache.java Wed Dec 10 21:03:10 2008
@@ -0,0 +1,595 @@
+/*
+ * 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.cache;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.cache.impl.EhCacheConfigResource;
+
+/**
+ * TestDatabasePageManagerCache
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ */
+public class TestDatabasePageManagerCache extends TestCase
+{
+    protected static Log log = LogFactory.getLog(TestDatabasePageManagerCache.class);
+    
+    // Members
+    
+    private String osExecutableExtension;
+    private String fileSeparator;
+    private File javaExecutablePath;
+    private String classPathSeparator;
+    private File projectDirectoryPath;
+    private Map systemProperties;
+    private String classPath;
+ 
+    // Test methods
+    
+    /**
+     * Tests distributed cache operation for DatabasePageManager
+     */
+    public void testDatabasePageManagerCache()
+    {
+        String result;
+        
+        // create and start servers
+        final TestProgram server0 = new TestProgram("server-0", DatabasePageManagerServer.class, 0);
+        final TestProgram server1 = new TestProgram("server-1", DatabasePageManagerServer.class, 1);
+        try
+        {
+            // start servers
+            server0.start();
+            server1.start();
+
+            // wait until servers have started
+            server0.execute("");
+            server1.execute("");
+
+            // check to ensure servers have distributed page manager caches
+            boolean server0Distributed = false;
+            boolean server1Distributed = false;
+            final long distributedCheckStarted = System.currentTimeMillis();
+            do
+            {
+                // check servers
+                if (!server0Distributed)
+                {
+                    result = server0.execute("pageManager.isDistributed();");
+                    assertTrue(result.indexOf("Exception") == -1);
+                    server0Distributed = result.endsWith("true");
+                }
+                if (!server1Distributed)
+                {
+                    result = server1.execute("pageManager.isDistributed();");
+                    assertTrue(result.indexOf("Exception") == -1);
+                    server1Distributed = result.endsWith("true");
+                }
+                
+                // wait if servers not distributed
+                if (!server0Distributed || !server1Distributed)
+                {
+                    Thread.sleep(250);
+                }
+            }
+            while ((!server0Distributed || !server1Distributed) && (System.currentTimeMillis()-distributedCheckStarted < 5000));
+            if (!server0Distributed && !server1Distributed)
+            {                
+                System.out.println("Server page managers not distributed: possible system limitation... test skipped");
+                log.warn("Server page managers not distributed: possible system limitation... test skipped");
+                return;
+            }
+            assertTrue(server0Distributed);
+            assertTrue(server1Distributed);
+
+            // clean and setup database page managers
+            result = server0.execute("removeRootFolder = pageManager.getFolder(\"/\");");
+            if (result.indexOf("FolderNotFoundException") == -1)
+            {
+                result = server0.execute("pageManager.removeFolder(removeRootFolder);");
+                assertTrue(result.indexOf("Exception") == -1);
+            }
+            result = server0.execute("pageManager.reset();");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server1.execute("pageManager.reset();");
+            assertTrue(result.indexOf("Exception") == -1);
+            
+            // create folder and documents in first page manager
+            result = server0.execute("folder = pageManager.newFolder(\"/\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("folder.setTitle(\"Root Folder\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("pageManager.updateFolder(folder);");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("page = pageManager.newPage(\"/default-page.psml\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("page.setTitle(\"Default Page\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("pageManager.updatePage(page);");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("page = pageManager.newPage(\"/another-page.psml\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("page.setTitle(\"Another Page\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("pageManager.updatePage(page);");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("page = pageManager.newPage(\"/some-other-page.psml\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("page.setTitle(\"Some Other Page\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("pageManager.updatePage(page);");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("link = pageManager.newLink(\"/default.link\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("link.setTitle(\"Default Link\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("link.setUrl(\"http://www.default.org/\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("pageManager.updateLink(link);");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("folder = pageManager.newFolder(\"/deep-0\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("folder.setTitle(\"Deep 0 Folder\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("pageManager.updateFolder(folder);");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("page = pageManager.newPage(\"/deep-0/deep-page-0.psml\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("page.setTitle(\"Deep Page 0\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("pageManager.updatePage(page);");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("folder = pageManager.newFolder(\"/deep-1\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("folder.setTitle(\"Deep 1 Folder\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("pageManager.updateFolder(folder);");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("page = pageManager.newPage(\"/deep-1/deep-page-1.psml\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("page.setTitle(\"Deep Page 1\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("pageManager.updatePage(page);");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("pageSecurity = pageManager.newPageSecurity();");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server0.execute("pageManager.updatePageSecurity(pageSecurity);");
+            assertTrue(result.indexOf("Exception") == -1);
+
+            // populate folders and documents in second page manager
+            result = server1.execute("pageManager.getFolder(\"/\").getTitle();");
+            assertTrue(result.endsWith("Root Folder"));
+            result = server1.execute("pageManager.getPage(\"/default-page.psml\").getTitle();");
+            assertTrue(result.endsWith("Default Page"));
+            result = server1.execute("pageManager.getPage(\"/another-page.psml\").getTitle();");
+            assertTrue(result.endsWith("Another Page"));
+            result = server1.execute("pageManager.getPage(\"/some-other-page.psml\").getTitle();");
+            assertTrue(result.endsWith("Some Other Page"));            
+            result = server1.execute("pageManager.getLink(\"/default.link\").getTitle();");
+            assertTrue(result.endsWith("Default Link"));
+            result = server1.execute("pageManager.getFolder(\"/deep-0\").getTitle();");
+            assertTrue(result.endsWith("Deep 0 Folder"));
+            result = server1.execute("pageManager.getPage(\"/deep-0/deep-page-0.psml\").getTitle();");
+            assertTrue(result.endsWith("Deep Page 0"));
+            result = server1.execute("pageManager.getFolder(\"/deep-1\").getTitle();");
+            assertTrue(result.endsWith("Deep 1 Folder"));
+            result = server1.execute("pageManager.getPage(\"/deep-1/deep-page-1.psml\").getTitle();");
+            assertTrue(result.endsWith("Deep Page 1"));
+            result = server1.execute("pageManager.getPageSecurity().getPath();");
+            assertTrue(result.endsWith("/page.security"));
+            
+            // update/remove objects in second page manager
+            result = server1.execute("page = pageManager.getPage(\"/default-page.psml\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server1.execute("page.setTitle(\"Edited Default Page\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server1.execute("pageManager.updatePage(page);");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server1.execute("page = pageManager.getPage(\"/some-other-page.psml\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server1.execute("pageManager.removePage(page);");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server1.execute("link = pageManager.getLink(\"/default.link\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server1.execute("link.setTitle(\"Edited Default Link\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server1.execute("pageManager.updateLink(link);");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server1.execute("folder = pageManager.getFolder(\"/deep-0\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server1.execute("folder.setTitle(\"Edited Deep 0 Folder\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server1.execute("pageManager.updateFolder(folder);");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server1.execute("folder = pageManager.getFolder(\"/deep-1\");");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server1.execute("pageManager.removeFolder(folder);");
+            assertTrue(result.indexOf("Exception") == -1);            
+            
+            // test objects in both page managers for cache coherency
+            result = server1.execute("pageManager.getPage(\"/default-page.psml\").getTitle();");
+            assertTrue(result.endsWith("Edited Default Page"));
+            result = server1.execute("pageManager.getPage(\"/some-other-page.psml\");");
+            assertTrue(result.indexOf("PageNotFoundException") != -1);
+            result = server1.execute("pageManager.getFolder(\"/\").getPages().size();");
+            assertTrue(result.endsWith("2"));
+            result = server1.execute("pageManager.getLink(\"/default.link\").getTitle();");
+            assertTrue(result.endsWith("Edited Default Link"));
+            result = server1.execute("pageManager.getFolder(\"/deep-0\").getTitle();");
+            assertTrue(result.endsWith("Edited Deep 0 Folder"));
+            result = server1.execute("pageManager.getPage(\"/deep-1/deep-page-1.psml\");");
+            assertTrue(result.indexOf("PageNotFoundException") != -1);
+            result = server1.execute("pageManager.getFolder(\"/deep-1\");");
+            assertTrue(result.indexOf("FolderNotFoundException") != -1);
+            result = server1.execute("pageManager.getFolder(\"/\").getFolders().size();");
+            assertTrue(result.endsWith("1"));
+            boolean defaultPageUpdated = false;
+            boolean someOtherPageRemoved = false;
+            boolean rootFolderPagesCountTwo = false;
+            boolean defaultLinkUpdated = false;
+            boolean deep0FolderUpdated = false;
+            boolean deepPage1Removed = false;
+            boolean deep1FolderRemoved = false;
+            boolean rootFolderFoldersCountOne = false;
+            final long coherencyCheckStarted = System.currentTimeMillis();
+            do
+            {
+                // check cache coherency
+                if (!defaultPageUpdated)
+                {
+                    result = server0.execute("pageManager.getPage(\"/default-page.psml\").getTitle();");
+                    defaultPageUpdated = result.endsWith("Edited Default Page");
+                }
+                if (!someOtherPageRemoved)
+                {
+                    result = server0.execute("pageManager.getPage(\"/some-other-page.psml\");");
+                    someOtherPageRemoved = (result.indexOf("PageNotFoundException") != -1);
+                }
+                if (!rootFolderPagesCountTwo)
+                {
+                    result = server0.execute("pageManager.getFolder(\"/\").getPages().size();");
+                    rootFolderPagesCountTwo = result.endsWith("2");
+                }
+                if (!defaultLinkUpdated)
+                {
+                    result = server0.execute("pageManager.getLink(\"/default.link\").getTitle();");
+                    defaultLinkUpdated = result.endsWith("Edited Default Link");
+                }
+                if (!deep0FolderUpdated)
+                {
+                    result = server0.execute("pageManager.getFolder(\"/deep-0\").getTitle();");
+                    deep0FolderUpdated = result.endsWith("Edited Deep 0 Folder");
+                }
+                if (!deepPage1Removed)
+                {
+                    result = server0.execute("pageManager.getPage(\"/deep-1/deep-page-1.psml\");");
+                    deepPage1Removed = (result.indexOf("PageNotFoundException") != -1);
+                }
+                if (!deep1FolderRemoved)
+                {
+                    result = server0.execute("pageManager.getFolder(\"/deep-1\");");
+                    deep1FolderRemoved = (result.indexOf("FolderNotFoundException") != -1);
+                }
+                if (!rootFolderFoldersCountOne)
+                {
+                    result = server0.execute("pageManager.getFolder(\"/\").getFolders().size();");
+                    rootFolderFoldersCountOne = result.endsWith("1");
+                }
+                
+                // wait for cache coherency
+                if (!defaultPageUpdated || !someOtherPageRemoved || !rootFolderPagesCountTwo || !defaultLinkUpdated || !deep0FolderUpdated || !deepPage1Removed || !deep1FolderRemoved || !rootFolderFoldersCountOne)
+                {
+                    Thread.sleep(250);
+                }
+            }
+            while ((!defaultPageUpdated || !someOtherPageRemoved || !rootFolderPagesCountTwo || !defaultLinkUpdated || !deep0FolderUpdated || !deepPage1Removed || !deep1FolderRemoved || !rootFolderFoldersCountOne) && (System.currentTimeMillis()-coherencyCheckStarted < 5000));
+            assertTrue(defaultPageUpdated);
+            assertTrue(someOtherPageRemoved);
+            assertTrue(rootFolderPagesCountTwo);
+            assertTrue(defaultLinkUpdated);
+            assertTrue(deep0FolderUpdated);
+            assertTrue(deepPage1Removed);
+            assertTrue(deep1FolderRemoved);
+            assertTrue(rootFolderFoldersCountOne);
+
+            // reset database page managers
+            result = server0.execute("pageManager.reset();");
+            assertTrue(result.indexOf("Exception") == -1);
+            result = server1.execute("pageManager.reset();");
+            assertTrue(result.indexOf("Exception") == -1);
+        }
+        catch (final Exception e)
+        {
+            log.error("Server test exception: "+e, e);
+            fail( "Server test exception: "+e);            
+        }        
+        finally
+        {
+            // silently shutdown servers
+            try
+            {
+                server0.shutdown();
+            }
+            catch (final Exception e)
+            {
+                log.error( "Server shutdown exception: "+e, e);
+            }
+            try
+            {
+                server1.shutdown();
+            }
+            catch (final Exception e)
+            {
+                log.error( "Server shutdown exception: "+e, e);
+            }
+        }
+    }
+    
+    // Implementation classes
+    
+    protected class TestProgram
+    {
+        private String name;
+        private Class mainClass;
+        private int index;
+
+        private Process process;
+        private BufferedWriter processInput;
+        private BufferedReader processOutput;
+        
+        public TestProgram(final String name, final Class mainClass, final int index)
+        {
+            this.name = name;
+            this.mainClass = mainClass;
+            this.index = index;
+        }
+        
+        public synchronized void start() throws IOException
+        {
+            assertNull(process);
+
+            // configure launcher with paths, properties, and indexed properties
+            final List commandAndArgs = new ArrayList();
+            commandAndArgs.add(javaExecutablePath.getCanonicalPath());
+            for (Iterator iter = systemProperties.entrySet().iterator(); iter.hasNext();)
+            {
+                final Map.Entry systemProperty = (Map.Entry)iter.next();
+                final String propertyName = (String)systemProperty.getKey();
+                String propertyValue = (String)systemProperty.getValue();
+                if (propertyName.equals(EhCacheConfigResource.EHCACHE_PORT_PROP_NAME))
+                {
+                    propertyValue = Integer.toString(Integer.parseInt(propertyValue)+index);
+                }
+                commandAndArgs.add( "-D"+propertyName+"="+propertyValue);
+            }
+            commandAndArgs.add("-Dlog4j.configuration=log4j-stdout.properties");
+            commandAndArgs.add("-classpath");
+            commandAndArgs.add(classPath);
+            commandAndArgs.add(mainClass.getName());
+
+            // launch test programs
+            process = Runtime.getRuntime().exec((String []) commandAndArgs.toArray(new String[commandAndArgs.size()]), null, projectDirectoryPath);
+
+            // setup I/O for process
+            processInput = new BufferedWriter(new OutputStreamWriter(process.getOutputStream()));
+            processOutput = new BufferedReader(new InputStreamReader(process.getInputStream()));
+
+            // read messages from process
+            for (String line; (processOutput.ready() && ((line = processOutput.readLine()) != null));)
+            {
+                logProcessLine(line);
+            }
+        }
+
+        public synchronized String execute(final String scriptLine) throws IOException
+        {
+            assertNotNull(process);
+
+            // read messages from process
+            for (String line; (processOutput.ready() && ((line = processOutput.readLine()) != null));)
+            {
+                logProcessLine(line);
+            }
+
+            // write script line to process
+            processInput.write(scriptLine);
+            processInput.newLine();
+            processInput.flush();
+
+            // read result or messages from process
+            String resultLine = null;
+            for (String line; ((line = processOutput.readLine()) != null);)
+            {
+                if (! line.startsWith(DatabasePageManagerServer.SCRIPT_RESULT_LINE_PREFIX))
+                {
+                    logProcessLine(line);
+                }
+                else
+                {
+                    resultLine = line;
+                    break;
+                }
+            }
+            if ( resultLine == null)
+            {
+                throw new IOException("Unexpected EOF from process output");
+            }
+            return resultLine;
+        }
+        
+        public synchronized void shutdown() throws IOException, InterruptedException
+        {
+            assertNotNull( process);
+
+            // start thread to destroy process on timeout
+            final Thread destroyThread = new Thread(new Runnable()
+            {
+                public void run()
+                {
+                    try
+                    {
+                        Thread.sleep(10000);
+                        if ( process != null)
+                        {
+                            log.warn( "Forcibly stopping "+name);
+                            process.destroy();
+                        }
+                    }
+                    catch ( final Exception e)
+                    {
+                    }
+                }
+            }, "DestroyThread");
+            destroyThread.setDaemon( true);
+            destroyThread.start();
+
+            // close process input to shutdown server and read messages
+            processInput.close();
+            for (String line; ((line = processOutput.readLine()) != null);)
+            {
+                logProcessLine(line);
+            }
+
+            // join on process completion
+            process.waitFor();
+            processOutput.close();
+            process = null;
+
+            // join on destroy thread
+            destroyThread.interrupt();
+            destroyThread.join();
+        }
+        
+        private void logProcessLine(final String line)
+        {
+            if ((line.indexOf("ERROR") == -1) && ((line.indexOf("ERROR") != -1) || (line.indexOf("Exception") != -1) || line.startsWith("   at ")))
+            {
+                log.error("{"+name+"} "+line);
+            }
+            else
+            {
+                log.info("{"+name+"} "+line);                        
+            }
+        }
+    }
+    
+    // TestCase implementation
+    
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        // setup cache properties
+        EhCacheConfigResource.getInstance(EhCacheConfigResource.EHCACHE_CONFIG_RESOURCE_DISTRIBUTED_CACHE, true);
+        
+        // environment setup
+        osExecutableExtension = (System.getProperty("os.name").startsWith("Windows") ? ".exe" : "");
+        fileSeparator = System.getProperty("file.separator");
+        javaExecutablePath = new File(System.getProperty("java.home")+fileSeparator+"bin"+fileSeparator+"java"+osExecutableExtension);
+        classPathSeparator = System.getProperty("path.separator");
+        projectDirectoryPath = new File(System.getProperty("basedir"));
+        systemProperties = new HashMap();
+        for (Iterator iter = System.getProperties().entrySet().iterator(); iter.hasNext();)
+        {
+            final Map.Entry systemProperty = (Map.Entry)iter.next();
+            final String propertyName = systemProperty.getKey().toString();
+            final String propertyValue = systemProperty.getValue().toString();
+            if (propertyName.startsWith("org.apache.jetspeed.") || propertyName.startsWith("java.net.") || propertyName.equals("basedir"))
+            {
+                systemProperties.put(propertyName, propertyValue);
+            }
+        }
+
+        // construct launcher classpath from current class loader
+        final StringBuffer classPathBuilder = new StringBuffer();
+        final ClassLoader loader = this.getClass().getClassLoader();
+        assertTrue(loader instanceof URLClassLoader);
+        final URLClassLoader urlLoader = (URLClassLoader)loader;
+        assertNotNull(urlLoader.getURLs());
+        for (int i = 0; (i < urlLoader.getURLs().length); i++)
+        {
+            final URL pathURL = urlLoader.getURLs()[i];
+
+            // convert path URL to file path
+            final String path = new File(new URI(pathURL.toString())).getCanonicalPath();
+
+            // build class path
+            if (classPathBuilder.length() > 0)
+            {
+                classPathBuilder.append(classPathSeparator);
+            }
+            classPathBuilder.append(path);
+        }
+        classPath = classPathBuilder.toString();
+        assertTrue(classPath.length() > 0);
+
+        // continue setup
+        super.setUp();
+    }
+
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+    }
+    
+    // Application entry point
+
+    /**
+     * Start the tests.
+     * 
+     * @param args not used
+     */
+    public static void main(final String [] args)
+    {
+        junit.awtui.TestRunner.main(new String[]{TestDatabasePageManagerCache.class.getName()});
+    }
+
+    /**
+     * Creates the test suite.
+     * 
+     * @return a test suite that includes all methods starting with "test"
+     */
+    public static Test suite()
+    {
+        return new TestSuite(TestDatabasePageManagerCache.class);
+    }
+}

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/secure-database-page-manager.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/secure-database-page-manager.xml?rev=725578&r1=725577&r2=725578&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/secure-database-page-manager.xml (original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/secure-database-page-manager.xml Wed Dec 10 21:03:10 2008
@@ -18,65 +18,20 @@
 -->
 <beans>
 
+    <import resource="database-page-manager-base.xml"/>
+
     <!-- Page Manager -->
-    <bean id="org.apache.jetspeed.page.PageManagerImpl" 
-          name="securePageManagerImpl"
-          init-method="init"
-          class="org.apache.jetspeed.page.impl.DatabasePageManager">
+    <bean id="pageManagerImpl" init-method="init" class="org.apache.jetspeed.page.impl.DatabasePageManager">
         <!-- OJB configuration file resource path -->
         <constructor-arg index="0"><value>JETSPEED-INF/ojb/page-manager-repository.xml</value></constructor-arg>       
-        <!-- folder/page/link cache size, default=128, min=128 -->
-        <constructor-arg index="1"><value>128</value></constructor-arg>
-        <!-- folder/page/link cache expires seconds, default=150, infinite=0, min=30 -->
-        <constructor-arg index="2"><value>0</value></constructor-arg>
         <!-- permissions security enabled flag, default=false -->
-        <constructor-arg index="3"><value>false</value></constructor-arg>
+        <constructor-arg index="1"><value>false</value></constructor-arg>
         <!-- constraints security enabled flag, default=true -->
-        <constructor-arg index="4"><value>true</value></constructor-arg>
-    </bean>
-
-    <!-- Transaction Proxying -->
-    <bean id="org.apache.jetspeed.page.PageManager" name="pageManager" parent="baseTransactionProxy">
-        <property name="proxyInterfaces">
-            <value>org.apache.jetspeed.page.PageManager</value>
-        </property>
-        <property name="target">
-            <ref bean="securePageManagerImpl" />
-        </property>
-        <property name="transactionAttributes">
-            <props>
-              <prop key="getPage*">PROPAGATION_SUPPORTS</prop>  
-              <prop key="getLink*">PROPAGATION_SUPPORTS</prop>  
-              <prop key="getFolder*">PROPAGATION_SUPPORTS</prop>  
-              <prop key="getContentPage">PROPAGATION_SUPPORTS</prop>  
-              <prop key="getAll">PROPAGATION_SUPPORTS</prop>  
-              <prop key="getUserFolder">PROPAGATION_SUPPORTS</prop>  
-              <prop key="update*">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="removePage">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="removeFolder">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="removeLink">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="removePageSecurity">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>                            
-              <prop key="createUserHomePagesFromRoles">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="deepCopy*">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="addPages">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>              
-              <prop key="folderExists">PROPAGATION_SUPPORTS</prop>  
-              <prop key="pageExists">PROPAGATION_SUPPORTS</prop>  
-              <prop key="linkExists">PROPAGATION_SUPPORTS</prop>  
-              <prop key="userFolderExists">PROPAGATION_SUPPORTS</prop>  
-              <prop key="userPageExists">PROPAGATION_SUPPORTS</prop>  
-            </props>
-        </property>
-    </bean>
-
-    <!-- Inject Page Manager Proxy into Page Manager -->
-    <bean id="injectPageManagerProxy" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
-        <property name="targetObject"><ref bean="securePageManagerImpl"/></property>
-        <property name="targetMethod"><value>setPageManagerProxy</value></property>
-        <property name="arguments">
-            <list>
-                <ref bean="pageManager"/>
-            </list>
-        </property>
+        <constructor-arg index="2"><value>true</value></constructor-arg>
+        <!-- folder/page/link cache -->
+        <constructor-arg index="3"><ref bean="pageManagerOidCache"/></constructor-arg>
+        <!-- folder/page/link path cache -->
+        <constructor-arg index="4"><ref bean="pageManagerPathCache"/></constructor-arg>
     </bean>
 
 </beans>

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/secure-permissions-database-page-manager.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/secure-permissions-database-page-manager.xml?rev=725578&r1=725577&r2=725578&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/secure-permissions-database-page-manager.xml (original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/page-manager/src/test/secure-permissions-database-page-manager.xml Wed Dec 10 21:03:10 2008
@@ -18,65 +18,20 @@
 -->
 <beans>
 
+    <import resource="database-page-manager-base.xml"/>
+
     <!-- Page Manager -->
-    <bean id="org.apache.jetspeed.page.PageManagerImpl" 
-          name="securePermissionsPageManagerImpl"
-          init-method="init"
-          class="org.apache.jetspeed.page.impl.DatabasePageManager">
+    <bean name="pageManagerImpl" init-method="init" class="org.apache.jetspeed.page.impl.DatabasePageManager">
         <!-- OJB configuration file resource path -->
         <constructor-arg index="0"><value>JETSPEED-INF/ojb/page-manager-repository.xml</value></constructor-arg>       
-        <!-- folder/page/link cache size, default=128, min=128 -->
-        <constructor-arg index="1"><value>128</value></constructor-arg>
-        <!-- folder/page/link cache expires seconds, default=150, infinite=0, min=30 -->
-        <constructor-arg index="2"><value>0</value></constructor-arg>
         <!-- permissions security enabled flag, default=false -->
-        <constructor-arg index="3"><value>true</value></constructor-arg>
+        <constructor-arg index="1"><value>true</value></constructor-arg>
         <!-- constraints security enabled flag, default=true -->
-        <constructor-arg index="4"><value>false</value></constructor-arg>
-    </bean>
-
-    <!-- Transaction Proxying -->
-    <bean id="org.apache.jetspeed.page.PageManager" name="pageManager" parent="baseTransactionProxy">
-        <property name="proxyInterfaces">
-            <value>org.apache.jetspeed.page.PageManager</value>
-        </property>
-        <property name="target">
-            <ref bean="securePermissionsPageManagerImpl" />
-        </property>
-        <property name="transactionAttributes">
-            <props>
-              <prop key="getPage*">PROPAGATION_SUPPORTS</prop>  
-              <prop key="getLink*">PROPAGATION_SUPPORTS</prop>  
-              <prop key="getFolder*">PROPAGATION_SUPPORTS</prop>  
-              <prop key="getContentPage">PROPAGATION_SUPPORTS</prop>  
-              <prop key="getAll">PROPAGATION_SUPPORTS</prop>  
-              <prop key="getUserFolder">PROPAGATION_SUPPORTS</prop>  
-              <prop key="update*">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="removePage">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="removeFolder">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="removeLink">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="removePageSecurity">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>                            
-              <prop key="createUserHomePagesFromRoles">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="deepCopy*">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>
-              <prop key="addPages">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop>              
-              <prop key="folderExists">PROPAGATION_SUPPORTS</prop>  
-              <prop key="pageExists">PROPAGATION_SUPPORTS</prop>  
-              <prop key="linkExists">PROPAGATION_SUPPORTS</prop>  
-              <prop key="userFolderExists">PROPAGATION_SUPPORTS</prop>  
-              <prop key="userPageExists">PROPAGATION_SUPPORTS</prop>  
-            </props>
-        </property>
-    </bean>
-
-    <!-- Inject Page Manager Proxy into Page Manager -->
-    <bean id="injectPageManagerProxy" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
-        <property name="targetObject"><ref bean="securePermissionsPageManagerImpl"/></property>
-        <property name="targetMethod"><value>setPageManagerProxy</value></property>
-        <property name="arguments">
-            <list>
-                <ref bean="pageManager"/>
-            </list>
-        </property>
+        <constructor-arg index="2"><value>false</value></constructor-arg>
+        <!-- folder/page/link cache -->
+        <constructor-arg index="3"><ref bean="pageManagerOidCache"/></constructor-arg>
+        <!-- folder/page/link path cache -->
+        <constructor-arg index="4"><ref bean="pageManagerPathCache"/></constructor-arg>
     </bean>
 
 </beans>

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/pom.xml?rev=725578&r1=725577&r2=725578&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/pom.xml Wed Dec 10 21:03:10 2008
@@ -119,7 +119,7 @@
             <artifactId>mail</artifactId>
         </dependency>
         <dependency>
-        	<groupId>ehcache</groupId>
+        	<groupId>net.sf.ehcache</groupId>
         	<artifactId>ehcache</artifactId>
         </dependency>
         <dependency>



---------------------------------------------------------------------
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