portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r723388 - in /portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade: components/jetspeed-portal/src/test/java/org/apache/jetspeed/deployment/ components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/ components/jetspeed-...
Date Thu, 04 Dec 2008 18:10:06 GMT
Author: woonsan
Date: Thu Dec  4 10:10:06 2008
New Revision: 723388

URL: http://svn.apache.org/viewvc?rev=723388&view=rev
Log:
Fixed compilation errors of test cases of jetspeed-portal component

Modified:
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/deployment/TestSimpleDeployment.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/MockUserInfoManager.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/resources/rc2.xml
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/alternate/request-context.xml

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/deployment/TestSimpleDeployment.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/deployment/TestSimpleDeployment.java?rev=723388&r1=723387&r2=723388&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/deployment/TestSimpleDeployment.java
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/deployment/TestSimpleDeployment.java
Thu Dec  4 10:10:06 2008
@@ -37,7 +37,7 @@
 import org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager;
 import org.apache.jetspeed.util.DirectoryHelper;
 import org.apache.jetspeed.util.JarHelper;
-import org.apache.pluto.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
 
 /**
  * <p>
@@ -329,7 +329,7 @@
     private void verifyDemoAppCreated( String appName, File appFile )
     {
         assertNotNull(appName + " was not registered into the portlet registery.", portletRegistry
-                .getPortletApplicationByIdentifier(TEST_PORTLET_APP_NAME));
+                .getPortletApplication(TEST_PORTLET_APP_NAME));
         assertTrue(appName + " directory was not created, app not deployed.", appFile.exists());
     }
     

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/MockUserInfoManager.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/MockUserInfoManager.java?rev=723388&r1=723387&r2=723388&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/MockUserInfoManager.java
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/MockUserInfoManager.java
Thu Dec  4 10:10:06 2008
@@ -18,14 +18,17 @@
 
 import java.util.HashMap;
 import java.util.Map;
+
+import javax.portlet.PortletRequest;
 
 import org.apache.jetspeed.request.RequestContext;
-import org.apache.pluto.om.portlet.ObjectID;
+import org.apache.pluto.PortletContainerException;
+import org.apache.pluto.PortletWindow;
 
 
 public class MockUserInfoManager implements UserInfoManager
 {
-    private Map fake = new HashMap();
+    private Map<String, String> fake = new HashMap<String, String>();
     
     public MockUserInfoManager()
     {}
@@ -33,9 +36,14 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.userinfo.UserInfoManager#getUserInfoMap(org.apache.pluto.om.common.ObjectID,
org.apache.jetspeed.request.RequestContext)
      */
-    public Map getUserInfoMap(ObjectID oid, RequestContext context)
+    public Map<String, String> getUserInfoMap(String appName, RequestContext context)
     {
         return fake;
+    }
+
+    public Map<String, String> getUserInfo(PortletRequest request, PortletWindow window)
throws PortletContainerException
+    {
+        return fake;
     }
-    
+    
 }
\ No newline at end of file

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=723388&r1=723387&r2=723388&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
Thu Dec  4 10:10:06 2008
@@ -16,7 +16,9 @@
  */
 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;
@@ -28,6 +30,8 @@
 import junit.framework.TestSuite;
 
 import org.apache.jetspeed.AbstractRequestContextTestCase;
+import org.apache.jetspeed.descriptor.JetspeedDescriptorService;
+import org.apache.jetspeed.descriptor.JetspeedDescriptorServiceImpl;
 import org.apache.jetspeed.mockobjects.request.MockRequestContext;
 import org.apache.jetspeed.om.portlet.PortletApplication;
 import org.apache.jetspeed.request.RequestContext;
@@ -37,8 +41,7 @@
 import org.apache.jetspeed.security.SecurityAttributes;
 import org.apache.jetspeed.security.UserManager;
 import org.apache.jetspeed.security.impl.UserImpl;
-import org.apache.jetspeed.util.descriptor.ExtendedPortletMetadata;
-import org.apache.jetspeed.util.descriptor.PortletApplicationDescriptor;
+import org.apache.pluto.descriptors.services.jaxb.PortletAppDescriptorServiceImpl;
 
 /**
  * <p>
@@ -87,8 +90,12 @@
 
     private void innerTestSetUserInfoMap(UserInfoManager uim) throws Exception
     {
-        PortletApplicationDescriptor pad = new PortletApplicationDescriptor(new FileReader(getBaseDir()+"src/test/testdata/deploy/portlet.xml"),
"unit-test");
-        portletApp = pad.createPortletApplication();
+        JetspeedDescriptorService descriptorService = new JetspeedDescriptorServiceImpl(new
PortletAppDescriptorServiceImpl());
+        InputStream webDescriptor = new FileInputStream(getBaseDir()+"src/test/testdata/deploy/web.xml");
+        InputStream portletDescriptor = new FileInputStream(getBaseDir()+"src/test/testdata/deploy/portlet.xml");
+        InputStream jetspeedPortletDescriptor = new FileInputStream(getBaseDir()+"src/test/testdata/deploy/jetspeed-portlet.xml");
+        ClassLoader paClassLoader = Thread.currentThread().getContextClassLoader();
+        portletApp = descriptorService.read(webDescriptor, portletDescriptor, jetspeedPortletDescriptor,
paClassLoader);
         assertNotNull("App is null", portletApp);
 
         // persist the app
@@ -108,22 +115,18 @@
 
         // Without linked attributes
         // There are no preferences associated to the user profile.
-        Map<String, String> userInfo = uim.getUserInfoMap(portletApp.getId(), request);
+        Map<String, String> userInfo = uim.getUserInfoMap(portletApp.getName(), request);
 //        assertNull(PortletRequest.USER_INFO + " is null", userInfo);
 
         // The user has preferences associated to the user profile.
         initUser();
         request = initRequestContext("test");
-        userInfo = uim.getUserInfoMap(portletApp.getId(), request);
+        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"));
         assertNull("should not contain user.home-info.online.email", userInfo.get("user.home-info.online.email"));
 
-        // With linked attributes
-        ExtendedPortletMetadata extMetaData = new ExtendedPortletMetadata(new FileReader(getBaseDir()+"src/test/testdata/deploy/jetspeed-portlet.xml"),
portletApp);
-        extMetaData.load();
-
         // persist the app
         try
         {
@@ -137,7 +140,7 @@
             throw new Exception(msg, e);
         }
 
-        userInfo = uim.getUserInfoMap(portletApp.getId(), request);
+        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"));

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/resources/rc2.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/resources/rc2.xml?rev=723388&r1=723387&r2=723388&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/resources/rc2.xml
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/test/resources/rc2.xml
Thu Dec  4 10:10:06 2008
@@ -23,14 +23,39 @@
   	   class="org.apache.jetspeed.userinfo.MockUserInfoManager"
   >
   </bean>
-    
-    <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/jetspeed-portal-resources/src/main/resources/assembly/alternate/request-context.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/alternate/request-context.xml?rev=723388&r1=723387&r2=723388&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/alternate/request-context.xml
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/alternate/request-context.xml
Thu Dec  4 10:10:06 2008
@@ -21,13 +21,12 @@
   <!-- Request Context -->
   <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>
+    <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>
+  
   <!-- Single Source User Info -->
   <bean id="org.apache.jetspeed.userinfo.UserInfoManager"
     class="org.apache.jetspeed.userinfo.impl.UserInfoManagerImpl">



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