struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [56/57] struts git commit: Merges xwork packages into struts
Date Wed, 17 Jun 2015 21:09:56 GMT
http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorParamOverridingTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorParamOverridingTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorParamOverridingTest.java
new file mode 100644
index 0000000..250dd64
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorParamOverridingTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.XWorkTestCase;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.RuntimeConfiguration;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.config.entities.InterceptorMapping;
+import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
+import com.opensymphony.xwork2.util.fs.DefaultFileManager;
+import com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author tm_jee
+ * @version $Date$ $Id$
+ */
+public class XmlConfigurationProviderInterceptorParamOverridingTest extends XWorkTestCase {
+
+    public void testInterceptorParamOveriding() throws Exception {
+        DefaultConfiguration conf = new DefaultConfiguration();
+        final XmlConfigurationProvider p = new XmlConfigurationProvider("com/opensymphony/xwork2/config/providers/xwork-test-interceptor-param-overriding.xml");
+        DefaultFileManagerFactory factory = new DefaultFileManagerFactory();
+        factory.setContainer(container);
+        factory.setFileManager(new DefaultFileManager());
+        p.setFileManagerFactory(factory);
+        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();
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorStackParamOverridingTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorStackParamOverridingTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorStackParamOverridingTest.java
new file mode 100644
index 0000000..a028db4
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorStackParamOverridingTest.java
@@ -0,0 +1,89 @@
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.RuntimeConfiguration;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.config.entities.InterceptorMapping;
+import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
+import com.opensymphony.xwork2.util.fs.DefaultFileManager;
+import com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <code>XmlConfigurationProviderInterceptorStackParamOverridingTest</code>
+ *
+ * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
+ * @version $Id$
+ */
+public class XmlConfigurationProviderInterceptorStackParamOverridingTest extends XWorkTestCase {
+    
+    public void testInterceptorStackParamOveriding() throws Exception {
+    	DefaultConfiguration conf = new DefaultConfiguration();
+    	final XmlConfigurationProvider p = new XmlConfigurationProvider("com/opensymphony/xwork2/config/providers/xwork-test-interceptor-stack-param-overriding.xml");
+        DefaultFileManagerFactory factory = new DefaultFileManagerFactory();
+        factory.setContainer(container);
+        factory.setFileManager(new DefaultFileManager());
+        p.setFileManagerFactory(factory);
+    	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();
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsSpringTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsSpringTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsSpringTest.java
new file mode 100644
index 0000000..de1a5f7
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsSpringTest.java
@@ -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 com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.ObjectFactory;
+import com.opensymphony.xwork2.config.ConfigurationException;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.entities.InterceptorConfig;
+import com.opensymphony.xwork2.config.entities.PackageConfig;
+import com.opensymphony.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 = "com/opensymphony/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);
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsTest.java
new file mode 100644
index 0000000..4f26b5f
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsTest.java
@@ -0,0 +1,226 @@
+/*
+ * 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.RuntimeConfiguration;
+import com.opensymphony.xwork2.config.entities.*;
+import com.opensymphony.xwork2.interceptor.LoggingInterceptor;
+import com.opensymphony.xwork2.interceptor.TimerInterceptor;
+import com.opensymphony.xwork2.mock.MockInterceptor;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+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 XmlConfigurationProviderInterceptorsTest extends ConfigurationTestBase {
+
+    InterceptorConfig loggingInterceptor = new InterceptorConfig.Builder("logging", LoggingInterceptor.class.getName()).build();
+    InterceptorConfig mockInterceptor = new InterceptorConfig.Builder("mock", MockInterceptor.class.getName()).build();
+    InterceptorConfig timerInterceptor = new InterceptorConfig.Builder("timer", TimerInterceptor.class.getName()).build();
+    ObjectFactory objectFactory;
+    
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        objectFactory = container.getInstance(ObjectFactory.class);
+    }
+
+
+    public void testBasicInterceptors() throws ConfigurationException {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-interceptors-basic.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+
+        // setup expectations
+        // the test interceptor with a parameter
+        Map<String, String> params = new HashMap<>();
+        params.put("foo", "expectedFoo");
+
+        InterceptorConfig paramsInterceptor = new InterceptorConfig.Builder("test", MockInterceptor.class.getName())
+            .addParams(params).build();
+
+        // the default interceptor stack
+        InterceptorStackConfig defaultStack = new InterceptorStackConfig.Builder("defaultStack")
+                .addInterceptor(new InterceptorMapping("timer", objectFactory.buildInterceptor(timerInterceptor, new HashMap<String, String>())))
+                .addInterceptor(new InterceptorMapping("test", objectFactory.buildInterceptor(mockInterceptor, params)))
+                .build();
+
+        // the derivative interceptor stack
+        InterceptorStackConfig derivativeStack = new InterceptorStackConfig.Builder("derivativeStack")
+                .addInterceptor(new InterceptorMapping("timer", objectFactory.buildInterceptor(timerInterceptor, new HashMap<String, String>())))
+            .addInterceptor(new InterceptorMapping("test", objectFactory.buildInterceptor(mockInterceptor, params)))
+                .addInterceptor(new InterceptorMapping("logging", objectFactory.buildInterceptor(loggingInterceptor, new HashMap<String, String>())))
+            .build();
+
+        // execute the configuration
+        provider.init(configuration);
+        provider.loadPackages();
+
+        PackageConfig pkg = configuration.getPackageConfig("default");
+        Map interceptorConfigs = pkg.getInterceptorConfigs();
+
+        // assertions for size
+        assertEquals(5, interceptorConfigs.size());
+
+        // assertions for interceptors
+        assertEquals(timerInterceptor, interceptorConfigs.get("timer"));
+        assertEquals(loggingInterceptor, interceptorConfigs.get("logging"));
+        assertEquals(paramsInterceptor, interceptorConfigs.get("test"));
+
+        // assertions for interceptor stacks
+        assertEquals(defaultStack, interceptorConfigs.get("defaultStack"));
+        assertEquals(derivativeStack, interceptorConfigs.get("derivativeStack"));
+    }
+
+    public void testInterceptorDefaultRefs() throws ConfigurationException {
+        XmlConfigurationProvider provider = new XmlConfigurationProvider("com/opensymphony/xwork2/config/providers/xwork-test-interceptor-defaultref.xml");
+        container.inject(provider);
+        loadConfigurationProviders(provider);
+
+        // expectations - the inherited interceptor stack
+        // default package
+        ArrayList<InterceptorMapping> interceptors = new ArrayList<>();
+        interceptors.add(new InterceptorMapping("logging", objectFactory.buildInterceptor(loggingInterceptor, new HashMap<String, String>())));
+
+        ActionConfig actionWithOwnRef = new ActionConfig.Builder("", "ActionWithOwnRef", SimpleAction.class.getName())
+            .addInterceptors(interceptors)
+            .build();
+
+        ActionConfig actionWithDefaultRef = new ActionConfig.Builder("", "ActionWithDefaultRef", SimpleAction.class.getName())
+            .addInterceptor(new InterceptorMapping("timer", objectFactory.buildInterceptor(timerInterceptor, new HashMap<String, String>())))
+            .build();
+
+        // sub package
+        // this should inherit
+        ActionConfig actionWithNoRef = new ActionConfig.Builder("", "ActionWithNoRef", SimpleAction.class.getName())
+            .addInterceptor(new InterceptorMapping("timer", objectFactory.buildInterceptor(timerInterceptor, new HashMap<String, String>())))
+            .build();
+
+        interceptors = new ArrayList<>();
+        interceptors.add(new InterceptorMapping("logging", objectFactory.buildInterceptor(loggingInterceptor, new HashMap<String, String>())));
+
+        ActionConfig anotherActionWithOwnRef = new ActionConfig.Builder("", "AnotherActionWithOwnRef", SimpleAction.class.getName())
+            .addInterceptor(new InterceptorMapping("logging", objectFactory.buildInterceptor(loggingInterceptor, new HashMap<String, String>())))
+            .build();
+
+        RuntimeConfiguration runtimeConfig = configurationManager.getConfiguration().getRuntimeConfiguration();
+
+        // assertions
+        assertEquals(actionWithOwnRef, runtimeConfig.getActionConfig("", "ActionWithOwnRef"));
+        assertEquals(actionWithDefaultRef, runtimeConfig.getActionConfig("", "ActionWithDefaultRef"));
+
+        assertEquals(actionWithNoRef, runtimeConfig.getActionConfig("", "ActionWithNoRef"));
+        assertEquals(anotherActionWithOwnRef, runtimeConfig.getActionConfig("", "AnotherActionWithOwnRef"));
+    }
+
+    public void testInterceptorInheritance() throws ConfigurationException {
+        
+        // expectations - the inherited interceptor stack
+        InterceptorStackConfig inheritedStack = new InterceptorStackConfig.Builder("subDefaultStack")
+            .addInterceptor(new InterceptorMapping("timer", objectFactory.buildInterceptor(timerInterceptor, new HashMap<String, String>())))
+            .build();
+
+        ConfigurationProvider provider = buildConfigurationProvider("com/opensymphony/xwork2/config/providers/xwork-test-interceptor-inheritance.xml");
+
+        // assertions
+        PackageConfig defaultPkg = configuration.getPackageConfig("default");
+        assertEquals(2, defaultPkg.getInterceptorConfigs().size());
+
+        PackageConfig subPkg = configuration.getPackageConfig("subPackage");
+        assertEquals(1, subPkg.getInterceptorConfigs().size());
+        assertEquals(3, subPkg.getAllInterceptorConfigs().size());
+        assertEquals(inheritedStack, subPkg.getInterceptorConfigs().get("subDefaultStack"));
+
+        // expectations - the inherited interceptor stack
+        inheritedStack = new InterceptorStackConfig.Builder("subSubDefaultStack")
+                .addInterceptor(new InterceptorMapping("timer", objectFactory.buildInterceptor(timerInterceptor, new HashMap<String, String>())))
+                .addInterceptor(new InterceptorMapping("timer", objectFactory.buildInterceptor(timerInterceptor, new HashMap<String, String>())))
+                .build();
+
+        PackageConfig subSubPkg = configuration.getPackageConfig("subSubPackage");
+        assertEquals(1, subSubPkg.getInterceptorConfigs().size());
+        assertEquals(4, subSubPkg.getAllInterceptorConfigs().size());
+        assertEquals(inheritedStack, subSubPkg.getInterceptorConfigs().get("subSubDefaultStack"));
+    }
+
+
+    public void testInterceptorParamOverriding() throws Exception {
+
+        Map<String, String> params = new HashMap<>();
+        params.put("foo", "expectedFoo");
+        params.put("expectedFoo", "expectedFooValue");
+
+        InterceptorStackConfig defaultStack = new InterceptorStackConfig.Builder("defaultStack")
+            .addInterceptor(new InterceptorMapping("timer", objectFactory.buildInterceptor(timerInterceptor, new HashMap<String, String>())))
+            .addInterceptor(new InterceptorMapping("test", objectFactory.buildInterceptor(mockInterceptor, params)))
+            .build();
+
+        ArrayList<InterceptorMapping> interceptors = new ArrayList<>();
+        interceptors.addAll(defaultStack.getInterceptors());
+
+        ActionConfig intAction = new ActionConfig.Builder("", "TestInterceptorParam", SimpleAction.class.getName())
+            .addInterceptors(interceptors)
+            .build();
+
+        // TestInterceptorParamOverride action tests that an interceptor with a param override worked
+        HashMap<String, String> interceptorParams = new HashMap<>();
+        interceptorParams.put("expectedFoo", "expectedFooValue2");
+        interceptorParams.put("foo", "foo123");
+
+        InterceptorStackConfig defaultStack2 = new InterceptorStackConfig.Builder("defaultStack")
+            .addInterceptor(new InterceptorMapping("timer", objectFactory.buildInterceptor(timerInterceptor, new HashMap<String, String>())))
+            .addInterceptor(new InterceptorMapping("test", objectFactory.buildInterceptor(mockInterceptor, interceptorParams)))
+            .build();
+
+        interceptors = new ArrayList<>();
+
+        interceptors.addAll(defaultStack2.getInterceptors());
+
+        ActionConfig intOverAction = new ActionConfig.Builder("", "TestInterceptorParamOverride", SimpleAction.class.getName())
+            .addInterceptors(interceptors)
+            .build();
+
+        ConfigurationProvider provider = buildConfigurationProvider("com/opensymphony/xwork2/config/providers/xwork-test-interceptor-params.xml");
+
+
+        PackageConfig pkg = configuration.getPackageConfig("default");
+        Map actionConfigs = pkg.getActionConfigs();
+
+        // assertions
+        assertEquals(2, actionConfigs.size());
+        assertEquals(intAction, actionConfigs.get("TestInterceptorParam"));
+        assertEquals(intOverAction, actionConfigs.get("TestInterceptorParamOverride"));
+
+        ActionConfig ac = (ActionConfig) actionConfigs.get("TestInterceptorParamOverride");
+        assertEquals(defaultStack.getInterceptors(), ac.getInterceptors());
+
+        ActionConfig ac2 = (ActionConfig) actionConfigs.get("TestInterceptorParam");
+        assertEquals(defaultStack2.getInterceptors(), ac2.getInterceptors());
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInvalidFileTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInvalidFileTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInvalidFileTest.java
new file mode 100644
index 0000000..889b2fd
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInvalidFileTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.config.ConfigurationException;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+
+
+/**
+ * XmlConfigurationProviderInvalidFileTest
+ *
+ * @author Jason Carreira
+ *         Created Sep 6, 2003 2:36:10 PM
+ */
+public class XmlConfigurationProviderInvalidFileTest extends ConfigurationTestBase {
+
+    public void testInvalidFileThrowsException() {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-invalid-file.xml";
+
+        try {
+            ConfigurationProvider provider = buildConfigurationProvider(filename);
+            fail();
+        } catch (ConfigurationException e) {
+            // this is what we expect
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderMultilevelTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderMultilevelTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderMultilevelTest.java
new file mode 100644
index 0000000..dcf6b69
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderMultilevelTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.ActionChainResult;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.config.entities.InterceptorMapping;
+import com.opensymphony.xwork2.config.entities.PackageConfig;
+import com.opensymphony.xwork2.config.entities.ResultConfig;
+import com.opensymphony.xwork2.interceptor.ParametersInterceptor;
+import junit.framework.Assert;
+
+
+/**
+ * Verify that Interceptor inheritance is happy for multi-level package derivations
+ *
+ * @author $Author$
+ * @version $Revision$
+ */
+public class XmlConfigurationProviderMultilevelTest extends ConfigurationTestBase {
+
+    /**
+     * attempt to load an xwork.xml file that has multilevel levels of inheritance and verify that the interceptors are
+     * correctly propagated through.
+     *
+     * @throws Exception
+     */
+    public void testMultiLevelInheritance() throws Exception {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-multilevel.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+        provider.init(configuration);
+        provider.loadPackages();
+
+        /**
+         * for this test, we expect the action named, action3, in the namespace, namespace3, to have a single
+         * ParameterInterceptor.  The ParameterInterceptor, param, has been defined far up namespace3's parentage ...
+         * namespace3 -> namespace2 -> namespace1 -> default
+         */
+        PackageConfig packageConfig = configuration.getPackageConfig("namespace3");
+        Assert.assertNotNull(packageConfig);
+        assertEquals(2, packageConfig.getAllInterceptorConfigs().size());
+
+        ActionConfig actionConfig = packageConfig.getActionConfigs().get("action3");
+
+        assertNotNull(actionConfig);
+        assertNotNull(actionConfig.getInterceptors());
+        assertEquals(2, actionConfig.getInterceptors().size());
+        assertEquals(ParametersInterceptor.class, ((InterceptorMapping) actionConfig.getInterceptors().get(0)).getInterceptor().getClass());
+        assertNotNull(actionConfig.getResults());
+        assertEquals(1, actionConfig.getResults().size());
+        assertTrue(actionConfig.getResults().containsKey("success"));
+
+        ResultConfig resultConfig = (ResultConfig) actionConfig.getResults().get("success");
+        assertEquals(ActionChainResult.class.getName(), resultConfig.getClassName());
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderPackagesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderPackagesTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderPackagesTest.java
new file mode 100644
index 0000000..01bcc7e
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderPackagesTest.java
@@ -0,0 +1,157 @@
+/*
+ * 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.config.ConfigurationException;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.RuntimeConfiguration;
+import com.opensymphony.xwork2.config.entities.PackageConfig;
+
+import java.util.List;
+
+
+/**
+ * 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 XmlConfigurationProviderPackagesTest extends ConfigurationTestBase {
+
+    public void testBadInheritance() throws ConfigurationException {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-bad-inheritance.xml";
+        ConfigurationProvider provider = null;
+        try {
+	    	provider = buildConfigurationProvider(filename);
+	    	fail("Should have thrown a ConfigurationException");
+	        provider.init(configuration);
+	        provider.loadPackages();
+        } catch (ConfigurationException e) {
+        	// Expected
+        }
+    }
+
+    public void testBasicPackages() throws ConfigurationException {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-basic-packages.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+        provider.init(configuration);
+        provider.loadPackages();
+
+        // setup our expectations
+        PackageConfig expectedNamespacePackage = new PackageConfig.Builder("namespacepkg")
+            .namespace("/namespace/set")
+            .isAbstract(false)
+            .build();
+        PackageConfig expectedAbstractPackage = new PackageConfig.Builder("abstractpkg")
+            .isAbstract(true)
+            .build();
+
+        // test expectations
+        assertEquals(3, configuration.getPackageConfigs().size());
+        assertEquals(expectedNamespacePackage, configuration.getPackageConfig("namespacepkg"));
+        assertEquals(expectedAbstractPackage, configuration.getPackageConfig("abstractpkg"));
+    }
+
+    public void testDefaultPackage() throws ConfigurationException {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-default-package.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+        provider.init(configuration);
+        provider.loadPackages();
+
+        // setup our expectations
+        PackageConfig expectedPackageConfig = new PackageConfig.Builder("default").build();
+
+        // test expectations
+        assertEquals(1, configuration.getPackageConfigs().size());
+        assertEquals(expectedPackageConfig, configuration.getPackageConfig("default"));
+    }
+
+    public void testPackageInheritance() throws ConfigurationException {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-package-inheritance.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+
+        provider.init(configuration);
+        provider.loadPackages();
+
+        // test expectations
+        assertEquals(5, configuration.getPackageConfigs().size());
+        PackageConfig defaultPackage = configuration.getPackageConfig("default");
+        assertNotNull(defaultPackage);
+        assertEquals("default", defaultPackage.getName());
+        PackageConfig abstractPackage = configuration.getPackageConfig("abstractPackage");
+        assertNotNull(abstractPackage);
+        assertEquals("abstractPackage", abstractPackage.getName());
+        PackageConfig singlePackage = configuration.getPackageConfig("singleInheritance");
+        assertNotNull(singlePackage);
+        assertEquals("singleInheritance", singlePackage.getName());
+        assertEquals(1, singlePackage.getParents().size());
+        assertEquals(defaultPackage, singlePackage.getParents().get(0));
+        PackageConfig multiplePackage = configuration.getPackageConfig("multipleInheritance");
+        assertNotNull(multiplePackage);
+        assertEquals("multipleInheritance", multiplePackage.getName());
+        assertEquals(3, multiplePackage.getParents().size());
+        List<PackageConfig> multipleParents = multiplePackage.getParents();
+        assertTrue(multipleParents.contains(defaultPackage));
+        assertTrue(multipleParents.contains(abstractPackage));
+        assertTrue(multipleParents.contains(singlePackage));
+        
+        PackageConfig parentBelow = configuration.getPackageConfig("testParentBelow");
+        assertEquals(1, parentBelow.getParents().size());
+        List<PackageConfig> parentBelowParents = parentBelow.getParents();
+        assertTrue(parentBelowParents.contains(multiplePackage));
+
+        configurationManager.addContainerProvider(provider);
+        configurationManager.reload();
+
+        RuntimeConfiguration runtimeConfiguration = configurationManager.getConfiguration().getRuntimeConfiguration();
+        assertNotNull(runtimeConfiguration.getActionConfig("/multiple", "default"));
+        assertNotNull(runtimeConfiguration.getActionConfig("/multiple", "abstract"));
+        assertNotNull(runtimeConfiguration.getActionConfig("/multiple", "single"));
+        assertNotNull(runtimeConfiguration.getActionConfig("/multiple", "multiple"));
+        assertNotNull(runtimeConfiguration.getActionConfig("/single", "default"));
+        assertNull(runtimeConfiguration.getActionConfig("/single", "abstract"));
+        assertNotNull(runtimeConfiguration.getActionConfig("/single", "single"));
+        assertNull(runtimeConfiguration.getActionConfig("/single", "multiple"));
+        
+        assertNotNull(runtimeConfiguration.getActionConfig("/parentBelow", "default"));
+        assertNotNull(runtimeConfiguration.getActionConfig("/parentBelow", "abstract"));
+        assertNotNull(runtimeConfiguration.getActionConfig("/parentBelow", "single"));
+        assertNotNull(runtimeConfiguration.getActionConfig("/parentBelow", "multiple"));
+        assertNotNull(runtimeConfiguration.getActionConfig("/parentBelow", "testParentBelowAction"));
+
+    }
+
+    public void testDefaultClassRef() throws ConfigurationException {
+    	final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-defaultclassref-package.xml";
+        final String hasDefaultClassRefPkgName = "hasDefaultClassRef";
+        final String noDefaultClassRefPkgName = "noDefaultClassRef";
+        final String testDefaultClassRef = "com.opensymphony.xwork2.ActionSupport";
+
+    	ConfigurationProvider provider = buildConfigurationProvider(filename);
+        provider.init(configuration);
+
+        // setup our expectations
+        PackageConfig expectedDefaultClassRefPackage = new PackageConfig.Builder(hasDefaultClassRefPkgName).defaultClassRef(testDefaultClassRef).build();
+
+        PackageConfig expectedNoDefaultClassRefPackage = new PackageConfig.Builder(noDefaultClassRefPkgName).build();
+
+        // test expectations
+        assertEquals(2, configuration.getPackageConfigs().size());
+        assertEquals(expectedDefaultClassRefPackage, configuration.getPackageConfig(hasDefaultClassRefPkgName));
+        assertEquals(expectedNoDefaultClassRefPackage, configuration.getPackageConfig(noDefaultClassRefPkgName));
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderResultTypesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderResultTypesTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderResultTypesTest.java
new file mode 100644
index 0000000..f5ef935
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderResultTypesTest.java
@@ -0,0 +1,119 @@
+/*
+ * 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.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.config.entities.PackageConfig;
+import com.opensymphony.xwork2.config.entities.ResultConfig;
+import com.opensymphony.xwork2.config.entities.ResultTypeConfig;
+import com.opensymphony.xwork2.mock.MockResult;
+
+import java.util.Map;
+
+
+/**
+ * Test XmlConfigurationProvider's <result-types> ... </result-types>
+ * 
+ * @author tm_jee
+ * @version $Date$ $Id$
+ */
+public class XmlConfigurationProviderResultTypesTest extends ConfigurationTestBase {
+
+	public void testPlainResultTypesParams() throws Exception {
+		ConfigurationProvider configurationProvider = buildConfigurationProvider("com/opensymphony/xwork2/config/providers/xwork-test-result-types.xml");
+		
+		PackageConfig packageConfig = configuration.getPackageConfig("xworkResultTypesTestPackage1");
+		Map resultTypesConfigMap = packageConfig.getResultTypeConfigs();
+		
+		assertEquals(resultTypesConfigMap.size(), 2);
+		assertTrue(resultTypesConfigMap.containsKey("result1"));
+		assertTrue(resultTypesConfigMap.containsKey("result2"));
+		assertFalse(resultTypesConfigMap.containsKey("result3"));
+		
+		ResultTypeConfig result1ResultTypeConfig = (ResultTypeConfig) resultTypesConfigMap.get("result1");
+		Map result1ParamsMap = result1ResultTypeConfig.getParams();
+		ResultTypeConfig result2ResultTypeConfig = (ResultTypeConfig) resultTypesConfigMap.get("result2");
+		Map result2ParamsMap = result2ResultTypeConfig.getParams();
+		
+		assertEquals(result1ResultTypeConfig.getName(), "result1");
+		assertEquals(result1ResultTypeConfig.getClazz(), MockResult.class.getName());
+		assertEquals(result2ResultTypeConfig.getName(), "result2");
+		assertEquals(result2ResultTypeConfig.getClazz(), MockResult.class.getName());
+		assertEquals(result1ParamsMap.size(), 3);
+		assertEquals(result2ParamsMap.size(), 2);
+		assertTrue(result1ParamsMap.containsKey("param1"));
+		assertTrue(result1ParamsMap.containsKey("param2"));
+		assertTrue(result1ParamsMap.containsKey("param3"));
+		assertFalse(result1ParamsMap.containsKey("param4"));
+		assertTrue(result2ParamsMap.containsKey("paramA"));
+		assertTrue(result2ParamsMap.containsKey("paramB"));
+		assertFalse(result2ParamsMap.containsKey("paramC"));
+		assertEquals(result1ParamsMap.get("param1"), "value1");
+		assertEquals(result1ParamsMap.get("param2"), "value2");
+		assertEquals(result1ParamsMap.get("param3"), "value3");
+		assertEquals(result2ParamsMap.get("paramA"), "valueA");
+		assertEquals(result2ParamsMap.get("paramB"), "valueB");
+	}
+	
+	public void testInheritedResultTypesParams() throws Exception {
+		ConfigurationProvider configurationProvider = buildConfigurationProvider("com/opensymphony/xwork2/config/providers/xwork-test-result-types.xml");
+		
+		PackageConfig packageConfig = configuration.getPackageConfig("xworkResultTypesTestPackage2");
+		Map actionConfigMap = packageConfig.getActionConfigs();
+		
+		
+		ActionConfig action1ActionConfig = (ActionConfig) actionConfigMap.get("action1");
+		ActionConfig action2ActionConfig = (ActionConfig) actionConfigMap.get("action2");
+		
+		ResultConfig action1Result = (ResultConfig) action1ActionConfig.getResults().get("success");
+		ResultConfig action2Result = (ResultConfig) action2ActionConfig.getResults().get("success");
+		
+		assertEquals(action1Result.getName(), "success");
+		assertEquals(action1Result.getClassName(), "com.opensymphony.xwork2.mock.MockResult");
+		assertEquals(action1Result.getName(), "success");
+		assertEquals(action1Result.getClassName(), "com.opensymphony.xwork2.mock.MockResult");
+		
+		Map action1ResultMap = action1Result.getParams();
+		Map action2ResultMap = action2Result.getParams();
+		
+		assertEquals(action1ResultMap.size(), 5);
+		assertTrue(action1ResultMap.containsKey("param1"));
+		assertTrue(action1ResultMap.containsKey("param2"));
+		assertTrue(action1ResultMap.containsKey("param3"));
+		assertTrue(action1ResultMap.containsKey("param10"));
+		assertTrue(action1ResultMap.containsKey("param11"));
+		assertFalse(action1ResultMap.containsKey("param12"));
+		assertEquals(action1ResultMap.get("param1"), "newValue1");
+		assertEquals(action1ResultMap.get("param2"), "value2");
+		assertEquals(action1ResultMap.get("param3"), "newValue3");
+		assertEquals(action1ResultMap.get("param10"), "value10");
+		assertEquals(action1ResultMap.get("param11"), "value11");
+		
+		assertEquals(action2ResultMap.size(), 3);
+		assertTrue(action2ResultMap.containsKey("paramA"));
+		assertTrue(action2ResultMap.containsKey("paramB"));
+		assertTrue(action2ResultMap.containsKey("paramZ"));
+		assertFalse(action2ResultMap.containsKey("paramY"));
+		assertEquals(action2ResultMap.get("paramA"), "valueA");
+		assertEquals(action2ResultMap.get("paramB"), "newValueB");
+		assertEquals(action2ResultMap.get("paramZ"), "valueZ");
+		
+		
+	}
+}
+
+

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderResultsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderResultsTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderResultsTest.java
new file mode 100644
index 0000000..caa9da0
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderResultsTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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.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.PackageConfig;
+import com.opensymphony.xwork2.config.entities.ResultConfig;
+import com.opensymphony.xwork2.config.entities.ResultTypeConfig;
+import com.opensymphony.xwork2.mock.MockResult;
+
+import java.util.HashMap;
+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 XmlConfigurationProviderResultsTest extends ConfigurationTestBase {
+
+    public void testActions() throws ConfigurationException {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-results.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+
+        HashMap<String, String> parameters = new HashMap<>();
+        HashMap<String, ResultConfig> results = new HashMap<>();
+
+        results.put("chainDefaultTypedResult", new ResultConfig.Builder("chainDefaultTypedResult", ActionChainResult.class.getName()).build());
+
+        results.put("mockTypedResult", new ResultConfig.Builder("mockTypedResult", 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());
+
+        resultParams = new HashMap<>();
+        resultParams.put("actionName", "foo.vm");
+        results.put("defaultLocationResult", new ResultConfig.Builder("defaultLocationResult", ActionChainResult.class.getName())
+                .addParams(resultParams).build());
+
+        resultParams = new HashMap<>();
+        resultParams.put("foo", "bar");
+        results.put("noDefaultLocationResult", new ResultConfig.Builder("noDefaultLocationResult", ActionChainResult.class.getName())
+                .addParams(resultParams).build());
+
+        ActionConfig expectedAction = new ActionConfig.Builder("default", "Bar", SimpleAction.class.getName())
+            .addParams(parameters)
+            .addResultConfigs(results)
+            .build();
+
+        // execute the configuration
+        provider.init(configuration);
+        provider.loadPackages();
+
+        PackageConfig pkg = configuration.getPackageConfig("default");
+        Map<String, ActionConfig> actionConfigs = pkg.getActionConfigs();
+
+        // assertions
+        assertEquals(1, actionConfigs.size());
+
+        ActionConfig action = actionConfigs.get("Bar");
+        assertEquals(expectedAction, action);
+    }
+
+    public void testResultInheritance() throws ConfigurationException {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-result-inheritance.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+
+        // expectations
+        provider.init(configuration);
+        provider.loadPackages();
+
+        // assertions
+        PackageConfig subPkg = configuration.getPackageConfig("subPackage");
+        assertEquals(1, subPkg.getResultTypeConfigs().size());
+        assertEquals(3, subPkg.getAllResultTypeConfigs().size());
+    }
+
+    public void testResultTypes() throws ConfigurationException {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-results.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+
+        // setup expectations
+        ResultTypeConfig chainResult = new ResultTypeConfig.Builder("chain", ActionChainResult.class.getName()).build();
+        ResultTypeConfig mockResult = new ResultTypeConfig.Builder("mock", MockResult.class.getName()).build();
+
+        // execute the configuration
+        provider.init(configuration);
+        provider.loadPackages();
+
+        PackageConfig pkg = configuration.getPackageConfig("default");
+        Map resultTypes = pkg.getResultTypeConfigs();
+
+        // assertions
+        assertEquals(2, resultTypes.size());
+        assertEquals("chain", pkg.getDefaultResultType());
+        assertEquals(chainResult, resultTypes.get("chain"));
+        assertEquals(mockResult, resultTypes.get("mock"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderTest.java
new file mode 100644
index 0000000..b161d02
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderTest.java
@@ -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 com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.FileManagerFactory;
+import com.opensymphony.xwork2.ObjectFactory;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.RuntimeConfiguration;
+import com.opensymphony.xwork2.config.entities.PackageConfig;
+import com.opensymphony.xwork2.config.impl.MockConfiguration;
+import com.opensymphony.xwork2.util.ClassLoaderUtil;
+import org.w3c.dom.Document;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+
+public class XmlConfigurationProviderTest extends ConfigurationTestBase {
+
+    public void testLoadOrder() throws Exception {
+        configuration = new MockConfiguration();
+        ((MockConfiguration) configuration).selfRegister();
+        container = configuration.getContainer();
+
+        XmlConfigurationProvider prov = new XmlConfigurationProvider("xwork-test-load-order.xml", true) {
+            @Override
+            protected Iterator<URL> getConfigurationUrls(String fileName) throws IOException {
+                List<URL> urls = new ArrayList<>();
+                urls.add(ClassLoaderUtil.getResource("com/opensymphony/xwork2/config/providers/loadorder1/xwork-test-load-order.xml", XmlConfigurationProvider.class));
+                urls.add(ClassLoaderUtil.getResource("com/opensymphony/xwork2/config/providers/loadorder2/xwork-test-load-order.xml", XmlConfigurationProvider.class));
+                urls.add(ClassLoaderUtil.getResource("com/opensymphony/xwork2/config/providers/loadorder3/xwork-test-load-order.xml", XmlConfigurationProvider.class));
+                return urls.iterator();
+            }
+        };
+        prov.setObjectFactory(container.getInstance(ObjectFactory.class));
+        prov.setFileManagerFactory(container.getInstance(FileManagerFactory.class));
+        prov.init(configuration);
+        List<Document> docs = prov.getDocuments();
+        assertEquals(3, docs.size());
+
+        assertEquals(1, XmlHelper.getLoadOrder(docs.get(0)).intValue());
+        assertEquals(2, XmlHelper.getLoadOrder(docs.get(1)).intValue());
+        assertEquals(3, XmlHelper.getLoadOrder(docs.get(2)).intValue());
+    }
+
+    public static final long FILE_TS_WAIT_IN_MS = 3600000;
+
+    private static void changeFileTime(File f) throws Exception {
+        final long orig = f.lastModified();
+        final long maxwait = orig + FILE_TS_WAIT_IN_MS;
+        long curr;
+        while (!f.setLastModified(curr = System.currentTimeMillis()) || orig == f.lastModified()) {
+            Thread.sleep(500);
+            assertTrue("Waited more than " + FILE_TS_WAIT_IN_MS + " ms to update timestamp on file: " + f, maxwait > curr);
+        }
+    }
+
+    public void testNeedsReload() throws Exception {
+        container.getInstance(FileManagerFactory.class).setReloadingConfigs("true");
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-actions.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+        container.getInstance(FileManagerFactory.class).setReloadingConfigs("true");
+
+        assertTrue(!provider.needsReload()); // Revision exists and timestamp didn't change
+
+        File file = new File(getClass().getResource("/" + filename).toURI());
+        assertTrue("not exists: " + file.toString(), file.exists());
+        changeFileTime(file);
+
+        assertTrue(provider.needsReload());
+    }
+
+    public void testInheritence() throws Exception {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-include-parent.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+
+        provider.init(configuration);
+        provider.loadPackages();
+
+        // test expectations
+        assertEquals(6, configuration.getPackageConfigs().size());
+
+
+        PackageConfig defaultPackage = configuration.getPackageConfig("default");
+        assertNotNull(defaultPackage);
+        assertEquals("default", defaultPackage.getName());
+
+
+        PackageConfig namespace1 = configuration.getPackageConfig("namespace1");
+        assertNotNull(namespace1);
+        assertEquals("namespace1", namespace1.getName());
+        assertEquals(defaultPackage, namespace1.getParents().get(0));
+
+        PackageConfig namespace2 = configuration.getPackageConfig("namespace2");
+        assertNotNull(namespace2);
+        assertEquals("namespace2", namespace2.getName());
+        assertEquals(1, namespace2.getParents().size());
+        assertEquals(namespace1, namespace2.getParents().get(0));
+
+
+        PackageConfig namespace4 = configuration.getPackageConfig("namespace4");
+        assertNotNull(namespace4);
+        assertEquals("namespace4", namespace4.getName());
+        assertEquals(1, namespace4.getParents().size());
+        assertEquals(namespace1, namespace4.getParents().get(0));
+
+
+        PackageConfig namespace5 = configuration.getPackageConfig("namespace5");
+        assertNotNull(namespace5);
+        assertEquals("namespace5", namespace5.getName());
+        assertEquals(1, namespace5.getParents().size());
+        assertEquals(namespace4, namespace5.getParents().get(0));
+
+        configurationManager.addContainerProvider(provider);
+        configurationManager.reload();
+
+        RuntimeConfiguration runtimeConfiguration = configurationManager.getConfiguration().getRuntimeConfiguration();
+        assertNotNull(runtimeConfiguration.getActionConfig("/namespace1", "action1"));
+        assertNotNull(runtimeConfiguration.getActionConfig("/namespace2", "action2"));
+        assertNotNull(runtimeConfiguration.getActionConfig("/namespace4", "action4"));
+        assertNotNull(runtimeConfiguration.getActionConfig("/namespace5", "action5"));
+    }
+
+    public void testGuessResultType() {
+        XmlConfigurationProvider prov = new XmlConfigurationProvider();
+
+        assertEquals(null, prov.guessResultType(null));
+        assertEquals("foo", prov.guessResultType("foo"));
+        assertEquals("foo", prov.guessResultType("foo-"));
+        assertEquals("fooBar", prov.guessResultType("foo-bar"));
+        assertEquals("fooBarBaz", prov.guessResultType("foo-bar-baz"));
+    }
+
+    public void testEmptySpaces() throws Exception {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork- test.xml";
+        container.getInstance(FileManagerFactory.class).getFileManager().setReloadingConfigs(true);
+
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+        assertTrue(!provider.needsReload());
+
+        URI uri = ClassLoaderUtil.getResource(filename, ConfigurationProvider.class).toURI();
+
+        File file = new File(uri);
+
+        assertTrue(file.exists());
+        changeFileTime(file);
+
+        assertTrue(provider.needsReload());
+    }
+
+    public void testConfigsInJarFiles() throws Exception {
+        container.getInstance(FileManagerFactory.class).getFileManager().setReloadingConfigs(true);
+        testProvider("xwork-jar.xml");
+        testProvider("xwork-zip.xml");
+        testProvider("xwork - jar.xml");
+        testProvider("xwork - zip.xml");
+
+        testProvider("xwork-jar2.xml");
+        testProvider("xwork-zip2.xml");
+        testProvider("xwork - jar2.xml");
+        testProvider("xwork - zip2.xml");
+    }
+
+    private void testProvider(String configFile) throws Exception {
+        ConfigurationProvider provider = buildConfigurationProvider(configFile);
+        assertTrue(!provider.needsReload());
+
+        String fullPath = ClassLoaderUtil.getResource(configFile, ConfigurationProvider.class).toString();
+
+        int startIndex = fullPath.indexOf(":file:/");
+        int endIndex = fullPath.indexOf("!/");
+
+        String jar = fullPath.substring(startIndex + (":file:/".length() - 1), endIndex).replaceAll("%20", " ");
+
+        File file = new File(jar);
+
+        assertTrue("File [" + file + "] doesn't exist!", file.exists());
+        file.setLastModified(System.currentTimeMillis());
+
+        assertTrue(!provider.needsReload());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderUnknownHandlerStackTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderUnknownHandlerStackTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderUnknownHandlerStackTest.java
new file mode 100644
index 0000000..ba17588
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderUnknownHandlerStackTest.java
@@ -0,0 +1,40 @@
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.UnknownHandlerManager;
+import com.opensymphony.xwork2.config.ConfigurationException;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.entities.UnknownHandlerConfig;
+import com.opensymphony.xwork2.DefaultUnknownHandlerManager;
+
+import java.util.List;
+
+public class XmlConfigurationProviderUnknownHandlerStackTest extends ConfigurationTestBase {
+
+    public void testStackWithElements() throws ConfigurationException {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-unknownhandler-stack.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+        loadConfigurationProviders(provider);
+        configurationManager.reload();
+
+        List<UnknownHandlerConfig> unknownHandlerStack = configuration.getUnknownHandlerStack();
+        assertNotNull(unknownHandlerStack);
+        assertEquals(2, unknownHandlerStack.size());
+
+        assertEquals("uh1", unknownHandlerStack.get(0).getName());
+        assertEquals("uh2", unknownHandlerStack.get(1).getName());
+
+        UnknownHandlerManager unknownHandlerManager = new DefaultUnknownHandlerManager();
+        container.inject(unknownHandlerManager);
+        assertTrue(unknownHandlerManager.hasUnknownHandlers());
+    }
+
+    public void testEmptyStack() throws ConfigurationException {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-unknownhandler-stack-empty.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+        loadConfigurationProviders(provider);
+        configurationManager.reload();
+
+        List<UnknownHandlerConfig> unknownHandlerStack = configuration.getUnknownHandlerStack();
+        assertNull(unknownHandlerStack);
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderWildCardIncludeTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderWildCardIncludeTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderWildCardIncludeTest.java
new file mode 100644
index 0000000..71cfc25
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderWildCardIncludeTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.entities.PackageConfig;
+
+public class XmlConfigurationProviderWildCardIncludeTest extends ConfigurationTestBase {
+
+    
+    public void testWildCardInclude() throws Exception {
+        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-wildcard-include.xml";
+        ConfigurationProvider provider = buildConfigurationProvider(filename);
+
+        provider.init(configuration);
+        provider.loadPackages();
+
+        PackageConfig defaultWildcardPackage = configuration.getPackageConfig("default-wildcard");
+        assertNotNull(defaultWildcardPackage);
+        assertEquals("default-wildcard", defaultWildcardPackage.getName());
+
+
+        PackageConfig defaultOnePackage = configuration.getPackageConfig("default-1");
+        assertNotNull(defaultOnePackage);
+        assertEquals("default-1", defaultOnePackage.getName());
+        
+        PackageConfig defaultTwoPackage = configuration.getPackageConfig("default-2");
+        assertNotNull(defaultTwoPackage);
+        assertEquals("default-2", defaultTwoPackage.getName());       
+
+        configurationManager.addContainerProvider(provider);
+        configurationManager.reload();
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/82cb1286/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlHelperTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlHelperTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlHelperTest.java
new file mode 100644
index 0000000..9e0f1a3
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlHelperTest.java
@@ -0,0 +1,255 @@
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.XWorkTestCase;
+import org.easymock.MockControl;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import java.util.Map;
+
+/**
+ * <code>XmlHelperTest</code>
+ *
+ * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
+ * @version $Id$
+ */
+public class XmlHelperTest extends XWorkTestCase {
+
+    public void testGetContent1() throws Exception {
+        // set up Node
+        MockControl nodeControl = MockControl.createControl(Node.class);
+        Node mockNode = (Node) nodeControl.getMock();
+
+        nodeControl.expectAndDefaultReturn(mockNode.getNodeValue(), "testing testing 123");
+        nodeControl.expectAndDefaultReturn(mockNode.getNodeType(), Node.TEXT_NODE);
+
+
+        // set up NodeList
+        MockControl nodeListControl = MockControl.createControl(NodeList.class);
+        NodeList mockNodeList = (NodeList) nodeListControl.getMock();
+
+        nodeListControl.expectAndDefaultReturn(mockNodeList.getLength(), 1);
+        nodeListControl.expectAndDefaultReturn(mockNodeList.item(0), mockNode);
+
+
+        // set up Element
+        MockControl elementControl = MockControl.createControl(Element.class);
+        Element mockElement = (Element) elementControl.getMock();
+
+        elementControl.expectAndDefaultReturn(mockElement.getChildNodes(), mockNodeList);
+
+        nodeControl.replay();
+        nodeListControl.replay();
+        elementControl.replay();
+
+        String result = XmlHelper.getContent(mockElement);
+
+        nodeControl.verify();
+        nodeListControl.verify();
+        elementControl.verify();
+
+        assertEquals(result, "testing testing 123");
+    }
+
+
+    public void testGetContent2() throws Exception {
+        // set up Node
+        MockControl nodeControl1 = MockControl.createControl(Node.class);
+        Node mockNode1 = (Node) nodeControl1.getMock();
+
+        nodeControl1.expectAndDefaultReturn(mockNode1.getNodeValue(), "testing testing 123");
+        nodeControl1.expectAndDefaultReturn(mockNode1.getNodeType(), Node.TEXT_NODE);
+
+        MockControl nodeControl2 = MockControl.createControl(Node.class);
+        Node mockNode2 = (Node) nodeControl2.getMock();
+
+        nodeControl2.expectAndDefaultReturn(mockNode2.getNodeValue(), "comment 1");
+        nodeControl2.expectAndDefaultReturn(mockNode2.getNodeType(), Node.COMMENT_NODE);
+
+        MockControl nodeControl3 = MockControl.createControl(Node.class);
+        Node mockNode3 = (Node) nodeControl3.getMock();
+
+        nodeControl3.expectAndDefaultReturn(mockNode3.getNodeValue(), " tmjee ");
+        nodeControl3.expectAndDefaultReturn(mockNode3.getNodeType(), Node.TEXT_NODE);
+
+        MockControl nodeControl4 = MockControl.createControl(Node.class);
+        Node mockNode4 = (Node) nodeControl4.getMock();
+
+        nodeControl4.expectAndDefaultReturn(mockNode4.getNodeValue(), " phil ");
+        nodeControl4.expectAndDefaultReturn(mockNode4.getNodeType(), Node.TEXT_NODE);
+
+        MockControl nodeControl5 = MockControl.createControl(Node.class);
+        Node mockNode5 = (Node) nodeControl5.getMock();
+
+        nodeControl5.expectAndDefaultReturn(mockNode5.getNodeValue(), "comment 2");
+        nodeControl5.expectAndDefaultReturn(mockNode5.getNodeType(), Node.COMMENT_NODE);
+
+        MockControl nodeControl6 = MockControl.createControl(Node.class);
+        Node mockNode6 = (Node) nodeControl6.getMock();
+
+        nodeControl6.expectAndDefaultReturn(mockNode6.getNodeValue(), "comment 3");
+        nodeControl6.expectAndDefaultReturn(mockNode6.getNodeType(), Node.COMMENT_NODE);
+
+
+        // set up NodeList
+        MockControl nodeListControl = MockControl.createControl(NodeList.class);
+        NodeList mockNodeList = (NodeList) nodeListControl.getMock();
+
+        nodeListControl.expectAndDefaultReturn(mockNodeList.getLength(), 6);
+        mockNodeList.item(0);
+        nodeListControl.setReturnValue(mockNode1);
+        mockNodeList.item(1);
+        nodeListControl.setReturnValue(mockNode2);
+        mockNodeList.item(2);
+        nodeListControl.setDefaultReturnValue(mockNode3);
+        mockNodeList.item(3);
+        nodeListControl.setReturnValue(mockNode4);
+        mockNodeList.item(4);
+        nodeListControl.setReturnValue(mockNode5);
+        mockNodeList.item(5);
+        nodeListControl.setReturnValue(mockNode6);
+
+
+        // set up Element
+        MockControl elementControl = MockControl.createControl(Element.class);
+        Element mockElement = (Element) elementControl.getMock();
+
+        elementControl.expectAndDefaultReturn(mockElement.getChildNodes(), mockNodeList);
+
+        nodeControl1.replay();
+        nodeControl2.replay();
+        nodeControl3.replay();
+        nodeControl4.replay();
+        nodeControl5.replay();
+        nodeControl6.replay();
+        nodeListControl.replay();
+        elementControl.replay();
+
+        String result = XmlHelper.getContent(mockElement);
+
+        nodeControl1.verify();
+        nodeControl2.verify();
+        nodeControl3.verify();
+        nodeControl4.verify();
+        nodeControl5.verify();
+        nodeControl6.verify();
+        nodeListControl.verify();
+        elementControl.verify();
+
+        assertEquals(result, "testing testing 123tmjeephil");
+    }
+
+
+
+    public void testGetParams() throws Exception {
+        // <param name="param1">value1</param>
+            MockControl nodeControl1 = MockControl.createControl(Node.class);
+            Node mockNode1 = (Node) nodeControl1.getMock();
+
+            nodeControl1.expectAndDefaultReturn(mockNode1.getNodeValue(), "value1");
+            nodeControl1.expectAndDefaultReturn(mockNode1.getNodeType(), Node.TEXT_NODE);
+
+
+            MockControl nodeListControl1 = MockControl.createControl(NodeList.class);
+            NodeList mockNodeList1 = (NodeList) nodeListControl1.getMock();
+
+            nodeListControl1.expectAndDefaultReturn(mockNodeList1.getLength(), 1);
+            nodeListControl1.expectAndDefaultReturn(mockNodeList1.item(0), mockNode1);
+
+            MockControl paramControl1 = MockControl.createControl(Element.class);
+            Element mockParamElement1 = (Element) paramControl1.getMock();
+            mockParamElement1.getNodeName();
+            paramControl1.setReturnValue("param");
+
+            mockParamElement1.getNodeType();
+            paramControl1.setReturnValue(Node.ELEMENT_NODE);
+
+            mockParamElement1.getAttribute("name");
+            paramControl1.setReturnValue("param1");
+
+            mockParamElement1.getChildNodes();
+            paramControl1.setReturnValue(mockNodeList1);
+
+            nodeControl1.replay();
+            nodeListControl1.replay();
+            paramControl1.replay();
+
+        // <param name="param2">value2</param>
+            MockControl nodeControl2 = MockControl.createControl(Node.class);
+            Node mockNode2 = (Node) nodeControl2.getMock();
+
+            nodeControl2.expectAndDefaultReturn(mockNode2.getNodeValue(), "value2");
+            nodeControl2.expectAndDefaultReturn(mockNode2.getNodeType(), Node.TEXT_NODE);
+
+
+            MockControl nodeListControl2 = MockControl.createControl(NodeList.class);
+            NodeList mockNodeList2 = (NodeList) nodeListControl2.getMock();
+
+            nodeListControl2.expectAndDefaultReturn(mockNodeList2.getLength(), 1);
+            nodeListControl2.expectAndDefaultReturn(mockNodeList2.item(0), mockNode2);
+
+            MockControl paramControl2 = MockControl.createControl(Element.class);
+            Element mockParamElement2 = (Element) paramControl2.getMock();
+            mockParamElement2.getNodeName();
+            paramControl2.setReturnValue("param");
+
+            mockParamElement2.getNodeType();
+            paramControl2.setReturnValue(Node.ELEMENT_NODE);
+
+            mockParamElement2.getAttribute("name");
+            paramControl2.setReturnValue("param2");
+
+            mockParamElement2.getChildNodes();
+            paramControl2.setReturnValue(mockNodeList2);
+
+            nodeControl2.replay();
+            nodeListControl2.replay();
+            paramControl2.replay();
+
+
+        // <some_element>
+        //   ...
+        // </some_element>
+        MockControl elementNodeListControl = MockControl.createControl(NodeList.class);
+        NodeList mockElementNodeList = (NodeList) elementNodeListControl.getMock();
+
+        elementNodeListControl.expectAndDefaultReturn(mockElementNodeList.getLength(), 2);
+        mockElementNodeList.item(0);
+        elementNodeListControl.setReturnValue(mockParamElement2);
+        mockElementNodeList.item(1);
+        elementNodeListControl.setReturnValue(mockParamElement1);
+
+        MockControl elementControl = MockControl.createControl(Element.class);
+        Element element = (Element) elementControl.getMock();
+
+        elementControl.expectAndDefaultReturn(element.getChildNodes(), mockElementNodeList);
+
+
+        elementNodeListControl.replay();
+        elementControl.replay();
+
+
+
+        Map params = XmlHelper.getParams(element);
+
+        nodeControl1.verify();
+            nodeListControl1.verify();
+            paramControl1.verify();
+
+
+        nodeControl2.verify();
+            nodeListControl2.verify();
+            paramControl2.verify();
+
+
+        elementNodeListControl.verify();
+        elementControl.verify();
+
+
+        assertNotNull(params);
+        assertEquals(params.size(), 2);
+        assertEquals(params.get("param1"), "value1");
+        assertEquals(params.get("param2"), "value2");
+    }
+}


Mime
View raw message