Commits

Anonymous committed 4bd051d

renaming xwork.xml to xwork-sample.xml and updating the tests accordingly. this ensures that the xwork.xml, which is simply a test resource, doesn't get picked up by other applications (namely QuickStart) when using IDEA to launch struts apps during development

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

Comments (0)

Files changed (11)

src/test/com/opensymphony/xwork2/ActionInvocationTest.java

 
 import java.util.HashMap;
 
+import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
+
 
 /**
  * @author $Author$
 public class ActionInvocationTest extends XWorkTestCase {
 
     public void testCommandInvocation() throws Exception {
-        ActionProxy baseActionProxy = ActionProxyFactory.getFactory().createActionProxy(configurationManager.getConfiguration(), 
+        ActionProxy baseActionProxy = ActionProxyFactory.getFactory().createActionProxy(configurationManager.getConfiguration(),
                 "baz", "commandTest", null);
         assertEquals("success", baseActionProxy.execute());
 
 
         // ensure we're using the default configuration, not simple config
         configurationManager.clearConfigurationProviders();
+        configurationManager.addConfigurationProvider(new XmlConfigurationProvider("xwork-sample.xml"));
         configurationManager.getConfiguration().reload(configurationManager.getConfigurationProviders());
     }
 }

src/test/com/opensymphony/xwork2/ChainResultTest.java

 
 import com.mockobjects.dynamic.Mock;
 import com.opensymphony.xwork2.config.Configuration;
+import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
 import com.opensymphony.xwork2.util.OgnlValueStack;
 import junit.framework.TestCase;
 
 
         // ensure we're using the default configuration, not simple config
         configurationManager.clearConfigurationProviders();
+        configurationManager.addConfigurationProvider(new XmlConfigurationProvider("xwork-sample.xml"));
         configurationManager.getConfiguration().reload(
                 configurationManager.getConfigurationProviders());
     }

src/test/com/opensymphony/xwork2/WildCardResultTest.java

 package com.opensymphony.xwork2;
 
 import com.opensymphony.xwork2.mock.MockResult;
+import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
 import junit.framework.TestCase;
 
 /**
 
         // ensure we're using the default configuration, not simple config
         configurationManager.clearConfigurationProviders();
+        configurationManager.addConfigurationProvider(new XmlConfigurationProvider("xwork-sample.xml"));
         configurationManager.getConfiguration().reload(configurationManager.getConfigurationProviders());
     }
 

src/test/com/opensymphony/xwork2/config/ConfigurationTest.java

         super.setUp();
 
         // ensure we're using the default configuration, not simple config
-        XmlConfigurationProvider c = new XmlConfigurationProvider();
+        XmlConfigurationProvider c = new XmlConfigurationProvider("xwork-sample.xml");
         configurationManager.addConfigurationProvider(c);
         configurationManager.reload();
     }

src/test/com/opensymphony/xwork2/config/ExternalReferenceResolverTest.java

         ActionContext.setContext(new ActionContext(new HashMap()));
 
         // ensure we're using the default configuration, not simple config
-        XmlConfigurationProvider c = new XmlConfigurationProvider();
-        configurationManager.addConfigurationProvider(c);
+        configurationManager.addConfigurationProvider(new XmlConfigurationProvider("xwork-sample.xml"));
         configurationManager.reload();
     }
 

src/test/com/opensymphony/xwork2/interceptor/AliasInterceptorTest.java

 import com.opensymphony.xwork2.mock.MockActionProxy;
 import com.opensymphony.xwork2.mock.MockActionInvocation;
 import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
 import com.opensymphony.xwork2.*;
 
 import java.util.HashMap;
         params.put("aliasSource", "source here");
 
         ActionProxyFactory factory = ActionProxyFactory.getFactory();
+        configurationManager.addConfigurationProvider(new XmlConfigurationProvider("xwork-sample.xml"));
         ActionProxy proxy = factory.createActionProxy(
                 configurationManager.getConfiguration(), "", "aliasTest", params);
         SimpleAction actionOne = (SimpleAction) proxy.getAction();

src/test/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java

 
 import com.mockobjects.dynamic.Mock;
 import com.opensymphony.xwork2.*;
+import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
 import com.opensymphony.xwork2.test.ModelDrivenAction2;
 import com.opensymphony.xwork2.test.TestBean2;
 
     protected void setUp() throws Exception {
         super.setUp();
         configurationManager.destroyConfiguration();
+        configurationManager.addConfigurationProvider(new XmlConfigurationProvider("xwork-sample.xml"));
         configurationManager.reload();
 
+
         OgnlValueStack stack = new OgnlValueStack();
         ActionContext.setContext(new ActionContext(stack.getContext()));
         ActionContext.getContext().setLocale(Locale.US);

src/test/com/opensymphony/xwork2/util/MyBeanActionTest.java

 package com.opensymphony.xwork2.util;
 
 import com.opensymphony.xwork2.*;
+import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
 
 import java.util.HashMap;
 import java.util.Map;
 
         // ensure we're using the default configuration, not simple config
         configurationManager.clearConfigurationProviders();
+        configurationManager.addConfigurationProvider(new XmlConfigurationProvider("xwork-sample.xml"));
         configurationManager.reload();
     }
 }

src/test/com/opensymphony/xwork2/validator/ModelDrivenValidationTest.java

 package com.opensymphony.xwork2.validator;
 
 import com.opensymphony.xwork2.*;
+import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
 import junit.framework.TestCase;
 
 import java.util.HashMap;
         Map context = new HashMap();
         context.put(ActionContext.PARAMETERS, params);
 
+        configurationManager.addConfigurationProvider(new XmlConfigurationProvider("xwork-sample.xml"));
         ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy(
                 configurationManager.getConfiguration(), null, "TestModelDrivenValidation", context);
         assertEquals(Action.SUCCESS, proxy.execute());

src/test/xwork-sample.xml

+<!DOCTYPE xwork PUBLIC
+    "-//OpenSymphony Group//XWork 1.1.1//EN"
+    "http://www.opensymphony.com/xwork/xwork-1.1.1.dtd"
+ >
+ <!-- "file:///temp/ross/xwork/src/etc/xwork-1.0.dtd"  -->
+
+<xwork>
+    <include file="xwork-default.xml"/>
+    <package name="default" extends="xwork-default" externalReferenceResolver="com.opensymphony.xwork2.config.TestExternalReferenceResolver">
+
+        <global-results>
+            <result name="login"> <!-- should be chain type since it is the default -->
+                <param name="actionName">login</param>
+            </result>
+        </global-results>
+
+        <action name="Foo" class="com.opensymphony.xwork2.SimpleAction">
+            <param name="foo">17</param>
+            <param name="bar">23</param>
+            <result name="success" type="chain">
+                <param name="actionName">Bar</param>
+            </result>
+            <interceptor-ref name="debugStack"/>
+            <interceptor-ref name="defaultStack"/>
+        </action>
+
+        <action name="WildCard" class="com.opensymphony.xwork2.SimpleAction">
+            <param name="foo">17</param>
+            <param name="bar">23</param>
+            <result name="success" type="void" />
+            <result name="*" type="mock" />
+            <interceptor-ref name="defaultStack"/>
+        </action>
+
+        <action name="WildCardInput" class="com.opensymphony.xwork2.SimpleAction" method="input">
+            <param name="foo">17</param>
+            <param name="bar">23</param>
+            <result name="success" type="void" />
+            <result name="*" type="mock" />
+            <interceptor-ref name="defaultStack"/>
+        </action>
+
+        <action name="WildCardError" class="com.opensymphony.xwork2.SimpleAction">
+            <result name="success" type="void" />
+            <result name="*" type="mock" />
+            <interceptor-ref name="defaultStack"/>
+        </action>
+		
+		<action name="WildCard/*/*" class="com.opensymphony.xwork2.{1}Action" 
+			method="{2}">
+            <param name="foo">{1}</param>
+            <param name="bar">{2}</param>
+            <result name="success" type="void" />
+            <interceptor-ref name="defaultStack"/>
+        </action>
+
+        <action name="aliasTest" class="com.opensymphony.xwork2.SimpleAction">
+            <param name="foo">17</param>
+            <param name="bar">23</param>
+           	<param name="aliases">#{ "aliasSource" : "aliasDest", "bar":"baz" }</param>
+			<interceptor-ref name="defaultStack"/>
+         	<interceptor-ref name="alias"/>
+        </action>
+      
+        <action name="packagelessAction" class="PackagelessAction">
+        </action>
+
+        <action name="Bar" class="com.opensymphony.xwork2.SimpleAction">
+        	<param name="foo">17</param>
+            <param name="bar">23</param>
+        </action>
+
+        <action name="MyBean" class="com.opensymphony.xwork2.util.MyBeanAction">
+            <interceptor-ref name="debugStack"/>
+            <interceptor-ref name="defaultStack"/>
+        </action>
+
+        <action name="TestInterceptorParam" class="com.opensymphony.xwork2.SimpleAction">
+            <interceptor-ref name="test">
+                <param name="expectedFoo">expectedFoo</param>
+            </interceptor-ref>
+        </action>
+
+        <action name="TestInterceptorParamOverride" class="com.opensymphony.xwork2.SimpleAction">
+            <interceptor-ref name="test">
+                <param name="foo">foo123</param>
+                <param name="expectedFoo">foo123</param>
+            </interceptor-ref>
+        </action>
+
+        <action name="TestModelDrivenValidation" class="com.opensymphony.xwork2.ModelDrivenAction">
+            <interceptor-ref name="defaultStack"/>
+            <interceptor-ref name="validation"/>
+        </action>
+        <!-- test resolution  -->
+        <action name="TestExternalRefResolver" class="com.opensymphony.xwork2.ExternalReferenceAction">
+                <external-ref name="foo">myFoo</external-ref>
+            <interceptor-ref name="debugStack"/>
+            <interceptor-ref name="defaultStack"/>
+        </action>
+        <!-- test required flag -->
+        <action name="TestExternalRefResolver2" class="com.opensymphony.xwork2.ExternalReferenceAction">
+                <external-ref name="foo">myFoo</external-ref>
+                <external-ref required="false" name="does_not_exist">Does Not Exist</external-ref>
+            <interceptor-ref name="debugStack"/>
+            <interceptor-ref name="defaultStack"/>
+        </action>
+        <!-- test where required reference is not found -->
+        <action name="TestExternalRefResolver3" class="com.opensymphony.xwork2.ExternalReferenceAction">
+                <external-ref required="true" name="Boo">myBoo</external-ref>
+            <interceptor-ref name="debugStack"/>
+            <interceptor-ref name="defaultStack"/>
+        </action>
+
+        <!-- chain resursion detection -->
+        <action name="InfiniteRecursionChain" class="com.opensymphony.xwork2.ActionSupport">
+                <result name="success" type="chain">InfiniteRecursionChain</result>
+        </action>
+
+   </package>
+
+           <package name="test-external-refs" extends="default" namespace="test/externalRef/">
+        <!-- test resolution when Resolver is declared on parent -->
+        <action name="TestExternalRefResolver4" class="com.opensymphony.xwork2.ExternalReferenceAction">
+                <external-ref name="foo">myFoo</external-ref>
+            <interceptor-ref name="defaultStack"/>
+        </action>
+
+   </package>
+
+    <package name="bar" extends="default" namespace="/foo/bar">
+        <interceptors>
+            <interceptor-stack name="barDefaultStack">
+                <interceptor-ref name="debugStack"/>
+                <interceptor-ref name="defaultStack"/>
+            </interceptor-stack>
+        </interceptors>
+
+        <global-exception-mappings>
+            <exception-mapping name="foo" exception="com.opensymphony.TestException" result="foo"/>
+        </global-exception-mappings>
+
+        <action name="Bar" class="com.opensymphony.xwork2.SimpleAction">
+            <interceptor-ref name="barDefaultStack"/>
+        </action>
+
+        <action name="TestInterceptorParamInheritance" class="com.opensymphony.xwork2.SimpleAction">
+            <interceptor-ref name="test">
+                <param name="expectedFoo">expectedFoo</param>
+            </interceptor-ref>
+        </action>
+
+        <action name="TestInterceptorParamInehritanceOverride" class="com.opensymphony.xwork2.SimpleAction">
+            <interceptor-ref name="test">
+                <param name="foo">foo123</param>
+                <param name="expectedFoo">foo123</param>
+            </interceptor-ref>
+        </action>
+    </package>
+
+    <package name="abstractPackage" namespace="/abstract" abstract="true">
+        <action name="test" class="com.opensymphony.xwork2.SimpleAction"/>
+    </package>
+
+    <package name="nonAbstractPackage" extends="abstractPackage" namespace="/nonAbstract"/>
+
+    <package name="baz" extends="default" namespace="baz">
+        <action name="commandTest" class="com.opensymphony.xwork2.SimpleAction">
+            <param name="foo">123</param>
+            <result name="error" type="chain">
+                <param name="actionName">bar</param>
+            </result>
+            <interceptor-ref name="static-params"/>
+        </action>
+        <action name="myCommand" class="com.opensymphony.xwork2.SimpleAction" method="commandMethod">
+            <param name="bar">456</param>
+            <result name="success" type="chain">
+                <param name="actionName">foo</param>
+            </result>
+            <interceptor-ref name="logger"/>
+        </action>
+    </package>
+
+    <package name="multipleInheritance" extends="default,abstractPackage,bar" namespace="multipleInheritance">
+        <action name="testMultipleInheritance" class="com.opensymphony.xwork2.SimpleAction">
+            <result name="success" type="chain">
+                <param name="actionName">foo</param>
+            </result>
+            <interceptor-ref name="barDefaultStack"/>
+        </action>
+    </package>
+
+    <include file="includeTest.xml"/>
+</xwork>

src/test/xwork.xml

-<!DOCTYPE xwork PUBLIC
-    "-//OpenSymphony Group//XWork 1.1.1//EN"
-    "http://www.opensymphony.com/xwork/xwork-1.1.1.dtd"
- >
- <!-- "file:///temp/ross/xwork/src/etc/xwork-1.0.dtd"  -->
-
-<xwork>
-    <include file="xwork-default.xml"/>
-    <package name="default" extends="xwork-default" externalReferenceResolver="com.opensymphony.xwork2.config.TestExternalReferenceResolver">
-
-        <global-results>
-            <result name="login"> <!-- should be chain type since it is the default -->
-                <param name="actionName">login</param>
-            </result>
-        </global-results>
-
-        <action name="Foo" class="com.opensymphony.xwork2.SimpleAction">
-            <param name="foo">17</param>
-            <param name="bar">23</param>
-            <result name="success" type="chain">
-                <param name="actionName">Bar</param>
-            </result>
-            <interceptor-ref name="debugStack"/>
-            <interceptor-ref name="defaultStack"/>
-        </action>
-
-        <action name="WildCard" class="com.opensymphony.xwork2.SimpleAction">
-            <param name="foo">17</param>
-            <param name="bar">23</param>
-            <result name="success" type="void" />
-            <result name="*" type="mock" />
-            <interceptor-ref name="defaultStack"/>
-        </action>
-
-        <action name="WildCardInput" class="com.opensymphony.xwork2.SimpleAction" method="input">
-            <param name="foo">17</param>
-            <param name="bar">23</param>
-            <result name="success" type="void" />
-            <result name="*" type="mock" />
-            <interceptor-ref name="defaultStack"/>
-        </action>
-
-        <action name="WildCardError" class="com.opensymphony.xwork2.SimpleAction">
-            <result name="success" type="void" />
-            <result name="*" type="mock" />
-            <interceptor-ref name="defaultStack"/>
-        </action>
-		
-		<action name="WildCard/*/*" class="com.opensymphony.xwork2.{1}Action" 
-			method="{2}">
-            <param name="foo">{1}</param>
-            <param name="bar">{2}</param>
-            <result name="success" type="void" />
-            <interceptor-ref name="defaultStack"/>
-        </action>
-
-        <action name="aliasTest" class="com.opensymphony.xwork2.SimpleAction">
-            <param name="foo">17</param>
-            <param name="bar">23</param>
-           	<param name="aliases">#{ "aliasSource" : "aliasDest", "bar":"baz" }</param>
-			<interceptor-ref name="defaultStack"/>
-         	<interceptor-ref name="alias"/>
-        </action>
-      
-        <action name="packagelessAction" class="PackagelessAction">
-        </action>
-
-        <action name="Bar" class="com.opensymphony.xwork2.SimpleAction">
-        	<param name="foo">17</param>
-            <param name="bar">23</param>
-        </action>
-
-        <action name="MyBean" class="com.opensymphony.xwork2.util.MyBeanAction">
-            <interceptor-ref name="debugStack"/>
-            <interceptor-ref name="defaultStack"/>
-        </action>
-
-        <action name="TestInterceptorParam" class="com.opensymphony.xwork2.SimpleAction">
-            <interceptor-ref name="test">
-                <param name="expectedFoo">expectedFoo</param>
-            </interceptor-ref>
-        </action>
-
-        <action name="TestInterceptorParamOverride" class="com.opensymphony.xwork2.SimpleAction">
-            <interceptor-ref name="test">
-                <param name="foo">foo123</param>
-                <param name="expectedFoo">foo123</param>
-            </interceptor-ref>
-        </action>
-
-        <action name="TestModelDrivenValidation" class="com.opensymphony.xwork2.ModelDrivenAction">
-            <interceptor-ref name="defaultStack"/>
-            <interceptor-ref name="validation"/>
-        </action>
-        <!-- test resolution  -->
-        <action name="TestExternalRefResolver" class="com.opensymphony.xwork2.ExternalReferenceAction">
-                <external-ref name="foo">myFoo</external-ref>
-            <interceptor-ref name="debugStack"/>
-            <interceptor-ref name="defaultStack"/>
-        </action>
-        <!-- test required flag -->
-        <action name="TestExternalRefResolver2" class="com.opensymphony.xwork2.ExternalReferenceAction">
-                <external-ref name="foo">myFoo</external-ref>
-                <external-ref required="false" name="does_not_exist">Does Not Exist</external-ref>
-            <interceptor-ref name="debugStack"/>
-            <interceptor-ref name="defaultStack"/>
-        </action>
-        <!-- test where required reference is not found -->
-        <action name="TestExternalRefResolver3" class="com.opensymphony.xwork2.ExternalReferenceAction">
-                <external-ref required="true" name="Boo">myBoo</external-ref>
-            <interceptor-ref name="debugStack"/>
-            <interceptor-ref name="defaultStack"/>
-        </action>
-
-        <!-- chain resursion detection -->
-        <action name="InfiniteRecursionChain" class="com.opensymphony.xwork2.ActionSupport">
-                <result name="success" type="chain">InfiniteRecursionChain</result>
-        </action>
-
-   </package>
-
-           <package name="test-external-refs" extends="default" namespace="test/externalRef/">
-        <!-- test resolution when Resolver is declared on parent -->
-        <action name="TestExternalRefResolver4" class="com.opensymphony.xwork2.ExternalReferenceAction">
-                <external-ref name="foo">myFoo</external-ref>
-            <interceptor-ref name="defaultStack"/>
-        </action>
-
-   </package>
-
-    <package name="bar" extends="default" namespace="/foo/bar">
-        <interceptors>
-            <interceptor-stack name="barDefaultStack">
-                <interceptor-ref name="debugStack"/>
-                <interceptor-ref name="defaultStack"/>
-            </interceptor-stack>
-        </interceptors>
-
-        <global-exception-mappings>
-            <exception-mapping name="foo" exception="com.opensymphony.TestException" result="foo"/>
-        </global-exception-mappings>
-
-        <action name="Bar" class="com.opensymphony.xwork2.SimpleAction">
-            <interceptor-ref name="barDefaultStack"/>
-        </action>
-
-        <action name="TestInterceptorParamInheritance" class="com.opensymphony.xwork2.SimpleAction">
-            <interceptor-ref name="test">
-                <param name="expectedFoo">expectedFoo</param>
-            </interceptor-ref>
-        </action>
-
-        <action name="TestInterceptorParamInehritanceOverride" class="com.opensymphony.xwork2.SimpleAction">
-            <interceptor-ref name="test">
-                <param name="foo">foo123</param>
-                <param name="expectedFoo">foo123</param>
-            </interceptor-ref>
-        </action>
-    </package>
-
-    <package name="abstractPackage" namespace="/abstract" abstract="true">
-        <action name="test" class="com.opensymphony.xwork2.SimpleAction"/>
-    </package>
-
-    <package name="nonAbstractPackage" extends="abstractPackage" namespace="/nonAbstract"/>
-
-    <package name="baz" extends="default" namespace="baz">
-        <action name="commandTest" class="com.opensymphony.xwork2.SimpleAction">
-            <param name="foo">123</param>
-            <result name="error" type="chain">
-                <param name="actionName">bar</param>
-            </result>
-            <interceptor-ref name="static-params"/>
-        </action>
-        <action name="myCommand" class="com.opensymphony.xwork2.SimpleAction" method="commandMethod">
-            <param name="bar">456</param>
-            <result name="success" type="chain">
-                <param name="actionName">foo</param>
-            </result>
-            <interceptor-ref name="logger"/>
-        </action>
-    </package>
-
-    <package name="multipleInheritance" extends="default,abstractPackage,bar" namespace="multipleInheritance">
-        <action name="testMultipleInheritance" class="com.opensymphony.xwork2.SimpleAction">
-            <result name="success" type="chain">
-                <param name="actionName">foo</param>
-            </result>
-            <interceptor-ref name="barDefaultStack"/>
-        </action>
-    </package>
-
-    <include file="includeTest.xml"/>
-</xwork>