This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch action-context-boost in repository https://gitbox.apache.org/repos/asf/struts.git
The following commit(s) were added to refs/heads/action-context-boost by this push: new 8a68c62 WW-4789 WW-3788 Adds instance bind() to simplify bind operation 8a68c62 is described below commit 8a68c6234d7d4ef4b6bd62613a2e470168aaaa01 Author: Lukasz Lenart <lukaszlen...@apache.org> AuthorDate: Sun Apr 5 07:37:42 2020 +0200 WW-4789 WW-3788 Adds instance bind() to simplify bind operation --- .../java/com/opensymphony/xwork2/ActionContext.java | 21 +++++++++++---------- .../xwork2/config/impl/DefaultConfiguration.java | 2 +- .../xwork2/util/XWorkTestCaseHelper.java | 4 ++-- .../org/apache/struts2/ServletActionContext.java | 2 +- .../struts2/dispatcher/PrepareOperations.java | 4 ++-- .../apache/struts2/util/StrutsTestCaseHelper.java | 2 +- .../java/org/apache/struts2/views/jsp/TagUtils.java | 2 +- .../com/opensymphony/xwork2/ActionContextTest.java | 4 ++-- .../xwork2/ActionContextThreadLocalTest.java | 2 +- .../com/opensymphony/xwork2/ActionSupportTest.java | 2 +- .../xwork2/DefaultTextProviderTest.java | 2 +- .../com/opensymphony/xwork2/LocaleAwareTest.java | 2 +- .../com/opensymphony/xwork2/StubValueStack.java | 2 +- .../xwork2/interceptor/ChainingInterceptorTest.java | 2 +- .../interceptor/ConversionErrorInterceptorTest.java | 4 ++-- .../interceptor/DefaultWorkflowInterceptorTest.java | 2 +- .../ExceptionMappingInterceptorTest.java | 2 +- .../ParameterRemoverInterceptorTest.java | 2 +- .../interceptor/ValidationErrorAwareTest.java | 2 +- ...dationInterceptorPrefixMethodInvocationTest.java | 2 +- .../AnnotationParameterFilterInterceptorTest.java | 8 ++++---- .../ActionAutowiringInterceptorTest.java | 4 ++-- .../ConversionErrorFieldValidatorTest.java | 2 +- .../DefaultActionValidatorManagerTest.java | 2 +- .../validator/SimpleActionValidationTest.java | 4 ++-- .../apache/struts2/ServletActionContextTest.java | 2 +- .../interceptor/ClearSessionInterceptorTest.java | 2 +- .../struts2/interceptor/I18nInterceptorTest.java | 2 +- .../interceptor/MessageStoreInterceptorTest.java | 12 ++++++------ .../MessageStorePreResultListenerTest.java | 8 ++++---- .../StrutsConversionErrorInterceptorTest.java | 2 +- .../struts2/interceptor/TokenInterceptorTest.java | 2 +- .../apache/struts2/result/PlainTextResultTest.java | 2 +- .../struts2/util/InvocationSessionStoreTest.java | 6 +++--- .../org/apache/struts2/util/TokenHelperTest.java | 2 +- .../views/freemarker/FreeMarkerResultTest.java | 2 +- .../freemarker/FreemarkerResultMockedTest.java | 2 +- .../apache/struts2/views/jsp/AbstractTagTest.java | 2 +- .../org/apache/struts2/views/jsp/TextTagTest.java | 2 +- .../org/apache/struts2/views/jsp/URLTagTest.java | 2 +- .../PackageBasedActionConfigBuilderTest.java | 4 ++-- .../org/apache/struts2/EmbeddedJSPResultTest.java | 2 +- .../struts2/views/java/simple/AbstractTest.java | 2 +- .../apache/struts2/views/java/simple/TokenTest.java | 2 +- .../struts2/osgi/OsgiConfigurationProvider.java | 2 +- .../portlet/context/PortletActionContextTest.java | 2 +- .../interceptor/PortletAwareInterceptorTest.java | 6 +++--- .../interceptor/PortletStateInterceptorTest.java | 6 +++--- .../struts2/portlet/result/PortletResultTest.java | 2 +- .../struts2/portlet/util/PortletUrlHelperTest.java | 2 +- .../apache/struts2/views/jsp/PortletUrlTagTest.java | 2 +- .../struts2/rest/ContentTypeHandlerManagerTest.java | 2 +- .../struts2/rest/RestWorkflowInterceptorTest.java | 2 +- .../struts2/rest/handler/JuneauXmlHandlerTest.java | 2 +- 54 files changed, 88 insertions(+), 87 deletions(-) diff --git a/core/src/main/java/com/opensymphony/xwork2/ActionContext.java b/core/src/main/java/com/opensymphony/xwork2/ActionContext.java index d9f6f48..95baaab 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ActionContext.java +++ b/core/src/main/java/com/opensymphony/xwork2/ActionContext.java @@ -128,24 +128,25 @@ public class ActionContext implements Serializable { return new ActionContext(context); } + /** + * Binds the provided context with the current thread + * + * @param actionContext context to bind to the thread + * @return context which was bound to the thread + */ public static ActionContext bind(ActionContext actionContext) { ActionContext.setContext(actionContext); return ActionContext.getContext(); } - public static ActionContext ofAndBind(Map<String, Object> context) { - return bind(of(context)); - } - /** - * Creates a new ActionContext based on passed in ActionContext - * and assign this instance to the current thread + * Binds this context with the current thread * - * @param actionContext ActionContext to be used for current thread - * @return new ActionContext + * @return this context which was bound to the thread */ - public static ActionContext ofAndBind(ActionContext actionContext) { - return bind(actionContext); + public ActionContext bind() { + ActionContext.setContext(this); + return ActionContext.getContext(); } /** diff --git a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java index b818139..3a714b8 100644 --- a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java +++ b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java @@ -223,7 +223,7 @@ public class DefaultConfiguration implements Configuration { ActionContext context = ActionContext.getContext(); if (context == null) { ValueStack vs = cont.getInstance(ValueStackFactory.class).createValueStack(); - context = ActionContext.ofAndBind(vs.getContext()); + context = ActionContext.of(vs.getContext()).bind(); } return context; } diff --git a/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java b/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java index f0ff4a6..6bef3af 100644 --- a/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java +++ b/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java @@ -40,7 +40,7 @@ public class XWorkTestCaseHelper { // Reset the value stack ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack(); stack.getContext().put(ActionContext.CONTAINER, container); - ActionContext.ofAndBind(stack.getContext()); + ActionContext.of(stack.getContext()).bind(); // clear out localization //container.getInstance(LocalizedTextUtil.class).reset(); @@ -80,7 +80,7 @@ public class XWorkTestCaseHelper { // Reset the value stack ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack(); stack.getContext().put(ActionContext.CONTAINER, container); - ActionContext.ofAndBind(stack.getContext()); + ActionContext.of(stack.getContext()).bind(); return configurationManager; } diff --git a/core/src/main/java/org/apache/struts2/ServletActionContext.java b/core/src/main/java/org/apache/struts2/ServletActionContext.java index b85b5d1..c9840dc 100644 --- a/core/src/main/java/org/apache/struts2/ServletActionContext.java +++ b/core/src/main/java/org/apache/struts2/ServletActionContext.java @@ -49,7 +49,7 @@ public class ServletActionContext implements StrutsStatics { public static ActionContext getActionContext(HttpServletRequest req) { ValueStack vs = getValueStack(req); if (vs != null) { - return ActionContext.ofAndBind(vs.getContext()); + return ActionContext.of(vs.getContext()).bind(); } else { return null; } diff --git a/core/src/main/java/org/apache/struts2/dispatcher/PrepareOperations.java b/core/src/main/java/org/apache/struts2/dispatcher/PrepareOperations.java index 8415a56..5ccc9d6 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/PrepareOperations.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/PrepareOperations.java @@ -77,13 +77,13 @@ public class PrepareOperations { ActionContext oldContext = ActionContext.getContext(); if (oldContext != null) { // detected existing context, so we are probably in a forward - ctx = ActionContext.ofAndBind(new HashMap<>(oldContext.getContextMap())); + ctx = ActionContext.of(new HashMap<>(oldContext.getContextMap())).bind(); } else { ctx = ServletActionContext.getActionContext(request); //checks if we are probably in an async if (ctx == null) { ValueStack stack = dispatcher.getContainer().getInstance(ValueStackFactory.class).createValueStack(); stack.getContext().putAll(dispatcher.createContextMap(request, response, null)); - ctx = ActionContext.ofAndBind(stack.getContext()); + ctx = ActionContext.of(stack.getContext()).bind(); } } request.setAttribute(CLEANUP_RECURSION_COUNTER, counter); diff --git a/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java b/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java index ca3323d..e87ec6e 100644 --- a/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java +++ b/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java @@ -48,7 +48,7 @@ public class StrutsTestCaseHelper { Container container = du.getContainer(); ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack(); stack.getContext().put(ActionContext.CONTAINER, container); - ActionContext.ofAndBind(stack.getContext()); + ActionContext.of(stack.getContext()).bind(); return du; } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java b/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java index 0b610b1..e4c1645 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java @@ -69,7 +69,7 @@ public class TagUtils { req.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack); // also tie this stack/context to the ThreadLocal - ActionContext.ofAndBind(stack.getContext()); + ActionContext.of(stack.getContext()).bind(); } else { // let's make sure that the current page context is in the action context // TODO: refactor this to stop using put() diff --git a/core/src/test/java/com/opensymphony/xwork2/ActionContextTest.java b/core/src/test/java/com/opensymphony/xwork2/ActionContextTest.java index 70bc3c5..8651b95 100644 --- a/core/src/test/java/com/opensymphony/xwork2/ActionContextTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/ActionContextTest.java @@ -57,7 +57,7 @@ public class ActionContextTest extends XWorkTestCase { extraContext.put(ActionContext.SESSION, session); extraContext.put(ActionContext.PARAMETERS, HttpParameters.create(params).build()); extraContext.put(ActionContext.ACTION_NAME, ACTION_NAME); - context = ActionContext.ofAndBind(extraContext); + context = ActionContext.of(extraContext).bind(); } public void testContextParams() { @@ -87,7 +87,7 @@ public class ActionContextTest extends XWorkTestCase { public void testContextMap() { Map<String, Object> map = new HashMap<>(); - ActionContext.ofAndBind(map); + ActionContext.of(map).bind(); assertEquals(map, ActionContext.getContext().getContextMap()); } diff --git a/core/src/test/java/com/opensymphony/xwork2/ActionContextThreadLocalTest.java b/core/src/test/java/com/opensymphony/xwork2/ActionContextThreadLocalTest.java index efc876b..de0b5c1 100644 --- a/core/src/test/java/com/opensymphony/xwork2/ActionContextThreadLocalTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/ActionContextThreadLocalTest.java @@ -38,7 +38,7 @@ public class ActionContextThreadLocalTest extends TestCase { } public void testSetContext() { - ActionContext context = ActionContext.ofAndBind(new HashMap<>()); + ActionContext context = ActionContext.of(new HashMap<>()).bind(); assertEquals(context, ActionContext.getContext()); } diff --git a/core/src/test/java/com/opensymphony/xwork2/ActionSupportTest.java b/core/src/test/java/com/opensymphony/xwork2/ActionSupportTest.java index c6ea080..2fad4c7 100644 --- a/core/src/test/java/com/opensymphony/xwork2/ActionSupportTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/ActionSupportTest.java @@ -159,7 +159,7 @@ public class ActionSupportTest extends XWorkTestCase { ActionContext.getContext().setLocale(Locale.ITALY); assertEquals(Locale.ITALY, as.getLocale()); - ActionContext.ofAndBind(new HashMap<>()); + ActionContext.of(new HashMap<>()).bind(); assertEquals(defLocale, as.getLocale()); // ActionContext will create a new context, when it was set to null before } diff --git a/core/src/test/java/com/opensymphony/xwork2/DefaultTextProviderTest.java b/core/src/test/java/com/opensymphony/xwork2/DefaultTextProviderTest.java index 3024399..60a2c0c 100644 --- a/core/src/test/java/com/opensymphony/xwork2/DefaultTextProviderTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/DefaultTextProviderTest.java @@ -129,7 +129,7 @@ public class DefaultTextProviderTest extends XWorkTestCase { protected void setUp() throws Exception { super.setUp(); - ActionContext ctx = ActionContext.ofAndBind(new HashMap<>()); + ActionContext ctx = ActionContext.of(new HashMap<>()).bind(); ctx.setLocale(Locale.CANADA); container.getInstance(LocalizedTextProvider.class).addDefaultResourceBundle(DefaultTextProviderTest.class.getName()); diff --git a/core/src/test/java/com/opensymphony/xwork2/LocaleAwareTest.java b/core/src/test/java/com/opensymphony/xwork2/LocaleAwareTest.java index 47f0f0f..f1d44ad 100644 --- a/core/src/test/java/com/opensymphony/xwork2/LocaleAwareTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/LocaleAwareTest.java @@ -69,6 +69,6 @@ public class LocaleAwareTest extends XWorkTestCase { ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack(); stack.getActionContext().setContainer(container); - ActionContext.ofAndBind(stack.getContext()); + ActionContext.of(stack.getContext()).bind(); } } diff --git a/core/src/test/java/com/opensymphony/xwork2/StubValueStack.java b/core/src/test/java/com/opensymphony/xwork2/StubValueStack.java index 6b5ed38..4673734 100644 --- a/core/src/test/java/com/opensymphony/xwork2/StubValueStack.java +++ b/core/src/test/java/com/opensymphony/xwork2/StubValueStack.java @@ -37,7 +37,7 @@ public class StubValueStack implements ValueStack { @Override public ActionContext getActionContext() { - return ActionContext.ofAndBind(ctx); + return ActionContext.of(ctx).bind(); } public void setDefaultType(Class defaultType) { diff --git a/core/src/test/java/com/opensymphony/xwork2/interceptor/ChainingInterceptorTest.java b/core/src/test/java/com/opensymphony/xwork2/interceptor/ChainingInterceptorTest.java index b89b514..d809e4b 100644 --- a/core/src/test/java/com/opensymphony/xwork2/interceptor/ChainingInterceptorTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/interceptor/ChainingInterceptorTest.java @@ -154,7 +154,7 @@ public class ChainingInterceptorTest extends XWorkTestCase { mockInvocation = new Mock(ActionInvocation.class); mockInvocation.expectAndReturn("getStack", stack); mockInvocation.expectAndReturn("invoke", Action.SUCCESS); - mockInvocation.expectAndReturn("getInvocationContext", ActionContext.ofAndBind(new HashMap<>())); + mockInvocation.expectAndReturn("getInvocationContext", ActionContext.of(new HashMap<>()).bind()); mockInvocation.expectAndReturn("getResult", new ActionChainResult()); invocation = (ActionInvocation) mockInvocation.proxy(); interceptor = new ChainingInterceptor(); diff --git a/core/src/test/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptorTest.java b/core/src/test/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptorTest.java index 559cca8..6c7ec9c 100644 --- a/core/src/test/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptorTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptorTest.java @@ -128,7 +128,7 @@ public class ConversionErrorInterceptorTest extends XWorkTestCase { } private ActionContext createActionContext() { - ActionContext ac = ActionContext.ofAndBind(stack.getContext()); + ActionContext ac = ActionContext.of(stack.getContext()).bind(); ac.setConversionErrors(conversionErrors); ac.setValueStack(stack); return ac; @@ -141,7 +141,7 @@ public class ConversionErrorInterceptorTest extends XWorkTestCase { mockInvocation = new Mock(ActionInvocation.class); invocation = (ActionInvocation) mockInvocation.proxy(); stack = ActionContext.getContext().getValueStack(); - context = ActionContext.ofAndBind(stack.getContext()); + context = ActionContext.of(stack.getContext()).bind(); conversionErrors = new HashMap<>(); context.setConversionErrors(conversionErrors); mockInvocation.matchAndReturn("getInvocationContext", context); diff --git a/core/src/test/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptorTest.java b/core/src/test/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptorTest.java index 5af6f3f..6ac2129 100644 --- a/core/src/test/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptorTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptorTest.java @@ -183,7 +183,7 @@ public class DefaultWorkflowInterceptorTest extends XWorkTestCase { EasyMock.replay(action); EasyMock.replay(proxy); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setActionInvocation(invocation); } diff --git a/core/src/test/java/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptorTest.java b/core/src/test/java/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptorTest.java index 37bcabc..d14b2b8 100644 --- a/core/src/test/java/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptorTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptorTest.java @@ -293,7 +293,7 @@ public class ExceptionMappingInterceptorTest extends XWorkTestCase { stack = ActionContext.getContext().getValueStack(); mockInvocation = new Mock(ActionInvocation.class); mockInvocation.expectAndReturn("getStack", stack); - mockInvocation.expectAndReturn("getInvocationContext", ActionContext.ofAndBind(new HashMap<>())); + mockInvocation.expectAndReturn("getInvocationContext", ActionContext.of(new HashMap<>()).bind()); interceptor = new ExceptionMappingInterceptor(); interceptor.init(); } diff --git a/core/src/test/java/com/opensymphony/xwork2/interceptor/ParameterRemoverInterceptorTest.java b/core/src/test/java/com/opensymphony/xwork2/interceptor/ParameterRemoverInterceptorTest.java index c65376f..928d13f 100644 --- a/core/src/test/java/com/opensymphony/xwork2/interceptor/ParameterRemoverInterceptorTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/interceptor/ParameterRemoverInterceptorTest.java @@ -45,7 +45,7 @@ public class ParameterRemoverInterceptorTest extends TestCase { @Override protected void setUp() throws Exception { contextMap = new LinkedHashMap<>(); - context = ActionContext.ofAndBind(contextMap); + context = ActionContext.of(contextMap).bind(); actionInvocation = createMock(ActionInvocation.class); expect(actionInvocation.getAction()).andStubReturn(new SampleAction()); diff --git a/core/src/test/java/com/opensymphony/xwork2/interceptor/ValidationErrorAwareTest.java b/core/src/test/java/com/opensymphony/xwork2/interceptor/ValidationErrorAwareTest.java index 8eb52ba..06586eb 100644 --- a/core/src/test/java/com/opensymphony/xwork2/interceptor/ValidationErrorAwareTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/interceptor/ValidationErrorAwareTest.java @@ -87,7 +87,7 @@ public class ValidationErrorAwareTest extends XWorkTestCase { EasyMock.replay(action); EasyMock.replay(proxy); - ActionContext context = ActionContext.ofAndBind(new HashMap<>()); + ActionContext context = ActionContext.of(new HashMap<>()).bind(); context.setActionInvocation(invocation); } diff --git a/core/src/test/java/com/opensymphony/xwork2/interceptor/ValidationInterceptorPrefixMethodInvocationTest.java b/core/src/test/java/com/opensymphony/xwork2/interceptor/ValidationInterceptorPrefixMethodInvocationTest.java index 11d5adc..f2dfe59 100644 --- a/core/src/test/java/com/opensymphony/xwork2/interceptor/ValidationInterceptorPrefixMethodInvocationTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/interceptor/ValidationInterceptorPrefixMethodInvocationTest.java @@ -101,7 +101,7 @@ public class ValidationInterceptorPrefixMethodInvocationTest extends XWorkTestCa EasyMock.replay(action); EasyMock.replay(proxy); - ActionContext context = ActionContext.ofAndBind(new HashMap<>()); + ActionContext context = ActionContext.of(new HashMap<>()).bind(); context.setActionInvocation(invocation); } } diff --git a/core/src/test/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationParameterFilterInterceptorTest.java b/core/src/test/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationParameterFilterInterceptorTest.java index 05c0151..ead2045 100644 --- a/core/src/test/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationParameterFilterInterceptorTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationParameterFilterInterceptorTest.java @@ -55,7 +55,7 @@ public class AnnotationParameterFilterInterceptorTest extends TestCase { parameterMap.put("job", "Baker"); parameterMap.put("name", "Martin"); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setParameters(HttpParameters.create(parameterMap).build()); Action action = new BlockingByDefaultAction(); @@ -92,7 +92,7 @@ public class AnnotationParameterFilterInterceptorTest extends TestCase { parameterMap.put("job", "Baker"); parameterMap.put("name", "Martin"); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setParameters(HttpParameters.create(parameterMap).build()); Action action = new AllowingByDefaultAction(); @@ -131,7 +131,7 @@ public class AnnotationParameterFilterInterceptorTest extends TestCase { parameterMap.put("m1", "s1"); parameterMap.put("m2", "s2"); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setParameters(HttpParameters.create(parameterMap).build()); stack.push(new BlockingByDefaultModel()); @@ -170,7 +170,7 @@ public class AnnotationParameterFilterInterceptorTest extends TestCase { parameterMap.put("m1", "s1"); parameterMap.put("m2", "s2"); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setParameters(HttpParameters.create(parameterMap).build()); stack.push(new AllowingByDefaultModel()); diff --git a/core/src/test/java/com/opensymphony/xwork2/spring/interceptor/ActionAutowiringInterceptorTest.java b/core/src/test/java/com/opensymphony/xwork2/spring/interceptor/ActionAutowiringInterceptorTest.java index bb73d36..a48fee7 100644 --- a/core/src/test/java/com/opensymphony/xwork2/spring/interceptor/ActionAutowiringInterceptorTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/spring/interceptor/ActionAutowiringInterceptorTest.java @@ -78,7 +78,7 @@ public class ActionAutowiringInterceptorTest extends XWorkTestCase { protected void loadSpringApplicationContextIntoApplication(ApplicationContext appContext) { Map<String, Object> context = new HashMap<>(); - ActionContext actionContext = ActionContext.ofAndBind(context); + ActionContext actionContext = ActionContext.of(context).bind(); Map<String, Object> application = new HashMap<>(); application.put(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, appContext); @@ -105,7 +105,7 @@ public class ActionAutowiringInterceptorTest extends XWorkTestCase { public void testIfApplicationContextIsNullThenBeanWillNotBeWiredUp() throws Exception { Map<String, Object> context = new HashMap<>(); - ActionContext actionContext = ActionContext.ofAndBind(context); + ActionContext actionContext = ActionContext.of(context).bind(); actionContext.setApplication(new HashMap<>()); diff --git a/core/src/test/java/com/opensymphony/xwork2/validator/ConversionErrorFieldValidatorTest.java b/core/src/test/java/com/opensymphony/xwork2/validator/ConversionErrorFieldValidatorTest.java index cc343da..4207962 100644 --- a/core/src/test/java/com/opensymphony/xwork2/validator/ConversionErrorFieldValidatorTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/validator/ConversionErrorFieldValidatorTest.java @@ -49,7 +49,7 @@ public class ConversionErrorFieldValidatorTest extends XWorkTestCase { public void setUp() throws Exception { super.setUp(); ValueStack stack = ActionContext.getContext().getValueStack(); - ActionContext context = ActionContext.ofAndBind(stack.getContext()); + ActionContext context = ActionContext.of(stack.getContext()).bind(); Map<String, ConversionData> conversionErrors = new HashMap<>(); conversionErrors.put("foo", new ConversionData("bar", Integer.class)); diff --git a/core/src/test/java/com/opensymphony/xwork2/validator/DefaultActionValidatorManagerTest.java b/core/src/test/java/com/opensymphony/xwork2/validator/DefaultActionValidatorManagerTest.java index d0cad75..5335d49 100644 --- a/core/src/test/java/com/opensymphony/xwork2/validator/DefaultActionValidatorManagerTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/validator/DefaultActionValidatorManagerTest.java @@ -67,7 +67,7 @@ public class DefaultActionValidatorManagerTest extends XWorkTestCase { actionValidatorManager.setValidatorFactory((ValidatorFactory)mockValidatorFactory.proxy()); stubValueStack = new StubValueStack(); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setValueStack(stubValueStack); DefaultFileManagerFactory factory = new DefaultFileManagerFactory(); diff --git a/core/src/test/java/com/opensymphony/xwork2/validator/SimpleActionValidationTest.java b/core/src/test/java/com/opensymphony/xwork2/validator/SimpleActionValidationTest.java index 363b331..709ba3c 100644 --- a/core/src/test/java/com/opensymphony/xwork2/validator/SimpleActionValidationTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/validator/SimpleActionValidationTest.java @@ -54,7 +54,7 @@ public class SimpleActionValidationTest extends XWorkTestCase { assertFalse(validationAware.hasFieldErrors()); // put in an out-of-range value to see if the old validators still work - ActionContext.ofAndBind(new HashMap<>()); + ActionContext.of(new HashMap<>()).bind(); params.put("bar", "42"); extraContext.put(ActionContext.PARAMETERS, HttpParameters.create(params).build()); @@ -124,7 +124,7 @@ public class SimpleActionValidationTest extends XWorkTestCase { try { ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.VALIDATION_ACTION_NAME, null, extraContext); ValueStack stack = ActionContext.getContext().getValueStack(); - ActionContext actionContext = ActionContext.ofAndBind(stack.getContext()); + ActionContext actionContext = ActionContext.of(stack.getContext()).bind(); actionContext.setLocale(Locale.US); proxy.execute(); diff --git a/core/src/test/java/org/apache/struts2/ServletActionContextTest.java b/core/src/test/java/org/apache/struts2/ServletActionContextTest.java index 7a1913e..2148b1c 100644 --- a/core/src/test/java/org/apache/struts2/ServletActionContextTest.java +++ b/core/src/test/java/org/apache/struts2/ServletActionContextTest.java @@ -54,7 +54,7 @@ public class ServletActionContextTest extends TestCase implements StrutsStatics extraContext.put(HTTP_RESPONSE, response); extraContext.put(SERVLET_CONTEXT, servletContext); - actionContext = ActionContext.ofAndBind(extraContext); + actionContext = ActionContext.of(extraContext).bind(); } public void testContextParams() { diff --git a/core/src/test/java/org/apache/struts2/interceptor/ClearSessionInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/ClearSessionInterceptorTest.java index 65d3a80..2928648 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/ClearSessionInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/ClearSessionInterceptorTest.java @@ -34,7 +34,7 @@ public class ClearSessionInterceptorTest extends StrutsInternalTestCase { public void testCreateSession() throws Exception { ClearSessionInterceptor interceptor = new ClearSessionInterceptor(); MockActionInvocation invocation = new MockActionInvocation(); - ActionContext context = ActionContext.ofAndBind(new HashMap<>()); + ActionContext context = ActionContext.of(new HashMap<>()).bind(); Map<String, Object> session = new HashMap<>(); session.put("Test1", "Test1"); session.put("Test2", "Test2"); diff --git a/core/src/test/java/org/apache/struts2/interceptor/I18nInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/I18nInterceptorTest.java index 927ad29..abb5d2d 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/I18nInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/I18nInterceptorTest.java @@ -256,7 +256,7 @@ public class I18nInterceptorTest extends TestCase { interceptor.init(); session = new HashMap<>(); - ac = ActionContext.ofAndBind(new HashMap<>()); + ac = ActionContext.of(new HashMap<>()).bind(); ac.setSession(session); ac.setParameters(HttpParameters.create().build()); diff --git a/core/src/test/java/org/apache/struts2/interceptor/MessageStoreInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/MessageStoreInterceptorTest.java index 09e51c7..4413099 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/MessageStoreInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/MessageStoreInterceptorTest.java @@ -66,7 +66,7 @@ public class MessageStoreInterceptorTest extends StrutsInternalTestCase { action.addActionMessage("some action message 1"); action.addFieldError("field2", "some field error 2"); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setParameters(HttpParameters.create().build()); HttpSession mockedSession = EasyMock.createControl().createMock(HttpSession.class); @@ -141,7 +141,7 @@ public class MessageStoreInterceptorTest extends StrutsInternalTestCase { EasyMock.replay(mockedRequest); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setParameters(HttpParameters.create().build()); actionContext.setSession(sessionMap); @@ -193,7 +193,7 @@ public class MessageStoreInterceptorTest extends StrutsInternalTestCase { action.addFieldError("field1", "some field error 1"); action.addFieldError("field2", "some field error 2"); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setParameters(HttpParameters.create().build()); actionContext.setSession(sessionMap); @@ -236,7 +236,7 @@ public class MessageStoreInterceptorTest extends StrutsInternalTestCase { Map<String, Object> paramMap = new LinkedHashMap<>(); paramMap.put("operationMode", new String[]{MessageStoreInterceptor.RETRIEVE_MODE}); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setParameters(HttpParameters.create(paramMap).build()); ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class); @@ -259,7 +259,7 @@ public class MessageStoreInterceptorTest extends StrutsInternalTestCase { Map<String, Object> paramMap = new LinkedHashMap<>(); paramMap.put("operationMode", new String[]{MessageStoreInterceptor.STORE_MODE}); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setParameters(HttpParameters.create(paramMap).build()); ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class); @@ -279,7 +279,7 @@ public class MessageStoreInterceptorTest extends StrutsInternalTestCase { public void testRequestOperationMode3() { - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setParameters(HttpParameters.create().build()); ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class); diff --git a/core/src/test/java/org/apache/struts2/interceptor/MessageStorePreResultListenerTest.java b/core/src/test/java/org/apache/struts2/interceptor/MessageStorePreResultListenerTest.java index 5d4f503..6b85930 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/MessageStorePreResultListenerTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/MessageStorePreResultListenerTest.java @@ -43,7 +43,7 @@ public class MessageStorePreResultListenerTest extends StrutsInternalTestCase { public void testSessionWasInvalidated() { // given - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setParameters(HttpParameters.create().build()); ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class); @@ -84,7 +84,7 @@ public class MessageStorePreResultListenerTest extends StrutsInternalTestCase { public void testResponseWasComitted() { // given - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setParameters(HttpParameters.create().build()); ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class); @@ -131,7 +131,7 @@ public class MessageStorePreResultListenerTest extends StrutsInternalTestCase { action.addFieldError("field1", "some field error 1"); action.addFieldError("field2", "some field error 2"); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setParameters(HttpParameters.create().build()); actionContext.setSession(sessionMap); @@ -212,7 +212,7 @@ public class MessageStorePreResultListenerTest extends StrutsInternalTestCase { action.addFieldError("field1", "some field error 1"); action.addFieldError("field2", "some field error 2"); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setParameters(HttpParameters.create().build()); actionContext.setSession(sessionMap); diff --git a/core/src/test/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptorTest.java index 83705e0..4077dde 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptorTest.java @@ -83,7 +83,7 @@ public class StrutsConversionErrorInterceptorTest extends StrutsInternalTestCase mockInvocation = new Mock(ActionInvocation.class); invocation = (ActionInvocation) mockInvocation.proxy(); stack = ActionContext.getContext().getValueStack(); - context = ActionContext.ofAndBind(stack.getContext()); + context = ActionContext.of(stack.getContext()).bind(); conversionErrors = new HashMap<>(); context.setConversionErrors(conversionErrors); mockInvocation.matchAndReturn("getInvocationContext", context); diff --git a/core/src/test/java/org/apache/struts2/interceptor/TokenInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/TokenInterceptorTest.java index d68d0dc..f10e5e5 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/TokenInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/TokenInterceptorTest.java @@ -122,7 +122,7 @@ public class TokenInterceptorTest extends StrutsInternalTestCase { ValueStack stack = ActionContext.getContext().getValueStack(); stack.getContext().putAll(extraContext); - oldContext = ActionContext.ofAndBind(stack.getContext()); + oldContext = ActionContext.of(stack.getContext()).bind(); } protected ActionProxy buildProxy(String actionName) throws Exception { diff --git a/core/src/test/java/org/apache/struts2/result/PlainTextResultTest.java b/core/src/test/java/org/apache/struts2/result/PlainTextResultTest.java index 906a1e7..2a055d3 100644 --- a/core/src/test/java/org/apache/struts2/result/PlainTextResultTest.java +++ b/core/src/test/java/org/apache/struts2/result/PlainTextResultTest.java @@ -130,7 +130,7 @@ public class PlainTextResultTest extends StrutsInternalTestCase { response.setWriter(writer); servletContext = new StrutsMockServletContext(); stack = ActionContext.getContext().getValueStack(); - context = ActionContext.ofAndBind(stack.getContext()); + context = ActionContext.of(stack.getContext()).bind(); context.put(StrutsStatics.HTTP_RESPONSE, response); context.put(StrutsStatics.SERVLET_CONTEXT, servletContext); invocation = new MockActionInvocation(); diff --git a/core/src/test/java/org/apache/struts2/util/InvocationSessionStoreTest.java b/core/src/test/java/org/apache/struts2/util/InvocationSessionStoreTest.java index 05027f3..357a42e 100644 --- a/core/src/test/java/org/apache/struts2/util/InvocationSessionStoreTest.java +++ b/core/src/test/java/org/apache/struts2/util/InvocationSessionStoreTest.java @@ -71,7 +71,7 @@ public class InvocationSessionStoreTest extends StrutsInternalTestCase { ActionContext actionContext = ActionContext.getContext(); InvocationSessionStore.storeInvocation(INVOCATION_KEY, TOKEN_VALUE, invocation); - ActionContext actionContext2 = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext2 = ActionContext.of(new HashMap<>()).bind(); actionContext2.setSession(session); assertEquals(actionContext2, ActionContext.getContext()); @@ -112,7 +112,7 @@ public class InvocationSessionStoreTest extends StrutsInternalTestCase { InvocationSessionStore.storeInvocation(INVOCATION_KEY, TOKEN_VALUE, invocation); - ActionContext actionContext2 = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext2 = ActionContext.of(new HashMap<>()).bind(); actionContext2.setSession(session); assertEquals(actionContext2, ActionContext.getContext()); @@ -134,7 +134,7 @@ public class InvocationSessionStoreTest extends StrutsInternalTestCase { super.setUp(); stack = ActionContext.getContext().getValueStack(); - ActionContext actionContext = ActionContext.ofAndBind(stack.getContext()); + ActionContext actionContext = ActionContext.of(stack.getContext()).bind(); session = new HashMap<>(); actionContext.setSession(session); diff --git a/core/src/test/java/org/apache/struts2/util/TokenHelperTest.java b/core/src/test/java/org/apache/struts2/util/TokenHelperTest.java index f3abebd..e1bd5d7 100644 --- a/core/src/test/java/org/apache/struts2/util/TokenHelperTest.java +++ b/core/src/test/java/org/apache/struts2/util/TokenHelperTest.java @@ -87,7 +87,7 @@ public class TokenHelperTest extends TestCase { protected void setUp() throws Exception { session = new HashMap<>(); Map<String, Object> ctxMap = new TreeMap<>(); - ActionContext ctx = ActionContext.ofAndBind(ctxMap); + ActionContext ctx = ActionContext.of(ctxMap).bind(); ctx.setSession(session); ctx.setParameters(HttpParameters.create().build()); } diff --git a/core/src/test/java/org/apache/struts2/views/freemarker/FreeMarkerResultTest.java b/core/src/test/java/org/apache/struts2/views/freemarker/FreeMarkerResultTest.java index ebd477b..0e386cb 100644 --- a/core/src/test/java/org/apache/struts2/views/freemarker/FreeMarkerResultTest.java +++ b/core/src/test/java/org/apache/struts2/views/freemarker/FreeMarkerResultTest.java @@ -134,7 +134,7 @@ public class FreeMarkerResultTest extends StrutsInternalTestCase { servletContext = new StrutsMockServletContext(); stack = ActionContext.getContext().getValueStack(); - context = ActionContext.ofAndBind(stack.getContext()); + context = ActionContext.of(stack.getContext()).bind(); context.setServletResponse(response); context.setServletRequest(request); context.setServletContext(servletContext); diff --git a/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerResultMockedTest.java b/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerResultMockedTest.java index 7bdbe39..cfc3e67 100644 --- a/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerResultMockedTest.java +++ b/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerResultMockedTest.java @@ -246,7 +246,7 @@ public class FreemarkerResultMockedTest extends StrutsInternalTestCase { request = new MockHttpServletRequest(); stack = ActionContext.getContext().getValueStack(); - context = ActionContext.ofAndBind(stack.getContext()); + context = ActionContext.of(stack.getContext()).bind(); context.setServletResponse(response); context.setServletRequest(request); context.setServletContext(servletContext); diff --git a/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java index dfc7226..eb410ac 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java @@ -121,7 +121,7 @@ public abstract class AbstractTagTest extends StrutsInternalTestCase { extraContext.remove(ActionContext.LOCALE); stack.getContext().putAll(extraContext); - ActionContext actionContext = ActionContext.ofAndBind(context); + ActionContext actionContext = ActionContext.of(context).bind(); actionContext.setServletRequest(request); actionContext.setServletResponse(response); actionContext.setServletContext(servletContext); diff --git a/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java index d0c4bad..e0a1201 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java @@ -308,7 +308,7 @@ public class TextTagTest extends AbstractTagTest { super.setUp(); tag = new TextTag(); tag.setPageContext(pageContext); - ActionContext.ofAndBind(stack.getContext()); + ActionContext.of(stack.getContext()).bind(); } protected void tearDown() throws Exception { diff --git a/core/src/test/java/org/apache/struts2/views/jsp/URLTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/URLTagTest.java index 1b25747..4fb3b0d 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/URLTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/URLTagTest.java @@ -556,7 +556,7 @@ public class URLTagTest extends AbstractUITagTest { extraContext.remove(ActionContext.LOCALE); stack.getContext().putAll(extraContext); - ActionContext actionContext = ActionContext.ofAndBind(context); + ActionContext actionContext = ActionContext.of(context).bind(); actionContext.setServletRequest(request); actionContext.setServletResponse(response); actionContext.setServletContext(servletContext); diff --git a/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java b/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java index d2fe6ef..2d647b3 100644 --- a/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java +++ b/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java @@ -89,7 +89,7 @@ public class PackageBasedActionConfigBuilderTest extends TestCase { @Override public void setUp() throws Exception { super.setUp(); - ActionContext context = ActionContext.ofAndBind(new HashMap<>()); + ActionContext context = ActionContext.of(new HashMap<>()).bind(); context.setContainer(new DummyContainer()); } @@ -691,7 +691,7 @@ public class PackageBasedActionConfigBuilderTest extends TestCase { ObjectFactory workingFactory = configuration.getContainer().getInstance(ObjectFactory.class); ConventionUnknownHandler uh = new ConventionUnknownHandler(configuration, workingFactory, context, mockContainer, "struts-default", null, "-"); - ActionContext actionContext = ActionContext.ofAndBind(Collections.emptyMap()); + ActionContext actionContext = ActionContext.of(Collections.emptyMap()).bind(); Result result = uh.handleUnknownResult(actionContext, "foo", pkgConfig.getActionConfigs().get("foo"), "bar"); assertNotNull(result); diff --git a/plugins/embeddedjsp/src/test/java/org/apache/struts2/EmbeddedJSPResultTest.java b/plugins/embeddedjsp/src/test/java/org/apache/struts2/EmbeddedJSPResultTest.java index 08c5fcb..f0e42fe 100644 --- a/plugins/embeddedjsp/src/test/java/org/apache/struts2/EmbeddedJSPResultTest.java +++ b/plugins/embeddedjsp/src/test/java/org/apache/struts2/EmbeddedJSPResultTest.java @@ -329,7 +329,7 @@ public class EmbeddedJSPResultTest extends TestCase { EasyMock.replay(request); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setParameters(HttpParameters.create(params).build()); actionContext.setServletRequest(request); actionContext.setServletResponse(response); diff --git a/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/AbstractTest.java b/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/AbstractTest.java index 6be2010..322f1de 100644 --- a/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/AbstractTest.java +++ b/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/AbstractTest.java @@ -121,7 +121,7 @@ public abstract class AbstractTest extends TestCase { replay(stack); replay(container); - ActionContext actionContext = ActionContext.ofAndBind(stackContext); + ActionContext actionContext = ActionContext.of(stackContext).bind(); actionContext.setServletRequest(request); } diff --git a/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/TokenTest.java b/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/TokenTest.java index a579e72..d0f0896 100644 --- a/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/TokenTest.java +++ b/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/TokenTest.java @@ -50,7 +50,7 @@ public class TokenTest extends AbstractTest { super.setUp(); this.tag = new Token(stack, request, response); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setSession(new HashMap<>()); } diff --git a/plugins/osgi/src/main/java/org/apache/struts2/osgi/OsgiConfigurationProvider.java b/plugins/osgi/src/main/java/org/apache/struts2/osgi/OsgiConfigurationProvider.java index e0e0291..0608ad7 100644 --- a/plugins/osgi/src/main/java/org/apache/struts2/osgi/OsgiConfigurationProvider.java +++ b/plugins/osgi/src/main/java/org/apache/struts2/osgi/OsgiConfigurationProvider.java @@ -101,7 +101,7 @@ public class OsgiConfigurationProvider implements PackageProvider, BundleListene } protected ActionContext createActionContext() { - return ActionContext.ofAndBind(new HashMap<>()); + return ActionContext.of(new HashMap<>()).bind(); } /** diff --git a/plugins/portlet/src/test/java/org/apache/struts2/portlet/context/PortletActionContextTest.java b/plugins/portlet/src/test/java/org/apache/struts2/portlet/context/PortletActionContextTest.java index 960765f..4088ba7 100644 --- a/plugins/portlet/src/test/java/org/apache/struts2/portlet/context/PortletActionContextTest.java +++ b/plugins/portlet/src/test/java/org/apache/struts2/portlet/context/PortletActionContextTest.java @@ -84,7 +84,7 @@ public class PortletActionContextTest extends MockObjectTestCase { portletConfig = (PortletConfig)mockPortletConfig.proxy(); - ActionContext.ofAndBind(context); + ActionContext.of(context).bind(); } public void testGetPhase() { diff --git a/plugins/portlet/src/test/java/org/apache/struts2/portlet/interceptor/PortletAwareInterceptorTest.java b/plugins/portlet/src/test/java/org/apache/struts2/portlet/interceptor/PortletAwareInterceptorTest.java index 6da37d1..8c400a1 100644 --- a/plugins/portlet/src/test/java/org/apache/struts2/portlet/interceptor/PortletAwareInterceptorTest.java +++ b/plugins/portlet/src/test/java/org/apache/struts2/portlet/interceptor/PortletAwareInterceptorTest.java @@ -46,7 +46,7 @@ public class PortletAwareInterceptorTest extends TestCase { PortletRequest request = EasyMock.createMock(PortletRequest.class); Map<String, Object> ctx = new HashMap<>(); ctx.put(PortletConstants.REQUEST, request); - ActionContext actionContext = ActionContext.ofAndBind(ctx); + ActionContext actionContext = ActionContext.of(ctx).bind(); PortletRequestAware action = EasyMock.createMock(PortletRequestAware.class); action.setPortletRequest(request); @@ -66,7 +66,7 @@ public class PortletAwareInterceptorTest extends TestCase { public void testActionPortletRequestAware() throws Exception { PortletRequest request = EasyMock.createMock(PortletRequest.class); Map<String, Object> ctx = new HashMap<>(); - ActionContext actionContext = ActionContext.ofAndBind(ctx); + ActionContext actionContext = ActionContext.of(ctx).bind(); ctx.put(PortletConstants.REQUEST, request); org.apache.struts2.portlet.action.PortletRequestAware action = EasyMock.createMock(org.apache.struts2.portlet.action.PortletRequestAware.class); action.withPortletRequest(request); @@ -87,7 +87,7 @@ public class PortletAwareInterceptorTest extends TestCase { PortletResponse response = EasyMock.createMock(PortletResponse.class); Map<String, Object> ctx = new HashMap<>(); ctx.put(PortletConstants.RESPONSE, response); - ActionContext actionContext = ActionContext.ofAndBind(ctx); + ActionContext actionContext = ActionContext.of(ctx).bind(); org.apache.struts2.portlet.action.PortletResponseAware action = EasyMock.createMock(org.apache.struts2.portlet.action.PortletResponseAware.class); action.withPortletResponse(response); diff --git a/plugins/portlet/src/test/java/org/apache/struts2/portlet/interceptor/PortletStateInterceptorTest.java b/plugins/portlet/src/test/java/org/apache/struts2/portlet/interceptor/PortletStateInterceptorTest.java index cddc2cf..533b2ea 100644 --- a/plugins/portlet/src/test/java/org/apache/struts2/portlet/interceptor/PortletStateInterceptorTest.java +++ b/plugins/portlet/src/test/java/org/apache/struts2/portlet/interceptor/PortletStateInterceptorTest.java @@ -57,7 +57,7 @@ public class PortletStateInterceptorTest extends StrutsTestCase { ctxMap.put(RESPONSE, actionResponse); Map<String, Object> session = new HashMap<>(); - ActionContext ctx = ActionContext.ofAndBind(ctxMap); + ActionContext ctx = ActionContext.of(ctxMap).bind(); ctx.setSession(session); EasyMock.expect(invocation.getInvocationContext()).andStubReturn(ctx); actionResponse.setRenderParameter(EVENT_ACTION, "true"); @@ -96,7 +96,7 @@ public class PortletStateInterceptorTest extends StrutsTestCase { ctxMap.put(PHASE, PortletPhase.RENDER_PHASE); ctxMap.put(REQUEST, renderRequest); - ActionContext ctx = ActionContext.ofAndBind(ctxMap); + ActionContext ctx = ActionContext.of(ctxMap).bind(); ctx.setSession(session); EasyMock.expect(invocation.getInvocationContext()).andStubReturn(ctx); @@ -137,7 +137,7 @@ public class PortletStateInterceptorTest extends StrutsTestCase { ctxMap.put(PHASE, PortletPhase.RENDER_PHASE); ctxMap.put(REQUEST, renderRequest); - ActionContext ctx = ActionContext.ofAndBind(ctxMap); + ActionContext ctx = ActionContext.of(ctxMap).bind(); ctx.setSession(session); EasyMock.expect(invocation.getInvocationContext()).andStubReturn(ctx); diff --git a/plugins/portlet/src/test/java/org/apache/struts2/portlet/result/PortletResultTest.java b/plugins/portlet/src/test/java/org/apache/struts2/portlet/result/PortletResultTest.java index b522add..4994a13 100644 --- a/plugins/portlet/src/test/java/org/apache/struts2/portlet/result/PortletResultTest.java +++ b/plugins/portlet/src/test/java/org/apache/struts2/portlet/result/PortletResultTest.java @@ -65,7 +65,7 @@ public class PortletResultTest extends MockObjectTestCase implements StrutsStati Map<String, Object> sessionMap = new HashMap<>(); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setSession(sessionMap); actionContext.setParameters(HttpParameters.create().build()); actionContext.put(STRUTS_PORTLET_CONTEXT, mockCtx.proxy()); diff --git a/plugins/portlet/src/test/java/org/apache/struts2/portlet/util/PortletUrlHelperTest.java b/plugins/portlet/src/test/java/org/apache/struts2/portlet/util/PortletUrlHelperTest.java index 1cd1b35..f33f122 100644 --- a/plugins/portlet/src/test/java/org/apache/struts2/portlet/util/PortletUrlHelperTest.java +++ b/plugins/portlet/src/test/java/org/apache/struts2/portlet/util/PortletUrlHelperTest.java @@ -69,7 +69,7 @@ public class PortletUrlHelperTest extends TestCase { modeNamespaceMap.put("edit", "/edit"); modeNamespaceMap.put("help", "/help"); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.put(REQUEST, renderRequest); actionContext.put(RESPONSE, renderResponse); actionContext.put(PHASE, PortletPhase.RENDER_PHASE); diff --git a/plugins/portlet/src/test/java/org/apache/struts2/views/jsp/PortletUrlTagTest.java b/plugins/portlet/src/test/java/org/apache/struts2/views/jsp/PortletUrlTagTest.java index 5419c85..26c4400 100644 --- a/plugins/portlet/src/test/java/org/apache/struts2/views/jsp/PortletUrlTagTest.java +++ b/plugins/portlet/src/test/java/org/apache/struts2/views/jsp/PortletUrlTagTest.java @@ -153,7 +153,7 @@ public class PortletUrlTagTest extends MockObjectTestCase { contextMap.put(PortletConstants.DEFAULT_ACTION_MAP, actionMap); contextMap.put(STRUTS_PORTLET_CONTEXT, mockCtx.proxy()); - ActionContext ctx = ActionContext.ofAndBind(contextMap); + ActionContext ctx = ActionContext.of(contextMap).bind(); ctx.setValueStack(stack); ctx.setContainer(dispatcher.getContainer()); diff --git a/plugins/rest/src/test/java/org/apache/struts2/rest/ContentTypeHandlerManagerTest.java b/plugins/rest/src/test/java/org/apache/struts2/rest/ContentTypeHandlerManagerTest.java index aded3d1..a55d0d2 100644 --- a/plugins/rest/src/test/java/org/apache/struts2/rest/ContentTypeHandlerManagerTest.java +++ b/plugins/rest/src/test/java/org/apache/struts2/rest/ContentTypeHandlerManagerTest.java @@ -58,7 +58,7 @@ public class ContentTypeHandlerManagerTest extends TestCase { mockResponse = new MockHttpServletResponse(); mockRequest = new MockHttpServletRequest(); mockRequest.setMethod("GET"); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setServletRequest(mockRequest); actionContext.setServletResponse(mockResponse); diff --git a/plugins/rest/src/test/java/org/apache/struts2/rest/RestWorkflowInterceptorTest.java b/plugins/rest/src/test/java/org/apache/struts2/rest/RestWorkflowInterceptorTest.java index 9094c8f..d3b9541 100644 --- a/plugins/rest/src/test/java/org/apache/struts2/rest/RestWorkflowInterceptorTest.java +++ b/plugins/rest/src/test/java/org/apache/struts2/rest/RestWorkflowInterceptorTest.java @@ -51,7 +51,7 @@ public class RestWorkflowInterceptorTest extends TestCase { }, null); wf.setContentTypeHandlerManager((ContentTypeHandlerManager) mockContentTypeHandlerManager.proxy()); - ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>()); + ActionContext actionContext = ActionContext.of(new HashMap<>()).bind(); actionContext.setActionMapping(new ActionMapping()); wf.doIntercept((ActionInvocation) mockActionInvocation.proxy()); diff --git a/plugins/rest/src/test/java/org/apache/struts2/rest/handler/JuneauXmlHandlerTest.java b/plugins/rest/src/test/java/org/apache/struts2/rest/handler/JuneauXmlHandlerTest.java index 1241f23..321864f 100644 --- a/plugins/rest/src/test/java/org/apache/struts2/rest/handler/JuneauXmlHandlerTest.java +++ b/plugins/rest/src/test/java/org/apache/struts2/rest/handler/JuneauXmlHandlerTest.java @@ -51,7 +51,7 @@ public class JuneauXmlHandlerTest extends XWorkTestCase { "</object>"; handler = new JuneauXmlHandler(); ai = new MockActionInvocation(); - ActionContext context = ActionContext.ofAndBind(new HashMap<>()); + ActionContext context = ActionContext.of(new HashMap<>()).bind(); context.setLocale(Locale.US); ((MockActionInvocation) ai).setInvocationContext(context); }