portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r722992 - in /portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed: aggregator/ layout/ tools/pamanager/
Date Wed, 03 Dec 2008 18:07:20 GMT
Author: woonsan
Date: Wed Dec  3 10:07:19 2008
New Revision: 722992

URL: http://svn.apache.org/viewvc?rev=722992&view=rev
Log:
fixing compilation errors on test cases of jetspeed-portal components. Still working.
btw, by changes with pluto2, the descriptor test cases are removed.

Removed:
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/tools/pamanager/TestJetspeedPortletDescriptor.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/tools/pamanager/TestPortletDescriptor.java
Modified:
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/aggregator/MockRenderJob.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/FragmentUtil.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

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/aggregator/MockRenderJob.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/aggregator/MockRenderJob.java?rev=722992&r1=722991&r2=722992&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/aggregator/MockRenderJob.java
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/aggregator/MockRenderJob.java
Wed Dec  3 10:07:19 2008
@@ -21,7 +21,7 @@
 
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.request.RequestContext;
-import org.apache.pluto.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
 import org.apache.jetspeed.container.PortletWindow;
 
 

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/FragmentUtil.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/FragmentUtil.java?rev=722992&r1=722991&r2=722992&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/FragmentUtil.java
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/FragmentUtil.java
Wed Dec  3 10:07:19 2008
@@ -25,6 +25,8 @@
 import org.apache.jetspeed.om.page.psml.PageImpl;
 import org.apache.jetspeed.request.JetspeedRequestContext;
 import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.request.RequestContextComponent;
+import org.jmock.Mock;
 
 import com.mockrunner.mock.web.MockHttpServletRequest;
 import com.mockrunner.mock.web.MockHttpServletResponse;
@@ -67,6 +69,8 @@
     public static RequestContext setupRequestContext(String p_sAction,
             String p_sPortletId, String p_sCol, String p_sRow)
     {
+        RequestContextComponent rcc = (RequestContextComponent) new Mock(RequestContextComponent.class).proxy();
+        
         MockServletConfig config = new MockServletConfig();
         MockServletContext context = new MockServletContext();
         MockHttpSession session = new MockHttpSession();
@@ -86,7 +90,7 @@
         request.setSession(session);
         MockHttpServletResponse response = new MockHttpServletResponse();
 
-        RequestContext a_oRC = new JetspeedRequestContext(request, response,
+        RequestContext a_oRC = new JetspeedRequestContext(rcc, request, response,
                 config, null);
         
         a_oRC.setSubject(new Subject());

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=722992&r1=722991&r2=722992&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
Wed Dec  3 10:07:19 2008
@@ -16,10 +16,11 @@
  */
 package org.apache.jetspeed.layout;
 
+import java.util.List;
+
 import org.apache.jetspeed.components.portletregistry.PortletRegistry;
+import org.apache.jetspeed.om.portlet.InitParam;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
-import org.apache.pluto.om.portlet.Parameter;
-import org.apache.pluto.om.portlet.ParameterSet;
 import org.jmock.Mock;
 import org.jmock.core.Constraint;
 import org.jmock.core.InvocationMatcher;
@@ -39,11 +40,9 @@
         PortletRegistry portletRegistry;
         Mock portletDefMock;
         PortletDefinition portletDef;
-        Mock portletDefInitParamsMock;
-        ParameterSet portletDefInitParams;
 
         Mock portletSizesParamMock;
-        Parameter portletSizesParam;
+        InitParam portletSizesParam;
         
         portletRegistryMock = new Mock(PortletRegistry.class);
         portletRegistry = (PortletRegistry) portletRegistryMock.proxy();
@@ -51,15 +50,10 @@
         portletDefMock = new Mock(PortletDefinition.class);
         portletDef = (PortletDefinition) portletDefMock.proxy();
 
-        portletDefInitParamsMock = new Mock(ParameterSet.class);
-        portletDefInitParams = (ParameterSet) portletDefInitParamsMock.proxy();
-
-        portletSizesParamMock = new Mock(Parameter.class);
-        portletSizesParam = (Parameter) portletSizesParamMock.proxy();
+        portletSizesParamMock = new Mock(InitParam.class);
+        portletSizesParam = (InitParam) 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;
     }

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=722992&r1=722991&r2=722992&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
Wed Dec  3 10:07:19 2008
@@ -38,6 +38,7 @@
 import org.apache.jetspeed.pipeline.PipelineException;
 import org.apache.jetspeed.request.JetspeedRequestContext;
 import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.request.RequestContextComponent;
 import org.apache.jetspeed.security.JSSubject;
 import org.apache.jetspeed.security.JetspeedPrincipal;
 import org.apache.jetspeed.security.JetspeedPrincipalType;
@@ -47,6 +48,7 @@
 import org.apache.jetspeed.security.User;
 import org.apache.jetspeed.security.impl.TransientJetspeedPrincipal;
 import org.apache.jetspeed.test.JetspeedTestCase;
+import org.jmock.Mock;
 
 import com.mockrunner.mock.web.MockHttpServletRequest;
 import com.mockrunner.mock.web.MockHttpServletResponse;
@@ -246,6 +248,8 @@
     public void runTest(String xml, String defName, String method)
     throws Exception
     {
+        RequestContextComponent rcc = (RequestContextComponent) new Mock(RequestContextComponent.class).proxy();
+        
         MockServletConfig config = new MockServletConfig();
         MockServletContext context = new MockServletContext();
         MockHttpSession session = new MockHttpSession();
@@ -259,7 +263,7 @@
         MockHttpServletResponse response = new MockHttpServletResponse();
 
         final RequestContext rc = 
-            new JetspeedRequestContext(request, response, config, null);
+            new JetspeedRequestContext(rcc, request, response, config, null);
         
         Set principals = new HashSet();
         principals.add(new TestUser("admin"));

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=722992&r1=722991&r2=722992&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
Wed Dec  3 10:07:19 2008
@@ -17,22 +17,22 @@
 package org.apache.jetspeed.tools.pamanager;
 
 import java.io.File;
+import java.util.List;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
 import junit.textui.TestRunner;
 
 import org.apache.jetspeed.AbstractRequestContextTestCase;
-import org.apache.jetspeed.om.common.servlet.MutableWebApplication;
+import org.apache.jetspeed.descriptor.JetspeedDescriptorService;
+import org.apache.jetspeed.descriptor.JetspeedDescriptorServiceImpl;
 import org.apache.jetspeed.om.portlet.PortletApplication;
-import org.apache.jetspeed.om.servlet.impl.SecurityRoleImpl;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.SecurityRole;
+import org.apache.jetspeed.om.portlet.SecurityRoleRef;
 import org.apache.jetspeed.util.DirectoryHelper;
 import org.apache.jetspeed.util.descriptor.PortletApplicationWar;
-import org.apache.pluto.om.portlet.SecurityRole;
-import org.apache.pluto.om.portlet.SecurityRoleRef;
-import org.apache.pluto.om.portlet.SecurityRoleRefSet;
-import org.apache.pluto.om.portlet.SecurityRoleSet;
-import org.apache.pluto.om.portlet.PortletDefinition;
+import org.apache.pluto.descriptors.services.jaxb.PortletAppDescriptorServiceImpl;
 
 /**
  * TestPortletDescriptorSecurityRoles - test and validate security roles and
@@ -79,19 +79,18 @@
     {
         System.out.println("Testing securityRoles");
         File warFile = new File(getBaseDir()+"src/test/testdata/deploy/webapp");
-        PortletApplicationWar paWar = new PortletApplicationWar(new DirectoryHelper(warFile),
"unit-test", "/" );
+        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);
 
-        MutableWebApplication webApp = paWar.createWebApp();
-        assertNotNull("WebApp is null", webApp);
+        PortletApplication portletApp = paWar.createPortletApp();
+        assertNotNull("portletApp is null", portletApp);
 
-        app.setWebApplicationDefinition(webApp);
-
-        PortletDefinition portlet = app.getPortletDefinitionByName("TestPortlet");
+        PortletDefinition portlet = app.getPortlet("TestPortlet");
         assertNotNull("TestPortlet is null", portlet);
-        checkWebSecurityRoles(webApp);
+        checkPortletApplicationSecurityRoles(portletApp);
         checkPortletSecurityRoleRefs(portlet);
         boolean validateFailed = false;
         try
@@ -103,9 +102,9 @@
             validateFailed = true;
         }
         assertTrue("Invalid PortletDescriptor validation result", validateFailed);
-        SecurityRoleImpl role = new SecurityRoleImpl();
-        role.setRoleName("users.manager");
-        webApp.addSecurityRole(role);
+        
+        portletApp.addSecurityRole("users.manager");
+
         try
         {
             paWar.validate();
@@ -162,22 +161,34 @@
 
     }
 
-    private void checkWebSecurityRoles( MutableWebApplication webApp )
+    private void checkPortletApplicationSecurityRoles( PortletApplication portletApp )
     {
-        SecurityRoleSet roles = webApp.getSecurityRoles();
+        List<SecurityRole> roles = portletApp.getSecurityRoles();
         assertEquals("Invalid number of security role definitions found", 1, roles.size());
-        SecurityRole role = roles.get("users.admin");
-        assertNotNull("Role users.admin undefined", role);
+        boolean roleFound = false;
+        
+        for (SecurityRole role : roles)
+        {
+            if ("users.admin".equals(role.getName()))
+            {
+                roleFound = true;
+                break;
+            }
+        }
+        
+        assertTrue("Role users.admin undefined", roleFound);
     }
 
     private void checkPortletSecurityRoleRefs( PortletDefinition portlet )
     {
-        SecurityRoleRefSet roleRefs = portlet.getInitSecurityRoleRefSet();
+        List<SecurityRoleRef> roleRefs = portlet.getSecurityRoleRefs();
         assertEquals("Invalid number of security role references found", 2, roleRefs.size());
-        SecurityRoleRef roleRef = roleRefs.get("admin");
+        
+        SecurityRoleRef roleRef = portlet.getSecurityRoleRef("admin");
         assertNotNull("Security Role Ref admin undefined", roleRef);
         assertEquals("security Role link expected", "users.admin", roleRef.getRoleLink());
-        roleRef = roleRefs.get("users.manager");
+        
+        roleRef = portlet.getSecurityRoleRef("users.manager");
         assertNotNull("Security Role Ref users.manager undefined", roleRef);
         assertNull("Undefined security Role link for users.managers expected", roleRef.getRoleLink());
     }



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