struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [57/57] struts git commit: Merges xwork packages into struts
Date Wed, 17 Jun 2015 21:09:57 GMT
Merges xwork packages into struts


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

Branch: refs/heads/master
Commit: 82cb1286cd544bd264f46808ca4f02f21f615b4e
Parents: 31af584
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Wed Jun 17 23:08:29 2015 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Wed Jun 17 23:08:30 2015 +0200

----------------------------------------------------------------------
 .../config/entities/ActionConfigTest.java       |  44 ++
 .../config/entities/PackageConfigTest.java      |  34 +
 .../config/impl/ActionConfigMatcherTest.java    | 164 +++++
 .../config/impl/NamespaceMatcherTest.java       |  41 ++
 .../config/providers/ConfigurationTestBase.java |  45 ++
 .../providers/InterceptorBuilderTest.java       | 274 +++++++
 .../providers/InterceptorForTestPurpose.java    |  47 ++
 .../providers/MockConfigurationProvider.java    | 194 +++++
 .../providers/NoNoArgsConstructorAction.java    |  24 +
 .../providers/PrivateConstructorAction.java     |  43 ++
 .../config/providers/SomeUnknownHandler.java    |  48 ++
 .../XmlConfigurationProviderActionsTest.java    | 214 ++++++
 ...ConfigurationProviderAllowedMethodsTest.java | 125 ++++
 ...figurationProviderExceptionMappingsTest.java |  65 ++
 ...tionProviderGlobalResultInheritenceTest.java |  53 ++
 ...nProviderInterceptorParamOverridingTest.java | 101 +++
 ...iderInterceptorStackParamOverridingTest.java |  89 +++
 ...igurationProviderInterceptorsSpringTest.java |  80 +++
 ...mlConfigurationProviderInterceptorsTest.java | 226 ++++++
 ...XmlConfigurationProviderInvalidFileTest.java |  40 ++
 .../XmlConfigurationProviderMultilevelTest.java |  70 ++
 .../XmlConfigurationProviderPackagesTest.java   | 157 ++++
 ...XmlConfigurationProviderResultTypesTest.java | 119 +++
 .../XmlConfigurationProviderResultsTest.java    | 121 ++++
 .../providers/XmlConfigurationProviderTest.java | 201 ++++++
 ...gurationProviderUnknownHandlerStackTest.java |  40 ++
 ...onfigurationProviderWildCardIncludeTest.java |  48 ++
 .../xwork2/config/providers/XmlHelperTest.java  | 255 +++++++
 .../impl/AnnotationXWorkConverterTest.java      | 469 ++++++++++++
 .../xwork2/conversion/impl/FooBarConverter.java |  72 ++
 .../conversion/impl/FooNumberConverter.java     |  18 +
 .../impl/InstantiatingNullHandlerTest.java      |  54 ++
 .../conversion/impl/NumberConverterTest.java    |  42 ++
 .../xwork2/conversion/impl/ParentClass.java     |  27 +
 .../impl/XWorkBasicConverterTest.java           | 260 +++++++
 .../conversion/impl/XWorkConverterTest.java     | 715 +++++++++++++++++++
 .../annotations/AllowingByDefaultAction.java    |  23 +
 .../annotations/AllowingByDefaultModel.java     |  22 +
 .../annotations/AnnotatedAction.java            |  46 ++
 .../AnnotationParameterFilterUnitTest.java      | 173 +++++
 .../AnnotationWorkflowInterceptorTest.java      | 102 +++
 .../annotations/BaseAnnotatedAction.java        |  32 +
 .../annotations/BlockingByDefaultAction.java    |  24 +
 .../annotations/BlockingByDefaultModel.java     |  22 +
 .../annotations/ShortcircuitedAction.java       |  35 +
 .../accessor/XWorkListPropertyAccessorTest.java |  53 ++
 .../ActionAutowiringInterceptorTest.java        | 112 +++
 .../interceptor/TestActionInvocation.java       |  82 +++
 .../xwork2/test/annotations/Address.java        |  40 ++
 .../test/annotations/AddressTypeConverter.java  |  29 +
 .../xwork2/test/annotations/Person.java         |  22 +
 .../xwork2/test/annotations/PersonAction.java   |  47 ++
 .../test/annotations/PersonActionTest.java      |  87 +++
 .../test/annotations/PersonTypeConverter.java   |  27 +
 .../ValidateAnnotatedMethodOnlyAction.java      |  55 ++
 .../test/subtest/NullModelDrivenAction.java     |  19 +
 .../xwork2/util/annotation/Dummy2Class.java     |   9 +
 .../xwork2/util/annotation/DummyClass.java      |  13 +
 .../xwork2/util/annotation/DummyClassExt.java   |   9 +
 .../xwork2/util/annotation/MyAnnotation.java    |  11 +
 .../xwork2/util/annotation/MyAnnotation2.java   |   8 +
 .../xwork2/util/annotation/package-info.java    |  22 +
 .../util/fs/DefaultFileManagerFactoryTest.java  | 135 ++++
 .../util/location/LocationAttributesTest.java   |  87 +++
 .../xwork2/util/location/LocationImplTest.java  |  87 +++
 .../xwork2/util/location/LocationUtilsTest.java |  53 ++
 .../xwork2/util/logging/LoggerUtilsTest.java    |  24 +
 .../util/profiling/ProfilingTimerBeanTest.java  | 124 ++++
 .../util/profiling/UtilTimerStackTest.java      | 133 ++++
 .../AppendingValidatorContextTest.java          |  47 ++
 .../validators/DateRangeFieldValidatorTest.java |  93 +++
 .../validators/IntRangeFieldValidatorTest.java  |  76 ++
 .../validators/LongRangeFieldValidatorTest.java |  76 ++
 .../validators/RequiredStringValidatorTest.java |  79 ++
 .../ShortRangeFieldValidatorTest.java           |  76 ++
 .../validator/validators/ValidationAction.java  | 136 ++++
 .../validators/ValidatorSupportTest.java        |  53 ++
 ...ionSupportTest$MyActionSupport_da.properties |  10 +
 .../xwork2/AnnotatedTestBean.properties         |   1 +
 .../DefaultTextProviderTest_en_CA.properties    |   8 +
 .../xwork2/ModelDrivenAction-validation.xml     |  13 +
 .../xwork2/ModelDrivenAction.properties         |   1 +
 .../ModelDrivenAnnotationAction.properties      |   6 +
 .../SimpleAction-some-alias-validation.xml      |  13 +
 .../SimpleAction-subproperty-validation.xml     |  18 +
 .../xwork2/SimpleAction-validation.xml          |  58 ++
 .../SimpleAction-validationAlias-validation.xml |  13 +
 .../opensymphony/xwork2/SimpleAction.properties |   3 +
 .../xwork2/SimpleAction_de.properties           |   1 +
 .../xwork2/SimpleAction_en.properties           |   0
 .../xwork2/SimpleAnnotationAction.properties    |   8 +
 .../xwork2/SimpleAnnotationAction_de.properties |   6 +
 .../xwork2/SimpleAnnotationAction_en.properties |   5 +
 .../TestBean-anotherContext-validation.xml      |  10 +
 .../xwork2/TestBean-badtest-validation.xml      |   8 +
 .../TestBean-beanMessageBundle-validation.xml   |  15 +
 ...TestBean-expressionValidation-validation.xml |   9 +
 .../opensymphony/xwork2/TestBean-validation.xml |   8 +
 ...stBean-visitorChildValidation-validation.xml |  14 +
 .../TestBean-visitorValidation-validation.xml   |   9 +
 .../com/opensymphony/xwork2/TestBean.properties |   1 +
 .../xwork2/TestChildBean-validation.xml         |  23 +
 .../TextProviderSupportTest_en.properties       |  12 +
 .../xwork2/ValidationOrderAction-validation.xml |  89 +++
 .../loadorder1/xwork-test-load-order.xml        |   7 +
 .../loadorder2/xwork-test-load-order.xml        |   7 +
 .../loadorder3/xwork-test-load-order.xml        |   7 +
 .../xwork2/config/providers/xwork- test.xml     |  81 +++
 .../providers/xwork-include-after-package-2.xml |  14 +
 .../providers/xwork-include-after-package.xml   |  20 +
 .../xwork-include-before-package-2.xml          |  14 +
 .../providers/xwork-include-before-package.xml  |  22 +
 .../config/providers/xwork-include-parent.xml   |  22 +
 .../providers/xwork-test-action-invalid.xml     |  23 +
 ...work-test-actions-packagedefaultclassref.xml |  41 ++
 .../config/providers/xwork-test-actions.xml     |  81 +++
 .../providers/xwork-test-allowed-methods.xml    |  48 ++
 .../providers/xwork-test-bad-inheritance.xml    |  17 +
 .../providers/xwork-test-basic-packages.xml     |  13 +
 .../providers/xwork-test-default-package.xml    |   9 +
 .../xwork-test-defaultclassref-package.xml      |  11 +
 .../providers/xwork-test-exception-mappings.xml |  33 +
 .../xwork-test-global-result-inheritence.xml    |  48 ++
 .../xwork-test-interceptor-defaultref.xml       |  30 +
 .../xwork-test-interceptor-inheritance.xml      |  34 +
 .../xwork-test-interceptor-param-overriding.xml |  44 ++
 .../providers/xwork-test-interceptor-params.xml |  37 +
 ...-test-interceptor-stack-param-overriding.xml |  51 ++
 .../providers/xwork-test-interceptors-basic.xml |  27 +
 .../xwork-test-interceptors-spring.xml          |  13 +
 .../providers/xwork-test-invalid-file.xml       |   9 +
 .../config/providers/xwork-test-multilevel.xml  |  45 ++
 .../xwork-test-package-inheritance.xml          |  27 +
 .../providers/xwork-test-result-inheritance.xml |  26 +
 .../providers/xwork-test-result-types.xml       |  54 ++
 .../config/providers/xwork-test-results.xml     |  32 +
 .../config/providers/xwork-test-wildcard-1.xml  |   8 +
 .../config/providers/xwork-test-wildcard-2.xml  |   8 +
 .../providers/xwork-test-wildcard-include.xml   |  10 +
 .../xwork-unknownhandler-stack-empty.xml        |  12 +
 .../providers/xwork-unknownhandler-stack.xml    |  14 +
 .../impl/test-xwork-conversion.properties       |   1 +
 .../com/opensymphony/xwork2/somefile.txt        |   9 +
 .../xwork2/spring/actionContext-spring.xml      |  43 ++
 .../xwork2/spring/actionContext-xwork.xml       |  23 +
 .../xwork2/spring/autowireContext.xml           |   6 +
 .../spring/resolverApplicationContext.xml       |  11 +
 .../xwork2/spring/xwork-autowire.xml            |  22 +
 .../com/opensymphony/xwork2/test.properties     |   1 +
 .../xwork2/test/DataAware-conversion.properties |   1 +
 .../xwork2/test/DataAware-validation.xml        |   8 +
 .../DataAware-validationAlias-validation.xml    |   8 +
 .../xwork2/test/DataAware.properties            |   2 +
 .../xwork2/test/DataAware2-validation.xml       |   8 +
 .../xwork2/test/Equidae-validation.xml          |  52 ++
 .../xwork2/test/SimpleAction2-validation.xml    |  13 +
 ...SimpleAction2-validationAlias-validation.xml |  13 +
 .../xwork2/test/TestBean2-conversion.properties |   1 +
 .../xwork2/test/User-conversion.properties      |   2 +
 .../xwork2/test/User-validation.xml             |  38 +
 .../xwork2/test/UserMarker-validation.xml       |  17 +
 .../opensymphony/xwork2/test/package.properties |   1 +
 .../com/opensymphony/xwork2/util/Bar.properties |   2 +
 .../xwork2/util/Cat-conversion.properties       |   2 +
 .../opensymphony/xwork2/util/FindMe.properties  |   2 +
 .../xwork2/util/Foo-conversion.properties       |  11 +
 .../util/ListHolder-conversion.properties       |   3 +
 .../util/LocalizedTextUtilTest.properties       |   3 +
 .../util/MyBeanAction-conversion.properties     |   8 +
 .../xwork2/util/Tiger-conversion.properties     |   1 +
 .../xwork2/util/XW404_de.properties             |   3 +
 .../xwork2/util/XW404_fr.properties             |   3 +
 .../xwork2/util/location/xml-with-location.xml  |   8 +
 ...teTextProviderTestResourceBundle1.properties |  10 +
 ...teTextProviderTestResourceBundle2.properties |  11 +
 .../VisitorValidatorModelAction-validation.xml  |   9 +
 ...rTestAction-beanMessageBundle-validation.xml |   8 +
 ...datorTestAction-validateArray-validation.xml |   8 +
 ...idatorTestAction-validateList-validation.xml |   8 +
 .../VisitorValidatorTestAction-validation.xml   |   8 +
 ...Action-visitorChildValidation-validation.xml |   8 +
 ...rTestAction-visitorValidation-validation.xml |   8 +
 ...Action-visitorValidationAlias-validation.xml |   9 +
 .../xwork2/validator/validator-parser-test.xml  |  33 +
 .../xwork2/validator/validator-parser-test2.xml |  17 +
 .../xwork2/validator/validator-parser-test3.xml |  11 +
 .../xwork2/validator/validator-parser-test4.xml |  12 +
 .../xwork2/validator/validator-parser-test5.xml |   4 +
 .../xwork2/validator/validator-parser-test6.xml |  27 +
 .../xwork2/validator/validators-fail.xml        |  21 +
 190 files changed, 8921 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/entities/ActionConfigTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/entities/ActionConfigTest.java b/core/src/test/java/com/opensymphony/xwork2/config/entities/ActionConfigTest.java
new file mode 100644
index 0000000..d22bd74
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/entities/ActionConfigTest.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2002-2003,2009 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.opensymphony.xwork2.config.entities;
+
+import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.util.location.LocationImpl;
+
+/**
+ * ActionConfigTest
+ */
+public class ActionConfigTest extends XWorkTestCase {
+
+    public void testToString() {
+        ActionConfig cfg = new ActionConfig.Builder("", "bob", "foo.Bar")
+                .methodName("execute")
+                .location(new LocationImpl(null, "foo/xwork.xml", 10, 12))
+                .build();
+
+        assertTrue("Wrong toString(): "+cfg.toString(), 
+            "{ActionConfig bob (foo.Bar.execute()) - foo/xwork.xml:10:12}".equals(cfg.toString()));
+    }
+    
+    public void testToStringWithNoMethod() {
+        ActionConfig cfg = new ActionConfig.Builder("", "bob", "foo.Bar")
+                .location(new LocationImpl(null, "foo/xwork.xml", 10, 12))
+                .build();
+        
+        assertTrue("Wrong toString(): "+cfg.toString(),
+            "{ActionConfig bob (foo.Bar) - foo/xwork.xml:10:12}".equals(cfg.toString()));
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/entities/PackageConfigTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/entities/PackageConfigTest.java b/core/src/test/java/com/opensymphony/xwork2/config/entities/PackageConfigTest.java
new file mode 100644
index 0000000..e2f2868
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/entities/PackageConfigTest.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2002-2003,2009 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.opensymphony.xwork2.config.entities;
+
+import com.opensymphony.xwork2.XWorkTestCase;
+
+public class PackageConfigTest extends XWorkTestCase {
+
+    public void testFullDefaultInterceptorRef() {
+        PackageConfig cfg1 = new PackageConfig.Builder("pkg1")
+                .defaultInterceptorRef("ref1").build();
+        PackageConfig cfg2 = new PackageConfig.Builder("pkg2").defaultInterceptorRef("ref2").build();
+        PackageConfig cfg = new PackageConfig.Builder("pkg")
+                .addParent(cfg1)
+                .addParent(cfg2)
+                .build();
+        
+        assertEquals("ref2", cfg.getFullDefaultInterceptorRef());
+    }
+    
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/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
new file mode 100644
index 0000000..e6de0b9
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcherTest.java
@@ -0,0 +1,164 @@
+/*
+ * $Id$
+ *
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.opensymphony.xwork2.config.impl;
+
+import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.config.entities.ExceptionMappingConfig;
+import com.opensymphony.xwork2.config.entities.InterceptorMapping;
+import com.opensymphony.xwork2.config.entities.ResultConfig;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class ActionConfigMatcherTest extends XWorkTestCase {
+
+    // ----------------------------------------------------- Instance Variables
+    private Map<String,ActionConfig> configMap;
+    private ActionConfigMatcher matcher;
+    
+    // ----------------------------------------------------- Setup and Teardown
+    @Override public void setUp() throws Exception {
+        super.setUp();
+        configMap = buildActionConfigMap();
+        matcher = new ActionConfigMatcher(configMap);
+    }
+
+    @Override public void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    // ------------------------------------------------------- Individual Tests
+    // ---------------------------------------------------------- match()
+    public void testNoMatch() {
+        assertNull("ActionConfig shouldn't be matched", matcher.match("test"));
+    }
+
+    public void testNoWildcardMatch() {
+        assertNull("ActionConfig shouldn't be matched", matcher.match("noWildcard"));
+    }
+
+    public void testShouldMatch() {
+        ActionConfig matched = matcher.match("foo/class/method");
+
+        assertNotNull("ActionConfig should be matched", matched);
+        assertTrue("ActionConfig should have properties, had " +
+                matched.getParams().size(), matched.getParams().size() == 2);
+        assertTrue("ActionConfig should have interceptors",
+                matched.getInterceptors().size() == 1);
+        assertTrue("ActionConfig should have ex mappings",
+                matched.getExceptionMappings().size() == 1);
+        assertTrue("ActionConfig should have external refs",
+                matched.getExceptionMappings().size() == 1);
+        assertTrue("ActionConfig should have results",
+                matched.getResults().size() == 1);
+    }
+
+    public void testCheckSubstitutionsMatch() {
+        ActionConfig m = matcher.match("foo/class/method");
+
+        assertTrue("Class hasn't been replaced", "foo.bar.classAction".equals(m.getClassName()));
+        assertTrue("Method hasn't been replaced", "domethod".equals(m.getMethodName()));
+        assertTrue("Package isn't correct", "package-class".equals(m.getPackageName()));
+
+        assertTrue("First param isn't correct", "class".equals(m.getParams().get("first")));
+        assertTrue("Second param isn't correct", "method".equals(m.getParams().get("second")));
+        
+        ExceptionMappingConfig ex = m.getExceptionMappings().get(0);
+        assertTrue("Wrong name, was "+ex.getName(), "fooclass".equals(ex.getName()));
+        assertTrue("Wrong result", "successclass".equals(ex.getResult()));
+        assertTrue("Wrong exception", 
+                "java.lang.methodException".equals(ex.getExceptionClassName()));
+        assertTrue("First param isn't correct", "class".equals(ex.getParams().get("first")));
+        assertTrue("Second param isn't correct", "method".equals(ex.getParams().get("second")));
+        
+        ResultConfig result = m.getResults().get("successclass");
+        assertTrue("Wrong name, was "+result.getName(), "successclass".equals(result.getName()));
+        assertTrue("Wrong classname", "foo.method".equals(result.getClassName()));
+        assertTrue("First param isn't correct", "class".equals(result.getParams().get("first")));
+        assertTrue("Second param isn't correct", "method".equals(result.getParams().get("second")));
+        
+    }
+
+    public void testCheckMultipleSubstitutions() {
+        ActionConfig m = matcher.match("bar/class/method/more");
+
+        assertTrue("Method hasn't been replaced correctly: " + m.getMethodName(),
+            "doclass_class".equals(m.getMethodName()));
+    }
+    
+    public void testLooseMatch() {
+        configMap.put("*!*", configMap.get("bar/*/**"));
+        ActionConfigMatcher matcher = new ActionConfigMatcher(configMap, true);
+        
+        // exact match
+        ActionConfig m = matcher.match("foo/class/method");
+        assertNotNull("ActionConfig should be matched", m);
+        assertTrue("Class hasn't been replaced "+m.getClassName(), "foo.bar.classAction".equals(m.getClassName()));
+        assertTrue("Method hasn't been replaced", "domethod".equals(m.getMethodName()));
+        
+        // Missing last wildcard
+        m = matcher.match("foo/class");
+        assertNotNull("ActionConfig should be matched", m);
+        assertTrue("Class hasn't been replaced", "foo.bar.classAction".equals(m.getClassName()));
+        assertTrue("Method hasn't been replaced, "+m.getMethodName(), "do".equals(m.getMethodName()));
+        
+        // Simple mapping
+        m = matcher.match("class!method");
+        assertNotNull("ActionConfig should be matched", m);
+        assertTrue("Class hasn't been replaced, "+m.getPackageName(), "package-class".equals(m.getPackageName()));
+        assertTrue("Method hasn't been replaced", "method".equals(m.getParams().get("first")));
+        
+        // Simple mapping
+        m = matcher.match("class");
+        assertNotNull("ActionConfig should be matched", m);
+        assertTrue("Class hasn't been replaced", "package-class".equals(m.getPackageName()));
+        assertTrue("Method hasn't been replaced", "".equals(m.getParams().get("first")));
+        
+    }
+
+    private Map<String,ActionConfig> buildActionConfigMap() {
+        Map<String, ActionConfig> map = new HashMap<>();
+
+        HashMap<String, String> params = new HashMap<>();
+        params.put("first", "{1}");
+        params.put("second", "{2}");
+
+        ActionConfig config = new ActionConfig.Builder("package-{1}", "foo/*/*", "foo.bar.{1}Action")
+                .methodName("do{2}")
+                .addParams(params)
+                .addExceptionMapping(new ExceptionMappingConfig.Builder("foo{1}", "java.lang.{2}Exception", "success{1}")
+                        .addParams(new HashMap<>(params))
+                    .build())
+                .addInterceptor(new InterceptorMapping(null, null))
+                .addResultConfig(new ResultConfig.Builder("success{1}", "foo.{2}").addParams(params).build())
+                .build();
+        map.put("foo/*/*", config);
+        
+        config = new ActionConfig.Builder("package-{1}", "bar/*/**", "bar")
+                .methodName("do{1}_{1}")
+                .addParam("first", "{2}")
+                .build();
+        
+        map.put("bar/*/**", config);
+        
+        map.put("noWildcard", new ActionConfig.Builder("", "", "").build());
+
+        return map;
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/impl/NamespaceMatcherTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/impl/NamespaceMatcherTest.java b/core/src/test/java/com/opensymphony/xwork2/config/impl/NamespaceMatcherTest.java
new file mode 100644
index 0000000..e70f18d
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/impl/NamespaceMatcherTest.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2002-2006,2009 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.opensymphony.xwork2.config.impl;
+
+import com.opensymphony.xwork2.util.WildcardHelper;
+import junit.framework.TestCase;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class NamespaceMatcherTest extends TestCase {
+
+    public void testMatch() {
+        Set<String> names = new HashSet<>();
+        names.add("/bar");
+        names.add("/foo/*/bar");
+        names.add("/foo/*");
+        names.add("/foo/*/jim/*");
+        NamespaceMatcher matcher = new NamespaceMatcher(new WildcardHelper(), names);
+        assertEquals(3, matcher.compiledPatterns.size());
+
+        assertNull(matcher.match("/asd"));
+        assertEquals("/foo/*", matcher.match("/foo/23").getPattern());
+        assertEquals("/foo/*/bar", matcher.match("/foo/23/bar").getPattern());
+        assertEquals("/foo/*/jim/*", matcher.match("/foo/23/jim/42").getPattern());
+        assertNull(matcher.match("/foo/23/asd"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/ConfigurationTestBase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/ConfigurationTestBase.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/ConfigurationTestBase.java
new file mode 100644
index 0000000..f5cd83a
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/ConfigurationTestBase.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2002-2003,2009 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.FileManagerFactory;
+import com.opensymphony.xwork2.ObjectFactory;
+import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.impl.MockConfiguration;
+
+
+/**
+ * ConfigurationTestBase
+ *
+ * @author Jason Carreira
+ *         Created Jun 9, 2003 7:42:12 AM
+ */
+public abstract class ConfigurationTestBase extends XWorkTestCase {
+
+    protected ConfigurationProvider buildConfigurationProvider(final String filename) {
+        configuration = new MockConfiguration();
+        ((MockConfiguration)configuration).selfRegister();
+        container = configuration.getContainer();
+
+        XmlConfigurationProvider prov = new XmlConfigurationProvider(filename, true);
+        prov.setObjectFactory(container.getInstance(ObjectFactory.class));
+        prov.setFileManagerFactory(container.getInstance(FileManagerFactory.class));
+        prov.init(configuration);
+        prov.loadPackages();
+        return prov;
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorBuilderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorBuilderTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorBuilderTest.java
new file mode 100644
index 0000000..914d963
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorBuilderTest.java
@@ -0,0 +1,274 @@
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.ObjectFactory;
+import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.config.entities.InterceptorConfig;
+import com.opensymphony.xwork2.config.entities.InterceptorMapping;
+import com.opensymphony.xwork2.config.entities.InterceptorStackConfig;
+import com.opensymphony.xwork2.config.entities.PackageConfig;
+import com.opensymphony.xwork2.interceptor.Interceptor;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+
+/**
+ * <code>InterceptorBuilderTest</code>
+ *
+ * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
+ * @version $Id$
+ */
+public class InterceptorBuilderTest extends XWorkTestCase {
+
+    ObjectFactory objectFactory;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        objectFactory = container.getInstance(ObjectFactory.class);
+    }
+    
+    /**
+     * Try to test this
+     * <interceptor-ref name="interceptorStack1">
+     * <param name="interceptor1.param1">interceptor1_value1</param>
+     * <param name="interceptor1.param2">interceptor1_value2</param>
+     * <param name="interceptor2.param1">interceptor2_value1</param>
+     * <param name="interceptor2.param2">interceptor2_value2</param>
+     * </interceptor-ref>
+     *
+     * @throws Exception
+     */
+    public void testBuildInterceptor_1() throws Exception {
+        InterceptorStackConfig interceptorStackConfig1 = new InterceptorStackConfig.Builder("interceptorStack1").build();
+
+        InterceptorConfig interceptorConfig1 = new InterceptorConfig.Builder("interceptor1", "com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor1").build();
+
+        InterceptorConfig interceptorConfig2 = new InterceptorConfig.Builder("interceptor2", "com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor2").build();
+
+
+        PackageConfig packageConfig = new PackageConfig.Builder("package1").namespace("/namespace").addInterceptorConfig(interceptorConfig1).addInterceptorConfig(interceptorConfig2).addInterceptorStackConfig(interceptorStackConfig1).build();
+
+        List
+                interceptorMappings =
+                InterceptorBuilder.constructInterceptorReference(packageConfig, "interceptorStack1",
+                        new LinkedHashMap<String, String>() {
+                            private static final long serialVersionUID = -1358620486812957895L;
+
+                            {
+                                put("interceptor1.param1", "interceptor1_value1");
+                                put("interceptor1.param2", "interceptor1_value2");
+                                put("interceptor2.param1", "interceptor2_value1");
+                                put("interceptor2.param2", "interceptor2_value2");
+                            }
+                        },null,  objectFactory);
+
+        assertEquals(interceptorMappings.size(), 2);
+
+        assertEquals(((InterceptorMapping) interceptorMappings.get(0)).getName(), "interceptor1");
+        assertNotNull(((InterceptorMapping) interceptorMappings.get(0)).getInterceptor());
+        assertEquals(((InterceptorMapping) interceptorMappings.get(0)).getInterceptor().getClass(), MockInterceptor1.class);
+        assertEquals(((MockInterceptor1) ((InterceptorMapping) interceptorMappings.get(0)).getInterceptor()).getParam1(), "interceptor1_value1");
+        assertEquals(((MockInterceptor1) ((InterceptorMapping) interceptorMappings.get(0)).getInterceptor()).getParam2(), "interceptor1_value2");
+
+        assertEquals(((InterceptorMapping) interceptorMappings.get(1)).getName(), "interceptor2");
+        assertNotNull(((InterceptorMapping) interceptorMappings.get(1)).getInterceptor());
+        assertEquals(((InterceptorMapping) interceptorMappings.get(1)).getInterceptor().getClass(), MockInterceptor2.class);
+        assertEquals(((MockInterceptor2) ((InterceptorMapping) interceptorMappings.get(1)).getInterceptor()).getParam1(), "interceptor2_value1");
+        assertEquals(((MockInterceptor2) ((InterceptorMapping) interceptorMappings.get(1)).getInterceptor()).getParam2(), "interceptor2_value2");
+    }
+
+    /**
+     * Try to test this
+     * <interceptor-ref name="interceptorStack1">
+     * <param name="interceptorStack2.interceptor1.param1">interceptor1_value1</param>
+     * <param name="interceptorStack2.interceptor1.param2">interceptor1_value2</param>
+     * <param name="interceptorStack3.interceptor2.param1">interceptor2_value1</param>
+     * <param name="interceptorStack3.interceptor2.param2">interceptor2_value2</param>
+     * </interceptor-ref>
+     *
+     * @throws Exception
+     */
+    public void testBuildInterceptor_2() throws Exception {
+        InterceptorStackConfig interceptorStackConfig1 = new InterceptorStackConfig.Builder("interceptorStack1").build();
+
+        InterceptorStackConfig interceptorStackConfig2 = new InterceptorStackConfig.Builder("interceptorStack2").build();
+
+        InterceptorStackConfig interceptorStackConfig3 = new InterceptorStackConfig.Builder("interceptorStack3").build();
+
+        InterceptorConfig interceptorConfig1 = new InterceptorConfig.Builder("interceptor1", "com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor1").build();
+
+        InterceptorConfig interceptorConfig2 = new InterceptorConfig.Builder("interceptor2", "com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor2").build();
+
+
+        PackageConfig packageConfig = new PackageConfig.Builder("package1").namespace("/namspace").
+                addInterceptorConfig(interceptorConfig1).
+                addInterceptorConfig(interceptorConfig2).
+                addInterceptorStackConfig(interceptorStackConfig1).
+                addInterceptorStackConfig(interceptorStackConfig2).
+                addInterceptorStackConfig(interceptorStackConfig3).build();
+
+        List interceptorMappings = InterceptorBuilder.constructInterceptorReference(packageConfig, "interceptorStack1",
+                new LinkedHashMap<String, String>() {
+                    private static final long serialVersionUID = -5819935102242042570L;
+
+                    {
+                        put("interceptorStack2.interceptor1.param1", "interceptor1_value1");
+                        put("interceptorStack2.interceptor1.param2", "interceptor1_value2");
+                        put("interceptorStack3.interceptor2.param1", "interceptor2_value1");
+                        put("interceptorStack3.interceptor2.param2", "interceptor2_value2");
+                    }
+                }, null, objectFactory);
+
+        assertEquals(interceptorMappings.size(), 2);
+
+        assertEquals(((InterceptorMapping) interceptorMappings.get(0)).getName(), "interceptor1");
+        assertNotNull(((InterceptorMapping) interceptorMappings.get(0)).getInterceptor());
+        assertEquals(((InterceptorMapping) interceptorMappings.get(0)).getInterceptor().getClass(), MockInterceptor1.class);
+        assertEquals(((MockInterceptor1) ((InterceptorMapping) interceptorMappings.get(0)).getInterceptor()).getParam1(), "interceptor1_value1");
+        assertEquals(((MockInterceptor1) ((InterceptorMapping) interceptorMappings.get(0)).getInterceptor()).getParam2(), "interceptor1_value2");
+
+        assertEquals(((InterceptorMapping) interceptorMappings.get(1)).getName(), "interceptor2");
+        assertNotNull(((InterceptorMapping) interceptorMappings.get(1)).getInterceptor());
+        assertEquals(((InterceptorMapping) interceptorMappings.get(1)).getInterceptor().getClass(), MockInterceptor2.class);
+        assertEquals(((MockInterceptor2) ((InterceptorMapping) interceptorMappings.get(1)).getInterceptor()).getParam1(), "interceptor2_value1");
+        assertEquals(((MockInterceptor2) ((InterceptorMapping) interceptorMappings.get(1)).getInterceptor()).getParam2(), "interceptor2_value2");
+    }
+
+    /**
+     * Try to test this
+     * <interceptor-ref name="interceptorStack1">
+     * <param name="interceptorStack2.interceptorStack3.interceptorStack4.interceptor1.param1">interceptor1_value1</param>
+     * <param name="interceptorStack2.interceptorStack3.interceptorStack4.interceptor1.param2">interceptor1_value2</param>
+     * <param name="interceptorStack5.interceptor2.param1">interceptor2_value1</param>
+     * <param name="interceptorStack5.interceptor2.param2">interceptor2_value2</param>
+     * </interceptor-ref>
+     *
+     * @throws Exception
+     */
+    public void testBuildInterceptor_3() throws Exception {
+        InterceptorConfig interceptorConfig1 = new InterceptorConfig.Builder("interceptor1", "com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor1").build();
+
+        InterceptorConfig interceptorConfig2 = new InterceptorConfig.Builder("interceptor2", "com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor2").build();
+
+
+        InterceptorStackConfig interceptorStackConfig1 = new InterceptorStackConfig.Builder("interceptorStack1").build();
+
+
+        InterceptorStackConfig interceptorStackConfig2 = new InterceptorStackConfig.Builder("interceptorStack2").build();
+
+
+        InterceptorStackConfig interceptorStackConfig3 = new InterceptorStackConfig.Builder("interceptorStack3").build();
+
+
+        InterceptorStackConfig interceptorStackConfig4 = new InterceptorStackConfig.Builder("interceptorStack4").build();
+
+
+        InterceptorStackConfig interceptorStackConfig5 = new InterceptorStackConfig.Builder("interceptorStack5").build();
+
+
+
+        PackageConfig packageConfig = new PackageConfig.Builder("package1").
+                addInterceptorConfig(interceptorConfig1).
+                addInterceptorConfig(interceptorConfig2).
+                addInterceptorStackConfig(interceptorStackConfig1).
+                addInterceptorStackConfig(interceptorStackConfig2).
+                addInterceptorStackConfig(interceptorStackConfig3).
+                addInterceptorStackConfig(interceptorStackConfig4).
+                addInterceptorStackConfig(interceptorStackConfig5).build();
+
+
+        List interceptorMappings = InterceptorBuilder.constructInterceptorReference(
+                packageConfig, "interceptorStack1",
+                new LinkedHashMap<String, String>() {
+                    private static final long serialVersionUID = 4675809753780875525L;
+
+                    {
+                        put("interceptorStack2.interceptorStack3.interceptorStack4.interceptor1.param1", "interceptor1_value1");
+                        put("interceptorStack2.interceptorStack3.interceptorStack4.interceptor1.param2", "interceptor1_value2");
+                        put("interceptorStack5.interceptor2.param1", "interceptor2_value1");
+                        put("interceptorStack5.interceptor2.param2", "interceptor2_value2");
+                    }
+                }, null, objectFactory);
+
+        assertEquals(interceptorMappings.size(), 2);
+
+        assertEquals(((InterceptorMapping) interceptorMappings.get(0)).getName(), "interceptor1");
+        assertNotNull(((InterceptorMapping) interceptorMappings.get(0)).getInterceptor());
+        assertEquals(((InterceptorMapping) interceptorMappings.get(0)).getInterceptor().getClass(), MockInterceptor1.class);
+        assertEquals(((MockInterceptor1) ((InterceptorMapping) interceptorMappings.get(0)).getInterceptor()).getParam1(), "interceptor1_value1");
+        assertEquals(((MockInterceptor1) ((InterceptorMapping) interceptorMappings.get(0)).getInterceptor()).getParam2(), "interceptor1_value2");
+
+        assertEquals(((InterceptorMapping) interceptorMappings.get(1)).getName(), "interceptor2");
+        assertNotNull(((InterceptorMapping) interceptorMappings.get(1)).getInterceptor());
+        assertEquals(((InterceptorMapping) interceptorMappings.get(1)).getInterceptor().getClass(), MockInterceptor2.class);
+        assertEquals(((MockInterceptor2) ((InterceptorMapping) interceptorMappings.get(1)).getInterceptor()).getParam1(), "interceptor2_value1");
+        assertEquals(((MockInterceptor2) ((InterceptorMapping) interceptorMappings.get(1)).getInterceptor()).getParam2(), "interceptor2_value2");
+    }
+
+
+    public static class MockInterceptor1 implements Interceptor {
+        private static final long serialVersionUID = 2939902550126175874L;
+        private String param1;
+        private String param2;
+
+        public void setParam1(String param1) {
+            this.param1 = param1;
+        }
+
+        public String getParam1() {
+            return this.param1;
+        }
+
+        public void setParam2(String param2) {
+            this.param2 = param2;
+        }
+
+        public String getParam2() {
+            return this.param2;
+        }
+
+        public void destroy() {
+        }
+
+        public void init() {
+        }
+
+        public String intercept(ActionInvocation invocation) throws Exception {
+            return invocation.invoke();
+        }
+    }
+
+    public static class MockInterceptor2 implements Interceptor {
+        private static final long serialVersionUID = 267427973306989618L;
+        private String param1;
+        private String param2;
+
+        public void setParam1(String param1) {
+            this.param1 = param1;
+        }
+
+        public String getParam1() {
+            return this.param1;
+        }
+
+        public void setParam2(String param2) {
+            this.param2 = param2;
+        }
+
+        public String getParam2() {
+            return this.param2;
+        }
+
+        public void destroy() {
+        }
+
+        public void init() {
+        }
+
+        public String intercept(ActionInvocation invocation) throws Exception {
+            return invocation.invoke();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorForTestPurpose.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorForTestPurpose.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorForTestPurpose.java
new file mode 100644
index 0000000..8911268
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorForTestPurpose.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2002-2006,2009 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.interceptor.Interceptor;
+
+/**
+ * 
+ * @author tm_jee
+ * @version $Date$ $Id$
+ */
+public class InterceptorForTestPurpose implements Interceptor {
+
+	private String paramOne;
+	private String paramTwo;
+	
+	public String getParamOne() { return paramOne; }
+	public void setParamOne(String paramOne) { this.paramOne = paramOne; }
+	
+	public String getParamTwo() { return paramTwo; }
+	public void setParamTwo(String paramTwo) { this.paramTwo = paramTwo; }
+	
+	public void destroy() {
+	}
+
+	public void init() {
+	}
+
+	public String intercept(ActionInvocation invocation) throws Exception {
+		return invocation.invoke();
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/MockConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/MockConfigurationProvider.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/MockConfigurationProvider.java
new file mode 100644
index 0000000..22d748b
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/MockConfigurationProvider.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2002-2003,2009 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.*;
+import com.opensymphony.xwork2.config.Configuration;
+import com.opensymphony.xwork2.config.ConfigurationException;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.entities.*;
+import com.opensymphony.xwork2.inject.ContainerBuilder;
+import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor;
+import com.opensymphony.xwork2.interceptor.ParametersInterceptor;
+import com.opensymphony.xwork2.interceptor.StaticParametersInterceptor;
+import com.opensymphony.xwork2.mock.MockResult;
+import com.opensymphony.xwork2.util.location.LocatableProperties;
+import com.opensymphony.xwork2.validator.ValidationInterceptor;
+
+import java.util.*;
+
+
+/**
+ * MockConfigurationProvider provides a simple configuration class without the need for xml files, etc. for simple testing.
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class MockConfigurationProvider implements ConfigurationProvider {
+
+    public static final String FOO_ACTION_NAME = "foo";
+    public static final String MODEL_DRIVEN_PARAM_TEST = "modelParamTest";
+    public static final String MODEL_DRIVEN_PARAM_FILTER_TEST  = "modelParamFilterTest";
+    public static final String PARAM_INTERCEPTOR_ACTION_NAME = "parametersInterceptorTest";
+    public static final String VALIDATION_ACTION_NAME = "validationInterceptorTest";
+    public static final String VALIDATION_ALIAS_NAME = "validationAlias";
+    public static final String VALIDATION_SUBPROPERTY_NAME = "subproperty";
+    public static final String EXPRESSION_VALIDATION_ACTION = "expressionValidationAction";
+
+    private static final Map<String,String> EMPTY_STRING_MAP = Collections.emptyMap();
+
+    private Configuration configuration;
+    private Map<String,String> params;
+    private ObjectFactory objectFactory;
+
+    public MockConfigurationProvider() {}
+    public MockConfigurationProvider(Map<String,String> params) {
+        this.params = params;
+    }
+
+    /**
+     * Allows the configuration to clean up any resources used
+     */
+    public void destroy() {
+    }
+    
+    public void init(Configuration config) {
+        this.configuration = config;
+    }
+    
+    @Inject
+    public void setObjectFactory(ObjectFactory fac) {
+        this.objectFactory = fac;
+    }
+
+    public void loadPackages() {
+        
+        PackageConfig.Builder defaultPackageContext = new PackageConfig.Builder("defaultPackage");
+        Map<String, String> params = new HashMap<>();
+        params.put("bar", "5");
+
+        Map<String, ResultConfig> results = new HashMap<>();
+        Map<String, String> successParams = new HashMap<>();
+        successParams.put("actionName", "bar");
+        results.put("success", new ResultConfig.Builder("success", ActionChainResult.class.getName()).addParams(successParams).build());
+
+        ActionConfig fooActionConfig = new ActionConfig.Builder("defaultPackage", FOO_ACTION_NAME, SimpleAction.class.getName())
+            .addResultConfig(new ResultConfig.Builder(Action.ERROR, MockResult.class.getName()).build())
+            .build();
+        defaultPackageContext.addActionConfig(FOO_ACTION_NAME, fooActionConfig);
+
+        results = new HashMap<>();
+        successParams = new HashMap<>();
+        successParams.put("actionName", "bar");
+        results.put("success", new ResultConfig.Builder("success", ActionChainResult.class.getName()).addParams(successParams).build());
+
+        List<InterceptorMapping> interceptors = new ArrayList<>();
+        interceptors.add(new InterceptorMapping("params", new ParametersInterceptor()));
+
+        ActionConfig paramInterceptorActionConfig = new ActionConfig.Builder("defaultPackage", PARAM_INTERCEPTOR_ACTION_NAME, SimpleAction.class.getName())
+            .addResultConfig(new ResultConfig.Builder(Action.ERROR, MockResult.class.getName()).build())
+            .addInterceptors(interceptors)
+            .build();
+        defaultPackageContext.addActionConfig(PARAM_INTERCEPTOR_ACTION_NAME, paramInterceptorActionConfig);
+
+        interceptors = new ArrayList<>();
+        interceptors.add(new InterceptorMapping("model", 
+                objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", ModelDrivenInterceptor.class.getName()).build(), EMPTY_STRING_MAP)));
+        interceptors.add(new InterceptorMapping("params",
+                objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", ParametersInterceptor.class.getName()).build(), EMPTY_STRING_MAP)));
+
+        ActionConfig modelParamActionConfig = new ActionConfig.Builder("defaultPackage", MODEL_DRIVEN_PARAM_TEST, ModelDrivenAction.class.getName())
+            .addInterceptors(interceptors)
+            .addResultConfig(new ResultConfig.Builder(Action.SUCCESS, MockResult.class.getName()).build())
+            .build();
+        defaultPackageContext.addActionConfig(MODEL_DRIVEN_PARAM_TEST, modelParamActionConfig);
+        
+        //List paramFilterInterceptor=new ArrayList();
+        //paramFilterInterceptor.add(new ParameterFilterInterC)
+        //ActionConfig modelParamFilterActionConfig = new ActionConfig(null, ModelDrivenAction.class, null, null, interceptors);
+
+
+        results = new HashMap<>();
+        successParams = new HashMap<>();
+        successParams.put("actionName", "bar");
+        results.put("success", new ResultConfig.Builder("success", ActionChainResult.class.getName()).addParams(successParams).build());
+        results.put(Action.ERROR, new ResultConfig.Builder(Action.ERROR, MockResult.class.getName()).build());
+
+        interceptors = new ArrayList<>();
+        interceptors.add(new InterceptorMapping("staticParams", 
+                objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", StaticParametersInterceptor.class.getName()).build(), EMPTY_STRING_MAP)));
+        interceptors.add(new InterceptorMapping("model", 
+                objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", ModelDrivenInterceptor.class.getName()).build(), EMPTY_STRING_MAP)));
+        interceptors.add(new InterceptorMapping("params", 
+                objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", ParametersInterceptor.class.getName()).build(), EMPTY_STRING_MAP)));
+        interceptors.add(new InterceptorMapping("validation", 
+                objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", ValidationInterceptor.class.getName()).build(), EMPTY_STRING_MAP)));
+
+        //Explicitly set an out-of-range date for DateRangeValidatorTest
+        params = new HashMap<>();
+        ActionConfig validationActionConfig = new ActionConfig.Builder("defaultPackage", VALIDATION_ACTION_NAME, SimpleAction.class.getName())
+            .addInterceptors(interceptors)
+            .addParams(params)
+            .addResultConfigs(results)
+            .build();
+        defaultPackageContext.addActionConfig(VALIDATION_ACTION_NAME, validationActionConfig);
+        defaultPackageContext.addActionConfig(VALIDATION_ALIAS_NAME,
+                new ActionConfig.Builder(validationActionConfig).name(VALIDATION_ALIAS_NAME).build());
+        defaultPackageContext.addActionConfig(VALIDATION_SUBPROPERTY_NAME,
+                new ActionConfig.Builder(validationActionConfig).name(VALIDATION_SUBPROPERTY_NAME).build());
+
+
+        params = new HashMap<>();
+        ActionConfig percentageActionConfig = new ActionConfig.Builder("defaultPackage", "percentage", SimpleAction.class.getName())
+                .addParams(params)
+                .addResultConfigs(results)
+                .addInterceptors(interceptors)
+                .build();
+        defaultPackageContext.addActionConfig(percentageActionConfig.getName(), percentageActionConfig);
+
+        // We need this actionconfig to be the final destination for action chaining
+        ActionConfig barActionConfig = new ActionConfig.Builder("defaultPackage", "bar", SimpleAction.class.getName())
+                .addResultConfig(new ResultConfig.Builder(Action.ERROR, MockResult.class.getName()).build())
+                .build();
+        defaultPackageContext.addActionConfig(barActionConfig.getName(), barActionConfig);
+
+        ActionConfig expressionValidationActionConfig = new ActionConfig.Builder("defaultPackage", EXPRESSION_VALIDATION_ACTION, SimpleAction.class.getName())
+                .addInterceptors(interceptors)
+                .addResultConfigs(results)
+                .build();
+        defaultPackageContext.addActionConfig(EXPRESSION_VALIDATION_ACTION, expressionValidationActionConfig);
+
+        configuration.addPackageConfig("defaultPackage", defaultPackageContext.build());
+    }
+
+    /**
+     * Tells whether the ConfigurationProvider should reload its configuration
+     *
+     * @return false
+     */
+    public boolean needsReload() {
+        return false;
+    }
+
+    public void register(ContainerBuilder builder, LocatableProperties props) throws ConfigurationException {
+        if (params != null) {
+            for (String key : params.keySet()) {
+                props.setProperty(key, params.get(key));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/NoNoArgsConstructorAction.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/NoNoArgsConstructorAction.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/NoNoArgsConstructorAction.java
new file mode 100644
index 0000000..8f1435d
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/NoNoArgsConstructorAction.java
@@ -0,0 +1,24 @@
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * Action with no public constructor taking no args.
+ * <p/>
+ * Used for unit test of {@link com.opensymphony.xwork2.config.providers.XmlConfigurationProvider}.
+ *
+ * @author Claus Ibsen
+ */
+public class NoNoArgsConstructorAction implements Action {
+
+    private int foo;
+
+    public NoNoArgsConstructorAction(int foo) {
+        this.foo = foo;
+    }
+
+    public String execute() throws Exception {
+        return SUCCESS;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/PrivateConstructorAction.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/PrivateConstructorAction.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/PrivateConstructorAction.java
new file mode 100644
index 0000000..640a171
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/PrivateConstructorAction.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2002-2006,2009 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * Action with nu public constructor.
+ * <p/>
+ * Used for unit test of {@link XmlConfigurationProvider}.
+ *
+ * @author Claus Ibsen
+ */
+public class PrivateConstructorAction implements Action {
+
+    private int foo;
+
+    private PrivateConstructorAction() {
+        // should be private, no constructor
+    }
+
+    public String execute() throws Exception {
+        return SUCCESS;
+    }
+
+    public void setFoo(int foo) {
+        this.foo = foo;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/SomeUnknownHandler.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/SomeUnknownHandler.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/SomeUnknownHandler.java
new file mode 100644
index 0000000..494a16c
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/SomeUnknownHandler.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2002-2006,2009 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.Result;
+import com.opensymphony.xwork2.UnknownHandler;
+import com.opensymphony.xwork2.XWorkException;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+
+public class SomeUnknownHandler implements UnknownHandler{
+    private ActionConfig actionConfig;
+    private String actionMethodResult;
+
+    public ActionConfig handleUnknownAction(String namespace, String actionName) throws XWorkException {
+        return actionConfig;
+    }
+
+    public Object handleUnknownActionMethod(Object action, String methodName) throws NoSuchMethodException {
+        return actionMethodResult;
+    }
+
+    public Result handleUnknownResult(ActionContext actionContext, String actionName, ActionConfig actionConfig,
+            String resultCode) throws XWorkException {
+        return null;
+    }
+
+    public void setActionConfig(ActionConfig actionConfig) {
+        this.actionConfig = actionConfig;
+    }
+
+    public void setActionMethodResult(String actionMethodResult) {
+        this.actionMethodResult = actionMethodResult;
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/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
new file mode 100644
index 0000000..2181181
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderActionsTest.java
@@ -0,0 +1,214 @@
+/*
+ * Copyright 2002-2003,2009 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.ObjectFactory;
+import com.opensymphony.xwork2.SimpleAction;
+import com.opensymphony.xwork2.config.ConfigurationException;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.entities.*;
+import com.opensymphony.xwork2.interceptor.TimerInterceptor;
+import com.opensymphony.xwork2.mock.MockInterceptor;
+import com.opensymphony.xwork2.mock.MockResult;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * @author Mike
+ * @author Rainer Hermanns
+ */
+public class XmlConfigurationProviderActionsTest extends ConfigurationTestBase {
+
+    private List<InterceptorMapping> interceptors;
+    private List<ExceptionMappingConfig> exceptionMappings;
+    private Map<String, String> params;
+    private Map<String, ResultConfig> results;
+    private ObjectFactory objectFactory;
+
+
+    public void testActions() throws Exception {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-actions.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+
+        // setup expectations
+        // bar action is very simple, just two params
+        params.put("foo", "17");
+        params.put("bar", "23");
+        params.put("testXW412", "foo.jspa?fooID=${fooID}&something=bar");
+        params.put("testXW412Again", "something");
+
+
+        ActionConfig barAction = new ActionConfig.Builder("", "Bar", SimpleAction.class.getName())
+                .addParams(params).build();
+
+        // foo action is a little more complex, two params, a result and an interceptor stack
+        results = new HashMap<>();
+        params = new HashMap<>();
+        params.put("foo", "18");
+        params.put("bar", "24");
+        results.put("success", new ResultConfig.Builder("success", MockResult.class.getName()).build());
+
+        InterceptorConfig timerInterceptorConfig = new InterceptorConfig.Builder("timer", TimerInterceptor.class.getName()).build();
+        interceptors.add(new InterceptorMapping("timer", objectFactory.buildInterceptor(timerInterceptorConfig, new HashMap<String, String>())));
+
+        ActionConfig fooAction = new ActionConfig.Builder("", "Foo", SimpleAction.class.getName())
+                .addParams(params)
+                .addResultConfigs(results)
+                .addInterceptors(interceptors)
+                .build();
+
+        // wildcard action is simple wildcard example
+        results = new HashMap<>();
+        results.put("*", new ResultConfig.Builder("*", MockResult.class.getName()).build());
+
+        ActionConfig wildcardAction = new ActionConfig.Builder("", "WildCard", SimpleAction.class.getName())
+                .addResultConfigs(results)
+                .addInterceptors(interceptors)
+                .build();
+
+        // fooBar action is a little more complex, two params, a result and an interceptor stack
+        params = new HashMap<String, String>();
+        params.put("foo", "18");
+        params.put("bar", "24");
+        results = new HashMap<>();
+        results.put("success", new ResultConfig.Builder("success", MockResult.class.getName()).build());
+
+        ExceptionMappingConfig exceptionConfig = new ExceptionMappingConfig.Builder("runtime", "java.lang.RuntimeException", "exception")
+                .build();
+        exceptionMappings.add(exceptionConfig);
+
+        ActionConfig fooBarAction = new ActionConfig.Builder("", "FooBar", SimpleAction.class.getName())
+                .addParams(params)
+                .addResultConfigs(results)
+                .addInterceptors(interceptors)
+                .addExceptionMappings(exceptionMappings)
+                .build();
+
+        // TestInterceptorParam action tests that an interceptor worked
+        HashMap<String, String> interceptorParams = new HashMap<>();
+        interceptorParams.put("expectedFoo", "expectedFooValue");
+        interceptorParams.put("foo", MockInterceptor.DEFAULT_FOO_VALUE);
+
+        InterceptorConfig mockInterceptorConfig = new InterceptorConfig.Builder("test", MockInterceptor.class.getName()).build();
+        interceptors = new ArrayList<>();
+        interceptors.add(new InterceptorMapping("test", objectFactory.buildInterceptor(mockInterceptorConfig, interceptorParams)));
+
+        ActionConfig intAction = new ActionConfig.Builder("", "TestInterceptorParam", SimpleAction.class.getName())
+                .addInterceptors(interceptors)
+                .build();
+
+        // TestInterceptorParamOverride action tests that an interceptor with a param override worked
+        interceptorParams = new HashMap<>();
+        interceptorParams.put("expectedFoo", "expectedFooValue");
+        interceptorParams.put("foo", "foo123");
+        interceptors = new ArrayList<>();
+        interceptors.add(new InterceptorMapping("test", objectFactory.buildInterceptor(mockInterceptorConfig, interceptorParams)));
+
+        ActionConfig intOverAction = new ActionConfig.Builder("", "TestInterceptorParamOverride", SimpleAction.class.getName())
+                .addInterceptors(interceptors)
+                .build();
+
+        // execute the configuration
+        provider.init(configuration);
+        provider.loadPackages();
+
+        PackageConfig pkg = configuration.getPackageConfig("default");
+        Map actionConfigs = pkg.getActionConfigs();
+
+        // assertions
+        assertEquals(7, actionConfigs.size());
+        assertEquals(barAction, actionConfigs.get("Bar"));
+        assertEquals(fooAction, actionConfigs.get("Foo"));
+        assertEquals(wildcardAction, actionConfigs.get("WildCard"));
+        assertEquals(fooBarAction, actionConfigs.get("FooBar"));
+        assertEquals(intAction, actionConfigs.get("TestInterceptorParam"));
+        assertEquals(intOverAction, actionConfigs.get("TestInterceptorParamOverride"));
+    }
+
+    public void testInvalidActions() throws Exception {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-action-invalid.xml";
+
+        try {
+            ConfigurationProvider provider = buildConfigurationProvider(filename);
+            fail("Should have thrown an exception");
+        } catch (ConfigurationException ex) {
+            // it worked correctly
+        }
+    }
+
+    public void testPackageDefaultClassRef() throws Exception {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-actions-packagedefaultclassref.xml";
+        final String testDefaultClassName = "com.opensymphony.xwork2.UserSpecifiedDefaultAction";
+
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+
+        // setup expectations
+        params.put("foo", "17");
+        params.put("bar", "23");
+
+        ActionConfig barWithPackageDefaultClassRefConfig =
+                new ActionConfig.Builder("", "Bar", "").addParams(params).build();
+
+        // execute the configuration
+        provider.init(configuration);
+
+        PackageConfig pkg = configuration.getPackageConfig("default");
+        Map actionConfigs = pkg.getActionConfigs();
+
+        // assertions
+        assertEquals(1, actionConfigs.size());
+        assertEquals(barWithPackageDefaultClassRefConfig, actionConfigs.get("Bar"));
+    }
+
+    public void testDefaultActionClass() throws Exception {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-actions.xml";
+        final String testDefaultClassName = "com.opensymphony.xwork2.ActionSupport";
+
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+
+        // setup expectations
+        params.put("foo", "17");
+        params.put("bar", "23");
+
+        ActionConfig barWithoutClassNameConfig =
+                new ActionConfig.Builder("", "BarWithoutClassName", "").addParams(params).build();
+
+        // execute the configuration
+        provider.init(configuration);
+
+        PackageConfig pkg = configuration.getPackageConfig("default");
+        Map actionConfigs = pkg.getActionConfigs();
+
+        // assertions
+        assertEquals(7, actionConfigs.size());
+        assertEquals(barWithoutClassNameConfig, actionConfigs.get("BarWithoutClassName"));
+    }
+
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        params = new HashMap<>();
+        results = new HashMap<>();
+        interceptors = new ArrayList<>();
+        exceptionMappings = new ArrayList<>();
+        this.objectFactory = container.getInstance(ObjectFactory.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/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
new file mode 100644
index 0000000..6a55e75
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderAllowedMethodsTest.java
@@ -0,0 +1,125 @@
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.config.ConfigurationException;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.config.entities.PackageConfig;
+
+import java.util.Map;
+
+/**
+ * @author John Lindal
+ */
+public class XmlConfigurationProviderAllowedMethodsTest extends ConfigurationTestBase {
+
+    public void testDefaultAllowedMethods() throws ConfigurationException {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-allowed-methods.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+
+        // execute the configuration
+        provider.init(configuration);
+        provider.loadPackages();
+
+        PackageConfig pkg = configuration.getPackageConfig("default");
+        Map actionConfigs = pkg.getActionConfigs();
+
+        // assertions
+        assertEquals(5, actionConfigs.size());
+
+        ActionConfig action = (ActionConfig) actionConfigs.get("Default");
+        assertEquals(1, action.getAllowedMethods().size());
+        assertTrue(action.isAllowedMethod("execute"));
+        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());
+        assertTrue(action.isAllowedMethod("execute"));
+        assertFalse(action.isAllowedMethod("foo"));
+        assertFalse(action.isAllowedMethod("bar"));
+        assertFalse(action.isAllowedMethod("baz"));
+        assertFalse(action.isAllowedMethod("xyz"));
+
+        action = (ActionConfig) actionConfigs.get("Foo");
+        assertEquals(1, action.getAllowedMethods().size());
+        assertTrue(action.isAllowedMethod("execute"));
+        assertTrue(action.isAllowedMethod("foo"));
+        assertFalse(action.isAllowedMethod("bar"));
+        assertFalse(action.isAllowedMethod("baz"));
+        assertFalse(action.isAllowedMethod("xyz"));
+
+        action = (ActionConfig) actionConfigs.get("Bar");
+        assertEquals(2, action.getAllowedMethods().size());
+        assertTrue(action.isAllowedMethod("execute"));
+        assertTrue(action.isAllowedMethod("foo"));
+        assertTrue(action.isAllowedMethod("bar"));
+        assertFalse(action.isAllowedMethod("baz"));
+        assertFalse(action.isAllowedMethod("xyz"));
+
+        action = (ActionConfig) actionConfigs.get("Baz");
+        assertEquals(2, action.getAllowedMethods().size());
+        assertFalse(action.isAllowedMethod("execute"));
+        assertTrue(action.isAllowedMethod("foo"));
+        assertTrue(action.isAllowedMethod("bar"));
+        assertTrue(action.isAllowedMethod("baz"));
+        assertFalse(action.isAllowedMethod("xyz"));
+    }
+
+    public void testStrictAllowedMethods() throws ConfigurationException {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-allowed-methods.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+
+        // execute the configuration
+        provider.init(configuration);
+        provider.loadPackages();
+
+        PackageConfig pkg = configuration.getPackageConfig("strict");
+        Map actionConfigs = pkg.getActionConfigs();
+
+        // assertions
+        assertEquals(5, actionConfigs.size());
+
+        ActionConfig action = (ActionConfig) actionConfigs.get("Default");
+        assertEquals(0, action.getAllowedMethods().size());
+        assertTrue(action.isAllowedMethod("execute"));
+        assertFalse(action.isAllowedMethod("foo"));
+        assertFalse(action.isAllowedMethod("bar"));
+        assertFalse(action.isAllowedMethod("baz"));
+        assertFalse(action.isAllowedMethod("xyz"));
+
+        action = (ActionConfig) actionConfigs.get("Boring");
+        assertEquals(0, action.getAllowedMethods().size());
+        assertTrue(action.isAllowedMethod("execute"));
+        assertFalse(action.isAllowedMethod("foo"));
+        assertFalse(action.isAllowedMethod("bar"));
+        assertFalse(action.isAllowedMethod("baz"));
+        assertFalse(action.isAllowedMethod("xyz"));
+
+        action = (ActionConfig) actionConfigs.get("Foo");
+        assertEquals(1, action.getAllowedMethods().size());
+        assertTrue(action.isAllowedMethod("execute"));
+        assertTrue(action.isAllowedMethod("foo"));
+        assertFalse(action.isAllowedMethod("bar"));
+        assertFalse(action.isAllowedMethod("baz"));
+        assertFalse(action.isAllowedMethod("xyz"));
+
+        action = (ActionConfig) actionConfigs.get("Bar");
+        assertEquals(2, action.getAllowedMethods().size());
+        assertTrue(action.isAllowedMethod("execute"));
+        assertTrue(action.isAllowedMethod("foo"));
+        assertTrue(action.isAllowedMethod("bar"));
+        assertFalse(action.isAllowedMethod("baz"));
+        assertFalse(action.isAllowedMethod("xyz"));
+
+        action = (ActionConfig) actionConfigs.get("Baz");
+        assertEquals(2, action.getAllowedMethods().size());
+        assertFalse(action.isAllowedMethod("execute"));
+        assertTrue(action.isAllowedMethod("foo"));
+        assertTrue(action.isAllowedMethod("bar"));
+        assertTrue(action.isAllowedMethod("baz"));
+        assertFalse(action.isAllowedMethod("xyz"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/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
new file mode 100644
index 0000000..232efd3
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderExceptionMappingsTest.java
@@ -0,0 +1,65 @@
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.ActionChainResult;
+import com.opensymphony.xwork2.SimpleAction;
+import com.opensymphony.xwork2.config.ConfigurationException;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.config.entities.ExceptionMappingConfig;
+import com.opensymphony.xwork2.config.entities.PackageConfig;
+import com.opensymphony.xwork2.config.entities.ResultConfig;
+import com.opensymphony.xwork2.mock.MockResult;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * User: Matthew E. Porter (matthew dot porter at metissian dot com)
+ * Date: Aug 15, 2005
+ * Time: 2:05:36 PM
+ */
+public class XmlConfigurationProviderExceptionMappingsTest extends ConfigurationTestBase {
+
+    public void testActions() throws ConfigurationException {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-exception-mappings.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+
+        List<ExceptionMappingConfig> exceptionMappings = new ArrayList<>();
+        HashMap<String, String> parameters = new HashMap<>();
+        HashMap<String, ResultConfig> results = new HashMap<>();
+
+        exceptionMappings.add(
+                new ExceptionMappingConfig.Builder("spooky-result", "com.opensymphony.xwork2.SpookyException", "spooky-result")
+                    .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());
+
+        ActionConfig expectedAction = new ActionConfig.Builder("default", "Bar", SimpleAction.class.getName())
+            .addParams(parameters)
+            .addResultConfigs(results)
+            .addExceptionMappings(exceptionMappings)
+            .build();
+
+        // execute the configuration
+        provider.init(configuration);
+        provider.loadPackages();
+
+        PackageConfig pkg = configuration.getPackageConfig("default");
+        Map actionConfigs = pkg.getActionConfigs();
+
+        // assertions
+        assertEquals(1, actionConfigs.size());
+
+        ActionConfig action = (ActionConfig) actionConfigs.get("Bar");
+        assertEquals(expectedAction, action);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderGlobalResultInheritenceTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderGlobalResultInheritenceTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderGlobalResultInheritenceTest.java
new file mode 100644
index 0000000..e4553df
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderGlobalResultInheritenceTest.java
@@ -0,0 +1,53 @@
+package com.opensymphony.xwork2.config.providers;
+
+
+import com.opensymphony.xwork2.config.Configuration;
+import com.opensymphony.xwork2.config.ConfigurationManager;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.config.entities.ResultConfig;
+
+/**
+ * <code>XmlConfigurationProviderGlobalResultInheritenceTest</code>
+ *
+ * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
+ * @author tm_jee
+ * @version $Id$
+ */
+public class XmlConfigurationProviderGlobalResultInheritenceTest extends ConfigurationTestBase {
+
+    public void testGlobalResultInheritenceTest() throws Exception {
+        ConfigurationProvider provider = buildConfigurationProvider("com/opensymphony/xwork2/config/providers/xwork-test-global-result-inheritence.xml");
+
+        ConfigurationManager configurationManager = new ConfigurationManager();
+        configurationManager.addContainerProvider(new XWorkConfigurationProvider());
+        configurationManager.addContainerProvider(provider);
+        Configuration configuration = configurationManager.getConfiguration();
+
+        ActionConfig parentActionConfig = configuration.getRuntimeConfiguration().getActionConfig("/base", "parentAction");
+        ActionConfig anotherActionConfig = configuration.getRuntimeConfiguration().getActionConfig("/base", "anotherAction");
+        ActionConfig childActionConfig = configuration.getRuntimeConfiguration().getActionConfig("/base", "childAction");
+
+        ResultConfig parentResultConfig1 = parentActionConfig.getResults().get("mockResult1");
+        ResultConfig parentResultConfig2 = parentActionConfig.getResults().get("mockResult2");
+        ResultConfig anotherResultConfig1 = anotherActionConfig.getResults().get("mockResult1");
+        ResultConfig anotherResultConfig2 = anotherActionConfig.getResults().get("mockResult2");
+        ResultConfig childResultConfig1 = childActionConfig.getResults().get("mockResult1");
+        ResultConfig childResultConfig2 = childActionConfig.getResults().get("mockResult2");
+
+        System.out.println(parentResultConfig1.getParams().get("identity"));
+        System.out.println(parentResultConfig2.getParams().get("identity"));
+        System.out.println(anotherResultConfig1.getParams().get("identity"));
+        System.out.println(anotherResultConfig2.getParams().get("identity"));
+        System.out.println(childResultConfig1.getParams().get("identity"));
+        System.out.println(childResultConfig2.getParams().get("identity"));
+
+        assertFalse(parentResultConfig1 == anotherResultConfig1);
+        assertFalse(parentResultConfig2 == anotherResultConfig2);
+
+        assertFalse(parentResultConfig1 == childResultConfig1);
+        assertTrue(parentResultConfig2 == childResultConfig2);
+    }
+}
+
+


Mime
View raw message