struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hus...@apache.org
Subject svn commit: r438331 - in /struts/struts2/trunk/apps/mailreader/src: main/java/ main/webapp/pages/ test/java/mailreader2/
Date Wed, 30 Aug 2006 03:00:32 GMT
Author: husted
Date: Tue Aug 29 20:00:32 2006
New Revision: 438331

URL: http://svn.apache.org/viewvc?rev=438331&view=rev
Log:
WW-1349 Add configuration test; reorder action elements. 


Added:
    struts/struts2/trunk/apps/mailreader/src/test/java/mailreader2/
    struts/struts2/trunk/apps/mailreader/src/test/java/mailreader2/ConfigTest.java
Modified:
    struts/struts2/trunk/apps/mailreader/src/main/java/struts.properties
    struts/struts2/trunk/apps/mailreader/src/main/java/struts.xml
    struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/MainMenu.jsp
    struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Welcome.jsp
    struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/registration.jsp
    struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/subscription.jsp

Modified: struts/struts2/trunk/apps/mailreader/src/main/java/struts.properties
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/java/struts.properties?rev=438331&r1=438330&r2=438331&view=diff
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/main/java/struts.properties (original)
+++ struts/struts2/trunk/apps/mailreader/src/main/java/struts.properties Tue Aug 29 20:00:32
2006
@@ -1,4 +1,3 @@
 struts.objectFactory = spring
 struts.devMode = true
-struts.custom.i18n.resources = resources
 struts.enable.DynamicMethodInvocation = false

Modified: struts/struts2/trunk/apps/mailreader/src/main/java/struts.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/java/struts.xml?rev=438331&r1=438330&r2=438331&view=diff
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/main/java/struts.xml (original)
+++ struts/struts2/trunk/apps/mailreader/src/main/java/struts.xml Tue Aug 29 20:00:32 2006
@@ -28,14 +28,18 @@
 
         <action name="subscription/Save" class="mailreader2.subscription.Save">
             <result name="input">/pages/subscription.jsp</result>
-            <result type="redirect-action">registration/vInput</result>
+            <result type="redirect-action">registration/+Input</result>
+        </action>
+
+        <!-- display actions: Welcome, Logoff, MainMenu -->
+
+        <action name="*" class="mailreader2.{1}">
+            <result>/pages/{1}.jsp</result>
         </action>
 
         <!-- prepare actions: Confirm/Delete, Edit, Input -->
-        <!-- A "!" might be a better convention,
-             but that doesn't seem to work with a button -->
 
-        <action name="*/v*" class="mailreader2.{1}.{2}">
+        <action name="*/+*" class="mailreader2.{1}.{2}">
             <result>/pages/{1}.jsp</result>
         </action>
 
@@ -45,28 +49,6 @@
             <result name="input">/pages/{1}.jsp</result>
         </action>
 
-        <!-- Why doen't these match * -->
-        <!-- It seems to be concaternating a period to the token -->
-        <!-- Unable to instantiate Action, mailreader2.Welcome.,
-             defined for 'Welcome' in namespace '/'mailreader2.Welcome. -->
-        <action name="Logoff" class="mailreader2.Logoff">
-            <result>/pages/Logoff.jsp</result>
-        </action>
-
-        <action name="MainMenu" class="mailreader2.MainMenu">
-            <result>/pages/MainMenu.jsp</result>
-        </action>
-
-        <action name="Welcome" class="mailreader2.Welcome">
-            <result>/pages/Welcome.jsp</result>
-        </action>
-
-        <!-- display actions: Welcome, Logoff, MainMenu -->
-
-        <action name="*" class="mailreader2.{1}">
-            <result>/pages/{1}.jsp</result>
-        </action>
-
-    </package>
+   </package>
 
 </struts>

Modified: struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/MainMenu.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/MainMenu.jsp?rev=438331&r1=438330&r2=438331&view=diff
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/MainMenu.jsp (original)
+++ struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/MainMenu.jsp Tue Aug 29 20:00:32
2006
@@ -14,7 +14,7 @@
         value="user.fullName"/></h3>
 <ul>
     <li>
-        <s:url id="Input" action="registration/vInput" />
+        <s:url id="Input" action="registration/+Input" />
         <s:a href="%{Input}">
             <s:text name="mainMenu.registration"/>
         </s:a>

Modified: struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Welcome.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Welcome.jsp?rev=438331&r1=438330&r2=438331&view=diff
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Welcome.jsp (original)
+++ struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Welcome.jsp Tue Aug 29 20:00:32
2006
@@ -15,11 +15,11 @@
 
 <ul>
     <li>
-        <s:url id="registration" action="registration/vInput" />
+        <s:url id="registration" action="registration/+Input" />
         <s:a href="%{registration}"><s:text name="index.registration"/></s:a>
     </li>
     <li>
-        <s:url id="logon" action="logon/vInput"/>
+        <s:url id="logon" action="logon/+Input"/>
         <s:a href="%{logon}"><s:text name="index.logon"/></s:a>
     </li>
 </ul>

Modified: struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/registration.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/registration.jsp?rev=438331&r1=438330&r2=438331&view=diff
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/registration.jsp (original)
+++ struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/registration.jsp Tue Aug 29
20:00:32 2006
@@ -100,14 +100,14 @@
                     <s:property value="autoConnect"/>
                 </td>
                 <td align="center">
-                    <s:url id="Delete" action="subscription/vDelete" >
+                    <s:url id="Delete" action="subscription/+Delete" >
                         <s:param name="host" value="host"/>
                     </s:url>
                     <s:a href="%{Delete}">
                         <s:text name="registration.deleteSubscription"/>
                     </s:a>
                     &nbsp;
-                    <s:url id="Edit" action="subscription/vEdit">
+                    <s:url id="Edit" action="subscription/+Edit">
                         <s:param name="host" value="host"/>
                     </s:url>
                     <s:a href="%{Edit}">
@@ -119,7 +119,7 @@
 
     </table>
 
-    <s:url id="Input" action="subscription/vInput" />
+    <s:url id="Input" action="subscription/+Input" />
     <s:a href="%{Input}"><s:text name="registration.addSubscription"/></s:a>
 
 </s:if>

Modified: struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/subscription.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/subscription.jsp?rev=438331&r1=438330&r2=438331&view=diff
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/subscription.jsp (original)
+++ struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/subscription.jsp Tue Aug 29
20:00:32 2006
@@ -57,7 +57,7 @@
         <s:reset value="%{getText('button.reset')}"/>
     </s:else>
 
-    <s:submit action="registration/vInput"
+    <s:submit action="registration/+Input"
               value="%{getText('button.cancel')}"
               onclick="form.onsubmit=null"/>
 </s:form>

Added: struts/struts2/trunk/apps/mailreader/src/test/java/mailreader2/ConfigTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/test/java/mailreader2/ConfigTest.java?rev=438331&view=auto
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/test/java/mailreader2/ConfigTest.java (added)
+++ struts/struts2/trunk/apps/mailreader/src/test/java/mailreader2/ConfigTest.java Tue Aug
29 20:00:32 2006
@@ -0,0 +1,66 @@
+package mailreader2;
+
+import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.ActionSupport;
+import com.opensymphony.xwork2.config.RuntimeConfiguration;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.config.entities.ResultConfig;
+import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
+
+import java.util.Map;
+
+public class ConfigTest extends XWorkTestCase {
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        XmlConfigurationProvider c = new XmlConfigurationProvider("struts.xml");
+        configurationManager.addConfigurationProvider(c);
+        configurationManager.reload();
+    }
+
+    private ActionConfig assertClass(String action_name, String class_name) {
+        RuntimeConfiguration configuration = configurationManager.getConfiguration().getRuntimeConfiguration();
+        ActionConfig config = configuration.getActionConfig("", action_name);
+        assertNotNull(config);
+        assertTrue("Wrong class name: [" + config.getClassName() + "]",
+                class_name.equals(config.getClassName()));
+        return config;
+    }
+
+    private void assertResult(ActionConfig config, String result_name, String result_value)
{
+        Map results = config.getResults();
+        ResultConfig result = (ResultConfig) results.get(result_name);
+        Map params = result.getParams();
+        String value = (String) params.get("actionName");
+        if (value==null)
+            value = (String) params.get("location");
+        assertTrue("Wrong result value: [" + value + "]",
+                result_value.equals(value));
+    }
+
+    public void testSubscriptionSave() throws Exception {
+        ActionConfig config = assertClass("subscription/Save", "mailreader2.subscription.Save");
+        assertResult(config, ActionSupport.SUCCESS, "registration/+Input");
+        assertResult(config, ActionSupport.INPUT, "/pages/subscription.jsp");
+    }
+
+    // */!*
+    public void testPrepareWildcard() throws Exception {
+        ActionConfig config = assertClass("logon/+Input", "mailreader2.logon.Input");
+        assertResult(config, ActionSupport.SUCCESS, "/pages/logon.jsp");
+    }
+
+    // */*
+    public void testExecuteWildcard() throws Exception {
+        ActionConfig config = assertClass("registration/Update", "mailreader2.registration.Update");
+        assertResult(config, ActionSupport.INPUT, "/pages/registration.jsp");
+        ActionConfig config2 = assertClass("logon/Retrieve", "mailreader2.logon.Retrieve");
+        assertResult(config2, ActionSupport.INPUT, "/pages/logon.jsp");
+    }
+
+    // single wildcard
+    public void testDisplayWildcard() throws Exception {
+        assertClass("Welcome", "mailreader2.Welcome");
+    }
+
+}



Mime
View raw message