Repository: struts Updated Branches: refs/heads/master d8b6602e6 -> 23a0c9eb6
WW-4596 Fixes SMI with ActionConfigMatcher Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/23a0c9eb Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/23a0c9eb Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/23a0c9eb Branch: refs/heads/master Commit: 23a0c9eb643c41f800dc43159672dd31a6159472 Parents: d8b6602 Author: Lukasz Lenart <lukaszlen...@apache.org> Authored: Wed Feb 3 09:48:30 2016 +0100 Committer: Lukasz Lenart <lukaszlen...@apache.org> Committed: Wed Feb 3 09:48:30 2016 +0100 ---------------------------------------------------------------------- .../xwork2/config/impl/ActionConfigMatcher.java | 1 + .../xwork2/config/impl/ActionConfigMatcherTest.java | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/23a0c9eb/core/src/main/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcher.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcher.java b/core/src/main/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcher.java index 3105437..2a2f0ed 100644 --- a/core/src/main/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcher.java +++ b/core/src/main/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcher.java @@ -115,6 +115,7 @@ public class ActionConfigMatcher extends AbstractMatcher<ActionConfig> implement .methodName(methodName) .addParams(params) .addResultConfigs(results) + .addAllowedMethod(orig.getAllowedMethods()) .addInterceptors(orig.getInterceptors()) .addExceptionMappings(exs) .location(orig.getLocation()) http://git-wip-us.apache.org/repos/asf/struts/blob/23a0c9eb/core/src/test/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcherTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcherTest.java b/core/src/test/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcherTest.java index a425157..6eb9f27 100644 --- a/core/src/test/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcherTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcherTest.java @@ -103,6 +103,14 @@ public class ActionConfigMatcherTest extends XWorkTestCase { "doclass_class".equals(m.getMethodName())); } + public void testAllowedMethods() { + ActionConfig m = matcher.match("addEvent!start"); + assertTrue(m.getAllowedMethods().contains("start")); + + m = matcher.match("addEvent!cancel"); + assertTrue(m.getAllowedMethods().contains("cancel")); + } + public void testLooseMatch() { configMap.put("*!*", configMap.get("bar/*/**")); ActionConfigMatcher matcher = new ActionConfigMatcher(new WildcardHelper(), configMap, true); @@ -157,7 +165,13 @@ public class ActionConfigMatcherTest extends XWorkTestCase { .build(); map.put("bar/*/**", config); - + + config = new ActionConfig.Builder("package", "eventAdd!*", "bar") + .methodName("{1}") + .build(); + + map.put("addEvent!*", config); + map.put("noWildcard", new ActionConfig.Builder("", "", "").build()); return map;