Anonymous avatar Anonymous committed 683ce9b

Tes file with empty space in name and new test method to test such case, related to bug WW-2956, https://issues.apache.org/struts/browse/WW-2956

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@1912 e221344d-f017-0410-9bd5-d282ab1896d7

Comments (0)

Files changed (2)

src/test/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderTest.java

 import com.opensymphony.xwork2.config.ConfigurationProvider;
 import com.opensymphony.xwork2.config.RuntimeConfiguration;
 import com.opensymphony.xwork2.config.entities.PackageConfig;
+import com.opensymphony.xwork2.util.ClassLoaderUtil;
 import com.opensymphony.xwork2.util.FileManager;
 
 import java.io.File;
+import java.net.URL;
 
 
 public class XmlConfigurationProviderTest extends ConfigurationTestBase {
         assertEquals("fooBar", prov.guessResultType("foo-bar"));
         assertEquals("fooBarBaz", prov.guessResultType("foo-bar-baz"));
     }
+
+    public void testEmptySpaces() throws Exception {
+        FileManager.setReloadingConfigs(true);
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork- test.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+
+        assertTrue(!provider.needsReload());
+
+        URL url = ClassLoaderUtil.getResource(filename, XmlConfigurationProvider.class);
+        File file = new File(getClass().getResource("/" + filename).toURI());
+        assertTrue(file.exists());
+        file.setLastModified(System.currentTimeMillis());
+
+        assertTrue(provider.needsReload());
+    }
+
 }

src/test/com/opensymphony/xwork2/config/providers/xwork- test.xml

+<!DOCTYPE xwork PUBLIC
+    "-//OpenSymphony Group//XWork 1.1.1//EN"
+    "http://www.opensymphony.com/xwork/xwork-1.1.1.dtd"
+ >
+
+<xwork>
+	<include file="xwork-test-beans.xml" />
+    <package name="default">
+        <result-types>
+            <result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult" default="true"/>
+            <result-type name="mock" class="com.opensymphony.xwork2.mock.MockResult"/>
+        </result-types>
+
+        <interceptors>
+            <interceptor name="timer" class="com.opensymphony.xwork2.interceptor.TimerInterceptor"/>
+            <interceptor name="logging" class="com.opensymphony.xwork2.interceptor.LoggingInterceptor"/>
+            <interceptor name="test" class="com.opensymphony.xwork2.mock.MockInterceptor">
+                <param name="foo">fooDefault</param>
+            </interceptor>
+
+            <interceptor-stack name="defaultStack">
+                <interceptor-ref name="timer"/>
+            </interceptor-stack>
+        </interceptors>
+
+        <global-results>
+            <result name="login"> <!-- should be chain type since it is the default -->
+                <param name="actionName">login</param>
+            </result>
+        </global-results>
+
+        <action name="Bar" class="com.opensymphony.xwork2.SimpleAction">
+            <param name="foo">17</param>
+            <param name="bar">23</param>
+            <param name="testXW412">foo.jspa?fooID=${fooID}&amp;something=bar</param>
+            <param name="testXW412Again">
+            		something
+            </param>
+            <param name="testForXW171"></param>
+        </action>
+
+        <action name="Foo" class="com.opensymphony.xwork2.SimpleAction">
+            <param name="foo">18</param>
+            <param name="bar">24</param>
+            <result name="success" type="mock" />
+            <interceptor-ref name="defaultStack"/>
+        </action>
+
+        <action name="WildCard" class="com.opensymphony.xwork2.SimpleAction">
+            <result name="*" type="mock" />
+            <interceptor-ref name="defaultStack"/>
+        </action>
+
+        <action name="FooBar" class="com.opensymphony.xwork2.SimpleAction">
+            <param name="foo">18</param>
+            <param name="bar">24</param>
+            <result name="success" type="mock" />
+            <interceptor-ref name="defaultStack"/>
+            <exception-mapping name="runtime" exception="java.lang.RuntimeException" result="exception"/>
+        </action>
+
+        <action name="TestInterceptorParam" class="com.opensymphony.xwork2.SimpleAction">
+            <interceptor-ref name="test">
+                <param name="expectedFoo">expectedFooValue</param>
+            </interceptor-ref>
+        </action>
+
+        <action name="TestInterceptorParamOverride" class="com.opensymphony.xwork2.SimpleAction">
+            <interceptor-ref name="test">
+                <param name="foo">foo123</param>
+                <param name="expectedFoo">expectedFooValue</param>
+            </interceptor-ref>
+        </action>
+
+        <action name="BarWithoutClassName">
+            <param name="foo">17</param>
+            <param name="bar">23</param>
+        </action>
+
+    </package>
+</xwork>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.