Author: mrdon
Date: Thu Jan 11 23:15:43 2007
New Revision: 495502
URL: http://svn.apache.org/viewvc?view=rev&rev=495502
Log:
Fixing getActionForMode on portlet context
WW-1636
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java
struts/struts2/trunk/core/src/test/java/org/apache/struts2/portlet/context/PortletActionContextTest.java
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java?view=diff&rev=495502&r1=495501&r2=495502
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java
Thu Jan 11 23:15:43 2007
@@ -30,6 +30,7 @@
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
+import org.apache.struts2.dispatcher.mapper.ActionMapping;
import org.apache.struts2.portlet.PortletActionConstants;
import com.opensymphony.xwork2.ActionContext;
@@ -176,12 +177,12 @@
}
/**
- * Get the default action name for the current mode.
+ * Get the default action mapping for the current mode.
*
- * @return The default action name for the current portlet mode.
+ * @return The default action mapping for the current portlet mode.
*/
- public static String getDefaultActionForMode() {
- return (String)getContext().get(DEFAULT_ACTION_FOR_MODE);
+ public static ActionMapping getDefaultActionForMode() {
+ return (ActionMapping)getContext().get(DEFAULT_ACTION_FOR_MODE);
}
/**
Modified:
struts/struts2/trunk/core/src/test/java/org/apache/struts2/portlet/context/PortletActionContextTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/portlet/context/PortletActionContextTest.java?view=diff&rev=495502&r1=495501&r2=495502
==============================================================================
---
struts/struts2/trunk/core/src/test/java/org/apache/struts2/portlet/context/PortletActionContextTest.java
(original)
+++
struts/struts2/trunk/core/src/test/java/org/apache/struts2/portlet/context/PortletActionContextTest.java
Thu Jan 11 23:15:43 2007
@@ -31,6 +31,7 @@
import junit.textui.TestRunner;
+import org.apache.struts2.dispatcher.mapper.ActionMapping;
import org.apache.struts2.portlet.PortletActionConstants;
import org.jmock.Mock;
import org.jmock.MockObjectTestCase;
@@ -166,8 +167,9 @@
}
public void testGetDefaultActionForMode() {
- context.put(PortletActionConstants.DEFAULT_ACTION_FOR_MODE,
"testAction");
- assertEquals("testAction",
PortletActionContext.getDefaultActionForMode());
+ ActionMapping mapping = new ActionMapping();
+ context.put(PortletActionConstants.DEFAULT_ACTION_FOR_MODE, mapping);
+ assertEquals(mapping, PortletActionContext.getDefaultActionForMode());
}
public void tearDown() throws Exception {