1 5 package org.exoplatform.test.mocks.portlet; 6 7 import java.util.* ; 8 import javax.portlet.* ; 9 10 public class MockPortletRequest implements PortletRequest { 11 private Map parameters_ ; 12 private Map attributes_ ; 13 private PortletSession session_ ; 14 private PortletMode portletMode_ ; 15 private String role_ = "none" ; 16 private String remoteUser_ ; 17 private PortletPreferences prefs_ ; 18 19 public MockPortletRequest() { 20 parameters_ = new Hashtable() ; 21 attributes_ = new Hashtable() ; 22 session_ = new MockPortletSession() ; 23 portletMode_ = PortletMode.VIEW ; 24 prefs_ = new MockPortletPreferences() ; 25 26 } 27 28 public boolean isWindowStateAllowed(WindowState state) { 29 return true ; 30 } 31 32 public boolean isPortletModeAllowed(PortletMode mode) { 33 return true ; 34 } 35 36 public PortletMode getPortletMode () { 37 return portletMode_ ; 38 } 39 40 public void setPortletMode(PortletMode mode) { 41 portletMode_ = mode ; 42 } 43 44 public WindowState getWindowState () { 45 return WindowState.NORMAL ; 46 } 47 48 public void setPreferences(PortletPreferences prefs) { 49 prefs_ = prefs ; 50 } 51 52 public PortletPreferences getPreferences () { 53 return prefs_ ; 54 } 55 56 public PortletSession getPortletSession () { 57 return session_ ; 58 } 59 60 public PortletSession getPortletSession (boolean create) { 61 return session_ ; 62 } 63 64 public String getProperty(String name) { 65 return "not support" ; 66 } 67 68 public java.util.Enumeration getProperties(String name) { 69 return null ; 70 } 71 72 public java.util.Enumeration getPropertyNames() { 73 return null ; 74 } 75 76 public PortalContext getPortalContext() { 77 return null ; 78 } 79 80 public java.lang.String getAuthType() { 81 return null ; 82 } 83 84 public String getContextPath() { 85 return null ; 86 } 87 88 89 public void setRemoteUser(String user) { 90 remoteUser_ = user ; 91 } 92 public java.lang.String getRemoteUser() { 93 return remoteUser_ ; 94 } 95 96 public java.security.Principal getUserPrincipal() { 97 return null ; 98 } 99 100 public void setUserInRole(String role) { 101 role_ = role ; 102 } 103 104 public boolean isUserInRole(java.lang.String role) { 105 return role_.equals(role) ; 106 } 107 108 public Object getAttribute(String name) { 109 return attributes_.get(name) ; 110 } 111 112 public java.util.Enumeration getAttributeNames() { 113 return null ; 114 } 115 116 public String getParameter(String name) { 117 return (String ) parameters_.get(name) ; 118 } 119 120 public void setParameter(String name, Object value) { 121 parameters_.put(name,value) ; 122 } 123 124 public java.util.Enumeration getParameterNames() { 125 return null ; 126 } 127 128 public String [] getParameterValues(String name) { 129 return (String []) parameters_.get(name) ; 130 } 131 132 public java.util.Map getParameterMap() { 133 return parameters_ ; 134 } 135 136 public boolean isSecure() { 137 return false ; 138 } 139 140 public void setAttribute(String name, Object o) { 141 attributes_.put(name, o) ; 142 } 143 144 public void removeAttribute(String name) { 145 attributes_.remove(name) ; 146 } 147 148 public String getRequestedSessionId() { 149 return session_.getId() ; 150 } 151 152 public boolean isRequestedSessionIdValid() { 153 return true ; 154 } 155 156 public String getResponseContentType() { 157 return "txt/html" ; 158 } 159 160 public java.util.Enumeration getResponseContentTypes() { 161 return null ; 162 } 163 164 public java.util.Locale getLocale() { 165 return Locale.US; 166 } 167 168 public java.util.Enumeration getLocales() { 169 return null ; 170 } 171 172 public String getScheme() { 173 return "http://" ; 174 } 175 176 public String getServerName() { 177 return "localhost" ; 178 } 179 180 public int getServerPort() { 181 return 8080 ; 182 } 183 } | Popular Tags |