KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > portletcontainer > imp > TestPersistentManager


1 /**
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved.
3  * Please look at license.txt in info directory for more license detail.
4  **/

5 package org.exoplatform.services.portletcontainer.imp;
6
7
8 import javax.portlet.PortletPreferences;
9 import javax.portlet.PreferencesValidator;
10 import javax.portlet.ValidatorException;
11 import org.exoplatform.services.portletcontainer.impl.portletAPIImp.PortletPreferencesImp;
12 import org.exoplatform.services.portletcontainer.pci.ExoWindowID;
13 import org.exoplatform.services.portletcontainer.pci.model.ExoPortletPreferences;
14 import org.exoplatform.services.portletcontainer.pci.model.Portlet;
15
16 /**
17  * Created by The eXo Platform SARL .
18  * Author : Tuan Nguyen
19  * tuan08@users.sourceforge.net
20  * Date: Aug 1st, 2003
21  **/

22 public class TestPersistentManager extends BaseTest {
23   public TestPersistentManager(String JavaDoc s) {
24     super(s);
25   }
26
27   public void setUp() throws Exception JavaDoc {
28     super.setUp();
29   }
30
31   public void testStorePortletPreferences() throws Exception JavaDoc {
32     ExoWindowID windowID = new ExoWindowID("exotest:/hello/HelloWorld/banner");
33     ExoPortletPreferences prefs =
34         ((Portlet) portletApp_.getPortlet().get(0)).getPortletPreferences();
35     PreferencesValidator validator = new PreferencesValidator() {
36       public void validate(PortletPreferences portletPreferences) throws ValidatorException {
37       }
38     };
39     PortletPreferencesImp preferences = new PortletPreferencesImp(validator,
40         prefs, windowID, persister);
41     //preferences.setValue("param-1", "value-1") ; //null pointer exception ??
42
//preferences.setValue("param-2", "value-2") ;
43
preferences.setMethodCalledIsAction(true);
44     preferences.store();
45     /*
46     CMSPersistenceManager manager =
47         (CMSPersistenceManager) PortalContainer.getInstance().getService(CMSPersistenceManager.class);
48     String windowLocalId = preferences.windowLocalId;
49     //get the window for an anonymous user
50     Input input = new Input();
51     input.setWindowId("hello/HelloWorld/winID");
52     input.setUserId("anon");
53     PortletWindowInternal pwi = manager.getWindow(input);
54     //get the window for a identified user
55     pwi = manager.getWindow(input);
56     */

57   }
58 }
Popular Tags