1 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.container.PortalContainer; 12 import org.exoplatform.services.portletcontainer.helper.PortletWindowInternal; 13 import org.exoplatform.services.portletcontainer.impl.portletAPIImp.PortletPreferencesImp; 14 import org.exoplatform.services.portletcontainer.impl.portletAPIImp.persistenceImp.DefaultPersistenceManager; 15 import org.exoplatform.services.portletcontainer.pci.ExoWindowID; 16 import org.exoplatform.services.portletcontainer.pci.Input; 17 import org.exoplatform.services.portletcontainer.pci.model.ExoPortletPreferences; 18 import org.exoplatform.services.portletcontainer.pci.model.Portlet; 19 20 26 public class TestHibernatePersistenceManager extends BaseTest { 27 public TestHibernatePersistenceManager(String s) { 28 super(s); 29 } 30 31 public void setUp() throws Exception { 32 super.setUp(); 33 } 34 35 public void testStorePortletPreferences() throws Exception { 36 ExoWindowID windowID = new ExoWindowID("exotest:/hello/HelloWorld/banner"); 37 ExoPortletPreferences prefs = 38 ((Portlet) portletApp_.getPortlet().get(0)).getPortletPreferences(); 39 PreferencesValidator validator = new PreferencesValidator() { 42 public void validate(PortletPreferences portletPreferences) throws ValidatorException { 43 } 44 }; 45 PortletPreferencesImp preferences = 46 new PortletPreferencesImp(validator, prefs, windowID, persister); 47 preferences.setMethodCalledIsAction(true); 50 preferences.store(); 51 DefaultPersistenceManager manager = 52 (DefaultPersistenceManager) PortalContainer.getInstance(). 53 getComponentInstanceOfType(DefaultPersistenceManager.class); 54 Input input = new Input(); 56 input.setWindowID(windowID); 57 PortletWindowInternal pwi = manager.getWindow(input, null); 58 pwi = manager.getWindow(input, null); 60 } 61 } | Popular Tags |