/**
 * 
 */
package org.ajax4jsf.portlet;

import java.security.Principal;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.portlet.PortalContext;
import javax.portlet.PortletMode;
import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequest;
import javax.portlet.PortletSession;
import javax.portlet.WindowState;

import org.apache.shale.test.mock.MockHttpServletRequest;

/**
 * @author asmirnov
 *
 */
public class MockPortletRequest extends MockHttpServletRequest implements PortletRequest {
    
    public static final String PARAMETER_VALUE2 = "value2";
    public static final String PARAMETER_VALUE1 = "value1";
    public static final String PARAMETER = "parameter";
    public Map parameters = new HashMap();
    
    public MockPortletRequest() {
	parameters.put(PARAMETER, new String[]{PARAMETER_VALUE1,PARAMETER_VALUE2});
    }
    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getAttribute(java.lang.String)
     */
    public Object getAttribute(String arg0) {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getAttributeNames()
     */
    public Enumeration getAttributeNames() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getAuthType()
     */
    public String getAuthType() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getContextPath()
     */
    public String getContextPath() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getLocale()
     */
    public Locale getLocale() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getLocales()
     */
    public Enumeration getLocales() {
	// TODO Auto-generated method stub
	return null;
    }

    
    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getParameter(java.lang.String)
     */
    public String getParameter(String name) {
	String result = null;
	String[] vals = (String[]) parameters.get(name);
	if(null != vals){
	    result = vals[0];
	}
	return result;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getParameterMap()
     */
    public Map getParameterMap() {
	return parameters;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getParameterNames()
     */
    public Enumeration getParameterNames() {
	return Collections.enumeration(Collections.singleton(PARAMETER));
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getParameterValues(java.lang.String)
     */
    public String[] getParameterValues(String arg0) {
	return (String[]) parameters.get(arg0);
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getPortalContext()
     */
    public PortalContext getPortalContext() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getPortletMode()
     */
    public PortletMode getPortletMode() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getPortletSession()
     */
    public PortletSession getPortletSession() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getPortletSession(boolean)
     */
    public PortletSession getPortletSession(boolean arg0) {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getPreferences()
     */
    public PortletPreferences getPreferences() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getProperties(java.lang.String)
     */
    public Enumeration getProperties(String arg0) {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getProperty(java.lang.String)
     */
    public String getProperty(String arg0) {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getPropertyNames()
     */
    public Enumeration getPropertyNames() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getRemoteUser()
     */
    public String getRemoteUser() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getRequestedSessionId()
     */
    public String getRequestedSessionId() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getResponseContentType()
     */
    public String getResponseContentType() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getResponseContentTypes()
     */
    public Enumeration getResponseContentTypes() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getScheme()
     */
    public String getScheme() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getServerName()
     */
    public String getServerName() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getServerPort()
     */
    public int getServerPort() {
	// TODO Auto-generated method stub
	return 0;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getUserPrincipal()
     */
    public Principal getUserPrincipal() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#getWindowState()
     */
    public WindowState getWindowState() {
	// TODO Auto-generated method stub
	return null;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#isPortletModeAllowed(javax.portlet.PortletMode)
     */
    public boolean isPortletModeAllowed(PortletMode arg0) {
	// TODO Auto-generated method stub
	return false;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#isRequestedSessionIdValid()
     */
    public boolean isRequestedSessionIdValid() {
	// TODO Auto-generated method stub
	return false;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#isSecure()
     */
    public boolean isSecure() {
	// TODO Auto-generated method stub
	return false;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#isUserInRole(java.lang.String)
     */
    public boolean isUserInRole(String arg0) {
	// TODO Auto-generated method stub
	return false;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#isWindowStateAllowed(javax.portlet.WindowState)
     */
    public boolean isWindowStateAllowed(WindowState arg0) {
	// TODO Auto-generated method stub
	return false;
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#removeAttribute(java.lang.String)
     */
    public void removeAttribute(String arg0) {
	// TODO Auto-generated method stub
    }

    /* (non-Javadoc)
     * @see javax.portlet.PortletRequest#setAttribute(java.lang.String, java.lang.Object)
     */
    public void setAttribute(String arg0, Object arg1) {
	// TODO Auto-generated method stub
    }
}
