WW-4789 WW-3788 Uses bind() instead of bound()

This commit is contained in:
Lukasz Lenart
2020-04-05 07:21:06 +02:00
parent fcdaffa01b
commit 1a8c751b9a
62 changed files with 93 additions and 93 deletions
@@ -128,13 +128,13 @@ public class ActionContext implements Serializable {
return new ActionContext(context);
}
public static ActionContext bound(ActionContext actionContext) {
public static ActionContext bind(ActionContext actionContext) {
ActionContext.setContext(actionContext);
return ActionContext.getContext();
}
public static ActionContext ofAndBound(Map<String, Object> context) {
return bound(of(context));
public static ActionContext ofAndBind(Map<String, Object> context) {
return bind(of(context));
}
/**
@@ -144,8 +144,8 @@ public class ActionContext implements Serializable {
* @param actionContext ActionContext to be used for current thread
* @return new ActionContext
*/
public static ActionContext ofAndBound(ActionContext actionContext) {
return bound(actionContext);
public static ActionContext ofAndBind(ActionContext actionContext) {
return bind(actionContext);
}
/**
@@ -145,7 +145,7 @@ public class DefaultActionProxy implements ActionProxy, Serializable {
public String execute() throws Exception {
ActionContext nestedContext = ActionContext.getContext();
ActionContext.bound(invocation.getInvocationContext());
ActionContext.bind(invocation.getInvocationContext());
String retCode = null;
@@ -153,7 +153,7 @@ public class DefaultActionProxy implements ActionProxy, Serializable {
retCode = invocation.invoke();
} finally {
if (cleanupContext) {
ActionContext.bound(nestedContext);
ActionContext.bind(nestedContext);
}
}
@@ -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.ofAndBound(vs.getContext());
context = ActionContext.ofAndBind(vs.getContext());
}
return context;
}
@@ -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.ofAndBound(stack.getContext());
ActionContext.ofAndBind(stack.getContext());
// 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.ofAndBound(stack.getContext());
ActionContext.ofAndBind(stack.getContext());
return configurationManager;
}
@@ -49,7 +49,7 @@ public class ServletActionContext implements StrutsStatics {
public static ActionContext getActionContext(HttpServletRequest req) {
ValueStack vs = getValueStack(req);
if (vs != null) {
return ActionContext.ofAndBound(vs.getContext());
return ActionContext.ofAndBind(vs.getContext());
} else {
return null;
}
@@ -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.ofAndBound(new HashMap<>(oldContext.getContextMap()));
ctx = ActionContext.ofAndBind(new HashMap<>(oldContext.getContextMap()));
} 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.ofAndBound(stack.getContext());
ctx = ActionContext.ofAndBind(stack.getContext());
}
}
request.setAttribute(CLEANUP_RECURSION_COUNTER, counter);
@@ -36,7 +36,7 @@ public class StrutsActionProxy extends DefaultActionProxy {
public String execute() throws Exception {
ActionContext previous = ActionContext.getContext();
ActionContext.bound(invocation.getInvocationContext());
ActionContext.bind(invocation.getInvocationContext());
try {
// This is for the new API:
// return RequestContextImpl.callInContext(invocation, new Callable<String>() {
@@ -48,7 +48,7 @@ public class StrutsActionProxy extends DefaultActionProxy {
return invocation.invoke();
} finally {
if (cleanupContext)
ActionContext.bound(previous);
ActionContext.bind(previous);
}
}
@@ -76,7 +76,7 @@ public class BackgroundProcess implements Serializable {
* @throws Exception any exception thrown will be thrown, in turn, by the ExecuteAndWaitInterceptor
*/
protected void beforeInvocation() throws Exception {
ActionContext.bound(invocation.getInvocationContext());
ActionContext.bind(invocation.getInvocationContext());
}
/**
@@ -62,7 +62,7 @@ public class InvocationSessionStore {
// would already be closed at this point (causing failures if used for output).
final ActionContext savedActionContext = savedInvocation.getInvocationContext();
final ActionContext previousActionContext = ActionContext.getContext();
ActionContext.bound(savedActionContext);
ActionContext.bind(savedActionContext);
savedActionContext.setValueStack(savedInvocation.getStack());
if (previousActionContext != null) {
savedActionContext.setPageContext(previousActionContext.getPageContext());
@@ -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.ofAndBound(stack.getContext());
ActionContext.ofAndBind(stack.getContext());
return du;
}
@@ -69,7 +69,7 @@ public class TagUtils {
req.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);
// also tie this stack/context to the ThreadLocal
ActionContext.ofAndBound(stack.getContext());
ActionContext.ofAndBind(stack.getContext());
} else {
// let's make sure that the current page context is in the action context
// TODO: refactor this to stop using put()
@@ -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.ofAndBound(extraContext);
context = ActionContext.ofAndBind(extraContext);
}
public void testContextParams() {
@@ -87,7 +87,7 @@ public class ActionContextTest extends XWorkTestCase {
public void testContextMap() {
Map<String, Object> map = new HashMap<>();
ActionContext.ofAndBound(map);
ActionContext.ofAndBind(map);
assertEquals(map, ActionContext.getContext().getContextMap());
}
@@ -38,7 +38,7 @@ public class ActionContextThreadLocalTest extends TestCase {
}
public void testSetContext() {
ActionContext context = ActionContext.ofAndBound(new HashMap<>());
ActionContext context = ActionContext.ofAndBind(new HashMap<>());
assertEquals(context, ActionContext.getContext());
}
@@ -159,7 +159,7 @@ public class ActionSupportTest extends XWorkTestCase {
ActionContext.getContext().setLocale(Locale.ITALY);
assertEquals(Locale.ITALY, as.getLocale());
ActionContext.ofAndBound(new HashMap<>());
ActionContext.ofAndBind(new HashMap<>());
assertEquals(defLocale, as.getLocale()); // ActionContext will create a new context, when it was set to null before
}
@@ -104,7 +104,7 @@ public class ChainResultTest extends XWorkTestCase {
invocationMock.matchAndReturn("getInvocationContext", ActionContext.getContext());
try {
ActionContext.bound(stack.getActionContext());
ActionContext.bind(stack.getActionContext());
result.execute((ActionInvocation) invocationMock.proxy());
actionProxyMock.verify();
} finally {
@@ -129,7 +129,7 @@ public class DefaultTextProviderTest extends XWorkTestCase {
protected void setUp() throws Exception {
super.setUp();
ActionContext ctx = ActionContext.ofAndBound(new HashMap<>());
ActionContext ctx = ActionContext.ofAndBind(new HashMap<>());
ctx.setLocale(Locale.CANADA);
container.getInstance(LocalizedTextProvider.class).addDefaultResourceBundle(DefaultTextProviderTest.class.getName());
@@ -69,6 +69,6 @@ public class LocaleAwareTest extends XWorkTestCase {
ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();
stack.getActionContext().setContainer(container);
ActionContext.ofAndBound(stack.getContext());
ActionContext.ofAndBind(stack.getContext());
}
}
@@ -37,7 +37,7 @@ public class StubValueStack implements ValueStack {
@Override
public ActionContext getActionContext() {
return ActionContext.ofAndBound(ctx);
return ActionContext.ofAndBind(ctx);
}
public void setDefaultType(Class defaultType) {
@@ -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.ofAndBound(new HashMap<>()));
mockInvocation.expectAndReturn("getInvocationContext", ActionContext.ofAndBind(new HashMap<>()));
mockInvocation.expectAndReturn("getResult", new ActionChainResult());
invocation = (ActionInvocation) mockInvocation.proxy();
interceptor = new ChainingInterceptor();
@@ -128,7 +128,7 @@ public class ConversionErrorInterceptorTest extends XWorkTestCase {
}
private ActionContext createActionContext() {
ActionContext ac = ActionContext.ofAndBound(stack.getContext());
ActionContext ac = ActionContext.ofAndBind(stack.getContext());
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.ofAndBound(stack.getContext());
context = ActionContext.ofAndBind(stack.getContext());
conversionErrors = new HashMap<>();
context.setConversionErrors(conversionErrors);
mockInvocation.matchAndReturn("getInvocationContext", context);
@@ -183,7 +183,7 @@ public class DefaultWorkflowInterceptorTest extends XWorkTestCase {
EasyMock.replay(action);
EasyMock.replay(proxy);
ActionContext actionContext = ActionContext.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
actionContext.setActionInvocation(invocation);
}
@@ -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.ofAndBound(new HashMap<>()));
mockInvocation.expectAndReturn("getInvocationContext", ActionContext.ofAndBind(new HashMap<>()));
interceptor = new ExceptionMappingInterceptor();
interceptor.init();
}
@@ -45,7 +45,7 @@ public class ParameterRemoverInterceptorTest extends TestCase {
@Override
protected void setUp() throws Exception {
contextMap = new LinkedHashMap<>();
context = ActionContext.ofAndBound(contextMap);
context = ActionContext.ofAndBind(contextMap);
actionInvocation = createMock(ActionInvocation.class);
expect(actionInvocation.getAction()).andStubReturn(new SampleAction());
@@ -87,7 +87,7 @@ public class ValidationErrorAwareTest extends XWorkTestCase {
EasyMock.replay(action);
EasyMock.replay(proxy);
ActionContext context = ActionContext.ofAndBound(new HashMap<>());
ActionContext context = ActionContext.ofAndBind(new HashMap<>());
context.setActionInvocation(invocation);
}
@@ -101,7 +101,7 @@ public class ValidationInterceptorPrefixMethodInvocationTest extends XWorkTestCa
EasyMock.replay(action);
EasyMock.replay(proxy);
ActionContext context = ActionContext.ofAndBound(new HashMap<>());
ActionContext context = ActionContext.ofAndBind(new HashMap<>());
context.setActionInvocation(invocation);
}
}
@@ -55,7 +55,7 @@ public class AnnotationParameterFilterInterceptorTest extends TestCase {
parameterMap.put("job", "Baker");
parameterMap.put("name", "Martin");
ActionContext actionContext = ActionContext.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
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.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
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.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
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.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
actionContext.setParameters(HttpParameters.create(parameterMap).build());
stack.push(new AllowingByDefaultModel());
@@ -78,7 +78,7 @@ public class ActionAutowiringInterceptorTest extends XWorkTestCase {
protected void loadSpringApplicationContextIntoApplication(ApplicationContext appContext) {
Map<String, Object> context = new HashMap<>();
ActionContext actionContext = ActionContext.ofAndBound(context);
ActionContext actionContext = ActionContext.ofAndBind(context);
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.ofAndBound(context);
ActionContext actionContext = ActionContext.ofAndBind(context);
actionContext.setApplication(new HashMap<>());
@@ -49,7 +49,7 @@ public class ConversionErrorFieldValidatorTest extends XWorkTestCase {
public void setUp() throws Exception {
super.setUp();
ValueStack stack = ActionContext.getContext().getValueStack();
ActionContext context = ActionContext.ofAndBound(stack.getContext());
ActionContext context = ActionContext.ofAndBind(stack.getContext());
Map<String, ConversionData> conversionErrors = new HashMap<>();
conversionErrors.put("foo", new ConversionData("bar", Integer.class));
@@ -67,7 +67,7 @@ public class DefaultActionValidatorManagerTest extends XWorkTestCase {
actionValidatorManager.setValidatorFactory((ValidatorFactory)mockValidatorFactory.proxy());
stubValueStack = new StubValueStack();
ActionContext actionContext = ActionContext.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
actionContext.setValueStack(stubValueStack);
DefaultFileManagerFactory factory = new DefaultFileManagerFactory();
@@ -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.ofAndBound(new HashMap<>());
ActionContext.ofAndBind(new HashMap<>());
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.ofAndBound(stack.getContext());
ActionContext actionContext = ActionContext.ofAndBind(stack.getContext());
actionContext.setLocale(Locale.US);
proxy.execute();
@@ -54,7 +54,7 @@ public class ServletActionContextTest extends TestCase implements StrutsStatics
extraContext.put(HTTP_RESPONSE, response);
extraContext.put(SERVLET_CONTEXT, servletContext);
actionContext = ActionContext.ofAndBound(extraContext);
actionContext = ActionContext.ofAndBind(extraContext);
}
public void testContextParams() {
@@ -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.ofAndBound(new HashMap<>());
ActionContext context = ActionContext.ofAndBind(new HashMap<>());
Map<String, Object> session = new HashMap<>();
session.put("Test1", "Test1");
session.put("Test2", "Test2");
@@ -256,7 +256,7 @@ public class I18nInterceptorTest extends TestCase {
interceptor.init();
session = new HashMap<>();
ac = ActionContext.ofAndBound(new HashMap<>());
ac = ActionContext.ofAndBind(new HashMap<>());
ac.setSession(session);
ac.setParameters(HttpParameters.create().build());
@@ -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.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
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.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
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.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
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.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
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.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
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.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
actionContext.setParameters(HttpParameters.create().build());
ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class);
@@ -43,7 +43,7 @@ public class MessageStorePreResultListenerTest extends StrutsInternalTestCase {
public void testSessionWasInvalidated() {
// given
ActionContext actionContext = ActionContext.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
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.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
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.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
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.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
actionContext.setParameters(HttpParameters.create().build());
actionContext.setSession(sessionMap);
@@ -83,7 +83,7 @@ public class StrutsConversionErrorInterceptorTest extends StrutsInternalTestCase
mockInvocation = new Mock(ActionInvocation.class);
invocation = (ActionInvocation) mockInvocation.proxy();
stack = ActionContext.getContext().getValueStack();
context = ActionContext.ofAndBound(stack.getContext());
context = ActionContext.ofAndBind(stack.getContext());
conversionErrors = new HashMap<>();
context.setConversionErrors(conversionErrors);
mockInvocation.matchAndReturn("getInvocationContext", context);
@@ -122,7 +122,7 @@ public class TokenInterceptorTest extends StrutsInternalTestCase {
ValueStack stack = ActionContext.getContext().getValueStack();
stack.getContext().putAll(extraContext);
oldContext = ActionContext.ofAndBound(stack.getContext());
oldContext = ActionContext.ofAndBind(stack.getContext());
}
protected ActionProxy buildProxy(String actionName) throws Exception {
@@ -130,7 +130,7 @@ public class PlainTextResultTest extends StrutsInternalTestCase {
response.setWriter(writer);
servletContext = new StrutsMockServletContext();
stack = ActionContext.getContext().getValueStack();
context = ActionContext.ofAndBound(stack.getContext());
context = ActionContext.ofAndBind(stack.getContext());
context.put(StrutsStatics.HTTP_RESPONSE, response);
context.put(StrutsStatics.SERVLET_CONTEXT, servletContext);
invocation = new MockActionInvocation();
@@ -71,7 +71,7 @@ public class InvocationSessionStoreTest extends StrutsInternalTestCase {
ActionContext actionContext = ActionContext.getContext();
InvocationSessionStore.storeInvocation(INVOCATION_KEY, TOKEN_VALUE, invocation);
ActionContext actionContext2 = ActionContext.ofAndBound(new HashMap<>());
ActionContext actionContext2 = ActionContext.ofAndBind(new HashMap<>());
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.ofAndBound(new HashMap<>());
ActionContext actionContext2 = ActionContext.ofAndBind(new HashMap<>());
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.ofAndBound(stack.getContext());
ActionContext actionContext = ActionContext.ofAndBind(stack.getContext());
session = new HashMap<>();
actionContext.setSession(session);
@@ -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.ofAndBound(ctxMap);
ActionContext ctx = ActionContext.ofAndBind(ctxMap);
ctx.setSession(session);
ctx.setParameters(HttpParameters.create().build());
}
@@ -134,7 +134,7 @@ public class FreeMarkerResultTest extends StrutsInternalTestCase {
servletContext = new StrutsMockServletContext();
stack = ActionContext.getContext().getValueStack();
context = ActionContext.ofAndBound(stack.getContext());
context = ActionContext.ofAndBind(stack.getContext());
context.setServletResponse(response);
context.setServletRequest(request);
context.setServletContext(servletContext);
@@ -246,7 +246,7 @@ public class FreemarkerResultMockedTest extends StrutsInternalTestCase {
request = new MockHttpServletRequest();
stack = ActionContext.getContext().getValueStack();
context = ActionContext.ofAndBound(stack.getContext());
context = ActionContext.ofAndBind(stack.getContext());
context.setServletResponse(response);
context.setServletRequest(request);
context.setServletContext(servletContext);
@@ -121,7 +121,7 @@ public abstract class AbstractTagTest extends StrutsInternalTestCase {
extraContext.remove(ActionContext.LOCALE);
stack.getContext().putAll(extraContext);
ActionContext actionContext = ActionContext.ofAndBound(context);
ActionContext actionContext = ActionContext.ofAndBind(context);
actionContext.setServletRequest(request);
actionContext.setServletResponse(response);
actionContext.setServletContext(servletContext);
@@ -308,7 +308,7 @@ public class TextTagTest extends AbstractTagTest {
super.setUp();
tag = new TextTag();
tag.setPageContext(pageContext);
ActionContext.ofAndBound(stack.getContext());
ActionContext.ofAndBind(stack.getContext());
}
protected void tearDown() throws Exception {
@@ -556,7 +556,7 @@ public class URLTagTest extends AbstractUITagTest {
extraContext.remove(ActionContext.LOCALE);
stack.getContext().putAll(extraContext);
ActionContext actionContext = ActionContext.ofAndBound(context);
ActionContext actionContext = ActionContext.ofAndBind(context);
actionContext.setServletRequest(request);
actionContext.setServletResponse(response);
actionContext.setServletContext(servletContext);
@@ -89,7 +89,7 @@ public class PackageBasedActionConfigBuilderTest extends TestCase {
@Override
public void setUp() throws Exception {
super.setUp();
ActionContext context = ActionContext.ofAndBound(new HashMap<>());
ActionContext context = ActionContext.ofAndBind(new HashMap<>());
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.ofAndBound(Collections.emptyMap());
ActionContext actionContext = ActionContext.ofAndBind(Collections.emptyMap());
Result result = uh.handleUnknownResult(actionContext, "foo", pkgConfig.getActionConfigs().get("foo"), "bar");
assertNotNull(result);
@@ -329,7 +329,7 @@ public class EmbeddedJSPResultTest extends TestCase {
EasyMock.replay(request);
ActionContext actionContext = ActionContext.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
actionContext.setParameters(HttpParameters.create(params).build());
actionContext.setServletRequest(request);
actionContext.setServletResponse(response);
@@ -406,7 +406,7 @@ class ServletGetRunnable implements Runnable {
}
public void run() {
actionContext = ActionContext.bound(actionContext);
actionContext = ActionContext.bind(actionContext);
//wait to start all threads at once..or try at least
try {
startBarrier.await();
@@ -121,7 +121,7 @@ public abstract class AbstractTest extends TestCase {
replay(stack);
replay(container);
ActionContext actionContext = ActionContext.ofAndBound(stackContext);
ActionContext actionContext = ActionContext.ofAndBind(stackContext);
actionContext.setServletRequest(request);
}
@@ -50,7 +50,7 @@ public class TokenTest extends AbstractTest {
super.setUp();
this.tag = new Token(stack, request, response);
ActionContext actionContext = ActionContext.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
actionContext.setSession(new HashMap<>());
}
@@ -138,7 +138,7 @@ public abstract class StrutsJUnit4TestCase<T> extends XWorkJUnit4TestCase {
actionContext.setParameters(HttpParameters.create(request.getParameterMap()).build());
initSession(actionContext);
// set the action context to the one used by the proxy
ActionContext.bound(actionContext);
ActionContext.bind(actionContext);
}
protected void initSession(ActionContext actionContext) {
@@ -122,7 +122,7 @@ public class StrutsRestTestCase<T> extends StrutsJUnit4TestCase<T> {
invocationContext.getContextMap().put(ServletActionContext.ACTION_MAPPING, mapping);
invocationContext.setParameters(HttpParameters.create(request.getParameterMap()).build());
// set the action context to the one used by the proxy
ActionContext.bound(invocationContext);
ActionContext.bind(invocationContext);
// this is normally done in onSetUp(), but we are using Struts internal
// objects (proxy and action invocation)
@@ -122,7 +122,7 @@ public abstract class StrutsTestCase extends XWorkTestCase {
initSession(actionContext);
applyAdditionalParams(actionContext);
// set the action context to the one used by the proxy
ActionContext.bound(actionContext);
ActionContext.bind(actionContext);
}
protected void initSession(ActionContext actionContext) {
@@ -101,7 +101,7 @@ public class OsgiConfigurationProvider implements PackageProvider, BundleListene
}
protected ActionContext createActionContext() {
return ActionContext.ofAndBound(new HashMap<>());
return ActionContext.ofAndBind(new HashMap<>());
}
/**
@@ -84,7 +84,7 @@ public class PortletActionContextTest extends MockObjectTestCase {
portletConfig = (PortletConfig)mockPortletConfig.proxy();
ActionContext.ofAndBound(context);
ActionContext.ofAndBind(context);
}
public void testGetPhase() {
@@ -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.ofAndBound(ctx);
ActionContext actionContext = ActionContext.ofAndBind(ctx);
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.ofAndBound(ctx);
ActionContext actionContext = ActionContext.ofAndBind(ctx);
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.ofAndBound(ctx);
ActionContext actionContext = ActionContext.ofAndBind(ctx);
org.apache.struts2.portlet.action.PortletResponseAware action = EasyMock.createMock(org.apache.struts2.portlet.action.PortletResponseAware.class);
action.withPortletResponse(response);
@@ -57,7 +57,7 @@ public class PortletStateInterceptorTest extends StrutsTestCasePortletTests {
ctxMap.put(RESPONSE, actionResponse);
Map<String, Object> session = new HashMap<>();
ActionContext ctx = ActionContext.ofAndBound(ctxMap);
ActionContext ctx = ActionContext.ofAndBind(ctxMap);
ctx.setSession(session);
EasyMock.expect(invocation.getInvocationContext()).andStubReturn(ctx);
actionResponse.setRenderParameter(EVENT_ACTION, "true");
@@ -96,7 +96,7 @@ public class PortletStateInterceptorTest extends StrutsTestCasePortletTests {
ctxMap.put(PHASE, PortletPhase.RENDER_PHASE);
ctxMap.put(REQUEST, renderRequest);
ActionContext ctx = ActionContext.ofAndBound(ctxMap);
ActionContext ctx = ActionContext.ofAndBind(ctxMap);
ctx.setSession(session);
EasyMock.expect(invocation.getInvocationContext()).andStubReturn(ctx);
@@ -137,7 +137,7 @@ public class PortletStateInterceptorTest extends StrutsTestCasePortletTests {
ctxMap.put(PHASE, PortletPhase.RENDER_PHASE);
ctxMap.put(REQUEST, renderRequest);
ActionContext ctx = ActionContext.ofAndBound(ctxMap);
ActionContext ctx = ActionContext.ofAndBind(ctxMap);
ctx.setSession(session);
EasyMock.expect(invocation.getInvocationContext()).andStubReturn(ctx);
@@ -65,7 +65,7 @@ public class PortletResultTest extends MockObjectTestCase implements StrutsStati
Map<String, Object> sessionMap = new HashMap<>();
ActionContext actionContext = ActionContext.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
actionContext.setSession(sessionMap);
actionContext.setParameters(HttpParameters.create().build());
actionContext.put(STRUTS_PORTLET_CONTEXT, mockCtx.proxy());
@@ -69,7 +69,7 @@ public class PortletUrlHelperTest extends TestCase {
modeNamespaceMap.put("edit", "/edit");
modeNamespaceMap.put("help", "/help");
ActionContext actionContext = ActionContext.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
actionContext.put(REQUEST, renderRequest);
actionContext.put(RESPONSE, renderResponse);
actionContext.put(PHASE, PortletPhase.RENDER_PHASE);
@@ -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.ofAndBound(contextMap);
ActionContext ctx = ActionContext.ofAndBind(contextMap);
ctx.setValueStack(stack);
ctx.setContainer(dispatcher.getContainer());
@@ -58,7 +58,7 @@ public class ContentTypeHandlerManagerTest extends TestCase {
mockResponse = new MockHttpServletResponse();
mockRequest = new MockHttpServletRequest();
mockRequest.setMethod("GET");
ActionContext actionContext = ActionContext.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
actionContext.setServletRequest(mockRequest);
actionContext.setServletResponse(mockResponse);
@@ -51,7 +51,7 @@ public class RestWorkflowInterceptorTest extends TestCase {
}, null);
wf.setContentTypeHandlerManager((ContentTypeHandlerManager) mockContentTypeHandlerManager.proxy());
ActionContext actionContext = ActionContext.ofAndBound(new HashMap<>());
ActionContext actionContext = ActionContext.ofAndBind(new HashMap<>());
actionContext.setActionMapping(new ActionMapping());
wf.doIntercept((ActionInvocation) mockActionInvocation.proxy());
@@ -51,7 +51,7 @@ public class JuneauXmlHandlerTest extends XWorkTestCase {
"</object>";
handler = new JuneauXmlHandler();
ai = new MockActionInvocation();
ActionContext context = ActionContext.ofAndBound(new HashMap<>());
ActionContext context = ActionContext.ofAndBind(new HashMap<>());
context.setLocale(Locale.US);
((MockActionInvocation) ai).setInvocationContext(context);
}