You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2011/12/02 17:33:45 UTC

svn commit: r1209569 [38/50] - in /struts/struts2/branches/STRUTS_3_X: apps/blank/src/main/java/example/ apps/blank/src/test/java/example/ apps/jboss-blank/src/main/java/example/ apps/jboss-blank/src/test/java/example/ apps/mailreader/src/main/java/mai...

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/impl/NamespaceMatcherTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/impl/NamespaceMatcherTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/impl/NamespaceMatcherTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/impl/NamespaceMatcherTest.java Fri Dec  2 16:33:03 2011
@@ -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 org.apache.struts2.xwork2.config.impl;
+
+import org.apache.struts2.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<String>();
+        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"));
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/ConfigurationTestBase.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/ConfigurationTestBase.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/ConfigurationTestBase.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/ConfigurationTestBase.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,43 @@
+/*
+ * 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 org.apache.struts2.xwork2.config.providers;
+
+import org.apache.struts2.xwork2.ObjectFactory;
+import org.apache.struts2.xwork2.XWorkTestCase;
+import org.apache.struts2.xwork2.config.ConfigurationProvider;
+import org.apache.struts2.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.init(configuration);
+        prov.loadPackages();
+        return prov;
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/InterceptorBuilderTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/InterceptorBuilderTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/InterceptorBuilderTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/InterceptorBuilderTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,274 @@
+package org.apache.struts2.xwork2.config.providers;
+
+import org.apache.struts2.xwork2.ActionInvocation;
+import org.apache.struts2.xwork2.ObjectFactory;
+import org.apache.struts2.xwork2.XWorkTestCase;
+import org.apache.struts2.xwork2.config.entities.InterceptorConfig;
+import org.apache.struts2.xwork2.config.entities.InterceptorMapping;
+import org.apache.struts2.xwork2.config.entities.InterceptorStackConfig;
+import org.apache.struts2.xwork2.config.entities.PackageConfig;
+import org.apache.struts2.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: InterceptorBuilderTest.java 1209415 2011-12-02 11:24:48Z lukaszlenart $
+ */
+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", "org.apache.struts2.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor1").build();
+
+        InterceptorConfig interceptorConfig2 = new InterceptorConfig.Builder("interceptor2", "org.apache.struts2.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", "org.apache.struts2.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor1").build();
+
+        InterceptorConfig interceptorConfig2 = new InterceptorConfig.Builder("interceptor2", "org.apache.struts2.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", "org.apache.struts2.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor1").build();
+
+        InterceptorConfig interceptorConfig2 = new InterceptorConfig.Builder("interceptor2", "org.apache.struts2.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();
+        }
+    }
+
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/InterceptorForTestPurpose.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/InterceptorForTestPurpose.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/InterceptorForTestPurpose.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/InterceptorForTestPurpose.java Fri Dec  2 16:33:03 2011
@@ -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 org.apache.struts2.xwork2.config.providers;
+
+import org.apache.struts2.xwork2.ActionInvocation;
+import org.apache.struts2.xwork2.interceptor.Interceptor;
+
+/**
+ * 
+ * @author tm_jee
+ * @version $Date: 2011-12-02 12:24:48 +0100 (Fri, 02 Dec 2011) $ $Id: InterceptorForTestPurpose.java 1209415 2011-12-02 11:24:48Z lukaszlenart $
+ */
+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();
+	}
+
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/MockConfigurationProvider.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/MockConfigurationProvider.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/MockConfigurationProvider.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/MockConfigurationProvider.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,201 @@
+/*
+ * 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 org.apache.struts2.xwork2.config.providers;
+
+import org.apache.struts2.xwork2.config.Configuration;
+import org.apache.struts2.xwork2.config.ConfigurationException;
+import org.apache.struts2.xwork2.Action;
+import org.apache.struts2.xwork2.ObjectFactory;
+import org.apache.struts2.xwork2.config.ConfigurationProvider;
+import org.apache.struts2.xwork2.ActionChainResult;
+import org.apache.struts2.xwork2.config.entities.ActionConfig;
+import org.apache.struts2.xwork2.config.entities.InterceptorConfig;
+import org.apache.struts2.xwork2.config.entities.PackageConfig;
+import org.apache.struts2.xwork2.config.entities.ResultConfig;
+import org.apache.struts2.xwork2.inject.ContainerBuilder;
+import org.apache.struts2.xwork2.inject.Inject;
+import org.apache.struts2.xwork2.interceptor.ModelDrivenInterceptor;
+import org.apache.struts2.xwork2.interceptor.ParametersInterceptor;
+import org.apache.struts2.xwork2.interceptor.StaticParametersInterceptor;
+import org.apache.struts2.xwork2.mock.MockResult;
+import org.apache.struts2.xwork2.util.location.LocatableProperties;
+import org.apache.struts2.xwork2.validator.ValidationInterceptor;
+import org.apache.struts2.xwork2.config.entities.InterceptorMapping;
+import org.apache.struts2.xwork2.ModelDrivenAction;
+import org.apache.struts2.xwork2.SimpleAction;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * MockConfigurationProvider provides a simple configuration class without the need for xml files, etc. for simple testing.
+ *
+ * @author $author$
+ * @version $Revision: 1209415 $
+ */
+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";
+    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");
+        HashMap params = new HashMap();
+        params.put("bar", "5");
+
+        HashMap results = new HashMap();
+        HashMap 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<InterceptorMapping>();
+        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<InterceptorMapping>();
+        interceptors.add(new InterceptorMapping("model", 
+                objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", ModelDrivenInterceptor.class.getName()).build(), new HashMap())));
+        interceptors.add(new InterceptorMapping("params",
+                objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", ParametersInterceptor.class.getName()).build(), new HashMap())));
+
+        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<String, ResultConfig>();
+        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<InterceptorMapping>();
+        interceptors.add(new InterceptorMapping("staticParams", 
+                objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", StaticParametersInterceptor.class.getName()).build(), new HashMap())));
+        interceptors.add(new InterceptorMapping("model", 
+                objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", ModelDrivenInterceptor.class.getName()).build(), new HashMap())));
+        interceptors.add(new InterceptorMapping("params", 
+                objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", ParametersInterceptor.class.getName()).build(), new HashMap())));
+        interceptors.add(new InterceptorMapping("validation",
+                objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", ValidationInterceptor.class.getName()).build(), new HashMap())));
+
+        //Explicitly set an out-of-range date for DateRangeValidatorTest
+        params = new HashMap();
+        params.put("date", new java.util.Date(2002 - 1900, 11, 20));
+
+        //Explicitly set an out-of-range double for DoubleRangeValidatorTest
+        params.put("percentage", new Double(100.0123));
+
+        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();
+        params.put("percentage", new Double(1.234567));
+        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);
+
+        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));
+            }
+        }
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/NoNoArgsConstructorAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/NoNoArgsConstructorAction.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/NoNoArgsConstructorAction.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/NoNoArgsConstructorAction.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,24 @@
+package org.apache.struts2.xwork2.config.providers;
+
+import org.apache.struts2.xwork2.Action;
+
+/**
+ * Action with no public constructor taking no args.
+ * <p/>
+ * Used for unit test of {@link org.apache.struts2.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;
+    }
+
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/PrivateConstructorAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/PrivateConstructorAction.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/PrivateConstructorAction.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/PrivateConstructorAction.java Fri Dec  2 16:33:03 2011
@@ -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 org.apache.struts2.xwork2.config.providers;
+
+import org.apache.struts2.xwork2.Action;
+
+/**
+ * Action with nu public constructor.
+ * <p/>
+ * Used for unit test of {@link org.apache.struts2.xwork2.config.providers.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;
+    }
+
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/SomeUnknownHandler.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/SomeUnknownHandler.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/SomeUnknownHandler.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/SomeUnknownHandler.java Fri Dec  2 16:33:03 2011
@@ -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 org.apache.struts2.xwork2.config.providers;
+
+import org.apache.struts2.xwork2.ActionContext;
+import org.apache.struts2.xwork2.Result;
+import org.apache.struts2.xwork2.UnknownHandler;
+import org.apache.struts2.xwork2.XWorkException;
+import org.apache.struts2.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;
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderActionsTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderActionsTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderActionsTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderActionsTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,219 @@
+/*
+ * 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 org.apache.struts2.xwork2.config.providers;
+
+import org.apache.struts2.xwork2.ObjectFactory;
+import org.apache.struts2.xwork2.SimpleAction;
+import org.apache.struts2.xwork2.config.ConfigurationException;
+import org.apache.struts2.xwork2.config.ConfigurationProvider;
+import org.apache.struts2.xwork2.config.entities.ActionConfig;
+import org.apache.struts2.xwork2.config.entities.ExceptionMappingConfig;
+import org.apache.struts2.xwork2.config.entities.InterceptorConfig;
+import org.apache.struts2.xwork2.config.entities.PackageConfig;
+import org.apache.struts2.xwork2.config.entities.ResultConfig;
+import org.apache.struts2.xwork2.interceptor.TimerInterceptor;
+import org.apache.struts2.xwork2.mock.MockInterceptor;
+import org.apache.struts2.xwork2.mock.MockResult;
+import org.apache.struts2.xwork2.config.entities.InterceptorMapping;
+
+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 = "org/apache/struts2/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<String, ResultConfig>();
+        params = new HashMap<String, String>();
+        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<String, ResultConfig>();
+        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<String, ResultConfig>();
+        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<String, String>();
+        interceptorParams.put("expectedFoo", "expectedFooValue");
+        interceptorParams.put("foo", MockInterceptor.DEFAULT_FOO_VALUE);
+
+        InterceptorConfig mockInterceptorConfig = new InterceptorConfig.Builder("test", MockInterceptor.class.getName()).build();
+        interceptors = new ArrayList<InterceptorMapping>();
+        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<String, String>();
+        interceptorParams.put("expectedFoo", "expectedFooValue");
+        interceptorParams.put("foo", "foo123");
+        interceptors = new ArrayList<InterceptorMapping>();
+        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 = "org/apache/struts2/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 = "org/apache/struts2/xwork2/config/providers/xwork-test-actions-packagedefaultclassref.xml";
+        final String testDefaultClassName = "org.apache.struts2.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 = "org/apache/struts2/xwork2/config/providers/xwork-test-actions.xml";
+        final String testDefaultClassName = "org.apache.struts2.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<String, String>();
+        results = new HashMap<String, ResultConfig>();
+        interceptors = new ArrayList<InterceptorMapping>();
+        exceptionMappings = new ArrayList<ExceptionMappingConfig>();
+        this.objectFactory = container.getInstance(ObjectFactory.class);
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderAllowedMethodsTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderAllowedMethodsTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderAllowedMethodsTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderAllowedMethodsTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,125 @@
+package org.apache.struts2.xwork2.config.providers;
+
+import org.apache.struts2.xwork2.config.ConfigurationException;
+import org.apache.struts2.xwork2.config.ConfigurationProvider;
+import org.apache.struts2.xwork2.config.entities.ActionConfig;
+import org.apache.struts2.xwork2.config.entities.PackageConfig;
+
+import java.util.Map;
+
+/**
+ * @author John Lindal
+ */
+public class XmlConfigurationProviderAllowedMethodsTest extends ConfigurationTestBase {
+
+    public void testDefaultAllowedMethods() throws ConfigurationException {
+        final String filename = "org/apache/struts2/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 = "org/apache/struts2/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"));
+    }
+
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderExceptionMappingsTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderExceptionMappingsTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderExceptionMappingsTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderExceptionMappingsTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,65 @@
+package org.apache.struts2.xwork2.config.providers;
+
+import org.apache.struts2.xwork2.ActionChainResult;
+import org.apache.struts2.xwork2.SimpleAction;
+import org.apache.struts2.xwork2.config.ConfigurationException;
+import org.apache.struts2.xwork2.config.ConfigurationProvider;
+import org.apache.struts2.xwork2.config.entities.ActionConfig;
+import org.apache.struts2.xwork2.config.entities.ExceptionMappingConfig;
+import org.apache.struts2.xwork2.config.entities.PackageConfig;
+import org.apache.struts2.xwork2.config.entities.ResultConfig;
+import org.apache.struts2.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 = "org/apache/struts2/xwork2/config/providers/xwork-test-exception-mappings.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+
+        List<ExceptionMappingConfig> exceptionMappings = new ArrayList<ExceptionMappingConfig>();
+        HashMap<String, String> parameters = new HashMap<String, String>();
+        HashMap<String, ResultConfig> results = new HashMap<String, ResultConfig>();
+
+        exceptionMappings.add(
+                new ExceptionMappingConfig.Builder("spooky-result", "org.apache.struts2.xwork2.SpookyException", "spooky-result")
+                    .build());
+        results.put("spooky-result", new ResultConfig.Builder("spooky-result", MockResult.class.getName()).build());
+
+        Map<String, String> resultParams = new HashMap<String, String>();
+        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);
+    }
+
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderGlobalResultInheritenceTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderGlobalResultInheritenceTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderGlobalResultInheritenceTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderGlobalResultInheritenceTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,53 @@
+package org.apache.struts2.xwork2.config.providers;
+
+
+import org.apache.struts2.xwork2.config.Configuration;
+import org.apache.struts2.xwork2.config.ConfigurationManager;
+import org.apache.struts2.xwork2.config.ConfigurationProvider;
+import org.apache.struts2.xwork2.config.entities.ActionConfig;
+import org.apache.struts2.xwork2.config.entities.ResultConfig;
+
+/**
+ * <code>XmlConfigurationProviderGlobalResultInheritenceTest</code>
+ *
+ * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
+ * @author tm_jee
+ * @version $Id: XmlConfigurationProviderGlobalResultInheritenceTest.java 1209415 2011-12-02 11:24:48Z lukaszlenart $
+ */
+public class XmlConfigurationProviderGlobalResultInheritenceTest extends ConfigurationTestBase {
+
+    public void testGlobalResultInheritenceTest() throws Exception {
+        ConfigurationProvider provider = buildConfigurationProvider("org/apache/struts2/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);
+    }
+}
+
+

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderInterceptorParamOverridingTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderInterceptorParamOverridingTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderInterceptorParamOverridingTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderInterceptorParamOverridingTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,95 @@
+/*
+ * 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 org.apache.struts2.xwork2.config.providers;
+
+import org.apache.struts2.xwork2.XWorkTestCase;
+import org.apache.struts2.xwork2.config.ConfigurationProvider;
+import org.apache.struts2.xwork2.config.RuntimeConfiguration;
+import org.apache.struts2.xwork2.config.entities.ActionConfig;
+import org.apache.struts2.xwork2.config.entities.InterceptorMapping;
+import org.apache.struts2.xwork2.config.impl.DefaultConfiguration;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author tm_jee
+ * @version $Date: 2011-12-02 12:24:48 +0100 (Fri, 02 Dec 2011) $ $Id: XmlConfigurationProviderInterceptorParamOverridingTest.java 1209415 2011-12-02 11:24:48Z lukaszlenart $
+ */
+public class XmlConfigurationProviderInterceptorParamOverridingTest extends XWorkTestCase {
+
+    public void testInterceptorParamOveriding() throws Exception {
+        DefaultConfiguration conf = new DefaultConfiguration();
+        final XmlConfigurationProvider p = new XmlConfigurationProvider("org/apache/struts2/xwork2/config/providers/xwork-test-interceptor-param-overriding.xml");
+        conf.reload(new ArrayList<ConfigurationProvider>() {
+            {
+                add(new XWorkConfigurationProvider());
+                add(p);
+            }
+        });
+
+        RuntimeConfiguration rtConf = conf.getRuntimeConfiguration();
+
+        ActionConfig actionOne = rtConf.getActionConfig("", "actionOne");
+        ActionConfig actionTwo = rtConf.getActionConfig("", "actionTwo");
+
+        List<InterceptorMapping> actionOneInterceptors = actionOne.getInterceptors();
+        List<InterceptorMapping> actionTwoInterceptors = actionTwo.getInterceptors();
+
+        assertNotNull(actionOne);
+        assertNotNull(actionTwo);
+        assertNotNull(actionOneInterceptors);
+        assertNotNull(actionTwoInterceptors);
+        assertEquals(actionOneInterceptors.size(), 3);
+        assertEquals(actionTwoInterceptors.size(), 3);
+
+        InterceptorMapping actionOneInterceptorMapping1 = actionOneInterceptors.get(0);
+        InterceptorMapping actionOneInterceptorMapping2 = actionOneInterceptors.get(1);
+        InterceptorMapping actionOneInterceptorMapping3 = actionOneInterceptors.get(2);
+        InterceptorMapping actionTwoInterceptorMapping1 = actionTwoInterceptors.get(0);
+        InterceptorMapping actionTwoInterceptorMapping2 = actionTwoInterceptors.get(1);
+        InterceptorMapping actionTwoInterceptorMapping3 = actionTwoInterceptors.get(2);
+
+        assertNotNull(actionOneInterceptorMapping1);
+        assertNotNull(actionOneInterceptorMapping2);
+        assertNotNull(actionOneInterceptorMapping3);
+        assertNotNull(actionTwoInterceptorMapping1);
+        assertNotNull(actionTwoInterceptorMapping2);
+        assertNotNull(actionTwoInterceptorMapping3);
+
+        assertEquals(((InterceptorForTestPurpose) actionOneInterceptorMapping1.getInterceptor()).getParamOne(), "i1p1");
+        assertEquals(((InterceptorForTestPurpose) actionOneInterceptorMapping1.getInterceptor()).getParamTwo(), "i1p2");
+        assertEquals(((InterceptorForTestPurpose) actionOneInterceptorMapping2.getInterceptor()).getParamOne(), "i2p1");
+        assertEquals(((InterceptorForTestPurpose) actionOneInterceptorMapping2.getInterceptor()).getParamTwo(), null);
+        assertEquals(((InterceptorForTestPurpose) actionOneInterceptorMapping3.getInterceptor()).getParamOne(), null);
+        assertEquals(((InterceptorForTestPurpose) actionOneInterceptorMapping3.getInterceptor()).getParamTwo(), null);
+
+        assertEquals(((InterceptorForTestPurpose) actionTwoInterceptorMapping1.getInterceptor()).getParamOne(), null);
+        assertEquals(((InterceptorForTestPurpose) actionTwoInterceptorMapping1.getInterceptor()).getParamTwo(), null);
+        assertEquals(((InterceptorForTestPurpose) actionTwoInterceptorMapping2.getInterceptor()).getParamOne(), null);
+        assertEquals(((InterceptorForTestPurpose) actionTwoInterceptorMapping2.getInterceptor()).getParamTwo(), "i2p2");
+        assertEquals(((InterceptorForTestPurpose) actionTwoInterceptorMapping3.getInterceptor()).getParamOne(), "i3p1");
+        assertEquals(((InterceptorForTestPurpose) actionTwoInterceptorMapping3.getInterceptor()).getParamTwo(), "i3p2");
+
+    }
+
+
+    @Override
+    protected void tearDown() throws Exception {
+
+        configurationManager.clearContainerProviders();
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderInterceptorStackParamOverridingTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderInterceptorStackParamOverridingTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderInterceptorStackParamOverridingTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderInterceptorStackParamOverridingTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,83 @@
+package org.apache.struts2.xwork2.config.providers;
+
+import org.apache.struts2.xwork2.XWorkTestCase;
+import org.apache.struts2.xwork2.config.ConfigurationProvider;
+import org.apache.struts2.xwork2.config.RuntimeConfiguration;
+import org.apache.struts2.xwork2.config.entities.ActionConfig;
+import org.apache.struts2.xwork2.config.entities.InterceptorMapping;
+import org.apache.struts2.xwork2.config.impl.DefaultConfiguration;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <code>XmlConfigurationProviderInterceptorStackParamOverridingTest</code>
+ *
+ * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
+ * @version $Id: XmlConfigurationProviderInterceptorStackParamOverridingTest.java 1209415 2011-12-02 11:24:48Z lukaszlenart $
+ */
+public class XmlConfigurationProviderInterceptorStackParamOverridingTest extends XWorkTestCase {
+    
+    public void testInterceptorStackParamOveriding() throws Exception {
+    	DefaultConfiguration conf = new DefaultConfiguration();
+    	final XmlConfigurationProvider p = new XmlConfigurationProvider("org/apache/struts2/xwork2/config/providers/xwork-test-interceptor-stack-param-overriding.xml");
+    	configurationManager.addContainerProvider(p);
+        conf.reload(new ArrayList<ConfigurationProvider>(){
+            {
+                add(new XWorkConfigurationProvider());
+                add(p);
+            }
+        });
+
+
+    	RuntimeConfiguration rtConf = conf.getRuntimeConfiguration();
+
+    	ActionConfig actionOne = rtConf.getActionConfig("", "actionOne");
+    	ActionConfig actionTwo = rtConf.getActionConfig("", "actionTwo");
+
+    	List actionOneInterceptors = actionOne.getInterceptors();
+    	List actionTwoInterceptors = actionTwo.getInterceptors();
+
+    	assertNotNull(actionOne);
+    	assertNotNull(actionTwo);
+    	assertNotNull(actionOneInterceptors);
+    	assertNotNull(actionTwoInterceptors);
+    	assertEquals(actionOneInterceptors.size(), 3);
+    	assertEquals(actionTwoInterceptors.size(), 3);
+
+    	InterceptorMapping actionOneInterceptorMapping1 = (InterceptorMapping) actionOneInterceptors.get(0);
+    	InterceptorMapping actionOneInterceptorMapping2 = (InterceptorMapping) actionOneInterceptors.get(1);
+    	InterceptorMapping actionOneInterceptorMapping3 = (InterceptorMapping) actionOneInterceptors.get(2);
+    	InterceptorMapping actionTwoInterceptorMapping1 = (InterceptorMapping) actionTwoInterceptors.get(0);
+    	InterceptorMapping actionTwoInterceptorMapping2 = (InterceptorMapping) actionTwoInterceptors.get(1);
+    	InterceptorMapping actionTwoInterceptorMapping3 = (InterceptorMapping) actionTwoInterceptors.get(2);
+
+    	assertNotNull(actionOneInterceptorMapping1);
+    	assertNotNull(actionOneInterceptorMapping2);
+    	assertNotNull(actionOneInterceptorMapping3);
+    	assertNotNull(actionTwoInterceptorMapping1);
+    	assertNotNull(actionTwoInterceptorMapping2);
+    	assertNotNull(actionTwoInterceptorMapping3);
+
+
+    	assertEquals(((InterceptorForTestPurpose)actionOneInterceptorMapping1.getInterceptor()).getParamOne(), "i1p1");
+		assertEquals(((InterceptorForTestPurpose)actionOneInterceptorMapping1.getInterceptor()).getParamTwo(), "i1p2");
+		assertEquals(((InterceptorForTestPurpose)actionOneInterceptorMapping2.getInterceptor()).getParamOne(), "i2p1");
+		assertEquals(((InterceptorForTestPurpose)actionOneInterceptorMapping2.getInterceptor()).getParamTwo(), null);
+		assertEquals(((InterceptorForTestPurpose)actionOneInterceptorMapping3.getInterceptor()).getParamOne(), null);
+		assertEquals(((InterceptorForTestPurpose)actionOneInterceptorMapping3.getInterceptor()).getParamTwo(), null);
+
+    	assertEquals(((InterceptorForTestPurpose)actionTwoInterceptorMapping1.getInterceptor()).getParamOne(), null);
+		assertEquals(((InterceptorForTestPurpose)actionTwoInterceptorMapping1.getInterceptor()).getParamTwo(), null);
+		assertEquals(((InterceptorForTestPurpose)actionTwoInterceptorMapping2.getInterceptor()).getParamOne(), null);
+		assertEquals(((InterceptorForTestPurpose)actionTwoInterceptorMapping2.getInterceptor()).getParamTwo(), "i2p2");
+		assertEquals(((InterceptorForTestPurpose)actionTwoInterceptorMapping3.getInterceptor()).getParamOne(), "i3p1");
+		assertEquals(((InterceptorForTestPurpose)actionTwoInterceptorMapping3.getInterceptor()).getParamTwo(), "i3p2");
+
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+    	configurationManager.clearContainerProviders();
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderInterceptorsSpringTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderInterceptorsSpringTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderInterceptorsSpringTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/config/providers/XmlConfigurationProviderInterceptorsSpringTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,80 @@
+/*
+ * 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 org.apache.struts2.xwork2.config.providers;
+
+import org.apache.struts2.xwork2.ObjectFactory;
+import org.apache.struts2.xwork2.config.ConfigurationException;
+import org.apache.struts2.xwork2.config.ConfigurationProvider;
+import org.apache.struts2.xwork2.config.entities.InterceptorConfig;
+import org.apache.struts2.xwork2.config.entities.PackageConfig;
+import org.apache.struts2.xwork2.interceptor.TimerInterceptor;
+import org.springframework.beans.MutablePropertyValues;
+import org.springframework.context.support.StaticApplicationContext;
+
+import java.util.Map;
+
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Mike
+ * Date: May 6, 2003
+ * Time: 3:10:16 PM
+ * To change this template use Options | File Templates.
+ */
+public class XmlConfigurationProviderInterceptorsSpringTest extends ConfigurationTestBase {
+
+    InterceptorConfig timerInterceptor = new InterceptorConfig.Builder("timer", TimerInterceptor.class.getName()).build();
+    ObjectFactory objectFactory;
+    StaticApplicationContext sac;
+
+
+    public void testInterceptorsLoadedFromSpringApplicationContext() throws ConfigurationException {
+        sac.registerSingleton("timer-interceptor", TimerInterceptor.class, new MutablePropertyValues());
+
+        final String filename = "org/apache/struts2/xwork2/config/providers/xwork-test-interceptors-spring.xml";
+
+        // Expect a ConfigurationException to be thrown if the interceptor reference
+        // cannot be resolved
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+
+        // execute the configuration
+        provider.init(configuration);
+        provider.loadPackages();
+
+        PackageConfig pkg = configuration.getPackageConfig("default");
+        Map interceptorConfigs = pkg.getInterceptorConfigs();
+
+        // assertions for size
+        assertEquals(1, interceptorConfigs.size());
+
+        // assertions for interceptors
+        InterceptorConfig seen = (InterceptorConfig) interceptorConfigs.get("timer");
+        assertEquals("timer-interceptor", seen.getClassName());
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        sac = new StaticApplicationContext();
+
+        //SpringObjectFactory objFactory = new SpringObjectFactory();
+        //objFactory.setApplicationContext(sac);
+        //ObjectFactory.setObjectFactory(objFactory);
+
+        objectFactory = container.getInstance(ObjectFactory.class);
+    }
+}