struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [24/33] struts git commit: Adjusts tests
Date Mon, 28 Sep 2015 18:53:13 GMT
Adjusts tests


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/3ccd7307
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/3ccd7307
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/3ccd7307

Branch: refs/heads/master
Commit: 3ccd7307f9af04d1f45a9ddd2360c390d83e13b0
Parents: 0aaade6
Author: Lukasz Lenart <lukasz.lenart@gmail.com>
Authored: Fri Sep 4 11:35:31 2015 +0200
Committer: Lukasz Lenart <lukasz.lenart@gmail.com>
Committed: Fri Sep 4 11:35:31 2015 +0200

----------------------------------------------------------------------
 .../XmlConfigurationProviderActionsTest.java        | 16 ++++++++++++++--
 .../XmlConfigurationProviderAllowedMethodsTest.java | 10 +++++-----
 ...lConfigurationProviderExceptionMappingsTest.java |  7 ++++---
 .../XmlConfigurationProviderInterceptorsTest.java   |  6 ++++++
 .../XmlConfigurationProviderResultsTest.java        |  1 +
 .../config/providers/xwork-test-allowed-methods.xml |  4 ++--
 6 files changed, 32 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/3ccd7307/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderActionsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderActionsTest.java
b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderActionsTest.java
index 2181181..cde4c62 100644
--- a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderActionsTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderActionsTest.java
@@ -56,6 +56,7 @@ public class XmlConfigurationProviderActionsTest extends ConfigurationTestBase
{
 
 
         ActionConfig barAction = new ActionConfig.Builder("", "Bar", SimpleAction.class.getName())
+                .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
                 .addParams(params).build();
 
         // foo action is a little more complex, two params, a result and an interceptor stack
@@ -72,6 +73,7 @@ public class XmlConfigurationProviderActionsTest extends ConfigurationTestBase
{
                 .addParams(params)
                 .addResultConfigs(results)
                 .addInterceptors(interceptors)
+                .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
                 .build();
 
         // wildcard action is simple wildcard example
@@ -81,6 +83,7 @@ public class XmlConfigurationProviderActionsTest extends ConfigurationTestBase
{
         ActionConfig wildcardAction = new ActionConfig.Builder("", "WildCard", SimpleAction.class.getName())
                 .addResultConfigs(results)
                 .addInterceptors(interceptors)
+                .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
                 .build();
 
         // fooBar action is a little more complex, two params, a result and an interceptor
stack
@@ -99,6 +102,7 @@ public class XmlConfigurationProviderActionsTest extends ConfigurationTestBase
{
                 .addResultConfigs(results)
                 .addInterceptors(interceptors)
                 .addExceptionMappings(exceptionMappings)
+                .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
                 .build();
 
         // TestInterceptorParam action tests that an interceptor worked
@@ -112,6 +116,7 @@ public class XmlConfigurationProviderActionsTest extends ConfigurationTestBase
{
 
         ActionConfig intAction = new ActionConfig.Builder("", "TestInterceptorParam", SimpleAction.class.getName())
                 .addInterceptors(interceptors)
+                .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
                 .build();
 
         // TestInterceptorParamOverride action tests that an interceptor with a param override
worked
@@ -123,6 +128,7 @@ public class XmlConfigurationProviderActionsTest extends ConfigurationTestBase
{
 
         ActionConfig intOverAction = new ActionConfig.Builder("", "TestInterceptorParamOverride",
SimpleAction.class.getName())
                 .addInterceptors(interceptors)
+                .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
                 .build();
 
         // execute the configuration
@@ -164,7 +170,10 @@ public class XmlConfigurationProviderActionsTest extends ConfigurationTestBase
{
         params.put("bar", "23");
 
         ActionConfig barWithPackageDefaultClassRefConfig =
-                new ActionConfig.Builder("", "Bar", "").addParams(params).build();
+                new ActionConfig.Builder("", "Bar", "")
+                        .addParams(params)
+                        .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
+                        .build();
 
         // execute the configuration
         provider.init(configuration);
@@ -188,7 +197,10 @@ public class XmlConfigurationProviderActionsTest extends ConfigurationTestBase
{
         params.put("bar", "23");
 
         ActionConfig barWithoutClassNameConfig =
-                new ActionConfig.Builder("", "BarWithoutClassName", "").addParams(params).build();
+                new ActionConfig.Builder("", "BarWithoutClassName", "")
+                        .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
+                        .addParams(params)
+                        .build();
 
         // execute the configuration
         provider.init(configuration);

http://git-wip-us.apache.org/repos/asf/struts/blob/3ccd7307/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderAllowedMethodsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderAllowedMethodsTest.java
b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderAllowedMethodsTest.java
index 11f779a..4b4460a 100644
--- a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderAllowedMethodsTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderAllowedMethodsTest.java
@@ -27,12 +27,12 @@ public class XmlConfigurationProviderAllowedMethodsTest extends ConfigurationTes
         assertEquals(5, actionConfigs.size());
 
         ActionConfig action = (ActionConfig) actionConfigs.get("Default");
-        assertEquals(0, action.getAllowedMethods().size());
+        assertEquals(1, action.getAllowedMethods().size());
         assertTrue(action.isAllowedMethod("execute"));
-        assertFalse(action.isAllowedMethod("foo"));
-        assertFalse(action.isAllowedMethod("bar"));
-        assertFalse(action.isAllowedMethod("baz"));
-        assertFalse(action.isAllowedMethod("xyz"));
+        assertTrue(action.isAllowedMethod("foo"));
+        assertTrue(action.isAllowedMethod("bar"));
+        assertTrue(action.isAllowedMethod("baz"));
+        assertTrue(action.isAllowedMethod("xyz"));
 
         action = (ActionConfig) actionConfigs.get("Boring");
         assertEquals(0, action.getAllowedMethods().size());

http://git-wip-us.apache.org/repos/asf/struts/blob/3ccd7307/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderExceptionMappingsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderExceptionMappingsTest.java
b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderExceptionMappingsTest.java
index 232efd3..d02a312 100644
--- a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderExceptionMappingsTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderExceptionMappingsTest.java
@@ -32,20 +32,21 @@ public class XmlConfigurationProviderExceptionMappingsTest extends Configuration
 
         exceptionMappings.add(
                 new ExceptionMappingConfig.Builder("spooky-result", "com.opensymphony.xwork2.SpookyException",
"spooky-result")
-                    .build());
+                        .build());
         results.put("spooky-result", new ResultConfig.Builder("spooky-result", MockResult.class.getName()).build());
 
         Map<String, String> resultParams = new HashMap<>();
         resultParams.put("actionName", "bar.vm");
         results.put("specificLocationResult",
                 new ResultConfig.Builder("specificLocationResult", ActionChainResult.class.getName())
-                    .addParams(resultParams)
-                    .build());
+                        .addParams(resultParams)
+                        .build());
 
         ActionConfig expectedAction = new ActionConfig.Builder("default", "Bar", SimpleAction.class.getName())
             .addParams(parameters)
             .addResultConfigs(results)
             .addExceptionMappings(exceptionMappings)
+            .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
             .build();
 
         // execute the configuration

http://git-wip-us.apache.org/repos/asf/struts/blob/3ccd7307/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsTest.java
b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsTest.java
index 4f26b5f..b10eb49 100644
--- a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsTest.java
@@ -108,16 +108,19 @@ public class XmlConfigurationProviderInterceptorsTest extends ConfigurationTestB
 
         ActionConfig actionWithOwnRef = new ActionConfig.Builder("", "ActionWithOwnRef",
SimpleAction.class.getName())
             .addInterceptors(interceptors)
+            .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
             .build();
 
         ActionConfig actionWithDefaultRef = new ActionConfig.Builder("", "ActionWithDefaultRef",
SimpleAction.class.getName())
             .addInterceptor(new InterceptorMapping("timer", objectFactory.buildInterceptor(timerInterceptor,
new HashMap<String, String>())))
+            .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
             .build();
 
         // sub package
         // this should inherit
         ActionConfig actionWithNoRef = new ActionConfig.Builder("", "ActionWithNoRef", SimpleAction.class.getName())
             .addInterceptor(new InterceptorMapping("timer", objectFactory.buildInterceptor(timerInterceptor,
new HashMap<String, String>())))
+            .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
             .build();
 
         interceptors = new ArrayList<>();
@@ -125,6 +128,7 @@ public class XmlConfigurationProviderInterceptorsTest extends ConfigurationTestB
 
         ActionConfig anotherActionWithOwnRef = new ActionConfig.Builder("", "AnotherActionWithOwnRef",
SimpleAction.class.getName())
             .addInterceptor(new InterceptorMapping("logging", objectFactory.buildInterceptor(loggingInterceptor,
new HashMap<String, String>())))
+            .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
             .build();
 
         RuntimeConfiguration runtimeConfig = configurationManager.getConfiguration().getRuntimeConfiguration();
@@ -184,6 +188,7 @@ public class XmlConfigurationProviderInterceptorsTest extends ConfigurationTestB
 
         ActionConfig intAction = new ActionConfig.Builder("", "TestInterceptorParam", SimpleAction.class.getName())
             .addInterceptors(interceptors)
+            .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
             .build();
 
         // TestInterceptorParamOverride action tests that an interceptor with a param override
worked
@@ -202,6 +207,7 @@ public class XmlConfigurationProviderInterceptorsTest extends ConfigurationTestB
 
         ActionConfig intOverAction = new ActionConfig.Builder("", "TestInterceptorParamOverride",
SimpleAction.class.getName())
             .addInterceptors(interceptors)
+            .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
             .build();
 
         ConfigurationProvider provider = buildConfigurationProvider("com/opensymphony/xwork2/config/providers/xwork-test-interceptor-params.xml");

http://git-wip-us.apache.org/repos/asf/struts/blob/3ccd7307/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderResultsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderResultsTest.java
b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderResultsTest.java
index caa9da0..d096c14 100644
--- a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderResultsTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderResultsTest.java
@@ -67,6 +67,7 @@ public class XmlConfigurationProviderResultsTest extends ConfigurationTestBase
{
         ActionConfig expectedAction = new ActionConfig.Builder("default", "Bar", SimpleAction.class.getName())
             .addParams(parameters)
             .addResultConfigs(results)
+            .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
             .build();
 
         // execute the configuration

http://git-wip-us.apache.org/repos/asf/struts/blob/3ccd7307/core/src/test/resources/com/opensymphony/xwork2/config/providers/xwork-test-allowed-methods.xml
----------------------------------------------------------------------
diff --git a/core/src/test/resources/com/opensymphony/xwork2/config/providers/xwork-test-allowed-methods.xml
b/core/src/test/resources/com/opensymphony/xwork2/config/providers/xwork-test-allowed-methods.xml
index 4059d62..6741e66 100644
--- a/core/src/test/resources/com/opensymphony/xwork2/config/providers/xwork-test-allowed-methods.xml
+++ b/core/src/test/resources/com/opensymphony/xwork2/config/providers/xwork-test-allowed-methods.xml
@@ -4,7 +4,7 @@
  >
 
 <xwork>
-    <package name="default">
+    <package name="default" strict-method-invocation="false">
         <action name="Default">
         </action>
 
@@ -25,7 +25,7 @@
         </action>
     </package>
 
-    <package name="strict">
+    <package name="strict" strict-method-invocation="true">
         <action name="Default">
         </action>
 


Mime
View raw message