Author: bdaw
Date: 2008-02-06 14:02:10 -0500 (Wed, 06 Feb 2008)
New Revision: 9806
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ActionURL286Tag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286Tag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286TagTEI.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/Namespace286Tag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/RenderURL286Tag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ResourceURL286Tag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ResourceURL286TagTEI.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/URLParameter286Tag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/URLProperty286Tag.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/ActionURLTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/DefineObjectsTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/NamespaceTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/RenderURLTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/ActionURLTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/NamespaceTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/RenderURLTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/ResourceURLTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/TaglibTestCase.java
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/actionURL.jsp
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/defineObjects.jsp
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/namespace.jsp
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/renderURL.jsp
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/actionURL.jsp
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/defineObjects.jsp
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/namespace.jsp
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/renderURL.jsp
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/resourceURL.jsp
Removed:
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/taglib.jsp
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/BaseURLImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/ActionURLTag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/GenerateURLTag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/RenderURLTag.java
modules/portlet/trunk/portlet/src/main/resources/org/jboss/portal/portlet/portlet_2_0.tld
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/TaglibTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/DefineObjectsTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/WEB-INF/portlet.xml
Log:
- JSR 286 taglib impl
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/BaseURLImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/BaseURLImpl.java 2008-02-06
18:49:08 UTC (rev 9805)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/BaseURLImpl.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -109,17 +109,35 @@
public void write(Writer writer, boolean b) throws IOException
{
- EntityEncoder.FULL.encode(toString(), new WriterCharWriter(writer));
+ if (b)
+ {
+ EntityEncoder.FULL.encode(toString(), new WriterCharWriter(writer));
+ }
+ else
+ {
+ EntityEncoder.BASIC.encode(toString(), new WriterCharWriter(writer));
+ }
}
public void addProperty(String s, String s1)
{
- throw new NotYetImplemented();
+ if (s == null)
+ {
+ throw new IllegalArgumentException("property name cannot be null");
+ }
+
+ //TODO:
+
}
public void setProperty(String s, String s1)
{
- throw new NotYetImplemented();
+ if (s == null)
+ {
+ throw new IllegalArgumentException("property name cannot be null");
+ }
+
+ //TODO:
}
public String toString()
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/ActionURLTag.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/ActionURLTag.java 2008-02-06
18:49:08 UTC (rev 9805)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/ActionURLTag.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -22,6 +22,9 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.taglib;
+import javax.portlet.PortletURL;
+import javax.portlet.BaseURL;
+
/**
* The actionURL tag for the JSR 168 Portlet specification.
* <p/>
@@ -45,4 +48,15 @@
{
return typeParameter;
}
+
+ protected BaseURL generateURL() throws Exception
+ {
+ PortletURL newPortletURL = (PortletURL)super.generateURL();
+
+ setWindowState(newPortletURL);
+
+ setPortletMode(newPortletURL);
+
+ return newPortletURL;
+ }
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/GenerateURLTag.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/GenerateURLTag.java 2008-02-06
18:49:08 UTC (rev 9805)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/GenerateURLTag.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.taglib;
-import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
import org.jboss.portal.portlet.impl.jsr168.api.PortletURLImpl;
import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
@@ -32,7 +31,7 @@
import javax.portlet.PortletURL;
import javax.portlet.WindowState;
import javax.portlet.WindowStateException;
-import javax.portlet.RenderRequest;
+import javax.portlet.BaseURL;
import javax.servlet.jsp.JspException;
import java.util.ArrayList;
import java.util.HashMap;
@@ -49,7 +48,7 @@
* @author <a href="mailto:sgwood@ix.netcom.com">Sherman Wood</a>
* @version $Revision: 5448 $
*/
-abstract class GenerateURLTag extends PortletTag
+public abstract class GenerateURLTag extends PortletTag
{
private String windowState;
private String portletMode;
@@ -186,7 +185,7 @@
*
* @return The PortelURL to decorate
*/
- private PortletURL getBasePortletEnvironmentAndURL()
+ protected BaseURL getBasePortletEnvironmentAndURL()
{
PortletRequestImpl preq = (PortletRequestImpl)getPortletRequest();
@@ -212,7 +211,7 @@
* @param portletURL
* @throws WindowStateException
*/
- private void setWindowState(PortletURL portletURL) throws WindowStateException
+ protected void setWindowState(PortletURL portletURL) throws WindowStateException
{
if (getWindowState() != null && getWindowState().trim().length() > 0)
{
@@ -227,7 +226,7 @@
* @param portletURL
* @throws PortletModeException
*/
- private void setPortletMode(PortletURL portletURL) throws PortletModeException
+ protected void setPortletMode(PortletURL portletURL) throws PortletModeException
{
if (getPortletMode() != null && getPortletMode().trim().length() > 0)
{
@@ -242,7 +241,7 @@
* @param portletURL
* @throws PortletSecurityException
*/
- private void setSecure(PortletURL portletURL) throws PortletSecurityException
+ protected void setSecure(BaseURL portletURL) throws PortletSecurityException
{
if (getSecure() != null && getSecure().trim().length() > 0)
{
@@ -255,7 +254,7 @@
}
}
- private void clearPreviousTag()
+ protected void clearPreviousTag()
{
parameters = new HashMap(5);
// windowCtx = null;
@@ -276,42 +275,44 @@
return EVAL_BODY_INCLUDE;
}
- /** Generate the URL */
- public int doEndTag() throws JspException
+ protected BaseURL generateURL() throws Exception
{
- String resultingURL = null;
- try
- {
+ BaseURL newPortletURL = getBasePortletEnvironmentAndURL();
- PortletURL newPortletURL = getBasePortletEnvironmentAndURL();
+ setSecure(newPortletURL);
- setWindowState(newPortletURL);
+ // Include parameters as part of the tag request.
- setPortletMode(newPortletURL);
+ if (!parameters.isEmpty())
+ {
+ newPortletURL.setParameters(getURLParameters());
+ }
+ return newPortletURL;
+ }
- setSecure(newPortletURL);
+ protected void writeURL(BaseURL portletURL) throws Exception
+ {
- // Include parameters as part of the tag request.
+ // If a variable was given in the tag to be set in the pageContext,
+ // do that. Otherwise, just write out the URL to the page.
- if (!parameters.isEmpty())
- {
- newPortletURL.setParameters(getURLParameters());
- }
+ if (getVar() != null)
+ {
+ pageContext.setAttribute(getVar(), portletURL.toString());
+ }
+ else
+ {
+ pageContext.getOut().print(portletURL.toString());
+ }
+ }
- resultingURL = newPortletURL.toString();
- // If a variable was given in the tag to be set in the pageContext,
- // do that. Otherwise, just write out the URL to the page.
-
- if (getVar() != null)
- {
- pageContext.setAttribute(getVar(), resultingURL);
- }
- else
- {
- pageContext.getOut().print(resultingURL);
- }
-
+ /** Generate the URL */
+ public int doEndTag() throws JspException
+ {
+ try
+ {
+ writeURL(generateURL());
}
catch (Exception e)
{
@@ -320,4 +321,6 @@
}
return EVAL_PAGE;
}
+
+
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/RenderURLTag.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/RenderURLTag.java 2008-02-06
18:49:08 UTC (rev 9805)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/RenderURLTag.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -22,6 +22,9 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.taglib;
+import javax.portlet.PortletURL;
+import javax.portlet.BaseURL;
+
/**
* The renderURL tag for the JSR 168 Portlet specification.
* <p/>
@@ -45,4 +48,15 @@
{
return typeParameter;
}
+
+ protected BaseURL generateURL() throws Exception
+ {
+ PortletURL newPortletURL = (PortletURL)super.generateURL();
+
+ setWindowState(newPortletURL);
+
+ setPortletMode(newPortletURL);
+
+ return newPortletURL;
+ }
}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ActionURL286Tag.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ActionURL286Tag.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ActionURL286Tag.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,80 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.portlet.impl.jsr286.taglib;
+
+import javax.portlet.PortletURL;
+import javax.portlet.BaseURL;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class ActionURL286Tag extends GenerateURL286Tag
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 7920291581022525492L;
+ public static String typeParameter = "action";
+
+ private String name;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ protected void setName(PortletURL portletURL)
+ {
+ if (name != null)
+ {
+ portletURL.setParameter("javax.portlet.action", name);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.portal.portlet.taglib.GenerateURLTag#addTypeParameter()
+ */
+ protected String getTypeValue()
+ {
+ return typeParameter;
+ }
+
+ protected BaseURL generateURL() throws Exception
+ {
+ PortletURL newPortletURL = (PortletURL)super.generateURL();
+
+ setWindowState(newPortletURL);
+
+ setPortletMode(newPortletURL);
+
+ setCopyCurrentRenderParameters(newPortletURL);
+
+ setName(newPortletURL);
+
+ return newPortletURL;
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286Tag.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286Tag.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286Tag.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,185 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.portlet.impl.jsr286.taglib;
+
+import org.jboss.portal.portlet.impl.jsr168.taglib.GenerateURLTag;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ResourceURLImpl;
+
+import javax.portlet.PortletURL;
+import javax.portlet.PortletContext;
+import javax.portlet.BaseURL;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Enumeration;
+import java.io.StringWriter;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public abstract class GenerateURL286Tag extends GenerateURLTag
+{
+ private Map<String, List> properties;
+
+ private String escapeXml;
+
+ private String copyCurrentRenderParameters;
+
+ private StringWriter stringWriter;
+
+ public String getEscapeXml()
+ {
+ return escapeXml;
+ }
+
+ public void setEscapeXml(String escapeXml)
+ {
+ this.escapeXml = escapeXml;
+ }
+
+ public String getCopyCurrentRenderParameters()
+ {
+ return copyCurrentRenderParameters;
+ }
+
+ public void setCopyCurrentRenderParameters(String copyCurrentRenderParameters)
+ {
+ this.copyCurrentRenderParameters = copyCurrentRenderParameters;
+ }
+
+ protected void setCopyCurrentRenderParameters(PortletURL portletURL)
+ {
+ //default is false
+ if (copyCurrentRenderParameters != null &&
copyCurrentRenderParameters.equalsIgnoreCase("true"))
+ {
+ portletURL.setParameters(getPortletRequest().getPrivateParameterMap());
+ }
+ }
+
+ protected boolean isEscapeXml()
+ {
+
+ boolean def = true;
+
+ String[] runtime =
getConfig().getContainerRuntimeOptions().get("javax.portlet.escapeXml");
+
+ if (runtime != null && runtime.length > 0)
+ {
+ if (runtime[0].equalsIgnoreCase("true"))
+ {
+ def = true;
+ }
+ else if (runtime[0].equalsIgnoreCase("false"))
+ {
+ def = false;
+ }
+ }
+
+ if(escapeXml != null)
+ {
+ return Boolean.parseBoolean(escapeXml);
+ }
+
+ return def;
+ }
+
+ /**
+ * Add a named property. Cater for multiple properties with the same name by storing
them in a list.
+ *
+ * @param name
+ * @param value
+ */
+ public void addProperty(String name, String value)
+ {
+ List<String> l = properties.get(name);
+ if (l == null)
+ {
+ l = new ArrayList<String>(5);
+ properties.put(name, l);
+ }
+
+ l.add(value);
+ }
+
+ protected void clearPreviousTag()
+ {
+ stringWriter = new StringWriter();
+ properties = new HashMap<String, List>();
+
+ super.clearPreviousTag();
+ }
+
+ protected BaseURL getBasePortletEnvironmentAndURL()
+ {
+ PortletRequestImpl preq = (PortletRequestImpl)getPortletRequest();
+
+ if ("resource".equals(getTypeValue()))
+ {
+ return ResourceURLImpl.createResourceURL(getInvocation(), preq);
+ }
+ else
+ {
+ return super.getBasePortletEnvironmentAndURL();
+ }
+ }
+
+ protected BaseURL generateURL() throws Exception
+ {
+ BaseURL newPortletURL = super.generateURL();
+
+ if (!properties.isEmpty())
+ {
+ for (String name : properties.keySet())
+ {
+ List<String> props = properties.get(name);
+ for (String prop : props)
+ {
+ newPortletURL.setProperty(name, prop);
+ }
+ }
+ }
+
+ return newPortletURL;
+ }
+
+ protected void writeURL(BaseURL portletURL) throws Exception
+ {
+
+ // If a variable was given in the tag to be set in the pageContext,
+ // do that. Otherwise, just write out the URL to the page.
+
+ portletURL.write(stringWriter, isEscapeXml());
+
+ if (getVar() != null)
+ {
+ pageContext.setAttribute(getVar(), stringWriter.toString());
+ }
+ else
+ {
+ pageContext.getOut().print(stringWriter.toString());
+ }
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286TagTEI.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286TagTEI.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286TagTEI.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,93 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.portlet.impl.jsr286.taglib;
+
+import org.jboss.portal.portlet.impl.jsr168.taglib.GenerateURLTagTEI;
+
+import javax.servlet.jsp.tagext.TagData;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class GenerateURL286TagTEI extends GenerateURLTagTEI
+{
+
+ public boolean isValid(TagData data)
+ {
+ return true;
+// if (super.isValid(data) &&
+// isEscapeXmlValid(data) &&
+// isCopyCurrentRenderParameters(data))
+// {
+// return true;
+// }
+ //return false;
+ }
+
+ public boolean isEscapeXmlValid(TagData data)
+ {
+ Object o = data.getAttribute("escapeXml");
+ if (o != null && o != TagData.REQUEST_TIME_VALUE)
+ {
+ String s = (String)o;
+ if (s.toLowerCase().equals("true") ||
+ s.toLowerCase().equals("false"))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ public boolean isCopyCurrentRenderParameters(TagData data)
+ {
+ Object o = data.getAttribute("copyCurrentRenderParameters");
+ if (o != null && o != TagData.REQUEST_TIME_VALUE)
+ {
+ String s = (String)o;
+ if (s.toLowerCase().equals("true") ||
+ s.toLowerCase().equals("false"))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/Namespace286Tag.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/Namespace286Tag.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/Namespace286Tag.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,33 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.portlet.impl.jsr286.taglib;
+
+import org.jboss.portal.portlet.impl.jsr168.taglib.NamespaceTag;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class Namespace286Tag extends NamespaceTag
+{
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/RenderURL286Tag.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/RenderURL286Tag.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/RenderURL286Tag.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,59 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.portlet.impl.jsr286.taglib;
+
+import javax.portlet.PortletURL;
+import javax.portlet.BaseURL;
+import javax.portlet.ResourceURL;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RenderURL286Tag extends GenerateURL286Tag
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -4232451651940217557L;
+ public static String typeParameter = "render";
+
+ /* (non-Javadoc)
+ * @see org.jboss.portal.portlet.taglib.GenerateURLTag#addTypeParameter()
+ */
+ protected String getTypeValue()
+ {
+ return typeParameter;
+ }
+
+ protected BaseURL generateURL() throws Exception
+ {
+ PortletURL newPortletURL = (PortletURL)super.generateURL();
+
+ setWindowState(newPortletURL);
+
+ setPortletMode(newPortletURL);
+
+ setCopyCurrentRenderParameters(newPortletURL);
+
+ return newPortletURL;
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ResourceURL286Tag.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ResourceURL286Tag.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ResourceURL286Tag.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,104 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.portlet.impl.jsr286.taglib;
+
+import javax.portlet.PortletURL;
+import javax.portlet.ResourceURL;
+import javax.portlet.BaseURL;
+
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class ResourceURL286Tag extends GenerateURL286Tag
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -4132423536342433557L;
+ public static String typeParameter = "resource";
+
+ private String id;
+
+ private String cacheability;
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getCacheability()
+ {
+ return cacheability;
+ }
+
+ protected void setId(ResourceURL resourceURL)
+ {
+ if (id != null)
+ {
+ resourceURL.setResourceID(id);
+ }
+ }
+
+ public void setCacheability(ResourceURL resourceURL)
+ {
+ if (cacheability != null)
+ {
+ resourceURL.setCacheability(cacheability);
+ }
+ else
+ {
+ resourceURL.setCacheability("PAGE");
+ }
+ }
+
+
+ public void setCacheability(String cacheability)
+ {
+ this.cacheability = cacheability;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.portal.portlet.taglib.GenerateURLTag#addTypeParameter()
+ */
+ protected String getTypeValue()
+ {
+ return typeParameter;
+ }
+
+ protected BaseURL generateURL() throws Exception
+ {
+ BaseURL newPortletURL = super.generateURL();
+
+ setId((ResourceURL)newPortletURL);
+ setCacheability((ResourceURL)newPortletURL);
+
+ return newPortletURL;
+ }
+
+}
+
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ResourceURL286TagTEI.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ResourceURL286TagTEI.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ResourceURL286TagTEI.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,66 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.portlet.impl.jsr286.taglib;
+
+import javax.servlet.jsp.tagext.TagData;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class ResourceURL286TagTEI extends GenerateURL286TagTEI
+{
+
+ public boolean isValid(TagData data)
+ {
+ if (super.isValid(data) &&
+ isCacheability(data))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean isCacheability(TagData data)
+ {
+ Object o = data.getAttribute("cacheability");
+ if (o != null && o != TagData.REQUEST_TIME_VALUE)
+ {
+ String s = (String)o;
+ if (s.toLowerCase().equals("full") ||
+ s.toLowerCase().equals("portlet") ||
+ s.toLowerCase().equals("page"))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return true;
+ }
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/URLParameter286Tag.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/URLParameter286Tag.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/URLParameter286Tag.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,33 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.portlet.impl.jsr286.taglib;
+
+import org.jboss.portal.portlet.impl.jsr168.taglib.URLParameterTag;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class URLParameter286Tag extends URLParameterTag
+{
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/URLProperty286Tag.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/URLProperty286Tag.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/URLProperty286Tag.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,155 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.portlet.impl.jsr286.taglib;
+
+import org.jboss.portal.portlet.impl.jsr168.taglib.GenerateURLTag;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.TagSupport;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class URLProperty286Tag extends TagSupport
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1432342354333218087L;
+ private String name;
+ private String value;
+
+ /**
+ * The name of the property to add to the URL.
+ * <p/>
+ * If null or empty, no action is performed.
+ *
+ * @return Returns the name.
+ * @jsp.attribute required="true" rtexprvalue="true"
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /** @param name The name to set. */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * The value of the property to add to the URL.
+ * <p/>
+ * If null, it is processed as an empty value.
+ *
+ * @return Returns the value.
+ * @jsp.attribute required="true" rtexprvalue="true"
+ */
+ public String getValue()
+ {
+ return value;
+ }
+
+ /** @param value The value to set. */
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ /**
+ * No body to process
+ *
+ * @see javax.servlet.jsp.tagext.Tag#doStartTag()
+ */
+ public int doStartTag() throws JspException
+ {
+ return SKIP_BODY;
+ }
+
+ /**
+ * Include the property in the surround tag properties
+ *
+ * @see javax.servlet.jsp.tagext.Tag#doEndTag()
+ */
+ public int doEndTag() throws JspException
+ {
+ try
+ {
+ GenerateURL286Tag ancestorTag =
+ (GenerateURL286Tag)findAncestorWithClass(this, GenerateURL286Tag.class);
+
+ Property p = new Property(getName(), getValue());
+
+ if (p.isValid())
+ {
+ ancestorTag.addProperty(p.getName(), p.getValue());
+ }
+ else
+ {
+ // Should throw a JspException?
+ // Not according to the JSR 286 spec. Ignore it
+ }
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new JspException(e);
+ }
+ return EVAL_PAGE;
+ }
+
+ public class Property
+ {
+ private String name;
+ private String value;
+
+ /** @return Returns the name. */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Per JSR 286 spec, if null, return an empty value
+ *
+ * @return Returns the value.
+ */
+ public String getValue()
+ {
+ return value;
+ }
+
+ public Property(String name, String value)
+ {
+ this.name = name;
+ this.value = value;
+ }
+
+ public boolean isValid()
+ {
+ return name != null && name.length() > 0;
+ }
+ }
+
+}
Modified:
modules/portlet/trunk/portlet/src/main/resources/org/jboss/portal/portlet/portlet_2_0.tld
===================================================================
---
modules/portlet/trunk/portlet/src/main/resources/org/jboss/portal/portlet/portlet_2_0.tld 2008-02-06
18:49:08 UTC (rev 9805)
+++
modules/portlet/trunk/portlet/src/main/resources/org/jboss/portal/portlet/portlet_2_0.tld 2008-02-06
19:02:10 UTC (rev 9806)
@@ -14,7 +14,7 @@
<tag>
<name>param</name>
-
<tag-class>org.jboss.portal.portlet.impl.jsr168.taglib.URLParameterTag</tag-class>
+
<tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.URLParameter286Tag</tag-class>
<body-content>empty</body-content>
<attribute>
@@ -33,9 +33,29 @@
</tag>
<tag>
+ <name>property</name>
+
<tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.URLProperty286Tag</tag-class>
+ <body-content>empty</body-content>
+
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
<name>renderURL</name>
-
<tag-class>org.jboss.portal.portlet.impl.jsr168.taglib.RenderURLTag</tag-class>
-
<tei-class>org.jboss.portal.portlet.impl.jsr168.taglib.GenerateURLTagTEI</tei-class>
+
<tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.RenderURL286Tag</tag-class>
+
<tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.GenerateURL286TagTEI</tei-class>
<body-content>JSP</body-content>
<attribute>
@@ -58,7 +78,17 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
+ <attribute>
+ <name>escapeXml</name>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>copyCurrentRenderParameters</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
</tag>
<tag>
@@ -71,8 +101,8 @@
<tag>
<name>actionURL</name>
-
<tag-class>org.jboss.portal.portlet.impl.jsr168.taglib.ActionURLTag</tag-class>
-
<tei-class>org.jboss.portal.portlet.impl.jsr168.taglib.GenerateURLTagTEI</tei-class>
+
<tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.ActionURL286Tag</tag-class>
+
<tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.GenerateURL286TagTEI</tei-class>
<body-content>JSP</body-content>
<attribute>
@@ -95,12 +125,62 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
+ <attribute>
+ <name>escapeXml</name>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>copyCurrentRenderParameters</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>name</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+
</tag>
<tag>
+ <name>resourceURL</name>
+
<tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.ResourceURL286Tag</tag-class>
+
<tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.ResourceURL286TagTEI</tei-class>
+ <body-content>JSP</body-content>
+
+ <attribute>
+ <name>secure</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>escapeXml</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>cacheability</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>id</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
<name>namespace</name>
-
<tag-class>org.jboss.portal.portlet.impl.jsr168.taglib.NamespaceTag</tag-class>
+
<tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.Namespace286Tag</tag-class>
<body-content>empty</body-content>
</tag>
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/ActionURLTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/ActionURLTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/ActionURLTestCase.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,111 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.portlet.jsr168.ext.taglib;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletURLImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletURL;
+import javax.portlet.WindowState;
+import javax.portlet.PortletMode;
+import java.io.IOException;
+import java.io.StringWriter;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase
+public class ActionURLTestCase extends TaglibTestCase
+{
+ public ActionURLTestCase(PortletTestCase seq)
+ {
+
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().
+ getRequestDispatcher("/actionURL.jsp");
+
+ PortletURL pu1 = response.createActionURL();
+
+ pu1.setWindowState(WindowState.MAXIMIZED);
+ pu1.setPortletMode(PortletMode.EDIT);
+ pu1.setSecure(true);
+
+ PortletURL pu2 = response.createActionURL();
+ pu2.setSecure(false);
+
+ pu2.setParameter("testParam", new String[]
{"testParamValue", "testParamValue2"});
+ pu2.setParameter("secondParam", "testParamValue");
+
+ // Create session
+ request.getPortletSession();
+
+ // escapeXml=true
+ String url1 = response.encodeURL(pu1.toString());
+
+ // escapeXml=false
+ String url2 = response.encodeURL(pu2.toString());
+
+ expectedResults = new String[]{ url1 , url1 , url2 };
+
+ include(dispatcher, request, response);
+
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+
+ assertResults(context);
+
+ return new EndTestResponse();
+ }
+ });
+
+
+ }
+}
\ No newline at end of file
Copied:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/DefineObjectsTestCase.java
(from rev 9794,
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/DefineObjectsTestCase.java)
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/DefineObjectsTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/DefineObjectsTestCase.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,95 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.portlet.jsr168.ext.taglib;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletActionTestAction;
+import org.jboss.portal.unit.actions.PortletEventTestAction;
+import org.jboss.portal.unit.actions.PortletResourceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.jsr286.tck.taglib.*;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.*;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase({
+ Assertion.JSR286_113
+ })
+public class DefineObjectsTestCase extends TaglibTestCase
+{
+
+ //TODO: doesn't test include from action/event - the
actionRequest/actionResponse/eventRequest/eventResponse objects
+
+ public DefineObjectsTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/defineObjects.jsp");
+
+ include(dispatcher, request, response);
+
+ expectedResult =
"jspDispatch,renderRequest,renderResponse,portletConfig";
+
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ assertResult(context);
+
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/NamespaceTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/NamespaceTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/NamespaceTestCase.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,89 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.portlet.jsr168.ext.taglib;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletResourceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.jsr286.tck.taglib.*;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase
+public class NamespaceTestCase extends TaglibTestCase
+{
+
+ public NamespaceTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().
+ getRequestDispatcher("/namespace.jsp");
+
+ expectedResult = response.getNamespace();
+
+ include(dispatcher, request, response);
+
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+
+ assertResult(context);
+
+ return new EndTestResponse();
+ }
+ });
+
+
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/RenderURLTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/RenderURLTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/RenderURLTestCase.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,125 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.portlet.jsr168.ext.taglib;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.jsr286.tck.taglib.*;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.WindowState;
+import javax.portlet.PortletMode;
+import java.io.IOException;
+import java.io.StringWriter;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase
+public class RenderURLTestCase extends TaglibTestCase
+{
+ public RenderURLTestCase(PortletTestCase seq)
+ {
+
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().
+ getRequestDispatcher("/renderURL.jsp");
+
+ PortletURL pu1 = response.createRenderURL();
+
+ pu1.setWindowState(WindowState.NORMAL);
+ pu1.setPortletMode(PortletMode.EDIT);
+ pu1.setSecure(true);
+
+ PortletURL pu2 = response.createRenderURL();
+ pu2.setSecure(false);
+
+ pu2.setParameter("testParam", new String[]
{"testParamValue", "testParamValue2"});
+ pu2.setParameter("secondParam", "testParamValue");
+
+ // Create session
+ request.getPortletSession();
+
+ // escapeXml=true
+ String url1 = response.encodeURL(pu1.toString());
+
+
+ // escapeXml=false
+ String url2 = response.encodeURL(pu2.toString());
+
+
+ expectedResults = new String[]{ url2 };
+
+ include(dispatcher, request, response);
+
+
+// <portlet:renderURL windowState="normal"
portletMode="edit" secure="true"/>
+//
+//<test_result_separator/>
+//
+//<portlet:renderURL windowState="normal" portletMode="edit"
secure="true"/>
+//<%
+// //Put url placed as page variable
+// out.print(pageContext.getAttribute("testVar"));
+//%>
+//
+//<test_result_separator/>
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+
+
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+
+ assertResults(context);
+
+ return new EndTestResponse();
+ }
+ });
+
+
+ }
+}
\ No newline at end of file
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/TaglibTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/TaglibTestCase.java 2008-02-06
18:49:08 UTC (rev 9805)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/TaglibTestCase.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -31,6 +31,8 @@
import org.jboss.portal.unit.annotations.TestCase;
import org.jboss.portal.unit.PortletTestContext;
import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
@@ -42,12 +44,14 @@
import javax.portlet.PortletSession;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
+import java.io.Writer;
/**
* The goal is to test that cross context session attributes are set in container and are
accessible from the direct
@@ -59,20 +63,58 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-@TestCase
-public class TaglibTestCase
+public abstract class TaglibTestCase
{
- public TaglibTestCase(PortletTestCase seq)
+
+ protected String startTag;
+ protected String endTag;
+ protected String expectedResult;
+ protected String[] expectedResults;
+
+
+ protected void include(PortletRequestDispatcher dispatcher, RenderRequest request,
RenderResponse response) throws IOException, PortletException
{
- seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ startTag = "<div id=" + response.getNamespace() + ">";
+ endTag = "</div>";
+
+ Writer writer = response.getWriter();
+
+ writer.write(startTag);
+ dispatcher.include(request, response);
+ writer.write(endTag);
+ }
+
+ protected void assertResult(PortletTestContext context)
+ {
+ String prevResponse = new String(context.getResponseBody());
+
+ String portletResp = prevResponse.substring(prevResponse.indexOf(startTag) +
startTag.length(), prevResponse.indexOf(endTag));
+
+ assertEquals(expectedResult, portletResp.trim());
+ }
+
+ protected void assertResults(PortletTestContext context)
+ {
+ String prevResponse = new String(context.getResponseBody());
+
+ String portletResp = prevResponse.substring(prevResponse.indexOf(startTag) +
startTag.length(), prevResponse.indexOf(endTag));
+
+ String[] results = portletResp.split("<test_result_separator/>");
+
+ // Trim all results
+ for (int i = 0; i < results.length; i++)
{
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- response.setContentType("text/html");
- PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/usetaglib.jsp");
- dispatcher.include(request, response);
- return new EndTestResponse();
- }
- });
+ results[i] = results[i].trim();
+
+ }
+
+
+ assertEquals(expectedResults, results);
}
-}
\ No newline at end of file
+
+ protected PortletInvocation getInvocation(PortletRequest req)
+ {
+ // Get the invocation
+ return
(PortletInvocation)req.getAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
+ }
+}
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/ActionURLTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/ActionURLTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/ActionURLTestCase.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,142 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.portlet.jsr286.tck.taglib;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletURLImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletURL;
+import javax.portlet.WindowState;
+import javax.portlet.PortletMode;
+import java.io.IOException;
+import java.io.StringWriter;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase
+public class ActionURLTestCase extends TaglibTestCase
+{
+ public ActionURLTestCase(PortletTestCase seq)
+ {
+
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+
+ PortletURL url = response.createRenderURL();
+ url.setParameter("testParamOne", "testValue1");
+ url.setParameter("testParameterTwo", "testValue2");
+
+
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().
+ getRequestDispatcher("/actionURL.jsp");
+
+ PortletURL pu1 = response.createActionURL();
+
+ pu1.setWindowState(WindowState.MAXIMIZED);
+ pu1.setPortletMode(PortletMode.EDIT);
+ pu1.setSecure(true);
+ pu1.setParameter("javax.portlet.action", "testAction");
+
+ // Params from previos request
+ pu1.setParameter("testParamOne", "testValue1");
+ pu1.setParameter("testParameterTwo", "testValue2");
+
+ PortletURL pu2 = response.createActionURL();
+ pu2.setSecure(false);
+ pu2.setParameter("javax.portlet.action", "testAction");
+
+ pu2.setParameter("testParam", new String[]
{"testParamValue", "testParamValue2"});
+ pu2.setParameter("secondParam", "testParamValue");
+ pu2.setProperty("testProperty", "testPropValue");
+ pu2.setProperty("testProperty", "testPropValue2");
+ pu2.setProperty("secondProperty", "testPropValue");
+
+ StringWriter sw = new StringWriter();
+
+ // Create session
+ request.getPortletSession();
+
+ // escapeXml=true
+ pu1.write(sw, true);
+ String url1 = response.encodeURL(sw.toString());
+
+ sw = new StringWriter();
+
+ // escapeXml=false
+ pu2.write(sw, false);
+ String url2 = response.encodeURL(sw.toString());
+ sw.flush();
+
+
+ expectedResults = new String[]{ url1, url1, url2};
+
+ include(dispatcher, request, response);
+
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+
+ assertResults(context);
+
+ return new EndTestResponse();
+ }
+ });
+
+
+ }
+}
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/DefineObjectsTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/DefineObjectsTestCase.java 2008-02-06
18:49:08 UTC (rev 9805)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/DefineObjectsTestCase.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -58,14 +58,11 @@
@TestCase({
Assertion.JSR286_113
})
-public class DefineObjectsTestCase
+public class DefineObjectsTestCase extends TaglibTestCase
{
//TODO: doesn't test include from action/event - the
actionRequest/actionResponse/eventRequest/eventResponse objects
- private String startTag;
- private String endTag;
-
public DefineObjectsTestCase(PortletTestCase seq)
{
seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
@@ -73,18 +70,14 @@
protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
response.setContentType("text/html");
- PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/taglib.jsp");
+ PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/defineObjects.jsp");
- startTag = "<div id=" + response.getNamespace() +
">";
- endTag = "</div>";
+ include(dispatcher, request, response);
- Writer writer = response.getWriter();
+ expectedResult =
"jspDispatch,renderRequest,renderResponse,portletConfig,portletSession,portletSessionScope,"
+
+ "portletPreferences,portletPreferencesValues";
- writer.write(startTag);
- dispatcher.include(request, response);
- writer.write(endTag);
-
return new InvokeGetResponse(response.createRenderURL().toString());
}
});
@@ -95,15 +88,8 @@
{
protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
- response.setContentType("text/html");
-
- String prevResponse = new String(context.getResponseBody());
-
- String portletResp = prevResponse.substring(prevResponse.indexOf(startTag) +
startTag.length(), prevResponse.indexOf(endTag));
-
-
assertEquals("jspDispatch,renderRequest,renderResponse,portletConfig,portletSession,portletSessionScope,"
+
- "portletPreferences,portletPreferencesValues",
portletResp.trim());
-
+ assertResult(context);
+
return new InvokeGetResponse(response.createResourceURL().toString());
}
});
@@ -113,7 +99,7 @@
protected DriverResponse run(Portlet portlet, ResourceRequest request,
ResourceResponse response, PortletTestContext context) throws IOException,
PortletException
{
response.setContentType("text/html");
- PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/taglib.jsp");
+ PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/defineObjects.jsp");
startTag = "<div id=" + response.getNamespace() +
">";
endTag = "</div>";
@@ -124,6 +110,9 @@
dispatcher.include(request, response);
writer.write(endTag);
+ expectedResult =
"jspDispatch,resourceRequest,resourceResponse,portletConfig,portletSession,portletSessionScope,"
+
+ "portletPreferences,portletPreferencesValues";
+
return new InvokeGetResponse(response.createRenderURL().toString());
}
});
@@ -132,15 +121,8 @@
{
protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
- response.setContentType("text/html");
+ assertResult(context);
- String prevResponse = new String(context.getResponseBody());
-
- String portletResp = prevResponse.substring(prevResponse.indexOf(startTag) +
startTag.length(), prevResponse.indexOf(endTag));
-
-
assertEquals("jspDispatch,resourceRequest,resourceResponse,portletConfig,portletSession,portletSessionScope,"
+
- "portletPreferences,portletPreferencesValues",
portletResp.trim());
-
return new EndTestResponse();
}
});
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/NamespaceTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/NamespaceTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/NamespaceTestCase.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,88 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.portlet.jsr286.tck.taglib;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletResourceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase
+public class NamespaceTestCase extends TaglibTestCase
+{
+
+ public NamespaceTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().
+ getRequestDispatcher("/namespace.jsp");
+
+ expectedResult = response.getNamespace();
+
+ include(dispatcher, request, response);
+
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+
+ assertResult(context);
+
+ return new EndTestResponse();
+ }
+ });
+
+
+ }
+}
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/RenderURLTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/RenderURLTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/RenderURLTestCase.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,137 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.portlet.jsr286.tck.taglib;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.WindowState;
+import javax.portlet.PortletMode;
+import java.io.IOException;
+import java.io.StringWriter;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase
+public class RenderURLTestCase extends TaglibTestCase
+{
+ public RenderURLTestCase(PortletTestCase seq)
+ {
+
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+
+ PortletURL url = response.createRenderURL();
+ url.setParameter("testParamOne", "testValue1");
+ url.setParameter("testParameterTwo", "testValue2");
+
+
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().
+ getRequestDispatcher("/renderURL.jsp");
+
+ PortletURL pu1 = response.createRenderURL();
+
+ pu1.setWindowState(WindowState.NORMAL);
+ pu1.setPortletMode(PortletMode.EDIT);
+ pu1.setSecure(true);
+
+ // Params from previos request
+ pu1.setParameter("testParamOne", "testValue1");
+ pu1.setParameter("testParameterTwo", "testValue2");
+
+ PortletURL pu2 = response.createRenderURL();
+ pu2.setSecure(false);
+
+ pu2.setParameter("testParam", new String[]
{"testParamValue", "testParamValue2"});
+ pu2.setParameter("secondParam", "testParamValue");
+ pu2.setProperty("testProperty", "testPropValue");
+ pu2.setProperty("testProperty", "testPropValue2");
+ pu2.setProperty("secondProperty", "testPropValue");
+
+ StringWriter sw = new StringWriter();
+
+ // Create session
+ request.getPortletSession();
+
+ // escapeXml=true
+ pu1.write(sw, true);
+ String url1 = response.encodeURL(sw.toString());
+
+ sw = new StringWriter();
+
+ // escapeXml=false
+ pu2.write(sw, false);
+ String url2 = response.encodeURL(sw.toString());
+ sw.flush();
+
+
+ expectedResults = new String[]{ url1, url1, url2};
+
+ include(dispatcher, request, response);
+
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+
+ assertResults(context);
+
+ return new EndTestResponse();
+ }
+ });
+
+
+ }
+}
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/ResourceURLTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/ResourceURLTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/ResourceURLTestCase.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,131 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.portlet.jsr286.tck.taglib;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.WindowState;
+import javax.portlet.PortletMode;
+import javax.portlet.ResourceURL;
+import java.io.IOException;
+import java.io.StringWriter;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase
+public class ResourceURLTestCase extends TaglibTestCase
+{
+ public ResourceURLTestCase(PortletTestCase seq)
+ {
+
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().
+ getRequestDispatcher("/resourceURL.jsp");
+
+ ResourceURL pu1 = response.createResourceURL();
+
+ pu1.setSecure(true);
+ pu1.setCacheability("FULL");
+
+ ResourceURL pu2 = response.createResourceURL();
+
+ pu2.setSecure(true);
+ pu2.setResourceID("testId1");
+
+
+ ResourceURL pu3 = response.createResourceURL();
+ pu3.setSecure(false);
+
+ pu3.setParameter("testParam", new String[]
{"testParamValue", "testParamValue2"});
+ pu3.setParameter("secondParam", "testParamValue");
+ pu3.setProperty("testProperty", "testPropValue");
+ pu3.setProperty("testProperty", "testPropValue2");
+ pu3.setProperty("secondProperty", "testPropValue");
+
+
+ StringWriter sw = new StringWriter();
+
+ // Create session
+ request.getPortletSession();
+
+ // escapeXml=true
+ pu1.write(sw, true);
+ String url1 = response.encodeURL(sw.toString());
+
+ sw = new StringWriter();
+
+ // escapeXml=true
+ pu2.write(sw, true);
+ String url2 = response.encodeURL(sw.toString());
+
+ sw = new StringWriter();
+
+ // escapeXml=false
+ pu3.write(sw, false);
+ String url3 = response.encodeURL(sw.toString());
+
+
+ expectedResults = new String[]{ url1, url2, url3};
+
+ include(dispatcher, request, response);
+
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+
+ assertResults(context);
+
+ return new EndTestResponse();
+ }
+ });
+
+
+ }
+}
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/TaglibTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/TaglibTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/TaglibTestCase.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,99 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.portlet.jsr286.tck.taglib;
+
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.RenderResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.PortletException;
+import javax.servlet.ServletRequest;
+import java.io.Writer;
+import java.io.IOException;
+
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public abstract class TaglibTestCase
+{
+
+ protected String startTag;
+ protected String endTag;
+ protected String expectedResult;
+ protected String[] expectedResults;
+
+
+ protected void include(PortletRequestDispatcher dispatcher, RenderRequest request,
RenderResponse response) throws IOException, PortletException
+ {
+ startTag = "<div id=" + response.getNamespace() + ">";
+ endTag = "</div>";
+
+ Writer writer = response.getWriter();
+
+ writer.write(startTag);
+ dispatcher.include(request, response);
+ writer.write(endTag);
+ }
+
+ protected void assertResult(PortletTestContext context)
+ {
+ String prevResponse = new String(context.getResponseBody());
+
+ String portletResp = prevResponse.substring(prevResponse.indexOf(startTag) +
startTag.length(), prevResponse.indexOf(endTag));
+
+ assertEquals(expectedResult, portletResp.trim());
+ }
+
+ protected void assertResults(PortletTestContext context)
+ {
+ String prevResponse = new String(context.getResponseBody());
+
+ String portletResp = prevResponse.substring(prevResponse.indexOf(startTag) +
startTag.length(), prevResponse.indexOf(endTag));
+
+ String[] results = portletResp.split("<test_result_separator/>");
+
+ // Trim all results
+ for (int i = 0; i < results.length; i++)
+ {
+ results[i] = results[i].trim();
+
+ }
+
+
+ assertEquals(expectedResults, results);
+ }
+
+ protected PortletInvocation getInvocation(PortletRequest req)
+ {
+ // Get the invocation
+ return
(PortletInvocation)req.getAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
+ }
+}
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-02-06
18:49:08 UTC (rev 9805)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-02-06
19:02:10 UTC (rev 9806)
@@ -1280,37 +1280,78 @@
"that the portlet must have when this link is executed, if no error condition
ocurred"),
JSR286_319(new TCK(319), "PLT.26.2", "If the specified portlet mode is
illegal for the current request, a " +
"JspException must be thrown."),
- JSR286_320(new TCK(320), "PLT.26.2", ""),
- JSR286_321(new TCK(321), "PLT.26.2", ""),
- JSR286_322(new TCK(322), "PLT.26.2", ""),
- JSR286_323(new TCK(323), Status.specUntestable(""), "PLT.26.2",
""),
- JSR286_324(new TCK(324), Status.specUntestable(""), "PLT.26.2",
""),
- JSR286_325(new TCK(325), Status.specUntestable(""), "PLT.26.2",
""),
- JSR286_326(new TCK(326), Status.specUntestable(""), "PLT.26.2",
""),
- JSR286_327(new TCK(327), "PLT.26.3", ""),
- JSR286_328(new TCK(328), "PLT.26.3", ""),
- JSR286_329(new TCK(329), "PLT.26.3", ""),
- JSR286_330(new TCK(330), "PLT.26.3", ""),
- JSR286_331(new TCK(331), "PLT.26.3", ""),
- JSR286_332(new TCK(332), "PLT.26.3", ""),
- JSR286_333(new TCK(333), "PLT.26.3", ""),
- JSR286_334(new TCK(334), "PLT.26.3", ""),
- JSR286_335(new TCK(335), Status.specUntestable(""), "PLT.26.3",
""),
- JSR286_336(new TCK(336), Status.specUntestable(""), "PLT.26.3",
""),
- JSR286_337(new TCK(337), Status.specUntestable(""), "PLT.26.3",
""),
- JSR286_338(new TCK(338), Status.specUntestable(""), "PLT.26.3",
""),
- JSR286_339(new TCK(339), "PLT.26.4", ""),
- JSR286_340(new TCK(340), "PLT.26.4", ""),
- JSR286_341(new TCK(341), "PLT.26.4", ""),
- JSR286_342(new TCK(342), "PLT.26.4", ""),
- JSR286_343(new TCK(343), "PLT.26.4", ""),
- JSR286_344(new TCK(344), "PLT.26.4", ""),
- JSR286_345(new TCK(345), "PLT.26.4", ""),
- JSR286_346(new TCK(346), "PLT.26.5", ""),
- JSR286_347(new TCK(347), "PLT.26.6", ""),
- JSR286_348(new TCK(348), "PLT.26.6", ""),
- JSR286_349(new TCK(349), "PLT.26.6", ""),
- JSR286_350(new TCK(350), "PLT.26.6", "")
+ JSR286_320(new TCK(320), "PLT.26.2", "If a portlet mode is not set for
a URL, it must stay the same as the mode of " +
+ "the current request."),
+ JSR286_321(new TCK(321), "PLT.26.2", "If the result is exported as a
JSP scoped variable, defined via the var " +
+ "attributes, nothing is written to the current JspWriter."),
+ JSR286_322(new TCK(322), "PLT.26.2", "If the given variable name
already exists in the scope of the page or it " +
+ "is used within an iteration loop, the new value overwrites the old
one."),
+ JSR286_323(new TCK(323), Status.specUntestable(""), "PLT.26.2",
"If the specified security setting is not supported " +
+ "by the run-time environment, a JspException must be thrown"),
+ JSR286_324(new TCK(324), Status.specUntestable(""), "PLT.26.2",
"copyCurrentRenderParameters (Type: boolean, " +
+ "non-required) – if set to true requests that the private render parameters of
the portlet of the current " +
+ "request must be attached to this URL."),
+ JSR286_325(new TCK(325), Status.specUntestable(""), "PLT.26.2",
"If additional <portlet:param> tags are specified " +
+ "parameters with the same name as an existing render parameter will get merged
and the value defined in " +
+ "additional <portlet:param> tags must be pre-pended."),
+ JSR286_326(new TCK(326), Status.specUntestable(""), "PLT.26.2",
"escapeXml (Type: boolean, non-required) – " +
+ "determines whether characters <,>,&,’,” in the resulting output
should be converted to their corresponding " +
+ "character entity codes (‘<’ gets converted to ‘<’, ‘>’ gets
converted to ‘>’ ‘&’ gets converted to " +
+ "‘&’, ‘‘’ gets converted to ‘'’, ‘”’ gets converted to
‘"’)."),
+ JSR286_327(new TCK(327), "PLT.26.3", "The portlet renderURL tag creates
a URL that must point to the current " +
+ "portlet and must trigger a render request with the supplied
parameters."),
+ JSR286_328(new TCK(328), "PLT.26.3", "If the specified window state is
illegal for the current request, a " +
+ "JspException must be thrown."),
+ JSR286_329(new TCK(329), "PLT.26.3", "If a window state is not set for
a URL, it should stay the same as the " +
+ "window state of the current request."),
+ JSR286_330(new TCK(330), "PLT.26.3", "portletMode (Type: String,
non-required) – indicates the portlet mode that " +
+ "the portlet must have when this link is executed, if not error condition
ocurred."),
+ JSR286_331(new TCK(331), "PLT.26.3", "If the specified portlet mode is
illegal for the current request, a " +
+ "JspException must be thrown."),
+ JSR286_332(new TCK(332), "PLT.26.3", "If a portlet mode is not set for
a URL, it must stay the same as the " +
+ "mode of the current request."),
+ JSR286_333(new TCK(333), "PLT.26.3", "If the result is exported as a
JSP scoped variable, defined via the var " +
+ "attributes, nothing is written to the current JspWriter."),
+ JSR286_334(new TCK(334), "PLT.26.3", "If the given variable name
already exists in the scope of the page or it " +
+ "is used within an iteration loop, the new value overwrites the old
one"),
+ JSR286_335(new TCK(335), Status.specUntestable(""), "PLT.26.3",
"If the security is not set for a URL, it must " +
+ "stay the same as the security setting of the current request."),
+ JSR286_336(new TCK(336), Status.specUntestable(""), "PLT.26.3",
"copyCurrentRenderParameters (Type: boolean, " +
+ "non-required) – if set to true requests that the private render parameters of
the portlet of the current " +
+ "request must attached to this URL."),
+ JSR286_337(new TCK(337), Status.specUntestable(""), "PLT.26.3",
"If additional <portlet:param> tags are specified " +
+ "parameters with the same name as an existing render parameter will get merged
and the value defined in " +
+ "additional <portlet:param> tags must be pre-pended."),
+ JSR286_338(new TCK(338), Status.specUntestable(""), "PLT.26.3",
"escapeXml (Type: boolean, non-required) – " +
+ "deterrmines whether characters <,>,&,’,” in the resulting output
should be converted to their corresponding " +
+ "character entity codes (‘<’ gets converted to ‘<’, ‘>’ gets
converted to ‘>’ ‘&’ gets converted to " +
+ "‘&’, ‘‘’ gets converted to ‘'’, ‘”’ gets converted to
‘"’)."),
+ JSR286_339(new TCK(339), "PLT.26.4", "The portlet resourceURL tag
creates a URL that must point to the current " +
+ "portlet and must trigger a serveResource request with the supplied
parameters"),
+ JSR286_340(new TCK(340), "PLT.26.4", "The resourceURL must preserve the
current portlet mode, window state and " +
+ "render parameters."),
+ JSR286_341(new TCK(341), "PLT.26.4", "If such a parameter has the same
name as a render parameter in this URL, " +
+ "the render parameter value must be the last value in the attribute value
array."),
+ JSR286_342(new TCK(342), "PLT.26.4", "If the result is exported as a
JSP scoped variable, defined via the var " +
+ "attributes, nothing is written to the current JspWriter"),
+ JSR286_343(new TCK(343), "PLT.26.4", "If the given variable name
already exists in the scope of the page or it " +
+ "is used within an iteration loop, the new value overwrites the old
one."),
+ JSR286_344(new TCK(344), Status.specUntestable(""), "PLT.26.4",
"If the security is not set for a URL, it must " +
+ "stay the same as the security setting of the current request."),
+ JSR286_345(new TCK(345), Status.specUntestable(""), "PLT.26.4",
"escapeXml (Type: boolean, non-required) – " +
+ "determines whether characters <,>,&,’,” in the resulting output
should be converted to their corresponding " +
+ "character entity codes (‘<’ gets converted to ‘<’, ‘>’ gets
converted to ‘>’ ‘&’ gets converted to " +
+ "‘&’, ‘‘’ gets converted to ‘'’, ‘”’ gets converted to
‘"’)."),
+ JSR286_346(new TCK(346), "PLT.26.5", "This tag produces a unique value
for the current portlet and must match " +
+ "the value of PortletResponse.getNamespace method."),
+ JSR286_347(new TCK(347), "PLT.26.6", "This tag defines a parameter that
may be added to an actionURL, renderURL " +
+ "or resourceURL."),
+ JSR286_348(new TCK(348), Status.specUntestable(""), "PLT.26.6",
"The param tag must not contain any body content."),
+ JSR286_349(new TCK(349), "PLT.26.6", "If the param tag has an empty
value the specified parameter name must be " +
+ "removed from the URL."),
+ JSR286_350(new TCK(350), "PLT.26.6", "If the same name of a parameter
occurs more than once within an actionURL, " +
+ "renderURL or resourceURL the values must be delivered as parameter value
array with the values in the order " +
+ "of the declaration within the URL tag.")
;
Modified:
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/portlet.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/portlet.xml 2008-02-06
18:49:08 UTC (rev 9805)
+++
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/portlet.xml 2008-02-06
19:02:10 UTC (rev 9806)
@@ -31,7 +31,8 @@
<portlet-name>UniversalTestPortletA</portlet-name>
<portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
<supports>
- <mime-type>text/html</mime-type>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>EDIT</portlet-mode>
</supports>
<portlet-info>
<title></title>
Added: modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/actionURL.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/actionURL.jsp
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/actionURL.jsp 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,23 @@
+<%@ page language="java" %>
+<%@ taglib
uri="http://java.sun.com/portlet" prefix="portlet"
%>
+<portlet:defineObjects/>
+
+<portlet:actionURL windowState="maximized" portletMode="edit"
secure="true"/>
+
+<test_result_separator/>
+
+<portlet:actionURL windowState="maximized" portletMode="edit"
secure="true" var="testVar"/>
+<%
+ //Put url placed as page variable
+ out.print(pageContext.getAttribute("testVar"));
+%>
+
+<test_result_separator/>
+
+<portlet:actionURL secure="false">
+
+ <portlet:param name="testParam" value="testParamValue"/>
+ <portlet:param name="testParam" value="testParamValue2"/>
+ <portlet:param name="secondParam" value="testParamValue"/>
+
+</portlet:actionURL>
Added:
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/defineObjects.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/defineObjects.jsp
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/defineObjects.jsp 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,23 @@
+<%@ page import="javax.portlet.RenderRequest" %>
+<%@ page import="javax.portlet.RenderResponse" %>
+<%@ page import="javax.portlet.PortletConfig" %>
+<%@ page language="java" %>
+<%@ taglib
uri="http://java.sun.com/portlet" prefix="portlet"
%>
+<portlet:defineObjects/>
+<%
+ out.print("jspDispatch");
+
+ if (renderRequest != null && renderRequest instanceof RenderRequest)
+ {
+ out.print(",renderRequest");
+ }
+ if (renderResponse != null && renderResponse instanceof RenderResponse)
+ {
+ out.print(",renderResponse");
+ }
+ if (portletConfig != null && portletConfig instanceof PortletConfig)
+ {
+ out.print(",portletConfig");
+ }
+
+%>
\ No newline at end of file
Added: modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/namespace.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/namespace.jsp
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/namespace.jsp 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,4 @@
+<%@ page language="java" %>
+<%@ taglib
uri="http://java.sun.com/portlet" prefix="portlet"
%>
+<portlet:defineObjects/>
+<portlet:namespace/>
\ No newline at end of file
Added: modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/renderURL.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/renderURL.jsp
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/renderURL.jsp 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,9 @@
+<%@ page language="java" %>
+<%@ taglib
uri="http://java.sun.com/portlet" prefix="portlet"
%>
+<portlet:defineObjects/>
+
+<portlet:renderURL secure="false">
+ <portlet:param name="testParam" value="testParamValue"/>
+ <portlet:param name="testParam" value="testParamValue2"/>
+ <portlet:param name="secondParam" value="testParamValue"/>
+</portlet:renderURL>
\ No newline at end of file
Modified:
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/WEB-INF/portlet.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/WEB-INF/portlet.xml 2008-02-06
18:49:08 UTC (rev 9805)
+++
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/WEB-INF/portlet.xml 2008-02-06
19:02:10 UTC (rev 9806)
@@ -32,6 +32,7 @@
<portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
<supports>
<mime-type>text/html</mime-type>
+ <portlet-mode>EDIT</portlet-mode>
</supports>
</portlet>
Added: modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/actionURL.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/actionURL.jsp
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/actionURL.jsp 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,29 @@
+<%@ page language="java" %>
+<%@ taglib
uri="http://java.sun.com/portlet_2_0" prefix="portlet"
%>
+<portlet:defineObjects/>
+
+<portlet:actionURL windowState="maximized" portletMode="edit"
secure="true" copyCurrentRenderParameters="true"
+ escapeXml="true" name="testAction"/>
+
+<test_result_separator/>
+
+<portlet:actionURL windowState="maximized" portletMode="edit"
secure="true" copyCurrentRenderParameters="true"
+ escapeXml="true" name="testAction"
var="testVar"/>
+<%
+ //Put url placed as page variable
+ out.print(pageContext.getAttribute("testVar"));
+%>
+
+<test_result_separator/>
+
+<portlet:actionURL secure="false" name="testAction"
escapeXml="false">
+
+ <portlet:property name="testProperty"
value="testPropValue"/>
+ <portlet:property name="testProperty"
value="testPropValue2"/>
+ <portlet:property name="secondProperty"
value="testPropValue"/>
+
+ <portlet:param name="testParam" value="testParamValue"/>
+ <portlet:param name="testParam" value="testParamValue2"/>
+ <portlet:param name="secondParam" value="testParamValue"/>
+
+</portlet:actionURL>
Copied:
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/defineObjects.jsp
(from rev 9794,
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/taglib.jsp)
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/defineObjects.jsp
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/defineObjects.jsp 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,73 @@
+<%@ page import="org.jboss.unit.api.Assert" %>
+<%@ page import="javax.portlet.RenderRequest" %>
+<%@ page import="javax.portlet.RenderResponse" %>
+<%@ page import="javax.portlet.ActionRequest" %>
+<%@ page import="javax.portlet.ActionResponse" %>
+<%@ page import="javax.portlet.EventRequest" %>
+<%@ page import="javax.portlet.EventResponse" %>
+<%@ page import="javax.portlet.ResourceRequest" %>
+<%@ page import="javax.portlet.ResourceResponse" %>
+<%@ page import="javax.portlet.PortletConfig" %>
+<%@ page import="javax.portlet.PortletSession" %>
+<%@ page import="java.util.Map" %>
+<%@ page import="javax.portlet.PortletPreferences" %>
+<%@ page language="java" %>
+<%@ taglib
uri="http://java.sun.com/portlet_2_0" prefix="portlet"
%>
+<portlet:defineObjects/>
+<%
+ out.print("jspDispatch");
+
+ if (renderRequest != null && renderRequest instanceof RenderRequest)
+ {
+ out.print(",renderRequest");
+ }
+ if (renderResponse != null && renderResponse instanceof RenderResponse)
+ {
+ out.print(",renderResponse");
+ }
+ if (actionRequest != null && actionRequest instanceof ActionRequest)
+ {
+ out.print(",actionRequest");
+ }
+ if (actionResponse != null && actionResponse instanceof ActionResponse)
+ {
+ out.print(",actionResponse");
+ }
+ if (eventRequest != null && eventRequest instanceof EventRequest)
+ {
+ out.print(",eventRequest");
+ }
+ if (eventResponse != null && eventResponse instanceof EventResponse)
+ {
+ out.print(",eventResponse");
+ }
+ if (resourceRequest != null && resourceRequest instanceof ResourceRequest)
+ {
+ out.print(",resourceRequest");
+ }
+ if (resourceResponse != null && resourceResponse instanceof ResourceResponse)
+ {
+ out.print(",resourceResponse");
+ }
+ if (portletConfig != null && portletConfig instanceof PortletConfig)
+ {
+ out.print(",portletConfig");
+ }
+ if (portletSession != null && portletSession instanceof PortletSession)
+ {
+ out.print(",portletSession");
+ }
+ if (portletSessionScope != null && portletSessionScope instanceof Map)
+ {
+ out.print(",portletSessionScope");
+ }
+ if (portletPreferences != null && portletPreferences instanceof
PortletPreferences)
+ {
+ out.print(",portletPreferences");
+ }
+ if (portletPreferencesValues != null && portletPreferencesValues instanceof
Map)
+ {
+ out.print(",portletPreferencesValues");
+ }
+
+%>
\ No newline at end of file
Added: modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/namespace.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/namespace.jsp
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/namespace.jsp 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,4 @@
+<%@ page language="java" %>
+<%@ taglib
uri="http://java.sun.com/portlet_2_0" prefix="portlet"
%>
+<portlet:defineObjects/>
+<portlet:namespace/>
\ No newline at end of file
Added: modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/renderURL.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/renderURL.jsp
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/renderURL.jsp 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,27 @@
+<%@ page language="java" %>
+<%@ taglib
uri="http://java.sun.com/portlet_2_0" prefix="portlet"
%>
+<portlet:defineObjects/>
+
+<portlet:renderURL windowState="normal" portletMode="edit"
secure="true" copyCurrentRenderParameters="true"
+ escapeXml="true"/>
+
+<test_result_separator/>
+
+<portlet:renderURL windowState="normal" portletMode="edit"
secure="true" copyCurrentRenderParameters="true"
+ escapeXml="true" var="testVar"/>
+<%
+ //Put url placed as page variable
+ out.print(pageContext.getAttribute("testVar"));
+%>
+
+<test_result_separator/>
+
+<portlet:renderURL secure="false" escapeXml="false">
+ <portlet:property name="testProperty"
value="testPropValue"/>
+ <portlet:property name="testProperty"
value="testPropValue2"/>
+ <portlet:property name="secondProperty"
value="testPropValue"/>
+
+ <portlet:param name="testParam" value="testParamValue"/>
+ <portlet:param name="testParam" value="testParamValue2"/>
+ <portlet:param name="secondParam" value="testParamValue"/>
+</portlet:renderURL>
\ No newline at end of file
Added:
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/resourceURL.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/resourceURL.jsp
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/resourceURL.jsp 2008-02-06
19:02:10 UTC (rev 9806)
@@ -0,0 +1,26 @@
+<%@ page language="java" %>
+<%@ taglib
uri="http://java.sun.com/portlet_2_0" prefix="portlet"
%>
+<portlet:defineObjects/>
+
+
+<portlet:resourceURL secure="true" escapeXml="true"
cacheability="FULL"/>
+
+<test_result_separator/>
+
+<portlet:resourceURL secure="true" escapeXml="true"
id="testId1" var="testVar"/>
+<%
+ //Put url placed as page variable
+ out.print(pageContext.getAttribute("testVar"));
+%>
+
+<test_result_separator/>
+
+<portlet:resourceURL secure="false" escapeXml="false">
+ <portlet:property name="testProperty"
value="testPropValue"/>
+ <portlet:property name="testProperty"
value="testPropValue2"/>
+ <portlet:property name="secondProperty"
value="testPropValue"/>
+
+ <portlet:param name="testParam" value="testParamValue"/>
+ <portlet:param name="testParam" value="testParamValue2"/>
+ <portlet:param name="secondParam" value="testParamValue"/>
+</portlet:resourceURL>
Deleted: modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/taglib.jsp
===================================================================
---
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/taglib.jsp 2008-02-06
18:49:08 UTC (rev 9805)
+++
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/taglib.jsp 2008-02-06
19:02:10 UTC (rev 9806)
@@ -1,73 +0,0 @@
-<%@ page import="org.jboss.unit.api.Assert" %>
-<%@ page import="javax.portlet.RenderRequest" %>
-<%@ page import="javax.portlet.RenderResponse" %>
-<%@ page import="javax.portlet.ActionRequest" %>
-<%@ page import="javax.portlet.ActionResponse" %>
-<%@ page import="javax.portlet.EventRequest" %>
-<%@ page import="javax.portlet.EventResponse" %>
-<%@ page import="javax.portlet.ResourceRequest" %>
-<%@ page import="javax.portlet.ResourceResponse" %>
-<%@ page import="javax.portlet.PortletConfig" %>
-<%@ page import="javax.portlet.PortletSession" %>
-<%@ page import="java.util.Map" %>
-<%@ page import="javax.portlet.PortletPreferences" %>
-<%@ page language="java" %>
-<%@ taglib
uri="http://java.sun.com/portlet_2_0" prefix="portlet"
%>
-<portlet:defineObjects/>
-<%
- out.print("jspDispatch");
-
- if (renderRequest != null && renderRequest instanceof RenderRequest)
- {
- out.print(",renderRequest");
- }
- if (renderResponse != null && renderResponse instanceof RenderResponse)
- {
- out.print(",renderResponse");
- }
- if (actionRequest != null && actionRequest instanceof ActionRequest)
- {
- out.print(",actionRequest");
- }
- if (actionResponse != null && actionResponse instanceof ActionResponse)
- {
- out.print(",actionResponse");
- }
- if (eventRequest != null && eventRequest instanceof EventRequest)
- {
- out.print(",eventRequest");
- }
- if (eventResponse != null && eventResponse instanceof EventResponse)
- {
- out.print(",eventResponse");
- }
- if (resourceRequest != null && resourceRequest instanceof ResourceRequest)
- {
- out.print(",resourceRequest");
- }
- if (resourceResponse != null && resourceResponse instanceof ResourceResponse)
- {
- out.print(",resourceResponse");
- }
- if (portletConfig != null && portletConfig instanceof PortletConfig)
- {
- out.print(",portletConfig");
- }
- if (portletSession != null && portletSession instanceof PortletSession)
- {
- out.print(",portletSession");
- }
- if (portletSessionScope != null && portletSessionScope instanceof Map)
- {
- out.print(",portletSessionScope");
- }
- if (portletPreferences != null && portletPreferences instanceof
PortletPreferences)
- {
- out.print(",portletPreferences");
- }
- if (portletPreferencesValues != null && portletPreferencesValues instanceof
Map)
- {
- out.print(",portletPreferencesValues");
- }
-
-%>
\ No newline at end of file