Update of /cvsroot/springframework/spring/mock/org/springframework/mock/web/portlet In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4919/mock/org/springframework/mock/web/portlet Modified Files: MockPortletURL.java MockPortalContext.java MockActionResponse.java MockPortletResponse.java MockPortletConfig.java Log Message: polishing Index: MockPortletConfig.java =================================================================== RCS file: /cvsroot/springframework/spring/mock/org/springframework/mock/web/portlet/MockPortletConfig.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MockPortletConfig.java 11 Oct 2007 16:46:39 -0000 1.4 --- MockPortletConfig.java 27 Nov 2008 18:04:36 -0000 1.5 *************** *** 1,4 **** /* ! * Copyright 2002-2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 22,25 **** --- 22,26 ---- import java.util.Properties; import java.util.ResourceBundle; + import java.util.Map; import javax.portlet.PortletConfig; *************** *** 41,45 **** private final String portletName; ! private final HashMap resourceBundles = new HashMap(); private final Properties initParameters = new Properties(); --- 42,46 ---- private final String portletName; ! private final Map resourceBundles = new HashMap(); private final Properties initParameters = new Properties(); Index: MockPortletURL.java =================================================================== RCS file: /cvsroot/springframework/spring/mock/org/springframework/mock/web/portlet/MockPortletURL.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MockPortletURL.java 25 Sep 2007 21:44:14 -0000 1.4 --- MockPortletURL.java 27 Nov 2008 18:04:36 -0000 1.5 *************** *** 1,4 **** /* ! * Copyright 2002-2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 60,64 **** private PortletMode portletMode; ! private final Map parameters = new LinkedHashMap(16); private boolean secure = false; --- 60,64 ---- private PortletMode portletMode; ! private final Map parameters = new LinkedHashMap(); private boolean secure = false; *************** *** 143,166 **** public boolean isSecure() { ! return secure; ! } ! ! public String toString() { ! StringBuffer query = new StringBuffer(); ! query.append(encodeParameter("urlType", this.urlType)); ! if (this.windowState != null) { ! query.append(";" + encodeParameter("windowState", this.windowState.toString())); ! } ! if (this.portletMode != null) { ! query.append(";" + encodeParameter("portletMode", this.portletMode.toString())); ! } ! for (Iterator it = this.parameters.entrySet().iterator(); it.hasNext();) { ! Map.Entry entry = (Map.Entry) it.next(); ! String name = (String) entry.getKey(); ! String[] values = (String[]) entry.getValue(); ! query.append(";" + encodeParameter("param_" + name, values)); ! } ! return (this.secure ? "https:" : "http:") + ! "//localhost/mockportlet?" + query.toString(); } --- 143,147 ---- public boolean isSecure() { ! return this.secure; } *************** *** 178,188 **** private String encodeParameter(String name, String[] values) { try { ! StringBuffer buf = new StringBuffer(); for (int i = 0, n = values.length; i < n; i++) { ! buf.append((i > 0 ? ";" : "") + URLEncoder.encode(name, ENCODING) + "=" + URLEncoder.encode(values[i], ENCODING)); } ! return buf.toString(); } catch (UnsupportedEncodingException ex) { --- 159,169 ---- private String encodeParameter(String name, String[] values) { try { ! StringBuffer sb = new StringBuffer(); for (int i = 0, n = values.length; i < n; i++) { ! sb.append((i > 0 ? ";" : "") + URLEncoder.encode(name, ENCODING) + "=" + URLEncoder.encode(values[i], ENCODING)); } ! return sb.toString(); } catch (UnsupportedEncodingException ex) { *************** *** 191,193 **** --- 172,194 ---- } + + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append(encodeParameter("urlType", this.urlType)); + if (this.windowState != null) { + sb.append(";" + encodeParameter("windowState", this.windowState.toString())); + } + if (this.portletMode != null) { + sb.append(";" + encodeParameter("portletMode", this.portletMode.toString())); + } + for (Iterator it = this.parameters.entrySet().iterator(); it.hasNext();) { + Map.Entry entry = (Map.Entry) it.next(); + String name = (String) entry.getKey(); + String[] values = (String[]) entry.getValue(); + sb.append(";" + encodeParameter("param_" + name, values)); + } + return (this.secure ? "https:" : "http:") + + "//localhost/mockportlet?" + sb.toString(); + } + } Index: MockPortletResponse.java =================================================================== RCS file: /cvsroot/springframework/spring/mock/org/springframework/mock/web/portlet/MockPortletResponse.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MockPortletResponse.java 25 Sep 2007 21:44:14 -0000 1.4 --- MockPortletResponse.java 27 Nov 2008 18:04:36 -0000 1.5 *************** *** 1,4 **** /* ! * Copyright 2002-2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 37,41 **** private final PortalContext portalContext; ! private final Map properties = new LinkedHashMap(16); --- 37,41 ---- private final PortalContext portalContext; ! private final Map properties = new LinkedHashMap(); *************** *** 62,66 **** */ public PortalContext getPortalContext() { ! return portalContext; } --- 62,66 ---- */ public PortalContext getPortalContext() { ! return this.portalContext; } Index: MockActionResponse.java =================================================================== RCS file: /cvsroot/springframework/spring/mock/org/springframework/mock/web/portlet/MockActionResponse.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MockActionResponse.java 25 Sep 2007 21:44:14 -0000 1.4 --- MockActionResponse.java 27 Nov 2008 18:04:36 -0000 1.5 *************** *** 1,4 **** /* ! * Copyright 2002-2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 20,25 **** import java.util.Collections; import java.util.Iterator; - import java.util.Map; import java.util.LinkedHashMap; import javax.portlet.ActionResponse; --- 20,25 ---- import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashMap; + import java.util.Map; import javax.portlet.ActionResponse; *************** *** 30,34 **** import javax.portlet.WindowStateException; - import org.springframework.core.CollectionFactory; import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; --- 30,33 ---- *************** *** 49,53 **** private String redirectedUrl; ! private final Map renderParameters = new LinkedHashMap(16); --- 48,52 ---- private String redirectedUrl; ! private final Map renderParameters = new LinkedHashMap(); *************** *** 134,139 **** } ! public String getRenderParameter(String name) { ! String[] arr = (String[]) this.renderParameters.get(name); return (arr != null && arr.length > 0 ? arr[0] : null); } --- 133,138 ---- } ! public String getRenderParameter(String key) { ! String[] arr = (String[]) this.renderParameters.get(key); return (arr != null && arr.length > 0 ? arr[0] : null); } Index: MockPortalContext.java =================================================================== RCS file: /cvsroot/springframework/spring/mock/org/springframework/mock/web/portlet/MockPortalContext.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MockPortalContext.java 15 Oct 2006 18:23:22 -0000 1.3 --- MockPortalContext.java 27 Nov 2008 18:04:36 -0000 1.4 *************** *** 1,4 **** /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 78,81 **** --- 78,85 ---- } + public void setProperty(String name, String value) { + this.properties.setProperty(name, value); + } + public String getProperty(String name) { return this.properties.getProperty(name); |