You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by at...@apache.org on 2008/03/24 04:00:36 UTC
svn commit: r640297 - in
/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test:
assembly/ java/org/apache/jetspeed/layout/
Author: ate
Date: Sun Mar 23 20:00:35 2008
New Revision: 640297
URL: http://svn.apache.org/viewvc?rev=640297&view=rev
Log:
Fxing TestPortletPlacement and TestLayout tests
Added:
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/MockPortletRegistryFactory.java (with props)
Modified:
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/assembly/test-layout-api.xml
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/ (props changed)
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/FragmentUtil.java
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestLayout.java
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestPortletPlacement.java
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/assembly/test-layout-api.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/assembly/test-layout-api.xml?rev=640297&r1=640296&r2=640297&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/assembly/test-layout-api.xml (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/assembly/test-layout-api.xml Sun Mar 23 20:00:35 2008
@@ -1,228 +1,251 @@
-<?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
- 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.
+ 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.
-->
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
-<!-- AJAX Actions
-
- == Constructor Arguments ==
- index 0 = render response VM template, generates XML NORMAL response
- index 1 = render response VM template, generates XML ERROR response
- index 1 = action name from AJAX Request
-
- -->
-
-<!--bean id="PortletActionSecurityBehavior"
- class="org.apache.jetspeed.layout.impl.PortletActionSecurityPathBehavior">
- <constructor-arg index='0'>
- <ref bean="org.apache.jetspeed.page.PageManager"/>
- </constructor-arg>
-</bean-->
-
-<bean id="AjaxMovePortletAbsolute"
- class="org.apache.jetspeed.layout.impl.MovePortletAction">
- <constructor-arg index="0">
- <value>org/apache/jetspeed/layout/ajax-xml/move.vm</value>
- </constructor-arg>
- <constructor-arg index="1">
- <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
- </constructor-arg>
- <constructor-arg index="2">
- <value>moveabs</value>
- </constructor-arg>
- <!--constructor-arg index='3'>
- <ref bean="org.apache.jetspeed.page.PageManager"/>
- </constructor-arg>
- <constructor-arg index='4'>
- <ref bean="PortletActionSecurityBehavior"/>
- </constructor-arg-->
-</bean>
-
-<bean id="AjaxMovePortletLeft"
- class="org.apache.jetspeed.layout.impl.MovePortletAction">
- <constructor-arg index="0">
- <value>org/apache/jetspeed/layout/ajax-xml/move.vm</value>
- </constructor-arg>
- <constructor-arg index="1">
- <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
- </constructor-arg>
- <constructor-arg index="2">
- <value>moveleft</value>
- </constructor-arg>
- <!-- constructor-arg index='3'>
- <ref bean="org.apache.jetspeed.page.PageManager"/>
- </constructor-arg>
- <constructor-arg index='4'>
- <ref bean="PortletActionSecurityBehavior"/>
- </constructor-arg-->
-</bean>
-
-<bean id="AjaxMovePortletRight"
- class="org.apache.jetspeed.layout.impl.MovePortletAction">
- <constructor-arg index="0">
- <value>org/apache/jetspeed/layout/ajax-xml/move.vm</value>
- </constructor-arg>
- <constructor-arg index="1">
- <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
- </constructor-arg>
- <constructor-arg index="2">
- <value>moveright</value>
- </constructor-arg>
- <!-- constructor-arg index='3'>
- <ref bean="org.apache.jetspeed.page.PageManager"/>
- </constructor-arg>
- <constructor-arg index='4'>
- <ref bean="PortletActionSecurityBehavior"/>
- </constructor-arg-->
-</bean>
-
-<bean id="AjaxMovePortletUp"
- class="org.apache.jetspeed.layout.impl.MovePortletAction">
- <constructor-arg index="0">
- <value>org/apache/jetspeed/layout/ajax-xml/move.vm</value>
- </constructor-arg>
- <constructor-arg index="1">
- <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
- </constructor-arg>
- <constructor-arg index="2">
- <value>moveup</value>
- </constructor-arg>
- <!-- constructor-arg index='3'>
- <ref bean="org.apache.jetspeed.page.PageManager"/>
- </constructor-arg>
- <constructor-arg index='4'>
- <ref bean="PortletActionSecurityBehavior"/>
- </constructor-arg-->
-</bean>
-
-<bean id="AjaxMovePortletDown"
- class="org.apache.jetspeed.layout.impl.MovePortletAction">
- <constructor-arg index="0">
- <value>org/apache/jetspeed/layout/ajax-xml/move.vm</value>
- </constructor-arg>
- <constructor-arg index="1">
- <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
- </constructor-arg>
- <constructor-arg index="2">
- <value>movedown</value>
- </constructor-arg>
- <!-- constructor-arg index='3'>
- <ref bean="org.apache.jetspeed.page.PageManager"/>
- </constructor-arg>
- <constructor-arg index='4'>
- <ref bean="PortletActionSecurityBehavior"/>
- </constructor-arg-->
-</bean>
-
-<bean id="AjaxAddPortlet"
- class="org.apache.jetspeed.layout.impl.AddPortletAction">
- <constructor-arg index="0">
- <value>org/apache/jetspeed/layout/ajax-xml/add.vm</value>
- </constructor-arg>
- <constructor-arg index="1">
- <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
- </constructor-arg>
- <constructor-arg index='2'>
- <ref bean="AjaxGetPortlets"/>
- </constructor-arg>
- <!-- constructor-arg index='2'>
- <ref bean="org.apache.jetspeed.page.PageManager"/>
- </constructor-arg>
- <constructor-arg index='3'>
- <ref bean="PortletActionSecurityBehavior"/>
- </constructor-arg-->
-</bean>
-
-<bean id="AjaxRemovePortlet"
- class="org.apache.jetspeed.layout.impl.RemovePortletAction">
- <constructor-arg index="0">
- <value>org/apache/jetspeed/layout/ajax-xml/remove.vm</value>
- </constructor-arg>
- <constructor-arg index="1">
- <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
- </constructor-arg>
- <!-- constructor-arg index='2'>
- <ref bean="org.apache.jetspeed.page.PageManager"/>
- </constructor-arg>
- <constructor-arg index='3'>
- <ref bean="PortletActionSecurityBehavior"/>
- </constructor-arg-->
-</bean>
-
-
-<bean id="AjaxRequestService" class="org.apache.jetspeed.ajax.AjaxRequestServiceImpl">
- <constructor-arg index="0">
- <map>
- <entry key="moveabs">
- <ref bean="AjaxMovePortletAbsolute"/>
- </entry>
- <entry key="moveleft">
- <ref bean="AjaxMovePortletLeft"/>
- </entry>
- <entry key="moveright">
- <ref bean="AjaxMovePortletRight"/>
- </entry>
- <entry key="moveup">
- <ref bean="AjaxMovePortletUp"/>
- </entry>
- <entry key="movedown">
- <ref bean="AjaxMovePortletDown"/>
- </entry>
- <entry key="add">
- <ref bean="AjaxAddPortlet"/>
- </entry>
- <entry key="remove">
- <ref bean="AjaxRemovePortlet"/>
- </entry>
- </map>
- </constructor-arg>
- <constructor-arg index="1">
- <ref bean="AjaxVelocityEngine"/>
- </constructor-arg>
-</bean>
-
-<bean id="AjaxVelocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
- <property name="velocityProperties">
- <props>
- <prop key="resource.loader">class</prop>
- <prop key="class.resource.loader.class">
- org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
- </prop>
- </props>
- </property>
- </bean>
-
- <bean id="layoutValve"
- class="org.apache.jetspeed.layout.impl.LayoutValve"
- init-method="initialize">
- <constructor-arg index="0">
- <ref bean="AjaxRequestService"/>
- </constructor-arg>
- </bean>
-
-<bean id="AjaxGetPortlets"
- class="org.apache.jetspeed.layout.impl.GetPortletsAction">
- <constructor-arg index="0">
- <value>org/apache/jetspeed/layout/ajax-xml/getportlets.vm</value>
- </constructor-arg>
- <constructor-arg index="1">
- <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
- </constructor-arg>
-</bean>
-
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+<beans>
+
+ <!-- AJAX Actions
+
+ == Constructor Arguments ==
+ index 0 = render response VM template, generates XML NORMAL response
+ index 1 = render response VM template, generates XML ERROR response
+ index 1 = action name from AJAX Request
+
+ -->
+
+ <!--bean id="PortletActionSecurityBehavior"
+ class="org.apache.jetspeed.layout.impl.PortletActionSecurityPathBehavior">
+ <constructor-arg index='0'>
+ <ref bean="org.apache.jetspeed.page.PageManager"/>
+ </constructor-arg>
+ </bean-->
+
+ <bean id="mockPortletRegistry" class="org.apache.jetspeed.layout.MockPortletRegistryFactory" factory-method="createMockPortletRegistry"/>
+
+ <bean id="AjaxMovePortletAbsolute"
+ class="org.apache.jetspeed.layout.impl.MovePortletAction">
+ <constructor-arg index="0">
+ <value>org/apache/jetspeed/layout/ajax-xml/move.vm</value>
+ </constructor-arg>
+ <constructor-arg index="1">
+ <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
+ </constructor-arg>
+ <constructor-arg index="2">
+ <ref bean="mockPortletRegistry"/>
+ </constructor-arg>
+ <constructor-arg index="3">
+ <value>moveabs</value>
+ </constructor-arg>
+ <!--constructor-arg index='3'>
+ <ref bean="org.apache.jetspeed.page.PageManager"/>
+ </constructor-arg>
+ <constructor-arg index='4'>
+ <ref bean="PortletActionSecurityBehavior"/>
+ </constructor-arg-->
+ </bean>
+
+ <bean id="AjaxMovePortletLeft"
+ class="org.apache.jetspeed.layout.impl.MovePortletAction">
+ <constructor-arg index="0">
+ <value>org/apache/jetspeed/layout/ajax-xml/move.vm</value>
+ </constructor-arg>
+ <constructor-arg index="1">
+ <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
+ </constructor-arg>
+ <constructor-arg index="2">
+ <ref bean="mockPortletRegistry"/>
+ </constructor-arg>
+ <constructor-arg index="3">
+ <value>moveleft</value>
+ </constructor-arg>
+ <!-- constructor-arg index='3'>
+ <ref bean="org.apache.jetspeed.page.PageManager"/>
+ </constructor-arg>
+ <constructor-arg index='4'>
+ <ref bean="PortletActionSecurityBehavior"/>
+ </constructor-arg-->
+ </bean>
+
+ <bean id="AjaxMovePortletRight"
+ class="org.apache.jetspeed.layout.impl.MovePortletAction">
+ <constructor-arg index="0">
+ <value>org/apache/jetspeed/layout/ajax-xml/move.vm</value>
+ </constructor-arg>
+ <constructor-arg index="1">
+ <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
+ </constructor-arg>
+ <constructor-arg index="2">
+ <ref bean="mockPortletRegistry"/>
+ </constructor-arg>
+ <constructor-arg index="3">
+ <value>moveright</value>
+ </constructor-arg>
+ <!-- constructor-arg index='3'>
+ <ref bean="org.apache.jetspeed.page.PageManager"/>
+ </constructor-arg>
+ <constructor-arg index='4'>
+ <ref bean="PortletActionSecurityBehavior"/>
+ </constructor-arg-->
+ </bean>
+
+ <bean id="AjaxMovePortletUp"
+ class="org.apache.jetspeed.layout.impl.MovePortletAction">
+ <constructor-arg index="0">
+ <value>org/apache/jetspeed/layout/ajax-xml/move.vm</value>
+ </constructor-arg>
+ <constructor-arg index="1">
+ <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
+ </constructor-arg>
+ <constructor-arg index="2">
+ <ref bean="mockPortletRegistry"/>
+ </constructor-arg>
+ <constructor-arg index="3">
+ <value>moveup</value>
+ </constructor-arg>
+ <!-- constructor-arg index='3'>
+ <ref bean="org.apache.jetspeed.page.PageManager"/>
+ </constructor-arg>
+ <constructor-arg index='4'>
+ <ref bean="PortletActionSecurityBehavior"/>
+ </constructor-arg-->
+ </bean>
+
+ <bean id="AjaxMovePortletDown"
+ class="org.apache.jetspeed.layout.impl.MovePortletAction">
+ <constructor-arg index="0">
+ <value>org/apache/jetspeed/layout/ajax-xml/move.vm</value>
+ </constructor-arg>
+ <constructor-arg index="1">
+ <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
+ </constructor-arg>
+ <constructor-arg index="2">
+ <ref bean="mockPortletRegistry"/>
+ </constructor-arg>
+ <constructor-arg index="3">
+ <value>movedown</value>
+ </constructor-arg>
+ <!-- constructor-arg index='3'>
+ <ref bean="org.apache.jetspeed.page.PageManager"/>
+ </constructor-arg>
+ <constructor-arg index='4'>
+ <ref bean="PortletActionSecurityBehavior"/>
+ </constructor-arg-->
+ </bean>
+
+ <bean id="AjaxAddPortlet"
+ class="org.apache.jetspeed.layout.impl.AddPortletAction">
+ <constructor-arg index="0">
+ <value>org/apache/jetspeed/layout/ajax-xml/add.vm</value>
+ </constructor-arg>
+ <constructor-arg index="1">
+ <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
+ </constructor-arg>
+ <constructor-arg index="2">
+ <ref bean="mockPortletRegistry"/>
+ </constructor-arg>
+ <constructor-arg index='3'>
+ <ref bean="AjaxGetPortlets"/>
+ </constructor-arg>
+ <!-- constructor-arg index='2'>
+ <ref bean="org.apache.jetspeed.page.PageManager"/>
+ </constructor-arg>
+ <constructor-arg index='3'>
+ <ref bean="PortletActionSecurityBehavior"/>
+ </constructor-arg-->
+ </bean>
+
+ <bean id="AjaxRemovePortlet"
+ class="org.apache.jetspeed.layout.impl.RemovePortletAction">
+ <constructor-arg index="0">
+ <value>org/apache/jetspeed/layout/ajax-xml/remove.vm</value>
+ </constructor-arg>
+ <constructor-arg index="1">
+ <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
+ </constructor-arg>
+ <constructor-arg index="2">
+ <ref bean="mockPortletRegistry"/>
+ </constructor-arg>
+ <!-- constructor-arg index='2'>
+ <ref bean="org.apache.jetspeed.page.PageManager"/>
+ </constructor-arg>
+ <constructor-arg index='3'>
+ <ref bean="PortletActionSecurityBehavior"/>
+ </constructor-arg-->
+ </bean>
+
+
+ <bean id="AjaxRequestService" class="org.apache.jetspeed.ajax.AjaxRequestServiceImpl">
+ <constructor-arg index="0">
+ <map>
+ <entry key="moveabs">
+ <ref bean="AjaxMovePortletAbsolute"/>
+ </entry>
+ <entry key="moveleft">
+ <ref bean="AjaxMovePortletLeft"/>
+ </entry>
+ <entry key="moveright">
+ <ref bean="AjaxMovePortletRight"/>
+ </entry>
+ <entry key="moveup">
+ <ref bean="AjaxMovePortletUp"/>
+ </entry>
+ <entry key="movedown">
+ <ref bean="AjaxMovePortletDown"/>
+ </entry>
+ <entry key="add">
+ <ref bean="AjaxAddPortlet"/>
+ </entry>
+ <entry key="remove">
+ <ref bean="AjaxRemovePortlet"/>
+ </entry>
+ </map>
+ </constructor-arg>
+ <constructor-arg index="1">
+ <ref bean="AjaxVelocityEngine"/>
+ </constructor-arg>
+ </bean>
+
+ <bean id="AjaxVelocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
+ <property name="velocityProperties">
+ <props>
+ <prop key="resource.loader">class</prop>
+ <prop key="class.resource.loader.class">
+ org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+ </prop>
+ </props>
+ </property>
+ </bean>
+
+ <bean id="layoutValve"
+ class="org.apache.jetspeed.layout.impl.LayoutValve"
+ init-method="initialize">
+ <constructor-arg index="0">
+ <ref bean="AjaxRequestService"/>
+ </constructor-arg>
+ </bean>
+
+ <bean id="AjaxGetPortlets"
+ class="org.apache.jetspeed.layout.impl.GetPortletsAction">
+ <constructor-arg index="0">
+ <value>org/apache/jetspeed/layout/ajax-xml/getportlets.vm</value>
+ </constructor-arg>
+ <constructor-arg index="1">
+ <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
+ </constructor-arg>
+ </bean>
+
</beans>
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Mar 23 20:00:35 2008
@@ -1,2 +1,2 @@
-target
+target
surefire*.properties
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/FragmentUtil.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/FragmentUtil.java?rev=640297&r1=640296&r2=640297&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/FragmentUtil.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/FragmentUtil.java Sun Mar 23 20:00:35 2008
@@ -46,25 +46,7 @@
// Build a request object and populate it with fragments
RequestContext a_oRC = setupRequestContext("remove", "1234", "0", "0");
- // Build some fragments and add them to the request context
- // Prepare some fragments
- Fragment a_oLayout = buildFragment("layout", "6", "layout", 0, 0);
- Fragment a_oFrag1 = buildFragment("frag1", "1", "portlet", 1, 0);
- Fragment a_oFrag2 = buildFragment("frag2", "2", "portlet", 1, 1);
- Fragment a_oFrag3 = buildFragment("frag3", "3", "portlet", 2, 0);
- Fragment a_oFrag4 = buildFragment("frag4", "4", "portlet", 2, 1);
- Fragment a_oFrag5 = buildFragment("frag5", "5", "portlet", 2, 2);
-
- LocalFragmentImpl a_oLocalLayout = (LocalFragmentImpl) a_oLayout;
- a_oLocalLayout.addFragment(a_oFrag1);
- a_oLocalLayout.addFragment(a_oFrag2);
- a_oLocalLayout.addFragment(a_oFrag3);
- a_oLocalLayout.addFragment(a_oFrag4);
- a_oLocalLayout.addFragment(a_oFrag5);
-
- Page a_oPage = new PageImpl();
- a_oPage.setRootFragment(a_oLayout);
- ContentPage a_oContentPage = new ContentPageImpl(a_oPage);
+ ContentPage a_oContentPage = new ContentPageImpl(setupPage());
a_oRC.setPage(a_oContentPage);
return a_oRC;
@@ -122,12 +104,12 @@
{
// Prepare some fragments
Fragment a_oLayout = buildFragment("layout", "6", "layout", 0, 0);
- Fragment a_oFrag1 = buildFragment("frag1", "1", "portlet", 1, 0);
- Fragment a_oFrag2 = buildFragment("frag2", "2", "portlet", 1, 1);
- Fragment a_oFrag3 = buildFragment("frag3", "3", "portlet", 2, 0);
- Fragment a_oFrag4 = buildFragment("frag4", "4", "portlet", 2, 1);
- Fragment a_oFrag5 = buildFragment("frag5", "5", "portlet", 2, 2);
-
+ Fragment a_oFrag1 = buildFragment("frag1", "1", "portlet", 0, 0);
+ Fragment a_oFrag2 = buildFragment("frag2", "2", "portlet", 0, 1);
+ Fragment a_oFrag3 = buildFragment("frag3", "3", "portlet", 1, 0);
+ Fragment a_oFrag4 = buildFragment("frag4", "4", "portlet", 1, 1);
+ Fragment a_oFrag5 = buildFragment("frag5", "5", "portlet", 1, 2);
+
LocalFragmentImpl a_oLocalLayout = (LocalFragmentImpl) a_oLayout;
a_oLocalLayout.addFragment(a_oFrag1);
a_oLocalLayout.addFragment(a_oFrag2);
@@ -158,6 +140,12 @@
MockHttpServletResponse mr = (MockHttpServletResponse) rc.getResponse();
String content = mr.getOutputStreamContent();
System.out.println("content = " + content);
+ }
+
+ public static String getContentOutput(RequestContext rc)
+ {
+ MockHttpServletResponse mr = (MockHttpServletResponse) rc.getResponse();
+ return mr.getOutputStreamContent();
}
}
Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/MockPortletRegistryFactory.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/MockPortletRegistryFactory.java?rev=640297&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/MockPortletRegistryFactory.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/MockPortletRegistryFactory.java Sun Mar 23 20:00:35 2008
@@ -0,0 +1,80 @@
+/*
+ * 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.layout;
+
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
+import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
+import org.apache.pluto.om.common.Parameter;
+import org.apache.pluto.om.common.ParameterSet;
+import org.jmock.Mock;
+import org.jmock.core.Constraint;
+import org.jmock.core.InvocationMatcher;
+import org.jmock.core.constraint.IsEqual;
+import org.jmock.core.matcher.InvokeAtLeastOnceMatcher;
+import org.jmock.core.stub.ReturnStub;
+
+/**
+ * @version $Id$
+ *
+ */
+public class MockPortletRegistryFactory
+{
+ public static PortletRegistry createMockPortletRegistry()
+ {
+ Mock portletRegistryMock;
+ PortletRegistry portletRegistry;
+ Mock portletDefMock;
+ PortletDefinitionComposite portletDef;
+ Mock portletDefInitParamsMock;
+ ParameterSet portletDefInitParams;
+
+ Mock portletSizesParamMock;
+ Parameter portletSizesParam;
+
+ portletRegistryMock = new Mock(PortletRegistry.class);
+ portletRegistry = (PortletRegistry) portletRegistryMock.proxy();
+
+ portletDefMock = new Mock(PortletDefinitionComposite.class);
+ portletDef = (PortletDefinitionComposite) portletDefMock.proxy();
+
+ portletDefInitParamsMock = new Mock(ParameterSet.class);
+ portletDefInitParams = (ParameterSet) portletDefInitParamsMock.proxy();
+
+ portletSizesParamMock = new Mock(Parameter.class);
+ portletSizesParam = (Parameter) portletSizesParamMock.proxy();
+
+ expectAndReturn(new InvokeAtLeastOnceMatcher(), portletSizesParamMock, "getValue", "33%,66%");
+ expectAndReturn(new InvokeAtLeastOnceMatcher(), portletDefInitParamsMock, "get",new Constraint[] {new IsEqual("sizes")}, portletSizesParam);
+ expectAndReturn(new InvokeAtLeastOnceMatcher(), portletDefMock, "getInitParameterSet", portletDefInitParams);
+ expectAndReturn(new InvokeAtLeastOnceMatcher(), portletRegistryMock, "getPortletDefinitionByUniqueName",new Constraint[] {new IsEqual("layout")}, portletDef);
+ return portletRegistry;
+ }
+
+ protected static void expectAndReturn(InvocationMatcher matcher, Mock mock, String methodName, Constraint[] constraints, Object returnValue)
+ {
+ mock.expects(matcher).method(methodName)
+ .with(constraints)
+ .will(new ReturnStub(returnValue));
+ }
+
+ protected static void expectAndReturn(InvocationMatcher matcher, Mock mock, String methodName, Object returnValue)
+ {
+ mock.expects(matcher).method(methodName)
+ .withNoArguments()
+ .will(new ReturnStub(returnValue));
+ }
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/MockPortletRegistryFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/MockPortletRegistryFactory.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/MockPortletRegistryFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestLayout.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestLayout.java?rev=640297&r1=640296&r2=640297&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestLayout.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestLayout.java Sun Mar 23 20:00:35 2008
@@ -154,105 +154,102 @@
public void testEasy()
{
- moveSuccess("moveabs", "1", "1", "0", "1", "1", "1", "1"); // Move down
- moveSuccess("moveright", "1", "1", "0", "2", "0", "2", "0"); // Straight across
+ moveSuccess("moveabs", "1", "0", "0", "0", "1", "0", "1"); // Move down
+ moveSuccess("moveright", "1", "0", "0", "1", "0", "1", "0"); // Straight across
}
public void testMoveSuccess()
{
- moveSuccess("moveabs", "1", "1", "0", "1", "0", "1", "0"); // Doesn't
+ moveSuccess("moveabs", "1", "0", "0", "0", "0", "-1", "-1"); // Doesn't
// really
// move
- moveSuccess("moveabs", "1", "1", "0", "1", "1", "1", "1"); // Move down
+ moveSuccess("moveabs", "1", "0", "0", "0", "1", "0", "1"); // Move down
- moveSuccess("moveabs", "2", "1", "1", "1", "0", "1", "0"); // Move up
- moveSuccess("moveabs", "1", "1", "0", "2", "0", "2", "0"); // Move
+ moveSuccess("moveabs", "2", "0", "1", "0", "0", "0", "0"); // Move up
+ moveSuccess("moveabs", "1", "0", "0", "1", "0", "1", "0"); // Move
// right
- moveSuccess("moveabs", "3", "2", "0", "1", "0", "1", "0"); // Move left
- moveSuccess("moveabs", "2", "1", "1", "2", "2", "2", "2"); // Move
+ moveSuccess("moveabs", "3", "1", "0", "0", "0", "0", "0"); // Move left
+ moveSuccess("moveabs", "2", "0", "1", "1", "2", "1", "2"); // Move
// right &
// move down
- moveSuccess("moveabs", "3", "2", "0", "1", "1", "1", "1"); // Move left
+ moveSuccess("moveabs", "3", "1", "0", "0", "1", "0", "1"); // Move left
// & move
// down
- moveSuccess("moveabs", "4", "2", "1", "1", "0", "1", "0"); // Move left
+ moveSuccess("moveabs", "4", "1", "1", "0", "0", "0", "0"); // Move left
// & move up
- moveSuccess("moveabs", "1", "1", "0", "1", "2", "1", "1"); // Move too
+ moveSuccess("moveabs", "1", "0", "0", "0", "2", "0", "1"); // Move too
// far down,
// should be
// at end of
// row
- moveSuccess("moveabs", "2", "1", "1", "1", "2", "1", "1"); // Move too
+ moveSuccess("moveabs", "2", "0", "1", "0", "2", "-1", "-1"); // Move too
// far down,
- // should be
- // at end of
- // row
- moveSuccess("moveabs", "3", "2", "0", "2", "3", "2", "2"); // Move too
+ // shouldn't
+ // move
+ moveSuccess("moveabs", "3", "1", "0", "1", "3", "1", "2"); // Move too
// far down,
// should be
// at end of
// row
- moveSuccess("moveabs", "4", "2", "1", "2", "3", "2", "2"); // Move too
+ moveSuccess("moveabs", "4", "1", "1", "1", "3", "1", "2"); // Move too
// far down,
// should be
// at end of
// row
- moveSuccess("moveabs", "5", "2", "2", "2", "3", "2", "2"); // Move too
+ moveSuccess("moveabs", "5", "1", "2", "1", "3", "-1", "-1"); // Move too
// far down,
- // should be
- // at end of
- // row
- moveSuccess("moveabs", "1", "1", "0", "2", "4", "2", "3"); // Move too
+ // shouldn't
+ // move
+ moveSuccess("moveabs", "1", "0", "0", "1", "4", "1", "3"); // Move too
// far down,
// should be
// at end of
// row
- moveSuccess("moveabs", "2", "1", "1", "2", "4", "2", "3"); // Move too
+ moveSuccess("moveabs", "2", "0", "1", "1", "4", "1", "3"); // Move too
// far down,
// should be
// at end of
// row
-
- moveSuccess("moveleft", "1", "1", "0", "0", "0", "0", "0"); // Shouldn't
+ moveSuccess("moveleft", "1", "0", "0", "0", "0", "-1", "-1"); // Shouldn't
// move
// Root layout ("6") shouldn't/cannot be moved, so the following test doesn't make sense
-// moveSuccess("moveleft", "6", "0", "0", "0", "0", "0", "0"); // Shouldn't
+// moveSuccess("moveleft", "6", "0", "0", "0", "0", "-1", "-1"); // Shouldn't
// move
- moveSuccess("moveleft", "3", "2", "0", "1", "0", "1", "0"); // Straight
+ moveSuccess("moveleft", "3", "1", "0", "0", "0", "0", "0"); // Straight
// across
- moveSuccess("moveleft", "4", "2", "1", "1", "1", "1", "1"); // Straight
+ moveSuccess("moveleft", "4", "1", "1", "0", "1", "0", "1"); // Straight
// across
- moveSuccess("moveleft", "5", "2", "2", "1", "2", "1", "2"); // Straight
+ moveSuccess("moveleft", "5", "1", "2", "0", "2", "0", "2"); // Straight
// across
- moveSuccess("moveright", "1", "1", "0", "2", "0", "2", "0"); // Straight
+ moveSuccess("moveright", "1", "0", "0", "1", "0", "1", "0"); // Straight
// across
- moveSuccess("moveright", "2", "1", "1", "2", "1", "2", "1"); // Straight
+ moveSuccess("moveright", "2", "0", "1", "1", "1", "1", "1"); // Straight
// across
- moveSuccess("moveright", "3", "2", "0", "3", "0", "3", "0"); // Shouldn't
-// // move
- moveSuccess("moveright", "4", "2", "1", "3", "0", "3", "0"); // Shouldn't
+ moveSuccess("moveright", "3", "1", "0", "2", "0", "-1", "-1"); // Shouldn't
+ // move
+ moveSuccess("moveright", "4", "1", "1", "2", "0", "-1", "-1"); // Shouldn't
// move
- moveSuccess("moveright", "5", "2", "2", "3", "0", "3", "0"); // Shouldn't
+ moveSuccess("moveright", "5", "1", "2", "2", "0", "-1", "-1"); // Shouldn't
// move
- moveSuccess("moveup", "2", "1", "1", "1", "0", "1", "0"); // Straight
+ moveSuccess("moveup", "2", "0", "1", "0", "0", "0", "0"); // Straight
// across
- moveSuccess("moveup", "4", "2", "1", "2", "0", "2", "0"); // Straight
+ moveSuccess("moveup", "4", "1", "1", "1", "0", "1", "0"); // Straight
// across
- moveSuccess("moveup", "5", "2", "2", "2", "1", "2", "1"); // Straight
+ moveSuccess("moveup", "5", "1", "2", "1", "1", "1", "1"); // Straight
// across
- moveSuccess("movedown", "1", "1", "0", "1", "1", "1", "1"); // Straight
+ moveSuccess("movedown", "1", "0", "0", "0", "1", "0", "1"); // Straight
// across
- moveSuccess("movedown", "2", "1", "1", "1", "1", "1", "1"); // Shouldn't
+ moveSuccess("movedown", "2", "0", "1", "0", "1", "-1", "-1"); // Shouldn't
// move
- moveSuccess("movedown", "3", "2", "0", "2", "1", "2", "1"); // Straight
+ moveSuccess("movedown", "3", "1", "0", "1", "1", "1", "1"); // Straight
// across
- moveSuccess("movedown", "4", "2", "1", "2", "2", "2", "2"); // Straight
+ moveSuccess("movedown", "4", "1", "1", "1", "2", "1", "2"); // Straight
// across
- moveSuccess("movedown", "5", "2", "2", "2", "2", "2", "2"); // Shouldn't
+ moveSuccess("movedown", "5", "1", "2", "1", "2", "-1", "-1"); // Shouldn't
// move
}
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestPortletPlacement.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestPortletPlacement.java?rev=640297&r1=640296&r2=640297&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestPortletPlacement.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestPortletPlacement.java Sun Mar 23 20:00:35 2008
@@ -18,6 +18,7 @@
import junit.framework.TestCase;
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
import org.apache.jetspeed.layout.impl.CoordinateImpl;
import org.apache.jetspeed.layout.impl.PortletPlacementContextImpl;
import org.apache.jetspeed.om.page.Fragment;
@@ -31,7 +32,12 @@
*/
public class TestPortletPlacement extends TestCase
{
+ private PortletRegistry portletRegistry;
+ public void setUp(){
+ portletRegistry = MockPortletRegistryFactory.createMockPortletRegistry();
+ }
+
public void testGetFragmentAt()
{
// Build a request object and populate it with fragments
@@ -39,44 +45,44 @@
try
{
- PortletPlacementContext ppc = new PortletPlacementContextImpl(requestContext);
+ PortletPlacementContext ppc = new PortletPlacementContextImpl(requestContext.getPage(),portletRegistry);
int a_iNumCols = ppc.getNumberColumns();
- assertEquals(a_iNumCols, 3);
+ assertEquals(a_iNumCols, 2);
- int a_iNumRows = ppc.getNumberRows(1);
+ int a_iNumRows = ppc.getNumberRows(0);
assertEquals(a_iNumRows, 2);
- a_iNumRows = ppc.getNumberRows(2);
+ a_iNumRows = ppc.getNumberRows(1);
assertEquals(a_iNumRows, 3);
// Check the fragments
Fragment a_oFrag = ppc
- .getFragmentAtNewCoordinate(new CoordinateImpl(1, 0, 1, 0));
- assertNotNull("null fragment found at 1,0", a_oFrag);
+ .getFragmentAtNewCoordinate(new CoordinateImpl(0, 0, 0, 0));
+ assertNotNull("null fragment found at 0,0", a_oFrag);
assertEquals(a_oFrag.getId(), "1");
assertEquals(a_oFrag.getName(), "frag1");
- a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(1, 1,
- 1, 1));
- assertNotNull("null fragment found at 1,1", a_oFrag);
+ a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(0, 1,
+ 0, 1));
+ assertNotNull("null fragment found at 0,1", a_oFrag);
assertEquals(a_oFrag.getId(), "2");
assertEquals(a_oFrag.getName(), "frag2");
- a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(2, 0,
- 2, 0));
- assertNotNull("null fragment found at 2,0", a_oFrag);
+ a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(1, 0,
+ 1, 0));
+ assertNotNull("null fragment found at 1,0", a_oFrag);
assertEquals(a_oFrag.getId(), "3");
assertEquals(a_oFrag.getName(), "frag3");
- a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(2, 1,
- 2, 1));
- assertNotNull("null fragment found at 2,1", a_oFrag);
+ a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(1, 1,
+ 1, 1));
+ assertNotNull("null fragment found at 1,1", a_oFrag);
assertEquals(a_oFrag.getId(), "4");
assertEquals(a_oFrag.getName(), "frag4");
- a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(2, 2,
- 2, 2));
- assertNotNull("null fragment found at 2,2", a_oFrag);
+ a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(1, 2,
+ 1, 2));
+ assertNotNull("null fragment found at 1,2", a_oFrag);
assertEquals(a_oFrag.getId(), "5");
assertEquals(a_oFrag.getName(), "frag5");
@@ -93,7 +99,7 @@
try
{
- PortletPlacementContext ppc = new PortletPlacementContextImpl(requestContext);
+ PortletPlacementContext ppc = new PortletPlacementContextImpl(requestContext.getPage(),portletRegistry);
// Check the fragments
Fragment a_oFrag = ppc.getFragmentById("1");
@@ -133,19 +139,19 @@
try
{
- PortletPlacementContext ppc = new PortletPlacementContextImpl(requestContext);
+ PortletPlacementContext ppc = new PortletPlacementContextImpl(requestContext.getPage(),portletRegistry);
Fragment a_oFrag = ppc
- .getFragmentAtNewCoordinate(new CoordinateImpl(1, 0, 1, 0));
+ .getFragmentAtNewCoordinate(new CoordinateImpl(0, 0, 0, 0));
Coordinate a_oCoordinate = ppc.remove(a_oFrag);
- assertEquals(a_oCoordinate.getOldCol(), 1);
+ assertEquals(a_oCoordinate.getOldCol(), 0);
assertEquals(a_oCoordinate.getOldRow(), 0);
// Should be the second fragment now that the first has been deleted
- a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(1, 0,
- 1, 0));
+ a_oFrag = ppc.getFragmentAtNewCoordinate(new CoordinateImpl(0, 0,
+ 0, 0));
assertEquals(a_oFrag.getId(), "2");
assertEquals(a_oFrag.getName(), "frag2");
} catch (PortletPlacementException e)
@@ -154,13 +160,13 @@
}
}
- public void footestFragmentMoveabs()
+ public void testFragmentMoveabs()
{
RequestContext requestContext = FragmentUtil.buildFullRequestContext();
try
{
- PortletPlacementContext ppc = new PortletPlacementContextImpl(requestContext);
+ PortletPlacementContext ppc = new PortletPlacementContextImpl(requestContext.getPage(),portletRegistry);
Fragment a_oFrag = ppc
.getFragmentAtNewCoordinate(new CoordinateImpl(0, 0, 0, 0));
@@ -189,13 +195,13 @@
}
}
- public void footestFragmentMoveUp()
+ public void testFragmentMoveUp()
{
RequestContext requestContext = FragmentUtil.buildFullRequestContext();
try
{
- PortletPlacementContext ppc = new PortletPlacementContextImpl(requestContext);
+ PortletPlacementContext ppc = new PortletPlacementContextImpl(requestContext.getPage(),portletRegistry);
Fragment a_oFrag = ppc
.getFragmentAtNewCoordinate(new CoordinateImpl(0, 0, 0, 1));
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org