portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r723787 - in /portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src: main/java/org/apache/jetspeed/layout/impl/ test/assembly/ test/java/org/apache/jetspeed/container/state/ test/java/org/apache/jetspee...
Date Fri, 05 Dec 2008 16:50:55 GMT
Author: woonsan
Date: Fri Dec  5 08:50:54 2008
New Revision: 723787

URL: http://svn.apache.org/viewvc?rev=723787&view=rev
Log:
Fixed unit tests of jetspeed-portal component.

Added:
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/assembly/cache-test.xml
  (with props)
Modified:
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/SecurityConstraintsAction.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/assembly/page-manager.xml
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/TestNavigationalState.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/MockPortletRegistryFactory.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestConstraintsAction.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/tools/pamanager/TestPortletDescriptorSecurityRoles.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/TestUserInfoManager.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/window/TestWindows.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/resources/rc3.xml
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/jetspeed-portlet.xml
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/portlet.xml
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/web.xml
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/webapp/WEB-INF/portlet.xml

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/SecurityConstraintsAction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/SecurityConstraintsAction.java?rev=723787&r1=723786&r2=723787&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/SecurityConstraintsAction.java
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/SecurityConstraintsAction.java
Fri Dec  5 08:50:54 2008
@@ -175,7 +175,9 @@
         {
             DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
             DocumentBuilder builder = domFactory.newDocumentBuilder();
-            Document document = builder.parse(new ByteArrayInputStream(xml.getBytes(requestContext.getCharacterEncoding())));
+            String charset = requestContext.getCharacterEncoding();
+            byte [] bytes = (charset != null ? xml.getBytes(charset) : xml.getBytes());
+            Document document = builder.parse(new ByteArrayInputStream(bytes));
             
             Element root = document.getDocumentElement();
             String name = root.getAttribute("name");
@@ -188,7 +190,7 @@
                 def.setName(name);
                 added = true;
             }
-            NodeList xmlConstraints = root.getElementsByTagName("security-contraint");
+            NodeList xmlConstraints = root.getElementsByTagName("security-constraint");
             int xmlSize = xmlConstraints.getLength();
             if (added == false)
             {

Added: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/assembly/cache-test.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/assembly/cache-test.xml?rev=723787&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/assembly/cache-test.xml
(added)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/assembly/cache-test.xml
Fri Dec  5 08:50:54 2008
@@ -0,0 +1,276 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+    
+    <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
+        <meta key="j2:cat" value="default,cache" />
+        <!--  get it through the class path
+            <property name="configLocation" value="${applicationRoot}/WEB-INF/conf/ehcache.xml"/>
+        -->
+    </bean>
+    
+    <!-- Page File Cache -->
+    <bean id="PageFileCache" class="org.apache.jetspeed.cache.file.FileCache" init-method="startFileScanner"
+        destroy-method="stopFileScanner">
+        <meta key="j2:cat" value="default,cache" />
+        <!-- Internal cache -->
+        <constructor-arg index="0">
+            <ref bean="internalPageFileCache" />
+        </constructor-arg>
+        <!-- Scan rate for changes in cached files on the file system -->
+        <constructor-arg index="1">
+            <value>10</value>
+        </constructor-arg>
+    </bean>
+    
+    <!-- Factory bean used to instantiate a EHCache with the specified name (and corresponding
+        configuration in cacheManager.xml -->
+    <bean id="ehPortletContentCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+        <meta key="j2:cat" value="default,cache" />
+        <property name="cacheManager">
+            <ref local="cacheManager" />
+        </property>
+        <property name="cacheName" value="portletContentCache" />
+    </bean>
+    
+    <bean id="ContentCacheKeyGenerator" class="org.apache.jetspeed.cache.impl.JetspeedCacheKeyGenerator">
+        <meta key="j2:cat" value="default,cache" />
+        <!-- Keys are order specific in the list:
+            where username  == the user principal name of the current user
+            pipeline  == the name of the active pipeline for the current request (portal
| desktop)
+            windowid  == the window id (fragment id) of the portlet
+            sessionid == the current session id 
+            request.{param.name} == request parameter name, such "request.myparam"
+            session.{attribute-name} == session attribute name, such "session.myattribute"
+            
+            username|sessionid AND windowid are required
+        -->
+        <constructor-arg index='0'>
+            <list>
+                <value>sessionid</value>
+                <value>pipeline</value>
+                <value>windowid</value>
+            </list>
+        </constructor-arg>
+    </bean>
+    
+    <bean id="portletContentCache" class="org.apache.jetspeed.cache.impl.EhPortletContentCacheImpl">
+        <meta key="j2:cat" value="default,cache" />
+        <constructor-arg index="0">
+            <ref bean="ehPortletContentCache" />
+        </constructor-arg>
+        <constructor-arg index="1">
+            <ref bean="preferencesCache" />
+        </constructor-arg>
+        <constructor-arg index="2">
+            <ref bean="ContentCacheKeyGenerator" />
+        </constructor-arg>
+    </bean>
+    
+    <bean id="ehDecorationContentCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+        <meta key="j2:cat" value="default,cache" />
+        <property name="cacheManager">
+            <ref local="cacheManager" />
+        </property>
+        <property name="cacheName" value="decorationContentCache" />
+    </bean>
+    
+    <bean id="decorationContentCache" class="org.apache.jetspeed.cache.impl.EhDecorationContentCacheImpl">
+        <meta key="j2:cat" value="default,cache" />
+        <constructor-arg index="0">
+            <ref bean="ehDecorationContentCache" />
+        </constructor-arg>
+        <constructor-arg index="1">
+            <ref bean="preferencesCache" />
+        </constructor-arg>
+        <constructor-arg index="2">
+            <ref bean="ContentCacheKeyGenerator" />
+        </constructor-arg>
+    </bean>
+    
+    <bean id="ehDecorationConfigurationCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+        <meta key="j2:cat" value="default,cache" />
+        <property name="cacheManager">
+            <ref local="cacheManager" />
+        </property>
+        <property name="cacheName" value="decorationConfigurationCache" />
+    </bean>
+    
+    <bean id="decorationConfigurationCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
+        <meta key="j2:cat" value="default,cache" />
+        <constructor-arg>
+            <ref bean="ehDesktopContentCache" />
+        </constructor-arg>
+    </bean>
+    
+    <bean id="ehPreferencesCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+        <meta key="j2:cat" value="default,cache" />
+        <property name="cacheManager">
+            <ref local="cacheManager" />
+        </property>
+        <property name="cacheName" value="preferencesCache" />
+    </bean>
+    
+    <bean id="preferencesCache" class="org.apache.jetspeed.cache.impl.EhCacheDistributedImpl">
+        <meta key="j2:cat" value="default,cache" />
+        <constructor-arg>
+            <ref bean="ehPreferencesCache" />
+        </constructor-arg>
+    </bean>
+    
+    <bean id="ehPortletApplicationOidCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+        <meta key="j2:cat" value="default,cache" />
+        <property name="cacheManager">
+            <ref local="cacheManager" />
+        </property>
+        <property name="cacheName" value="portletApplicationOidCache" />
+    </bean>
+    
+    <bean id="ehPortletApplicationNameCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+        <meta key="j2:cat" value="default,cache" />
+        <property name="cacheManager">
+            <ref local="cacheManager" />
+        </property>
+        <property name="cacheName" value="portletApplicationNameCache" />
+    </bean>
+    
+    <bean id="ehDesktopContentCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+        <meta key="j2:cat" value="default,cache" />
+        <property name="cacheManager">
+            <ref local="cacheManager" />
+        </property>
+        <property name="cacheName" value="desktopContentCache" />
+    </bean>
+    
+    <bean id="portletApplicationOidCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
+        <meta key="j2:cat" value="default,cache" />
+        <constructor-arg>
+            <ref bean="ehPortletApplicationOidCache" />
+        </constructor-arg>
+    </bean>
+    
+    <bean id="portletApplicationNameCache" class="org.apache.jetspeed.cache.impl.EhCacheDistributedImpl">
+        <meta key="j2:cat" value="default,cache" />
+        <constructor-arg>
+            <ref bean="ehPortletApplicationNameCache" />
+        </constructor-arg>
+    </bean>
+    
+    <bean id="desktopContentCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
+        <meta key="j2:cat" value="default,cache" />
+        <constructor-arg>
+            <ref bean="ehDesktopContentCache" />
+        </constructor-arg>
+    </bean>
+    
+    <bean id="ehPortletDefinitionOidCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+        <meta key="j2:cat" value="default,cache" />
+        <property name="cacheManager">
+            <ref local="cacheManager" />
+        </property>
+        <property name="cacheName" value="portletDefinitionOidCache" />
+    </bean>
+    
+    <bean id="ehPortletDefinitionNameCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+        <meta key="j2:cat" value="default,cache" />
+        <property name="cacheManager">
+            <ref local="cacheManager" />
+        </property>
+        <property name="cacheName" value="portletDefinitionNameCache" />
+    </bean>
+    
+    
+    <bean id="portletDefinitionOidCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
+        <meta key="j2:cat" value="default,cache" />
+        <constructor-arg>
+            <ref bean="ehPortletDefinitionOidCache" />
+        </constructor-arg>
+    </bean>
+    
+    <bean id="portletDefinitionNameCache" class="org.apache.jetspeed.cache.impl.EhCacheDistributedImpl">
+        <meta key="j2:cat" value="default,cache" />
+        <constructor-arg>
+            <ref bean="ehPortletDefinitionNameCache" />
+        </constructor-arg>
+    </bean>
+    
+    <!--  Active Authentication Cache: only use with Active Authentication -->
+    <!-- Factory bean used to instantiate a EHCache with the specified name (and corresponding
+        configuration in cacheManager.xml -->
+    <bean id="ehActiveAuthenticationCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+        <meta key="j2:cat" value="default,cache" />
+        <property name="cacheManager">
+            <ref local="cacheManager" />
+        </property>
+        <property name="cacheName" value="activeAuthenticationCache" />
+    </bean>
+    
+    <bean id="activeAuthenticationCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
+        <meta key="j2:cat" value="default,cache" />
+        <constructor-arg index="0">
+            <ref bean="ehActiveAuthenticationCache" />
+        </constructor-arg>
+    </bean>
+    
+    <bean id="ehPortletWindowCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+        <meta key="j2:cat" value="default,cache" />
+        <property name="cacheManager">
+            <ref local="cacheManager" />
+        </property>
+        <property name="cacheName" value="portletWindowCache" />
+    </bean>
+    
+    <bean id="portletWindowCache" class="org.apache.jetspeed.cache.impl.EhPortletWindowCache">
+        <meta key="j2:cat" value="default,cache" />
+        <constructor-arg index="0">
+            <ref bean="ehPortletWindowCache" />
+        </constructor-arg>
+    </bean>
+    
+    <bean id="ehInternalPageFileCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+        <meta key="j2:cat" value="default,cache" />
+        <property name="cacheManager">
+            <ref local="cacheManager" />
+        </property>
+        <property name="cacheName" value="pageFileCache" />
+    </bean>
+    
+    <bean id="internalPageFileCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
+        <meta key="j2:cat" value="default,cache" />
+        <constructor-arg>
+            <ref bean="ehInternalPageFileCache" />
+        </constructor-arg>
+    </bean>
+    
+    <bean id="ehInternalImportPageFileCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+        <meta key="j2:cat" value="default,cache" />
+        <property name="cacheManager">
+            <ref local="cacheManager" />
+        </property>
+        <property name="cacheName" value="importPageFileCache" />
+    </bean>
+    
+    <bean id="internalImportPageFileCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
+        <meta key="j2:cat" value="default,cache" />
+        <constructor-arg>
+            <ref bean="ehInternalImportPageFileCache" />
+        </constructor-arg>
+    </bean>
+    
+</beans>

Propchange: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/assembly/cache-test.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/assembly/cache-test.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/assembly/page-manager.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/assembly/page-manager.xml?rev=723787&r1=723786&r2=723787&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/assembly/page-manager.xml
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/assembly/page-manager.xml
Fri Dec  5 08:50:54 2008
@@ -117,17 +117,5 @@
             <value></value>
         </constructor-arg>
     </bean>
-
-    <!-- Page File Cache -->
-    <bean id="PageFileCache" class="org.apache.jetspeed.cache.file.FileCache" init-method="startFileScanner"
destroy-method="stopFileScanner">
-        <!-- Scan rate for changes in cached files on the file system -->
-        <constructor-arg index="0">
-            <value>10</value>
-        </constructor-arg>
-        <!-- Cache size -->
-        <constructor-arg index="1">
-            <value>100</value>
-        </constructor-arg>
-    </bean>
     
 </beans>

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/TestNavigationalState.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/TestNavigationalState.java?rev=723787&r1=723786&r2=723787&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/TestNavigationalState.java
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/TestNavigationalState.java
Fri Dec  5 08:50:54 2008
@@ -43,13 +43,14 @@
 import org.apache.jetspeed.om.window.impl.PortletWindowImpl;
 import org.apache.jetspeed.test.JetspeedTestCase;
 import org.apache.jetspeed.testhelpers.SpringEngineHelper;
-import org.apache.jetspeed.util.JetspeedLongObjectID;
 import org.apache.jetspeed.container.PortletEntity;
-import org.apache.pluto.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
 import org.apache.jetspeed.container.PortletWindow;
 import org.jmock.Mock;
 import org.jmock.core.matcher.AnyArgumentsMatcher;
+import org.jmock.core.matcher.NoArgumentsMatcher;
 import org.jmock.core.stub.ReturnStub;
+import org.jmock.core.stub.VoidStub;
 
 import com.mockrunner.mock.web.MockHttpServletRequest;
 import com.mockrunner.mock.web.MockHttpSession;
@@ -101,9 +102,10 @@
         Mock entityMock = new Mock(PortletEntity.class);        
         Mock portletDefinitionMock = new Mock(PortletDefinition.class);
         Mock portletApplicationMock = new Mock(PortletApplication.class);
-        portletApplicationMock.expects(new AnyArgumentsMatcher()).method("getId").withNoArguments().will(new
ReturnStub(new JetspeedLongObjectID(1)));
-        portletDefinitionMock.expects(new AnyArgumentsMatcher()).method("getPortletApplicationDefinition").withNoArguments().will(new
ReturnStub(portletApplicationMock.proxy()));
+        portletDefinitionMock.expects(new AnyArgumentsMatcher()).method("getApplication").withNoArguments().will(new
ReturnStub(portletApplicationMock.proxy()));
+        portletApplicationMock.expects(new NoArgumentsMatcher()).method("getName").withNoArguments().will(new
ReturnStub("app1"));
         entityMock.expects(new AnyArgumentsMatcher()).method("getPortletDefinition").withNoArguments().will(new
ReturnStub(portletDefinitionMock.proxy()));
+        entityMock.expects(new AnyArgumentsMatcher()).method("setPortletWindow").withAnyArguments().will(new
VoidStub());
         PortletWindowAccessor accessor = (PortletWindowAccessor) engine.getComponentManager().getComponent(PortletWindowAccessor.class);
       
         accessor.createPortletWindow((PortletEntity)entityMock.proxy(), "111");
         accessor.createPortletWindow((PortletEntity)entityMock.proxy(), "222");
@@ -207,11 +209,11 @@
       assertTrue("window state is not set", nav.getState(window).equals(WindowState.MAXIMIZED));
       PortletWindow target = nav.getPortletWindowOfAction();
       assertNotNull("target window is null", target);
-      assertEquals("target window should equal window 111", target.getId(), "111");
+      assertEquals("target window should equal window 111", target.getId().getStringId(),
"111");
 
       PortletWindow maximizedWindow = nav.getMaximizedWindow();
       assertNotNull("maximized window is null", maximizedWindow);
-      assertEquals("maximized window should equal window 111", maximizedWindow.getId(), "111");
+      assertEquals("maximized window should equal window 111", maximizedWindow.getId().getStringId(),
"111");
 
       Iterator iter = nav.getParameterNames(target);
       assertTrue("There should be one parameter",iter.hasNext());

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/MockPortletRegistryFactory.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/MockPortletRegistryFactory.java?rev=723787&r1=723786&r2=723787&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/MockPortletRegistryFactory.java
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/MockPortletRegistryFactory.java
Fri Dec  5 08:50:54 2008
@@ -53,8 +53,11 @@
         portletSizesParamMock = new Mock(InitParam.class);
         portletSizesParam = (InitParam) portletSizesParamMock.proxy();
 
-        expectAndReturn(new InvokeAtLeastOnceMatcher(), portletSizesParamMock, "getValue",
"33%,66%");
+        expectAndReturn(new InvokeAtLeastOnceMatcher(), portletSizesParamMock, "getParamValue",
"33%,66%");
         expectAndReturn(new InvokeAtLeastOnceMatcher(), portletRegistryMock, "getPortletDefinitionByUniqueName",new
Constraint[] {new IsEqual("layout")}, portletDef);
+        expectAndReturn(new InvokeAtLeastOnceMatcher(), portletDefMock, "getInitParam", new
Constraint[] {new IsEqual("sizes")}, portletSizesParam);
+        
+        
         return portletRegistry;
     }
     

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestConstraintsAction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestConstraintsAction.java?rev=723787&r1=723786&r2=723787&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestConstraintsAction.java
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestConstraintsAction.java
Fri Dec  5 08:50:54 2008
@@ -73,7 +73,7 @@
 
     public static void main(String[] args)
     {
-        junit.swingui.TestRunner.run(TestLayout.class);
+        junit.swingui.TestRunner.run(TestConstraintsAction.class);
     }
 
     /**
@@ -93,7 +93,8 @@
         String[] appConfigs =
         { //"src/webapp/WEB-INF/assembly/layout-api.xml",
                 "src/test/assembly/test-layout-constraints-api.xml",
-                "src/test/assembly/page-manager.xml"};
+                "src/test/assembly/page-manager.xml",
+                "src/test/assembly/cache-test.xml"};
         
                 
         cm = new SpringComponentManager(null, bootConfigs, appConfigs, servletContent, getBaseDir());
@@ -121,8 +122,10 @@
         PageSecurity pageSecurity = pageManager.getPageSecurity();
         SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(defName);
         assertNotNull("definition " + defName + " not found ", def);
-        SecurityConstraint constraint =  (SecurityConstraint)def.getSecurityConstraints().get(0);
         assertNotNull("first constraint for " + defName + " not found ", def);
+        List constraints = def.getSecurityConstraints();
+        assertFalse("constraint list is empty.", constraints.isEmpty());
+        SecurityConstraint constraint =  (SecurityConstraint) constraints.get(0);
         assertEquals("update failed for constraints " + constraint.getPermissions().toString(),
constraint.getPermissions().toString(), "[view, edit]");
     }
 

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/tools/pamanager/TestPortletDescriptorSecurityRoles.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/tools/pamanager/TestPortletDescriptorSecurityRoles.java?rev=723787&r1=723786&r2=723787&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/tools/pamanager/TestPortletDescriptorSecurityRoles.java
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/tools/pamanager/TestPortletDescriptorSecurityRoles.java
Fri Dec  5 08:50:54 2008
@@ -82,59 +82,30 @@
         JetspeedDescriptorService descriptorService = new JetspeedDescriptorServiceImpl(new
PortletAppDescriptorServiceImpl());
         PortletApplicationWar paWar = new PortletApplicationWar(new DirectoryHelper(warFile),
"unit-test", "/", descriptorService );
 
-        PortletApplication app = paWar.createPortletApp();
-        assertNotNull("App is null", app);
-
-        PortletApplication portletApp = paWar.createPortletApp();
-        assertNotNull("portletApp is null", portletApp);
-
-        PortletDefinition portlet = app.getPortlet("TestPortlet");
-        assertNotNull("TestPortlet is null", portlet);
-        checkPortletApplicationSecurityRoles(portletApp);
-        checkPortletSecurityRoleRefs(portlet);
+        PortletApplication portletApp = null;
+        
         boolean validateFailed = false;
         try
         {
-            paWar.validate();
+            // From 2.2, createPortletApp() will do validation also.
+            portletApp = paWar.createPortletApp();
         }
         catch (PortletApplicationException e)
         {
             validateFailed = true;
+            portletApp = paWar.getPortletApp();
         }
         assertTrue("Invalid PortletDescriptor validation result", validateFailed);
         
-        portletApp.addSecurityRole("users.manager");
-
-        try
-        {
-            paWar.validate();
-            validateFailed = false;
-        }
-        catch (PortletApplicationException e)
-        {
-        }
-        assertEquals("Invalid PortletDescriptor validation result", false, validateFailed);
+        assertNotNull("portletApp is null", portletApp);
 
-        // persist the app
-        try
-        {
-            
-            portletRegistry.registerPortletApplication(app);
-            
-        }
-        catch (Exception e)
-        {
-            String msg = "Unable to register portlet application, " + app.getName()
-                    + ", through the portlet registry: " + e.toString();
-            
-            throw new Exception(msg, e);
-        }
-        // clear cache
+        PortletDefinition portlet = portletApp.getPortlet("TestPortlet");
+        assertNotNull("TestPortlet is null", portlet);
+        checkPortletApplicationSecurityRoles(portletApp);
+        checkPortletSecurityRoleRefs(portlet);
         
+        portletApp.addSecurityRole("users.manager");
 
-        // read back in
-        app = portletRegistry.getPortletApplication("unit-test");
-        validateFailed = true;
         try
         {
             paWar.validate();
@@ -143,21 +114,7 @@
         catch (PortletApplicationException e)
         {
         }
-        assertEquals("Invalid loaded PortletDescriptor validation result", false, validateFailed);
-
-        // remove the app
-        try
-        {
-            
-            portletRegistry.removeApplication(app);
-            
-        }
-        catch (Exception e)
-        {
-            String msg = "Unable to remove portlet application, " + app.getName()
-                    + ", through the portlet portletRegistry: " + e.toString();
-            throw new Exception(msg, e);
-        }
+        assertEquals("Invalid PortletDescriptor validation result", false, validateFailed);
 
     }
 

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/TestUserInfoManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/TestUserInfoManager.java?rev=723787&r1=723786&r2=723787&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/TestUserInfoManager.java
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/TestUserInfoManager.java
Fri Dec  5 08:50:54 2008
@@ -17,11 +17,11 @@
 package org.apache.jetspeed.userinfo;
 
 import java.io.FileInputStream;
-import java.io.FileReader;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import javax.portlet.PortletRequest;
@@ -97,7 +97,10 @@
         ClassLoader paClassLoader = Thread.currentThread().getContextClassLoader();
         portletApp = descriptorService.read(webDescriptor, portletDescriptor, jetspeedPortletDescriptor,
paClassLoader);
         assertNotNull("App is null", portletApp);
-
+        
+        portletApp.setName("TestRegistry");
+        portletApp.setContextRoot("/TestRegistry");
+        
         // persist the app
         try
         {
@@ -123,8 +126,8 @@
         request = initRequestContext("test");
         userInfo = uim.getUserInfoMap(portletApp.getName(), request);
         assertNotNull(PortletRequest.USER_INFO + " should not be null", userInfo);
-        assertEquals("should contain user.name.given", "Test Dude", (String) userInfo.get("user.name.given"));
-        assertEquals("should contain user.name.family", "Dudley", (String) userInfo.get("user.name.family"));
+        assertEquals("should contain user-name-given", "Test Dude", (String) userInfo.get("user-name-given"));
+        assertEquals("should contain user-name-family", "Dudley", (String) userInfo.get("user-name-family"));
         assertNull("should not contain user.home-info.online.email", userInfo.get("user.home-info.online.email"));
 
         // persist the app
@@ -180,9 +183,8 @@
             assertTrue("user exists. should not have thrown an exception.", false);
         }
         
-        SecurityAttributes attributes = user.getSecurityAttributes();
-        attributes.getAttribute("user.name.given", true).setStringValue("Test Dude");
-        attributes.getAttribute("user.name.family", true).setStringValue("Dudley");
+        user.getSecurityAttributes().getAttribute("user.name.given", true).setStringValue("Test
Dude");
+        user.getSecurityAttributes().getAttribute("user.name.family", true).setStringValue("Dudley");
         
         ums.updateUser(user);
     }

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/window/TestWindows.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/window/TestWindows.java?rev=723787&r1=723786&r2=723787&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/window/TestWindows.java
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/window/TestWindows.java
Fri Dec  5 08:50:54 2008
@@ -16,7 +16,6 @@
  */
 package org.apache.jetspeed.window;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 
@@ -33,16 +32,15 @@
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.ContentFragmentImpl;
-import org.apache.jetspeed.util.JetspeedObjectID;
 import org.apache.jetspeed.container.PortletEntity;
 import org.apache.jetspeed.container.PortletWindow;
 import org.jmock.Mock;
 import org.jmock.core.Invocation;
 import org.jmock.core.InvocationMatcher;
 import org.jmock.core.matcher.InvokeAtLeastOnceMatcher;
-import org.jmock.core.matcher.InvokeOnceMatcher;
 import org.jmock.core.stub.CustomStub;
 import org.jmock.core.stub.ReturnStub;
+import org.jmock.core.stub.VoidStub;
 
 /**
  * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
@@ -54,7 +52,6 @@
     protected Mock fragMock;
     protected Mock entityAccessMock;
     protected Mock entityMock;
-    protected Mock windowListMock;
 
     public static Test suite()
     {
@@ -81,7 +78,6 @@
 
     public void testWindowAccess() throws Exception
     {
-        List windows = new ArrayList();
         ContentFragment f1 = new ContentFragmentImpl((Fragment) fragMock.proxy(), new HashMap());
         PortletEntity entity = (PortletEntity) entityMock.proxy();
         entityAccessMock.expects(new InvokeAtLeastOnceMatcher()).method("getPortletEntityForFragment")
@@ -89,25 +85,13 @@
         fragMock.expects(new InvokeAtLeastOnceMatcher()).method("getId").withNoArguments()
                 .will(new ReturnStub("frag1"));
         entityMock.expects(new InvokeAtLeastOnceMatcher()).method("getId").withNoArguments().will(
-            new ReturnStub(new JetspeedObjectID("entity1")));
-
-        windowListMock.expects(new InvokeCountMatcher(4)).method("add").withAnyArguments().will(
-                new ListAppendStub(windows));
-        
+            new ReturnStub("entity1"));
+        entityMock.expects(new InvokeAtLeastOnceMatcher()).method("setPortletWindow").withAnyArguments().will(new
VoidStub());
 
         PortletWindow window = windowAccess.getPortletWindow(f1);
         assertNotNull(window);
         assertEquals("frag1", window.getId().toString());
 
-        // Make sure the portlet entity's window list got updated
-        assertEquals(1, windows.size());
-
-        PortletWindow windowInList = (PortletWindow) windows.get(0);
-
-        // The window in the entities list should be the same as the one
-        // returned by getPortletWindow(f1)
-        assertEquals(windowInList, window);
-
         // remove the window
         windowAccess.removeWindow(window);
 
@@ -120,10 +104,8 @@
         // Test same remove but via entity
         windowAccess.removeWindow(window);              
 
-        assertNotNull(windowAccess.getPortletWindow(f1));                
+        assertNotNull(windowAccess.getPortletWindow(f1));
         
-        windowListMock.expects(new InvokeOnceMatcher()).method("iterator").withNoArguments().will(new
ReturnStub(windows.iterator()));
-
 /*        
         windowAccess.removeWindows(entity);  
         

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/resources/rc3.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/resources/rc3.xml?rev=723787&r1=723786&r2=723787&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/resources/rc3.xml
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/resources/rc3.xml
Fri Dec  5 08:50:54 2008
@@ -19,13 +19,38 @@
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
     
-    <bean id="org.apache.jetspeed.request.RequestContextComponent" class="org.apache.jetspeed.request.JetspeedRequestContextComponent">
-        <constructor-arg>
-            <value>org.apache.jetspeed.request.JetspeedRequestContext</value>
-        </constructor-arg>
-        <constructor-arg>
-            <ref bean="org.apache.jetspeed.userinfo.UserInfoManager" />
-        </constructor-arg>
-    </bean>
+  <!-- Request Context -->
+  <bean id="org.apache.jetspeed.request.RequestContextComponent"
+    class="org.apache.jetspeed.request.JetspeedRequestContextComponent">
+    <constructor-arg index='0'><ref bean="ServletRequestFactory" /></constructor-arg>
+    <constructor-arg index='1'><ref bean="ServletResponseFactory" /></constructor-arg>
+    <constructor-arg index='2'><ref bean="org.apache.jetspeed.userinfo.UserInfoManager"
/></constructor-arg>
+    <constructor-arg index='3'><ref bean="RequestContextObjects" /></constructor-arg>
+  </bean>
+  
+  <bean id="RequestContextObjects" class="java.util.HashMap">
+    <constructor-arg index="0">
+      <map>
+        <!-- 
+          <entry key="myObject">
+          <ref bean="org.me.MyObject" />
+          </entry>
+        -->
+      </map>
+    </constructor-arg>
+  </bean>
+
+  <bean id="ServletRequestFactory" name="javax.servlet.http.HttpServletRequest"
+    class="org.apache.jetspeed.engine.servlet.ServletRequestFactoryImpl">
+    <constructor-arg><ref bean="org.apache.pluto.services.NamespaceMapper"/></constructor-arg>
 </bean>
+
+  <bean id="ServletResponseFactory" name="javax.servlet.http.HttpServletResponse"
+    class="org.apache.jetspeed.engine.servlet.ServletResponseFactoryImpl">
+  </bean>
+  
+  <bean id="org.apache.pluto.services.NamespaceMapper"
+    class="org.apache.jetspeed.container.namespace.JetspeedNamespaceMapperImpl">
+    <constructor-arg index="0"><value>js_</value></constructor-arg>
+  </bean>
 
 </beans>

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/jetspeed-portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/jetspeed-portlet.xml?rev=723787&r1=723786&r2=723787&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/jetspeed-portlet.xml
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/jetspeed-portlet.xml
Fri Dec  5 08:50:54 2008
@@ -96,12 +96,14 @@
     </js:services>
     
     <js:user-attribute-ref>
-		<js:name>user-name-given</js:name>
-		<js:name-link>user.name.given</js:name-link>
+    	<js:description>User Given Name</js:description>
+  		<js:name>user-name-given</js:name>
+  		<js:name-link>user.name.given</js:name-link>
   	</js:user-attribute-ref>
   	<js:user-attribute-ref>
-		<js:name>user-name-family</js:name>
-		<js:name-link>user.name.family</js:name-link>
+    	<js:description>User Last Name</js:description>
+  		<js:name>user-name-family</js:name>
+  		<js:name-link>user.name.family</js:name-link>
   	</js:user-attribute-ref>
 
 </portlet-app>

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/portlet.xml?rev=723787&r1=723786&r2=723787&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/portlet.xml
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/portlet.xml
Fri Dec  5 08:50:54 2008
@@ -107,16 +107,16 @@
   </portlet>
   
   <user-attribute>
-	<description>User Given Name</description>
-	<name>user.name.given</name>
+  	<description>User Given Name</description>
+  	<name>user.name.given</name>
   </user-attribute>
   <user-attribute>
-	<description>User Last Name</description>
-	<name>user.name.family</name>
+  	<description>User Last Name</description>
+  	<name>user.name.family</name>
   </user-attribute>
   <user-attribute>
-	<description>User eMail</description>
-	<name>user.home-info.online.email</name>
+  	<description>User eMail</description>
+  	<name>user.home-info.online.email</name>
   </user-attribute>
   
  </portlet-app>

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/web.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/web.xml?rev=723787&r1=723786&r2=723787&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/web.xml
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/web.xml
Fri Dec  5 08:50:54 2008
@@ -15,9 +15,8 @@
 See the License for the specific language governing permissions and
 limitations under the License.
 -->
-<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
-                         "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
-<web-app>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.4"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
   <display-name>Jetspeed Container Application</display-name>
   <description>MVC Servlet for Jetspeed Portlet Applications</description>
   <servlet>

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/webapp/WEB-INF/portlet.xml?rev=723787&r1=723786&r2=723787&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/webapp/WEB-INF/portlet.xml
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/testdata/deploy/webapp/WEB-INF/portlet.xml
Fri Dec  5 08:50:54 2008
@@ -15,7 +15,10 @@
 See the License for the specific language governing permissions and
 limitations under the License.
 -->
-<portlet-app id="TestSecurityRoles" version="1.0">
+<portlet-app id="TestSecurityRoles" 
+    xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
   
  <portlet id="TestPortlet">
     <portlet-name>TestPortlet</portlet-name>
     <portlet-class>org.apache.jetspeed.portlet.helloworld.HelloWorld</portlet-class>



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