struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject svn commit: r1209569 [36/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...
Date Fri, 02 Dec 2011 16:33:45 GMT
Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/main/resources/org/apache/struts2/xwork2/xwork-messages.properties
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/main/resources/org/apache/struts2/xwork2/xwork-messages.properties?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/main/resources/org/apache/struts2/xwork2/xwork-messages.properties (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/main/resources/org/apache/struts2/xwork2/xwork-messages.properties Fri Dec  2 16:33:03 2011
@@ -0,0 +1,10 @@
+#
+# Copyright (c) 2002-2006 by OpenSymphony
+# All rights reserved.
+#
+
+xwork.error.action.execution=Error during Action invocation
+xwork.exception.missing-action=There is no Action mapped for action name {0}.
+xwork.exception.missing-package-action=There is no Action mapped for namespace {0} and action name {1}.
+xwork.default.invalid.fieldvalue=Invalid field value for field "{0}".
+

Modified: struts/struts2/branches/STRUTS_3_X/xwork-core/src/main/resources/xwork-default.xml
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/main/resources/xwork-default.xml?rev=1209569&r1=1209568&r2=1209569&view=diff
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/main/resources/xwork-default.xml (original)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/main/resources/xwork-default.xml Fri Dec  2 16:33:03 2011
@@ -7,7 +7,7 @@
 
         <!-- START SNIPPET: xwork2-default-result-types -->
         <result-types>
-            <result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/>
+            <result-type name="chain" class="org.apache.struts2.xwork2.ActionChainResult"/>
         </result-types>
 
         <!-- END SNIPPET: xwork2-default-result-types -->
@@ -15,32 +15,32 @@
         <interceptors>
             <!-- START SNIPPET: xwork2-default-interceptors -->
 
-            <interceptor name="timer" class="com.opensymphony.xwork2.interceptor.TimerInterceptor"/>
-            <interceptor name="logger" class="com.opensymphony.xwork2.interceptor.LoggingInterceptor"/>
-            <interceptor name="chain" class="com.opensymphony.xwork2.interceptor.ChainingInterceptor"/>
-            <interceptor name="staticParams" class="com.opensymphony.xwork2.interceptor.StaticParametersInterceptor"/>
-            <interceptor name="params" class="com.opensymphony.xwork2.interceptor.ParametersInterceptor"/>
-            <interceptor name="filterParams" class="com.opensymphony.xwork2.interceptor.ParameterFilterInterceptor"/>
-            <interceptor name="removeParams" class="com.opensymphony.xwork2.interceptor.ParameterRemoverInterceptor"/>
-            <interceptor name="modelDriven" class="com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor"/>
+            <interceptor name="timer" class="org.apache.struts2.xwork2.interceptor.TimerInterceptor"/>
+            <interceptor name="logger" class="org.apache.struts2.xwork2.interceptor.LoggingInterceptor"/>
+            <interceptor name="chain" class="org.apache.struts2.xwork2.interceptor.ChainingInterceptor"/>
+            <interceptor name="staticParams" class="org.apache.struts2.xwork2.interceptor.StaticParametersInterceptor"/>
+            <interceptor name="params" class="org.apache.struts2.xwork2.interceptor.ParametersInterceptor"/>
+            <interceptor name="filterParams" class="org.apache.struts2.xwork2.interceptor.ParameterFilterInterceptor"/>
+            <interceptor name="removeParams" class="org.apache.struts2.xwork2.interceptor.ParameterRemoverInterceptor"/>
+            <interceptor name="modelDriven" class="org.apache.struts2.xwork2.interceptor.ModelDrivenInterceptor"/>
             <interceptor name="scopedModelDriven"
-                         class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor"/>
-            <interceptor name="validation" class="com.opensymphony.xwork2.validator.ValidationInterceptor"/>
-            <interceptor name="workflow" class="com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor"/>
-            <interceptor name="prepare" class="com.opensymphony.xwork2.interceptor.PrepareInterceptor"/>
-            <interceptor name="conversionError" class="com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor"/>
-            <interceptor name="alias" class="com.opensymphony.xwork2.interceptor.AliasInterceptor"/>
-            <interceptor name="exception" class="com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor"/>
-            <interceptor name="i18n" class="com.opensymphony.xwork2.interceptor.I18nInterceptor"/>
+                         class="org.apache.struts2.xwork2.interceptor.ScopedModelDrivenInterceptor"/>
+            <interceptor name="validation" class="org.apache.struts2.xwork2.validator.ValidationInterceptor"/>
+            <interceptor name="workflow" class="org.apache.struts2.xwork2.interceptor.DefaultWorkflowInterceptor"/>
+            <interceptor name="prepare" class="org.apache.struts2.xwork2.interceptor.PrepareInterceptor"/>
+            <interceptor name="conversionError" class="org.apache.struts2.xwork2.interceptor.ConversionErrorInterceptor"/>
+            <interceptor name="alias" class="org.apache.struts2.xwork2.interceptor.AliasInterceptor"/>
+            <interceptor name="exception" class="org.apache.struts2.xwork2.interceptor.ExceptionMappingInterceptor"/>
+            <interceptor name="i18n" class="org.apache.struts2.xwork2.interceptor.I18nInterceptor"/>
 
             <!-- END SNIPPET: xwork2-default-interceptors -->
 
-            <!--interceptor name="static-params" class="com.opensymphony.xwork2.interceptor.StaticParametersInterceptor"/>
-            <interceptor name="filter-params" class="com.opensymphony.xwork2.interceptor.ParameterFilterInterceptor"/>
-            <interceptor name="remove-params" class="com.opensymphony.xwork2.interceptor.ParameterRemoverInterceptor"/>
-            <interceptor name="model-driven" class="com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor"/>
+            <!--interceptor name="static-params" class="org.apache.struts2.xwork2.interceptor.StaticParametersInterceptor"/>
+            <interceptor name="filter-params" class="org.apache.struts2.xwork2.interceptor.ParameterFilterInterceptor"/>
+            <interceptor name="remove-params" class="org.apache.struts2.xwork2.interceptor.ParameterRemoverInterceptor"/>
+            <interceptor name="model-driven" class="org.apache.struts2.xwork2.interceptor.ModelDrivenInterceptor"/>
             <interceptor name="scoped-model-driven"
-                         class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor"/-->
+                         class="org.apache.struts2.xwork2.interceptor.ScopedModelDrivenInterceptor"/-->
 
             <!-- START SNIPPET: xwork2-default-interceptor-stack -->
 
@@ -61,7 +61,7 @@
 
         </interceptors>
 
-        <default-class-ref class="com.opensymphony.xwork2.ActionSupport"/>
+        <default-class-ref class="org.apache.struts2.xwork2.ActionSupport"/>
 
     </package>
 </xwork>

Modified: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/PackagelessAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/PackagelessAction.java?rev=1209569&r1=1209568&r2=1209569&view=diff
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/PackagelessAction.java (original)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/PackagelessAction.java Fri Dec  2 16:33:03 2011
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-import com.opensymphony.xwork2.ActionSupport;
+import org.apache.struts2.xwork2.ActionSupport;
 
 
 /**

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionContextTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionContextTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionContextTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionContextTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,115 @@
+/*
+ * 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;
+
+import org.apache.struts2.xwork2.util.ValueStack;
+import org.apache.struts2.xwork2.util.ValueStackFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * Unit test for {@link ActionContext}.
+ *
+ * @author Jason Carreira
+ */
+public class ActionContextTest extends XWorkTestCase {
+
+    private static final String APPLICATION_KEY = "org.apache.struts2.xwork2.ActionContextTest.application";
+    private static final String SESSION_KEY = "org.apache.struts2.xwork2.ActionContextTest.session";
+    private static final String PARAMETERS_KEY = "org.apache.struts2.xwork2.ActionContextTest.params";
+    private static final String ACTION_NAME = "org.apache.struts2.xwork2.ActionContextTest.actionName";
+
+    private ActionContext context;
+
+    @Override public void setUp() throws Exception {
+        super.setUp();
+        ValueStack valueStack = container.getInstance(ValueStackFactory.class).createValueStack();
+        Map<String, Object> extraContext = valueStack.getContext();
+        Map<String, Object> application = new HashMap<String, Object>();
+        application.put(APPLICATION_KEY, APPLICATION_KEY);
+
+        Map<String, Object> session = new HashMap<String, Object>();
+        session.put(SESSION_KEY, SESSION_KEY);
+
+        Map<String, Object> params = new HashMap<String, Object>();
+        params.put(PARAMETERS_KEY, PARAMETERS_KEY);
+        extraContext.put(ActionContext.APPLICATION, application);
+        extraContext.put(ActionContext.SESSION, session);
+        extraContext.put(ActionContext.PARAMETERS, params);
+        extraContext.put(ActionContext.ACTION_NAME, ACTION_NAME);
+        context = new ActionContext(extraContext);
+        ActionContext.setContext(context);
+    }
+
+    public void testContextParams() {
+        assertTrue(ActionContext.getContext().getApplication().containsKey(APPLICATION_KEY));
+        assertTrue(ActionContext.getContext().getSession().containsKey(SESSION_KEY));
+        assertTrue(ActionContext.getContext().getParameters().containsKey(PARAMETERS_KEY));
+        assertEquals(ActionContext.getContext().getName(), ACTION_NAME);
+    }
+
+    public void testGetContext() {
+        ActionContext threadContext = ActionContext.getContext();
+        assertEquals(context, threadContext);
+    }
+
+    public void testNewActionContextCanFindDefaultTexts() {
+        ValueStack valueStack = context.getValueStack();
+        String actionErrorMessage = (String) valueStack.findValue("getText('xwork.error.action.execution')");
+        assertNotNull(actionErrorMessage);
+        assertEquals("Error during Action invocation", actionErrorMessage);
+    }
+
+    public void testApplication() {
+        Map<String, Object> app = new HashMap<String, Object>();
+        context.setApplication(app);
+        assertEquals(app, context.getApplication());
+    }
+
+    public void testContextMap() {
+        Map<String, Object> map = new HashMap<String, Object>();
+        context.setContextMap(map);
+        assertEquals(map, context.getContextMap());
+    }
+
+    public void testParameters() {
+        Map<String, Object> param = new HashMap<String, Object>();
+        context.setParameters(param);
+        assertEquals(param, context.getParameters());
+    }
+
+    public void testConversionErrors() {
+        Map<String, Object> errors = context.getConversionErrors();
+        assertNotNull(errors);
+        assertEquals(0, errors.size());
+
+        Map<String, Object> errors2 = new HashMap<String, Object>();
+        context.setConversionErrors(errors);
+        assertEquals(errors2, context.getConversionErrors());
+    }
+
+    public void testStaticMethods() {
+        assertEquals(context, ActionContext.getContext());
+
+        ActionContext context2 = new ActionContext(null);
+        ActionContext.setContext(context2);
+
+        assertEquals(context2, ActionContext.getContext());
+    }
+
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionContextThreadLocalTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionContextThreadLocalTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionContextThreadLocalTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionContextThreadLocalTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,42 @@
+/*
+ * 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;
+
+import junit.framework.TestCase;
+
+import java.util.HashMap;
+
+
+/**
+ * Simple Test ActionContext's ThreadLocal
+ * 
+ * @author tm_jee
+ * @version $Date: 2011-12-02 12:24:48 +0100 (Fri, 02 Dec 2011) $ $Id: ActionContextThreadLocalTest.java 1209415 2011-12-02 11:24:48Z lukaszlenart $
+ */
+public class ActionContextThreadLocalTest extends TestCase {
+
+	
+	public void testGetContext() throws Exception {
+	    ActionContext.setContext(null);
+		assertNull(ActionContext.getContext());
+	}
+	
+	public void testSetContext() throws Exception {
+		ActionContext context = new ActionContext(new HashMap<String, Object>());
+		ActionContext.setContext(context);
+		assertEquals(context, ActionContext.getContext());
+	}
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionInvocationTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionInvocationTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionInvocationTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionInvocationTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,101 @@
+/*
+ * 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;
+
+import org.apache.struts2.xwork2.config.entities.ActionConfig;
+import org.apache.struts2.xwork2.config.providers.XmlConfigurationProvider;
+
+import java.util.HashMap;
+
+
+/**
+ * @author $Author: lukaszlenart $
+ * @version $Revision: 1209415 $
+ */
+public class ActionInvocationTest extends XWorkTestCase {
+
+    public void testCommandInvocation() throws Exception {
+        ActionProxy baseActionProxy = actionProxyFactory.createActionProxy(
+                "baz", "commandTest", null, null);
+        assertEquals("success", baseActionProxy.execute());
+
+        ActionProxy commandActionProxy = actionProxyFactory.createActionProxy(
+                "baz", "myCommand", null, null);
+        assertEquals(SimpleAction.COMMAND_RETURN_CODE, commandActionProxy.execute());
+    }
+
+    public void testCommandInvocationDoMethod() throws Exception {
+        ActionProxy baseActionProxy = actionProxyFactory.createActionProxy(
+                "baz", "doMethodTest", null, null);
+        assertEquals("input", baseActionProxy.execute());
+    }
+
+    public void testCommandInvocationUnknownHandler() throws Exception {
+
+        DefaultActionProxy baseActionProxy = (DefaultActionProxy) actionProxyFactory.createActionProxy(
+                "baz", "unknownMethodTest", "unknownmethod", null);
+        UnknownHandler unknownHandler = new UnknownHandler() {
+			public ActionConfig handleUnknownAction(String namespace, String actionName) throws XWorkException { return null;}
+			public Result handleUnknownResult(ActionContext actionContext, String actionName, ActionConfig actionConfig, String resultCode) throws XWorkException {
+				return null;
+			}
+			public Object handleUnknownActionMethod(Object action, String methodName) throws NoSuchMethodException {
+				if (methodName.equals("unknownmethod")) {
+					return "found";
+				} else {
+					return null;
+				}
+			}
+        };
+
+        UnknownHandlerManagerMock uhm = new UnknownHandlerManagerMock();
+        uhm.addUnknownHandler(unknownHandler);
+        ((DefaultActionInvocation)baseActionProxy.getInvocation()).setUnknownHandlerManager(uhm);
+
+        assertEquals("found", baseActionProxy.execute());
+    }
+
+    public void testResultReturnInvocationAndWired() throws Exception {
+        ActionProxy baseActionProxy = actionProxyFactory.createActionProxy(
+                "baz", "resultAction", null, null);
+        assertEquals(null, baseActionProxy.execute());
+        assertTrue(SimpleAction.resultCalled);
+    }
+
+    public void testSimple() {
+        HashMap<String, Object> params = new HashMap<String, Object>();
+        params.put("blah", "this is blah");
+
+        HashMap<String, Object> extraContext = new HashMap<String, Object>();
+        extraContext.put(ActionContext.PARAMETERS, params);
+
+        try {
+            ActionProxy proxy = actionProxyFactory.createActionProxy( "", "Foo", null, extraContext);
+            proxy.execute();
+            assertEquals("this is blah", proxy.getInvocation().getStack().findValue("[1].blah"));
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    @Override protected void setUp() throws Exception {
+        super.setUp();
+
+        // ensure we're using the default configuration, not simple config
+        loadConfigurationProviders(new XmlConfigurationProvider("xwork-sample.xml"));
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionNestingTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionNestingTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionNestingTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionNestingTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,143 @@
+/*
+ * 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;
+
+import org.apache.struts2.xwork2.config.Configuration;
+import org.apache.struts2.xwork2.config.ConfigurationProvider;
+import org.apache.struts2.xwork2.config.entities.ActionConfig;
+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.mock.MockResult;
+import org.apache.struts2.xwork2.util.ValueStack;
+import org.apache.struts2.xwork2.util.location.LocatableProperties;
+
+import java.util.HashMap;
+
+
+/**
+ * ActionNestingTest
+ *
+ * @author Jason Carreira
+ *         Created Mar 5, 2003 2:02:01 PM
+ */
+public class ActionNestingTest extends XWorkTestCase {
+
+    public static final String VALUE = "myValue";
+    public static final String NESTED_VALUE = "myNestedValue";
+    public static final String KEY = "myProperty";
+    public static final String NESTED_KEY = "nestedProperty";
+    public static final String NAMESPACE = "NestedActionTest";
+    public static final String SIMPLE_ACTION_NAME = "SimpleAction";
+    public static final String NO_STACK_ACTION_NAME = "NoStackNestedAction";
+    public static final String STACK_ACTION_NAME = "StackNestedAction";
+
+
+    private ActionContext context;
+
+
+    public String getMyProperty() {
+        return VALUE;
+    }
+
+    @Override public void setUp() throws Exception {
+        super.setUp();
+        loadConfigurationProviders(new NestedTestConfigurationProvider());
+
+        context = ActionContext.getContext();
+        context.getValueStack().push(this);
+    }
+
+    @Override protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testNestedContext() throws Exception {
+        assertEquals(context, ActionContext.getContext());
+        ActionProxy proxy = actionProxyFactory.createActionProxy(NAMESPACE, SIMPLE_ACTION_NAME, null);
+        proxy.execute();
+        assertEquals(context, ActionContext.getContext());
+    }
+
+    public void testNestedNoValueStack() throws Exception {
+        ValueStack stack = ActionContext.getContext().getValueStack();
+        assertEquals(VALUE, stack.findValue(KEY));
+
+        ActionProxy proxy = actionProxyFactory.createActionProxy(NAMESPACE, NO_STACK_ACTION_NAME, null);
+        proxy.execute();
+        stack = ActionContext.getContext().getValueStack();
+        assertEquals(stack.findValue(KEY), VALUE);
+        assertNull(stack.findValue(NESTED_KEY));
+    }
+
+    public void testNestedValueStack() throws Exception {
+        ValueStack stack = ActionContext.getContext().getValueStack();
+        assertEquals(VALUE, stack.findValue(KEY));
+
+        HashMap<String, Object> extraContext = new HashMap<String, Object>();
+        extraContext.put(ActionContext.VALUE_STACK, stack);
+
+        ActionProxy proxy = actionProxyFactory.createActionProxy(NAMESPACE, STACK_ACTION_NAME, extraContext);
+        proxy.execute();
+        assertEquals(context, ActionContext.getContext());
+        assertEquals(stack, ActionContext.getContext().getValueStack());
+        assertEquals(VALUE, stack.findValue(KEY));
+        assertEquals(NESTED_VALUE, stack.findValue(NESTED_KEY));
+        assertEquals(3, stack.size());
+    }
+
+
+    class NestedTestConfigurationProvider implements ConfigurationProvider {
+        private Configuration configuration;
+        public void destroy() {
+        }
+        public void init(Configuration configuration) {
+            this.configuration = configuration;
+        }
+
+        public void register(ContainerBuilder builder, LocatableProperties props) {
+        }
+        
+        public void loadPackages() {
+            
+            PackageConfig packageContext = new PackageConfig.Builder("nestedActionTest")
+                .addActionConfig(SIMPLE_ACTION_NAME, new ActionConfig.Builder("nestedActionTest", SIMPLE_ACTION_NAME, SimpleAction.class.getName())
+                        .addResultConfig(new ResultConfig.Builder(Action.SUCCESS, MockResult.class.getName()).build())
+                        .addResultConfig(new ResultConfig.Builder(Action.ERROR, MockResult.class.getName()).build())
+                        .build())
+                .addActionConfig(NO_STACK_ACTION_NAME, new ActionConfig.Builder("nestedActionTest", NO_STACK_ACTION_NAME, NestedAction.class.getName())
+                        .addResultConfig(new ResultConfig.Builder(Action.SUCCESS, MockResult.class.getName()).build())
+                        .methodName("noStack")
+                        .build())
+                .addActionConfig(STACK_ACTION_NAME, new ActionConfig.Builder("nestedActionTest", STACK_ACTION_NAME, NestedAction.class.getName())
+                        .addResultConfig(new ResultConfig.Builder(Action.SUCCESS, MockResult.class.getName()).build())
+                        .methodName("stack")
+                        .build())
+                .namespace(NAMESPACE)
+                .build();
+            configuration.addPackageConfig("nestedActionTest", packageContext);
+        }
+
+        /**
+         * Tells whether the ConfigurationProvider should reload its configuration
+         *
+         * @return
+         */
+        public boolean needsReload() {
+            return false;
+        }
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionSupportTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionSupportTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionSupportTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ActionSupportTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,330 @@
+/*
+ * 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;
+
+import org.apache.struts2.xwork2.util.ValueStack;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * Unit test for {@link ActionSupport}.
+ *
+ * @author Claus Ibsen
+ */
+public class ActionSupportTest extends XWorkTestCase {
+
+    private ActionSupport as;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        as = new ActionSupport();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        as = null;
+    }
+
+    public void testNothingDoneOnActionSupport() throws Exception {
+        assertEquals(false, as.hasErrors());
+
+        assertNotNull(as.getActionErrors());
+        assertEquals(0, as.getActionErrors().size());
+        assertEquals(false, as.hasActionErrors());
+
+        assertNotNull(as.getActionMessages());
+        assertEquals(0, as.getActionMessages().size());
+        assertEquals(false, as.hasActionMessages());
+
+        assertNotNull(as.getFieldErrors());
+        assertEquals(0, as.getFieldErrors().size());
+        assertEquals(false, as.hasFieldErrors());
+
+        assertNull(as.getText(null));
+
+        try {
+            as.pause(null);
+        } catch (Exception e) {
+            fail("Should not fail");
+        }
+
+        assertEquals(Action.INPUT, as.input());
+        assertEquals(Action.SUCCESS, as.doDefault());
+        assertEquals(Action.SUCCESS, as.execute());
+        try {
+            as.clone();
+            fail("Failure expected for clone()");
+        } catch (CloneNotSupportedException e) {
+            // success!
+        }
+
+
+        assertNull(as.getText(null, (List) null));
+        assertNull(as.getText(null, (String) null));
+        assertNull(as.getText(null, (String[]) null));
+
+        assertNull(as.getText(null, (String) null, (List) null));
+        assertNull(as.getText(null, (String) null, (String) null));
+        assertNull(as.getText(null, (String) null, (String[]) null));
+
+        assertNull(as.getText(null, (String) null, (List) null, (ValueStack) null));
+        assertNull(as.getText(null, (String) null, (String[]) null, (ValueStack) null));
+
+        assertNotNull(as.getLocale());
+        assertEquals(ActionContext.getContext().getLocale(), as.getLocale());
+
+        assertNull(as.getTexts()); // can not find a bundle
+        assertEquals("not.in.bundle", as.getText("not.in.bundle"));
+    }
+
+    public void testActionErrors() {
+        assertEquals(false, as.hasActionErrors());
+        assertEquals(0, as.getActionErrors().size());
+        as.addActionError("Damm");
+        assertEquals(1, as.getActionErrors().size());
+        assertEquals("Damm", as.getActionErrors().iterator().next());
+        assertEquals(true, as.hasActionErrors());
+        assertEquals(true, as.hasErrors());
+
+        as.clearErrorsAndMessages();
+        assertEquals(false, as.hasActionErrors());
+        assertEquals(false, as.hasErrors());
+    }
+
+    public void testActionMessages() {
+        assertEquals(false, as.hasActionMessages());
+        assertEquals(0, as.getActionMessages().size());
+        as.addActionMessage("Killroy was here");
+        assertEquals(1, as.getActionMessages().size());
+        assertEquals("Killroy was here", as.getActionMessages().iterator().next());
+        assertEquals(true, as.hasActionMessages());
+
+        assertEquals(false, as.hasActionErrors()); // does not count as a error
+        assertEquals(false, as.hasErrors()); // does not count as a error
+
+        as.clearErrorsAndMessages();
+        assertEquals(false, as.hasActionMessages());
+        assertEquals(false, as.hasErrors());
+    }
+
+    public void testFieldErrors() {
+        assertEquals(false, as.hasFieldErrors());
+        assertEquals(0, as.getFieldErrors().size());
+        as.addFieldError("username", "Admin is not allowed as username");
+        List<String> errors = as.getFieldErrors().get("username");
+        assertEquals(1, errors.size());
+        assertEquals("Admin is not allowed as username", errors.get(0));
+
+        assertEquals(true, as.hasFieldErrors());
+        assertEquals(true, as.hasErrors());
+
+        as.clearErrorsAndMessages();
+        assertEquals(false, as.hasFieldErrors());
+        assertEquals(false, as.hasErrors());
+    }
+
+    public void testDeprecated() throws Exception {
+        assertNotNull(as.getErrorMessages());
+        assertEquals(0, as.getErrorMessages().size());
+
+        assertNotNull(as.getErrors());
+        assertEquals(0, as.getErrors().size());
+    }
+
+    public void testLocale() {
+        Locale defLocale = Locale.getDefault();
+        ActionContext.getContext().setLocale(null);
+
+        // will never return null, if no locale is set then default is returned
+        assertNotNull(as.getLocale());
+        assertEquals(defLocale, as.getLocale());
+
+        ActionContext.getContext().setLocale(Locale.ITALY);
+        assertEquals(Locale.ITALY, as.getLocale());
+
+        ActionContext.setContext(new ActionContext(new HashMap<String, Object>()));
+        assertEquals(defLocale, as.getLocale()); // ActionContext will create a new context, when it was set to null before
+    }
+
+    public void testMyActionSupport() throws Exception {
+        ActionContext.getContext().setLocale(new Locale("da"));
+        MyActionSupport mas = new MyActionSupport();
+
+        assertEquals("santa", mas.doDefault());
+        assertNotNull(mas.getTexts());
+
+        assertEquals(false, mas.hasActionMessages());
+        mas.validate();
+        assertEquals(true, mas.hasActionMessages());
+    }
+
+    public void testSimpleGetTexts() throws Exception {
+        ActionContext.getContext().setLocale(new Locale("da"));
+        MyActionSupport mas = new MyActionSupport();
+
+        checkGetTexts(mas);
+    }
+
+    public void testSimpleGetTextsWithInjectedTextProvider() throws Exception {
+        ActionContext.getContext().setLocale(new Locale("da"));
+        MyActionSupport mas = new MyActionSupport();
+
+        TextProvider textProvider = container.getInstance(TextProvider.class, "system");
+
+        assertNotNull(textProvider);
+
+        container.inject(mas);
+
+        checkGetTexts(mas);
+    }
+
+    private void checkGetTexts(MyActionSupport mas) {
+        assertEquals("Hello World", mas.getText("hello"));
+        assertEquals("not.in.bundle", mas.getText("not.in.bundle"));
+
+        assertEquals("Hello World", mas.getText("hello", "this is default"));
+        assertEquals("this is default", mas.getText("not.in.bundle", "this is default"));
+
+        List nullList = null;
+        assertEquals("Hello World", mas.getText("hello", nullList));
+
+        String[] nullStrings = null;
+        assertEquals("Hello World", mas.getText("hello", nullStrings));
+    }
+
+    public void testGetTextsWithArgs() throws Exception {
+        ActionContext.getContext().setLocale(new Locale("da"));
+        MyActionSupport mas = new MyActionSupport();
+
+        assertEquals("Hello World", mas.getText("hello", "this is default", "from me")); // no args in bundle
+        assertEquals("Hello World from me", mas.getText("hello.0", "this is default", "from me"));
+        assertEquals("this is default", mas.getText("not.in.bundle", "this is default", "from me"));
+        assertEquals("this is default from me", mas.getText("not.in.bundle", "this is default {0}", "from me"));
+
+        assertEquals("not.in.bundle", mas.getText("not.in.bundle"));
+    }
+
+    public void testGetTextsWithListArgs() throws Exception {
+        ActionContext.getContext().setLocale(new Locale("da"));
+        MyActionSupport mas = new MyActionSupport();
+
+        List<Object> args = new ArrayList<Object>();
+        args.add("Santa");
+        args.add("loud");
+        assertEquals("Hello World", mas.getText("hello", "this is default", args)); // no args in bundle
+        assertEquals("Hello World Santa", mas.getText("hello.0", "this is default", args)); // only 1 arg in bundle
+        assertEquals("Hello World. This is Santa speaking loud", mas.getText("hello.1", "this is default", args));
+
+        assertEquals("this is default", mas.getText("not.in.bundle", "this is default", args));
+        assertEquals("this is default Santa", mas.getText("not.in.bundle", "this is default {0}", args));
+        assertEquals("this is default Santa speaking loud", mas.getText("not.in.bundle", "this is default {0} speaking {1}", args));
+
+        assertEquals("Hello World", mas.getText("hello", args)); // no args in bundle
+        assertEquals("Hello World Santa", mas.getText("hello.0", args)); // only 1 arg in bundle
+        assertEquals("Hello World. This is Santa speaking loud", mas.getText("hello.1", args));
+
+        assertEquals("not.in.bundle", mas.getText("not.in.bundle", args));
+
+        assertEquals("Hello World", mas.getText("hello", "this is default", (List) null));
+        assertEquals("this is default", mas.getText("not.in.bundle", "this is default", (List) null));
+    }
+
+    public void testGetTextsWithArrayArgs() throws Exception {
+        ActionContext.getContext().setLocale(new Locale("da"));
+        MyActionSupport mas = new MyActionSupport();
+
+        String[] args = {"Santa", "loud"};
+        assertEquals("Hello World", mas.getText("hello", "this is default", args)); // no args in bundle
+        assertEquals("Hello World Santa", mas.getText("hello.0", "this is default", args)); // only 1 arg in bundle
+        assertEquals("Hello World. This is Santa speaking loud", mas.getText("hello.1", "this is default", args));
+
+        assertEquals("this is default", mas.getText("not.in.bundle", "this is default", args));
+        assertEquals("this is default Santa", mas.getText("not.in.bundle", "this is default {0}", args));
+        assertEquals("this is default Santa speaking loud", mas.getText("not.in.bundle", "this is default {0} speaking {1}", args));
+
+        assertEquals("Hello World", mas.getText("hello", args)); // no args in bundle
+        assertEquals("Hello World Santa", mas.getText("hello.0", args)); // only 1 arg in bundle
+        assertEquals("Hello World. This is Santa speaking loud", mas.getText("hello.1", args));
+
+        assertEquals("not.in.bundle", mas.getText("not.in.bundle", args));
+
+        assertEquals("Hello World", mas.getText("hello", "this is default", (String[]) null));
+        assertEquals("this is default", mas.getText("not.in.bundle", "this is default", (String[]) null));
+    }
+
+    public void testGetTextsWithListAndStack() throws Exception {
+        ActionContext.getContext().setLocale(new Locale("da"));
+        MyActionSupport mas = new MyActionSupport();
+
+        ValueStack stack = ActionContext.getContext().getValueStack();
+
+        List<Object> args = new ArrayList<Object>();
+        args.add("Santa");
+        args.add("loud");
+        assertEquals("Hello World", mas.getText("hello", "this is default", args, stack)); // no args in bundle
+        assertEquals("Hello World Santa", mas.getText("hello.0", "this is default", args, stack)); // only 1 arg in bundle
+        assertEquals("Hello World. This is Santa speaking loud", mas.getText("hello.1", "this is default", args, stack));
+
+        assertEquals("this is default", mas.getText("not.in.bundle", "this is default", args, stack));
+        assertEquals("this is default Santa", mas.getText("not.in.bundle", "this is default {0}", args, stack));
+        assertEquals("this is default Santa speaking loud", mas.getText("not.in.bundle", "this is default {0} speaking {1}", args, stack));
+    }
+
+    public void testGetTextsWithArrayAndStack() throws Exception {
+        ActionContext.getContext().setLocale(new Locale("da"));
+        MyActionSupport mas = new MyActionSupport();
+
+        ValueStack stack = ActionContext.getContext().getValueStack();
+
+        String[] args = {"Santa", "loud"};
+        assertEquals("Hello World", mas.getText("hello", "this is default", args, stack)); // no args in bundle
+        assertEquals("Hello World Santa", mas.getText("hello.0", "this is default", args, stack)); // only 1 arg in bundle
+        assertEquals("Hello World. This is Santa speaking loud", mas.getText("hello.1", "this is default", args, stack));
+
+        assertEquals("this is default", mas.getText("not.in.bundle", "this is default", args, stack));
+        assertEquals("this is default Santa", mas.getText("not.in.bundle", "this is default {0}", args, stack));
+        assertEquals("this is default Santa speaking loud", mas.getText("not.in.bundle", "this is default {0} speaking {1}", args, stack));
+    }
+
+    public void testGetBundle() throws Exception {
+        ActionContext.getContext().setLocale(new Locale("da"));
+        MyActionSupport mas = new MyActionSupport();
+
+        ResourceBundle rb = ResourceBundle.getBundle(MyActionSupport.class.getName(), new Locale("da"));
+        assertEquals(rb, mas.getTexts(MyActionSupport.class.getName()));
+    }
+
+    private class MyActionSupport extends ActionSupport {
+
+        @Override
+        public String doDefault() throws Exception {
+            return "santa";
+        }
+
+        @Override
+        public void validate() {
+            super.validate(); // to have code coverage
+            addActionMessage("validation was called");
+        }
+    }
+
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/AnnotatedTestBean.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/AnnotatedTestBean.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/AnnotatedTestBean.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/AnnotatedTestBean.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,76 @@
+/*
+ * 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;
+
+import org.apache.struts2.xwork2.validator.annotations.IntRangeFieldValidator;
+import org.apache.struts2.xwork2.validator.annotations.RequiredStringValidator;
+import org.apache.struts2.xwork2.validator.annotations.Validations;
+
+import java.util.Date;
+
+
+/**
+ * AnnotatedTestBean
+ * @author Jason Carreira
+ * @author Rainer Hermanns
+ * Created Aug 4, 2003 12:39:53 AM
+ */
+public class AnnotatedTestBean {
+    //~ Instance fields ////////////////////////////////////////////////////////
+
+    private Date birth;
+    private String name;
+    private int count;
+
+    //~ Constructors ///////////////////////////////////////////////////////////
+
+    public AnnotatedTestBean() {
+    }
+
+    //~ Methods ////////////////////////////////////////////////////////////////
+
+    public void setBirth(Date birth) {
+        this.birth = birth;
+    }
+
+    public Date getBirth() {
+        return birth;
+    }
+
+    @Validations(
+            intRangeFields = {
+                @IntRangeFieldValidator(shortCircuit = true, min = "1", max="100", key="invalid.count", message = "Invalid Count!"),
+                @IntRangeFieldValidator(shortCircuit = true, min = "20", max="28", key="invalid.count.bad", message = "Smaller Invalid Count: ${count}")
+            }
+
+    )
+    public void setCount(int count) {
+        this.count = count;
+    }
+
+    public int getCount() {
+        return count;
+    }
+
+    @RequiredStringValidator(message = "You must enter a name.")
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ChainResultTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ChainResultTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ChainResultTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ChainResultTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,144 @@
+/*
+ * 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.
+ */
+/*
+ * Created on 28/02/2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.struts2.xwork2;
+
+import com.mockobjects.dynamic.Mock;
+import org.apache.struts2.xwork2.config.providers.XmlConfigurationProvider;
+import org.apache.struts2.xwork2.util.ValueStack;
+import junit.framework.TestCase;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * @author CameronBraid
+ */
+public class ChainResultTest extends XWorkTestCase {
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        // ensure we're using the default configuration, not simple config
+        loadConfigurationProviders(new XmlConfigurationProvider("xwork-sample.xml"));
+    }
+
+    public void testNamespaceAndActionExpressionEvaluation() throws Exception {
+        ActionChainResult result = new ActionChainResult();
+        result.setActionName("${actionName}");
+        result.setNamespace("${namespace}");
+
+        String expectedActionName = "testActionName";
+        String expectedNamespace = "testNamespace";
+        Map<String, Object> values = new HashMap<String, Object>();
+        values.put("actionName", expectedActionName);
+        values.put("namespace", expectedNamespace);
+
+        ValueStack stack = ActionContext.getContext().getValueStack();
+        stack.push(values);
+
+        Mock actionProxyMock = new Mock(ActionProxy.class);
+        actionProxyMock.expect("execute");
+
+        ActionProxyFactory testActionProxyFactory = new NamespaceActionNameTestActionProxyFactory(expectedNamespace, expectedActionName, (ActionProxy) actionProxyMock.proxy());
+        result.setActionProxyFactory(testActionProxyFactory);
+        try {
+
+            ActionContext testContext = new ActionContext(stack.getContext());
+            ActionContext.setContext(testContext);
+            result.execute(null);
+            actionProxyMock.verify();
+        } finally {
+            ActionContext.setContext(null);
+        }
+    }
+
+    public void testRecursiveChain() throws Exception {
+        ActionProxy proxy = actionProxyFactory.createActionProxy("", "InfiniteRecursionChain", null);
+
+        try {
+            proxy.execute();
+            fail("did not detected repeated chain to an action");
+        } catch (XWorkException e) {
+        }
+    }
+
+    private class NamespaceActionNameTestActionProxyFactory implements ActionProxyFactory {
+        private ActionProxy returnVal;
+        private String expectedActionName;
+        private String expectedNamespace;
+
+        public NamespaceActionNameTestActionProxyFactory(String expectedNamespace, String expectedActionName, ActionProxy returnVal) {
+            this.expectedNamespace = expectedNamespace;
+            this.expectedActionName = expectedActionName;
+            this.returnVal = returnVal;
+        }
+
+        public ActionProxy createActionProxy(String namespace, String actionName, Map<String, Object> extraContext) {
+            TestCase.assertEquals(expectedNamespace, namespace);
+            TestCase.assertEquals(expectedActionName, actionName);
+
+            return returnVal;
+        }
+
+        public ActionProxy createActionProxy(String namespace, String actionName, String methodName, Map<String, Object> extraContext) {
+            TestCase.assertEquals(expectedNamespace, namespace);
+            TestCase.assertEquals(expectedActionName, actionName);
+
+            return returnVal;
+        }
+
+        public ActionProxy createActionProxy(String namespace, String actionName, Map<String, Object> extraContext, boolean executeResult, boolean cleanupContext) {
+            TestCase.assertEquals(expectedNamespace, namespace);
+            TestCase.assertEquals(expectedActionName, actionName);
+
+            return returnVal;
+        }
+
+        public ActionProxy createActionProxy(String namespace, String actionName, String methodName, Map<String, Object> extraContext, boolean executeResult, boolean cleanupContext) {
+             TestCase.assertEquals(expectedNamespace, namespace);
+            TestCase.assertEquals(expectedActionName, actionName);
+
+            return returnVal;
+        }
+
+        public ActionProxy createActionProxy(ActionInvocation actionInvocation, String namespace, String actionName, String methodName, boolean executeResult, boolean cleanupContext) {
+             TestCase.assertEquals(expectedNamespace, namespace);
+            TestCase.assertEquals(expectedActionName, actionName);
+
+            return returnVal;
+        }
+
+        public ActionProxy createActionProxy(String namespace, String actionName, String method, boolean executeResult, boolean cleanupContext) {
+            TestCase.assertEquals(expectedNamespace, namespace);
+            TestCase.assertEquals(expectedActionName, actionName);
+
+            return returnVal;
+        }
+
+        public ActionProxy createActionProxy(ActionInvocation inv, String namespace, String actionName,
+                Map<String, Object> extraContext, boolean executeResult, boolean cleanupContext) throws Exception {
+            return null;
+        }
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/CompositeTextProviderTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/CompositeTextProviderTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/CompositeTextProviderTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/CompositeTextProviderTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,102 @@
+package org.apache.struts2.xwork2;
+
+import java.util.ArrayList;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * <code>CompositeTextProviderTest</code>
+ *
+ * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
+ * @version $Id: CompositeTextProviderTest.java 1209415 2011-12-02 11:24:48Z lukaszlenart $
+ */
+public class CompositeTextProviderTest extends XWorkTestCase {
+
+
+    private CompositeTextProvider textProvider = null;
+
+
+    public void testGetText() throws Exception {
+        // we should get the text from the 1st text provider
+        assertEquals(textProvider.getText("name"), "1 name");
+        assertEquals(textProvider.getText("age"), "1 age");
+        assertEquals(textProvider.getText("dog"), "This is a dog");
+        assertEquals(textProvider.getText("cat"), "This is a cat");
+        assertEquals(textProvider.getText("car"), "This is a car");
+        assertEquals(textProvider.getText("bike"), "This is a bike");
+        assertEquals(textProvider.getText("someNonExistingKey"), "someNonExistingKey");
+    }
+
+
+    public void testGetTextWithDefaultValues() throws Exception {
+        assertEquals(textProvider.getText("name", "some default name"), "1 name");
+        assertEquals(textProvider.getText("age", "some default age"), "1 age");
+        assertEquals(textProvider.getText("no_such_key", "default value"), "default value");
+        assertEquals(textProvider.getText("dog", "some default dog"), "This is a dog");
+        assertEquals(textProvider.getText("cat", "some default cat"), "This is a cat");
+        assertEquals(textProvider.getText("car", "some default car"), "This is a car");
+        assertEquals(textProvider.getText("bike", "some default bike"), "This is a bike");
+    }
+
+
+    public void testGetTextWithDefaultValuesAndArgs() throws Exception {
+        assertEquals(textProvider.getText("goodnight", "say good night", "Adam"), "1 good night Adam");
+        assertEquals(textProvider.getText("goodnight", "say good night", new String[] { "Adam" }), "1 good night Adam");
+        assertEquals(textProvider.getText("goodnight", "say good night", new ArrayList<Object>() { {add("Adam");} }), "1 good night Adam");
+        assertEquals(textProvider.getText("goodmorning", "say good morning", new String[] { "Jack", "Jim" }), "1 good morning Jack and Jim");
+        assertEquals(textProvider.getText("goodmorning", "say good morning", new ArrayList<Object>() { { add("Jack"); add("Jim"); }}), "1 good morning Jack and Jim");
+    }
+
+    public void testHasKey() throws Exception {
+        assertTrue(textProvider.hasKey("name"));
+        assertTrue(textProvider.hasKey("age"));
+        assertTrue(textProvider.hasKey("cat"));
+        assertTrue(textProvider.hasKey("dog"));
+        assertTrue(textProvider.hasKey("car"));
+        assertTrue(textProvider.hasKey("bike"));
+        assertTrue(textProvider.hasKey("goodnight"));
+        assertTrue(textProvider.hasKey("goodmorning"));
+        assertFalse(textProvider.hasKey("nosuchkey"));
+    }
+
+    public void testGetResourceBundleByName() throws Exception {
+        assertNotNull(textProvider.getTexts("org.apache.struts2.xwork2.validator.CompositeTextProviderTestResourceBundle1"));
+        assertNotNull(textProvider.getTexts("org.apache.struts2.xwork2.validator.CompositeTextProviderTestResourceBundle2"));
+        assertNull(textProvider.getTexts("org.apache.struts2.xwork2.validator.CompositeTextProviderTestResourceBundle3"));
+    }
+
+    public void testGetResourceBundle() throws Exception {
+        assertNotNull(textProvider.getTexts());
+        // we should get the first resource bundle where 'car' and 'bike' has a i18n msg
+        assertNotNull(textProvider.getTexts().getString("car"));
+        assertNotNull(textProvider.getTexts().getString("bike"));
+    }
+
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        textProvider = new CompositeTextProvider(new TextProvider[] {
+                new TextProviderSupport(ResourceBundle.getBundle("org.apache.struts2.xwork2.validator.CompositeTextProviderTestResourceBundle1"),
+                        new LocaleProvider() {
+                            public Locale getLocale() {
+                                return Locale.ENGLISH;
+                            }
+                        }),
+                new TextProviderSupport(ResourceBundle.getBundle("org.apache.struts2.xwork2.validator.CompositeTextProviderTestResourceBundle2"),
+                        new LocaleProvider() {
+                            public Locale getLocale() {
+                                return Locale.ENGLISH;
+                            }
+                        })
+
+        });
+    }
+
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        textProvider = null;
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/DefaultActionInvocationTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/DefaultActionInvocationTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/DefaultActionInvocationTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/DefaultActionInvocationTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,59 @@
+package org.apache.struts2.xwork2;
+
+import org.apache.struts2.xwork2.config.entities.InterceptorMapping;
+import org.apache.struts2.xwork2.mock.MockActionProxy;
+import org.apache.struts2.xwork2.mock.MockInterceptor;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+
+/**
+ * A partial test of DefaultActionInvocation.
+ * Created to change interceptor chain logic.
+ *
+ * @author <a href="mailto:kristian at zenior.no">Kristian Rosenvold</a>
+ */
+public class DefaultActionInvocationTest extends XWorkTestCase {
+
+    /**
+     * Tests interceptor chain invoke.
+     *
+     * @throws Exception when action throws exception
+     */
+    public void testInvoke() throws Exception {
+        List<InterceptorMapping> interceptorMappings = new ArrayList<InterceptorMapping>();
+        MockInterceptor mockInterceptor1 = new MockInterceptor();
+        mockInterceptor1.setFoo("test1");
+        mockInterceptor1.setExpectedFoo("test1");
+        interceptorMappings.add(new InterceptorMapping("test1", mockInterceptor1));
+        MockInterceptor mockInterceptor2 = new MockInterceptor();
+        interceptorMappings.add(new InterceptorMapping("test2", mockInterceptor2));
+        mockInterceptor2.setFoo("test2");
+        mockInterceptor2.setExpectedFoo("test2");
+        MockInterceptor mockInterceptor3 = new MockInterceptor();
+        interceptorMappings.add(new InterceptorMapping("test3", mockInterceptor3));
+        mockInterceptor3.setFoo("test3");
+        mockInterceptor3.setExpectedFoo("test3");
+
+        DefaultActionInvocation defaultActionInvocation = new DefaultActionInvocationTester(interceptorMappings);
+        defaultActionInvocation.invoke();
+        assertTrue(mockInterceptor1.isExecuted());
+        assertTrue(mockInterceptor2.isExecuted());
+        assertTrue(mockInterceptor3.isExecuted());
+    }
+
+
+    class DefaultActionInvocationTester extends DefaultActionInvocation {
+        DefaultActionInvocationTester(List<InterceptorMapping> interceptorMappings) {
+            super(new HashMap<String, Object>(), false);
+            interceptors = interceptorMappings.iterator();
+            MockActionProxy actionProxy = new MockActionProxy();
+            actionProxy.setMethod("execute");
+            proxy = actionProxy;
+            action = new ActionSupport();
+        }
+    }
+
+}
\ No newline at end of file

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/DefaultClasstTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/DefaultClasstTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/DefaultClasstTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/DefaultClasstTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2002-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;
+
+import org.apache.struts2.xwork2.config.providers.XmlConfigurationProvider;
+
+/**
+ * <code>WildCardResultTest</code>
+ *
+ * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
+ * @version $Id: DefaultClasstTest.java 1209415 2011-12-02 11:24:48Z lukaszlenart $
+ */
+public class DefaultClasstTest extends XWorkTestCase {
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        // ensure we're using the default configuration, not simple config
+        loadConfigurationProviders(new XmlConfigurationProvider("xwork-sample.xml"));
+    }
+
+    public void testWildCardEvaluation() throws Exception {
+        ActionProxy proxy = actionProxyFactory.createActionProxy("Abstract-crud", "edit", null);
+        assertEquals("org.apache.struts2.xwork2.SimpleAction", proxy.getConfig().getClassName());
+        
+        proxy = actionProxyFactory.createActionProxy("/example", "edit", null);
+        assertEquals("org.apache.struts2.xwork2.ModelDrivenAction", proxy.getConfig().getClassName());
+         
+
+        proxy = actionProxyFactory.createActionProxy("/example2", "override", null);
+        assertEquals("org.apache.struts2.xwork2.ModelDrivenAction", proxy.getConfig().getClassName());
+        
+        proxy = actionProxyFactory.createActionProxy("/example2/subItem", "save", null);
+        assertEquals("org.apache.struts2.xwork2.ModelDrivenAction", proxy.getConfig().getClassName());
+        
+        proxy = actionProxyFactory.createActionProxy("/example2", "list", null);
+        assertEquals("org.apache.struts2.xwork2.ModelDrivenAction", proxy.getConfig().getClassName());
+        
+        proxy = actionProxyFactory.createActionProxy("/example3", "list", null);
+        assertEquals("org.apache.struts2.xwork2.SimpleAction", proxy.getConfig().getClassName());
+    }
+
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/DefaultTextProviderTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/DefaultTextProviderTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/DefaultTextProviderTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/DefaultTextProviderTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,147 @@
+/*
+ * 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;
+
+import org.apache.struts2.xwork2.util.LocalizedTextUtil;
+import junit.framework.TestCase;
+
+import java.util.*;
+
+/**
+ * Unit test for {@link DefaultTextProvider}.
+ *
+ * @author Claus Ibsen
+ */
+public class DefaultTextProviderTest extends TestCase {
+
+    private DefaultTextProvider tp;
+
+    public void testSimpleGetTexts() throws Exception {
+        assertEquals("Hello World", tp.getText("hello"));
+        assertEquals(null, tp.getText("not.in.bundle"));
+
+        assertEquals("Hello World", tp.getText("hello", "this is default"));
+        assertEquals("this is default", tp.getText("not.in.bundle", "this is default"));
+
+        List<Object> nullList = null;
+        assertEquals("Hello World", tp.getText("hello", nullList));
+
+        String[] nullStrings = null;
+        assertEquals("Hello World", tp.getText("hello", nullStrings));
+    }
+
+   public void testGetTextsWithArgs() throws Exception {
+        assertEquals("Hello World", tp.getText("hello", "this is default", "from me")); // no args in bundle
+        assertEquals("Hello World from me", tp.getText("hello.0", "this is default", "from me"));
+        assertEquals("this is default", tp.getText("not.in.bundle", "this is default", "from me"));
+        assertEquals("this is default from me", tp.getText("not.in.bundle", "this is default {0}", "from me"));
+
+        assertEquals(null, tp.getText("not.in.bundle"));
+    }
+
+    public void testGetTextsWithListArgs() throws Exception {
+        List<Object> args = new ArrayList<Object>();
+        args.add("Santa");
+        args.add("loud");
+        assertEquals("Hello World", tp.getText("hello", "this is default", args)); // no args in bundle
+        assertEquals("Hello World Santa", tp.getText("hello.0", "this is default", args)); // only 1 arg in bundle
+        assertEquals("Hello World. This is Santa speaking loud", tp.getText("hello.1", "this is default", args));
+
+        assertEquals("this is default", tp.getText("not.in.bundle", "this is default", args));
+        assertEquals("this is default Santa", tp.getText("not.in.bundle", "this is default {0}", args));
+        assertEquals("this is default Santa speaking loud", tp.getText("not.in.bundle", "this is default {0} speaking {1}", args));
+
+        assertEquals("Hello World", tp.getText("hello", args)); // no args in bundle
+        assertEquals("Hello World Santa", tp.getText("hello.0", args)); // only 1 arg in bundle
+        assertEquals("Hello World. This is Santa speaking loud", tp.getText("hello.1", args));
+
+        assertEquals(null, tp.getText("not.in.bundle", args));
+
+        assertEquals("Hello World", tp.getText("hello", "this is default", (List) null));
+        assertEquals("this is default", tp.getText("not.in.bundle", "this is default", (List) null));
+    }
+
+    public void testGetTextsWithArrayArgs() throws Exception {
+        String[] args = { "Santa", "loud" };
+        assertEquals("Hello World", tp.getText("hello", "this is default", args)); // no args in bundle
+        assertEquals("Hello World Santa", tp.getText("hello.0", "this is default", args)); // only 1 arg in bundle
+        assertEquals("Hello World. This is Santa speaking loud", tp.getText("hello.1", "this is default", args));
+
+        assertEquals("this is default", tp.getText("not.in.bundle", "this is default", args));
+        assertEquals("this is default Santa", tp.getText("not.in.bundle", "this is default {0}", args));
+        assertEquals("this is default Santa speaking loud", tp.getText("not.in.bundle", "this is default {0} speaking {1}", args));
+
+        assertEquals("Hello World", tp.getText("hello", args)); // no args in bundle
+        assertEquals("Hello World Santa", tp.getText("hello.0", args)); // only 1 arg in bundle
+        assertEquals("Hello World. This is Santa speaking loud", tp.getText("hello.1", args));
+
+        assertEquals(null, tp.getText("not.in.bundle", args));
+
+        assertEquals("Hello World", tp.getText("hello", "this is default", (String[]) null));
+        assertEquals("this is default", tp.getText("not.in.bundle", "this is default", (String[]) null));
+    }
+
+    public void testGetTextsWithListAndStack() throws Exception {
+        List<Object> args = new ArrayList<Object>();
+        args.add("Santa");
+        args.add("loud");
+        assertEquals("Hello World", tp.getText("hello", "this is default", args, null)); // no args in bundle
+        assertEquals("Hello World Santa", tp.getText("hello.0", "this is default", args, null)); // only 1 arg in bundle
+        assertEquals("Hello World. This is Santa speaking loud", tp.getText("hello.1", "this is default", args, null));
+
+        assertEquals("this is default", tp.getText("not.in.bundle", "this is default", args, null));
+        assertEquals("this is default Santa", tp.getText("not.in.bundle", "this is default {0}", args, null));
+        assertEquals("this is default Santa speaking loud", tp.getText("not.in.bundle", "this is default {0} speaking {1}", args, null));
+    }
+
+    public void testGetTextsWithArrayAndStack() throws Exception {
+        String[] args = { "Santa", "loud" };
+        assertEquals("Hello World", tp.getText("hello", "this is default", args, null)); // no args in bundle
+        assertEquals("Hello World Santa", tp.getText("hello.0", "this is default", args, null)); // only 1 arg in bundle
+        assertEquals("Hello World. This is Santa speaking loud", tp.getText("hello.1", "this is default", args, null));
+
+        assertEquals("this is default", tp.getText("not.in.bundle", "this is default", args, null));
+        assertEquals("this is default Santa", tp.getText("not.in.bundle", "this is default {0}", args, null));
+        assertEquals("this is default Santa speaking loud", tp.getText("not.in.bundle", "this is default {0} speaking {1}", args, null));
+    }
+
+    public void testGetBundle() throws Exception {
+        assertNull(tp.getTexts()); // always returns null
+
+        ResourceBundle rb = ResourceBundle.getBundle(TextProviderSupportTest.class.getName(), Locale.CANADA);
+        assertEquals(rb, tp.getTexts(TextProviderSupportTest.class.getName()));
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        ActionContext ctx = new ActionContext(new HashMap<String, Object>());
+        ActionContext.setContext(ctx);
+        ctx.setLocale(Locale.CANADA);
+
+        LocalizedTextUtil.clearDefaultResourceBundles();
+        LocalizedTextUtil.addDefaultResourceBundle(DefaultTextProviderTest.class.getName());
+
+        tp = new DefaultTextProvider();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        ActionContext.setContext(null);
+        tp = null;
+    }
+
+
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ExternalReferenceAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ExternalReferenceAction.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ExternalReferenceAction.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ExternalReferenceAction.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+/*
+ * Created on Nov 11, 2003
+ *
+ * To change the template for this generated file go to Window - Preferences -
+ * Java - Code Generation - Code and Comments
+ */
+package org.apache.struts2.xwork2;
+
+
+/**
+ * @author Mike
+ *         <p/>
+ *         To change the template for this generated type comment go to Window -
+ *         Preferences - Java - Code Generation - Code and Comments
+ */
+public class ExternalReferenceAction implements Action {
+
+    private Foo foo;
+
+
+    /**
+     * @param foo The foo to set.
+     */
+    public void setFoo(Foo foo) {
+        this.foo = foo;
+    }
+
+    /**
+     * @return Returns the foo.
+     */
+    public Foo getFoo() {
+        return foo;
+    }
+
+    public String execute() throws Exception {
+        return SUCCESS;
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/Foo.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/Foo.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/Foo.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/Foo.java Fri Dec  2 16:33:03 2011
@@ -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.
+ */
+/*
+ * Created on Nov 11, 2003
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.struts2.xwork2;
+
+
+/**
+ * @author Mike
+ *         <p/>
+ *         To change the template for this generated type comment go to
+ *         Window - Preferences - Java - Code Generation - Code and Comments
+ */
+public class Foo {
+
+    String name = null;
+
+
+    public Foo() {
+        name = "not set";
+    }
+
+    public Foo(String name) {
+        this.name = name;
+    }
+
+
+    public String getName() {
+        return name;
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/GenericsBean.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/GenericsBean.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/GenericsBean.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/GenericsBean.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,57 @@
+package org.apache.struts2.xwork2;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <code>GenericsBean</code>
+ *
+ * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
+ * @version $Id: GenericsBean.java 1209415 2011-12-02 11:24:48Z lukaszlenart $
+ */
+public class GenericsBean {
+    private List<Double> blubb;
+    private List<Double> getterList;
+    private Map<Double, Integer> genericMap = new HashMap<Double, Integer>();
+    private Map<Double, List<Integer>> extendedMap = new HashMap<Double, List<Integer>>();
+
+    /**
+     * @return Returns the doubles.
+     */
+    public List<Double> getDoubles() {
+        return blubb;
+    }
+
+    /**
+     * @param doubles The doubles to set.
+     */
+    public void setDoubles(List<Double> doubles) {
+        this.blubb = doubles;
+    }
+
+    public Map<Double, Integer> getGenericMap() {
+        return genericMap;
+    }
+
+    public void setGenericMap(Map<Double, Integer> genericMap) {
+        this.genericMap = genericMap;
+    }
+
+    public List<Double> getGetterList() {
+        if ( getterList == null ) {
+            getterList = new ArrayList<Double>(1);
+            getterList.add(42.42);
+        }
+        return getterList;
+    }
+
+    public Map<Double, List<Integer>> getExtendedMap() {
+        return extendedMap;
+    }
+
+    public void setExtendedMap(Map<Double, List<Integer>> extendedMap) {
+        this.extendedMap = extendedMap;
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/LocaleAwareTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/LocaleAwareTest.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/LocaleAwareTest.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/LocaleAwareTest.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,68 @@
+/*
+ * 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;
+
+import org.apache.struts2.xwork2.config.providers.MockConfigurationProvider;
+import org.apache.struts2.xwork2.config.providers.XmlConfigurationProvider;
+import org.apache.struts2.xwork2.util.ValueStack;
+import org.apache.struts2.xwork2.util.ValueStackFactory;
+
+import java.util.Locale;
+
+
+/**
+ * LocaleAwareTest
+ *
+ * @author Jason Carreira
+ *         Created Feb 10, 2003 6:13:13 PM
+ */
+public class LocaleAwareTest extends XWorkTestCase {
+
+    public void testGetText() {
+        try {
+            ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.FOO_ACTION_NAME, null);
+            ActionContext.getContext().setLocale(Locale.US);
+
+            TextProvider localeAware = (TextProvider) proxy.getAction();
+            assertEquals("Foo Range Message", localeAware.getText("foo.range"));
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    public void testLocaleGetText() {
+        try {
+            ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.FOO_ACTION_NAME, null);
+            ActionContext.getContext().setLocale(Locale.GERMANY);
+
+            TextProvider localeAware = (TextProvider) proxy.getAction();
+            assertEquals("I don't know German", localeAware.getText("foo.range"));
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        loadConfigurationProviders(new XmlConfigurationProvider("xwork-test-beans.xml"), new MockConfigurationProvider());
+
+        ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();
+        stack.getContext().put(ActionContext.CONTAINER, container);
+        ActionContext.setContext(new ActionContext(stack.getContext()));
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ModelDrivenAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ModelDrivenAction.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ModelDrivenAction.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ModelDrivenAction.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2002-2003,2009 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.struts2.xwork2;
+
+
+/**
+ * ModelDrivenAction
+ *
+ * @author Jason Carreira
+ *         Created Apr 8, 2003 6:27:29 PM
+ */
+public class ModelDrivenAction extends ActionSupport implements ModelDriven {
+
+    private String foo;
+    private TestBean model = new TestBean();
+
+
+    public void setFoo(String foo) {
+        this.foo = foo;
+    }
+
+    public String getFoo() {
+        return foo;
+    }
+
+    /**
+     * @return the model to be pushed onto the ValueStack after the Action itself
+     */
+    public Object getModel() {
+        return model;
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ModelDrivenAnnotationAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ModelDrivenAnnotationAction.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ModelDrivenAnnotationAction.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ModelDrivenAnnotationAction.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,45 @@
+/*
+ * 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;
+
+/**
+ * ModelDrivenAnnotationAction
+ *
+ * @author Jason Carreira
+ * @author Rainer Hermanns
+ *         Created Apr 8, 2003 6:27:29 PM
+ */
+public class ModelDrivenAnnotationAction extends ActionSupport implements ModelDriven {
+
+    private String foo;
+    private AnnotatedTestBean model = new AnnotatedTestBean();
+
+
+    public void setFoo(String foo) {
+        this.foo = foo;
+    }
+
+    public String getFoo() {
+        return foo;
+    }
+
+    /**
+     * @return the model to be pushed onto the ValueStack after the Action itself
+     */
+    public Object getModel() {
+        return model;
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/NestedAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/NestedAction.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/NestedAction.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/NestedAction.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,67 @@
+/*
+ * 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;
+
+import org.apache.struts2.xwork2.util.ValueStack;
+import junit.framework.Assert;
+
+
+/**
+ * NestedAction
+ *
+ * @author Jason Carreira
+ *         Created Mar 5, 2003 3:08:19 PM
+ */
+public class NestedAction implements Action {
+
+    private String nestedProperty = ActionNestingTest.NESTED_VALUE;
+
+
+    public NestedAction() {
+    }
+
+
+    public String getNestedProperty() {
+        return nestedProperty;
+    }
+
+    public String execute() throws Exception {
+        Assert.fail();
+
+        return null;
+    }
+
+    public String noStack() {
+        ValueStack stack = ActionContext.getContext().getValueStack();
+        // Action + DefaultTextProvider on the stack
+        Assert.assertEquals(2, stack.size());
+        Assert.assertNull(stack.findValue(ActionNestingTest.KEY));
+        Assert.assertEquals(ActionNestingTest.NESTED_VALUE, stack.findValue(ActionNestingTest.NESTED_KEY));
+
+        return SUCCESS;
+    }
+
+    public String stack() {
+        ValueStack stack = ActionContext.getContext().getValueStack();
+        //DefaultTextProvider, NestedActionTest pushed on by the test, and the NestedAction
+        Assert.assertEquals(3, stack.size());
+        Assert.assertNotNull(stack.findValue(ActionNestingTest.KEY));
+        Assert.assertEquals(ActionContext.getContext().getValueStack().findValue(ActionNestingTest.KEY), ActionNestingTest.VALUE);
+        Assert.assertEquals(ActionNestingTest.NESTED_VALUE, stack.findValue(ActionNestingTest.NESTED_KEY));
+
+        return SUCCESS;
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ProxyInvocationAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ProxyInvocationAction.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ProxyInvocationAction.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ProxyInvocationAction.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,10 @@
+package org.apache.struts2.xwork2;
+
+/**
+ * Need by the ProxyInvocationTest
+ */
+public class ProxyInvocationAction extends ActionSupport implements ProxyInvocationInterface {
+    public String show() {
+        return "proxyResult";
+    }
+}

Added: struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ProxyInvocationInterface.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ProxyInvocationInterface.java?rev=1209569&view=auto
==============================================================================
--- struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ProxyInvocationInterface.java (added)
+++ struts/struts2/branches/STRUTS_3_X/xwork-core/src/test/java/org/apache/struts2/xwork2/ProxyInvocationInterface.java Fri Dec  2 16:33:03 2011
@@ -0,0 +1,8 @@
+package org.apache.struts2.xwork2;
+
+/**
+ * Need by the ProxyInvocationTest
+ */
+public interface ProxyInvocationInterface {
+    public String show();
+}



Mime
View raw message