WW-4572 Simplifies method name

This commit is contained in:
Lukasz Lenart
2016-10-07 10:06:10 +02:00
parent 69da41eb79
commit 6ab6ec879c
18 changed files with 27 additions and 31 deletions
@@ -161,10 +161,10 @@ public class ParametersInterceptor extends MethodFilterInterceptor {
HttpParameters params;
Map<String, Parameter> acceptableParameters;
if (ordered) {
params = HttpParameters.createEmpty().withComparator(getOrderedComparator()).withParent(parameters).build();
params = HttpParameters.create().withComparator(getOrderedComparator()).withParent(parameters).build();
acceptableParameters = new TreeMap<>(getOrderedComparator());
} else {
params = HttpParameters.createEmpty().withParent(parameters).build();
params = HttpParameters.create().withParent(parameters).build();
acceptableParameters = new TreeMap<>();
}
@@ -218,7 +218,7 @@ public class StaticParametersInterceptor extends AbstractInterceptor {
protected void addParametersToContext(ActionContext ac, Map<String, ?> newParams) {
HttpParameters previousParams = ac.getParameters();
HttpParameters.Builder combinedParams = HttpParameters.createEmpty();
HttpParameters.Builder combinedParams = HttpParameters.create();
if (overwrite) {
if (previousParams != null) {
combinedParams = combinedParams.withParent(previousParams);
@@ -216,7 +216,7 @@ public class ActionComponent extends ContextBean {
parentParams = new ActionContext(getStack().getContext()).getParameters();
}
HttpParameters.Builder builder = HttpParameters.createEmpty();
HttpParameters.Builder builder = HttpParameters.create();
if (parentParams != null) {
builder = builder.withParent(parentParams);
}
@@ -20,7 +20,7 @@ public class HttpParameters implements Cloneable {
return new Builder(requestParameterMap);
}
public static Builder createEmpty() {
public static Builder create() {
return new Builder(new HashMap<String, Object>());
}
@@ -86,7 +86,7 @@ public class ActionMappingParametersInteceptor extends ParametersInterceptor {
if (mapping != null) {
return HttpParameters.create(mapping.getParams()).build();
} else {
return HttpParameters.createEmpty().build();
return HttpParameters.create().build();
}
}
@@ -103,7 +103,7 @@ public class ActionMappingParametersInteceptor extends ParametersInterceptor {
@Override
protected void addParametersToContext(ActionContext ac, Map<String, ?> newParams) {
HttpParameters previousParams = ac.getParameters();
HttpParameters.Builder combinedParams = HttpParameters.createEmpty().withParent(previousParams).withExtraParams(newParams);
HttpParameters.Builder combinedParams = HttpParameters.create().withParent(previousParams).withExtraParams(newParams);
ac.setParameters(combinedParams.build());
}
@@ -89,7 +89,7 @@ public class ActionContextTest extends XWorkTestCase {
}
public void testParameters() {
context.setParameters(HttpParameters.createEmpty().build());
context.setParameters(HttpParameters.create().build());
assertEquals(0, context.getParameters().getNames().size());
}
@@ -126,7 +126,7 @@ public class StaticParametersInterceptorTest extends XWorkTestCase {
User user = new User();
ActionContext.getContext().getValueStack().push(user);
ActionContext.getContext().setParameters(HttpParameters.createEmpty().build());
ActionContext.getContext().setParameters(HttpParameters.create().build());
int before = ActionContext.getContext().getValueStack().size();
interceptor.setMerge("false");
interceptor.intercept(mai);
@@ -235,7 +235,7 @@ public class DoubleRangeValidatorTest extends XWorkTestCase {
loadConfigurationProviders(provider, new MockConfigurationProvider());
val = new DoubleRangeFieldValidator();
val.setValueStack(ActionContext.getContext().getValueStack());
ActionContext.getContext().setParameters(HttpParameters.createEmpty().build());
ActionContext.getContext().setParameters(HttpParameters.create().build());
}
@Override
@@ -37,7 +37,7 @@ public class ValidatorAnnotationTest extends XWorkTestCase {
public void testNotAnnotatedMethodSuccess2() throws Exception {
HashMap<String, Object> extraContext = new HashMap<>();
extraContext.put(ActionContext.PARAMETERS, HttpParameters.createEmpty().build());
extraContext.put(ActionContext.PARAMETERS, HttpParameters.create().build());
ActionProxy proxy = actionProxyFactory.createActionProxy("", "notAnnotatedMethod", null, extraContext);
proxy.execute();
@@ -50,7 +50,7 @@ public class ValidatorAnnotationTest extends XWorkTestCase {
public void testAnnotatedMethodFailure() throws Exception {
HashMap<String, Object> extraContext = new HashMap<>();
extraContext.put(ActionContext.PARAMETERS, HttpParameters.createEmpty().build());
extraContext.put(ActionContext.PARAMETERS, HttpParameters.create().build());
ActionProxy proxy = actionProxyFactory.createActionProxy("", "annotatedMethod", null, extraContext);
proxy.execute();
@@ -173,7 +173,7 @@ public class ExecuteAndWaitInterceptorTest extends StrutsInternalTestCase {
params = new HashMap();
context = new HashMap();
context.put(ActionContext.SESSION, session);
context.put(ActionContext.PARAMETERS, HttpParameters.createEmpty().build());
context.put(ActionContext.PARAMETERS, HttpParameters.create().build());
request = new StrutsMockHttpServletRequest();
httpSession = new StrutsMockHttpSession();
@@ -201,7 +201,7 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase {
mai.setResultCode("success");
mai.setInvocationContext(ActionContext.getContext());
ActionContext.getContext().setParameters(HttpParameters.createEmpty().build());
ActionContext.getContext().setParameters(HttpParameters.create().build());
ActionContext.getContext().put(ServletActionContext.HTTP_REQUEST, createMultipartRequest(req, 2000));
interceptor.intercept(mai);
@@ -222,7 +222,7 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase {
mai.setResultCode("success");
mai.setInvocationContext(ActionContext.getContext());
ActionContext.getContext().setParameters(HttpParameters.createEmpty().build());
ActionContext.getContext().setParameters(HttpParameters.create().build());
ActionContext.getContext().put(ServletActionContext.HTTP_REQUEST, createMultipartRequest(req, 2000));
interceptor.intercept(mai);
@@ -201,7 +201,7 @@ public class I18nInterceptorTest extends TestCase {
session = new HashMap();
Map<String, Object> ctx = new HashMap<String, Object>();
ctx.put(ActionContext.PARAMETERS, HttpParameters.createEmpty().build());
ctx.put(ActionContext.PARAMETERS, HttpParameters.create().build());
ctx.put(ActionContext.SESSION, session);
ac = new ActionContext(ctx);
@@ -27,12 +27,10 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.interceptor.PreResultListener;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.StrutsInternalTestCase;
import org.apache.struts2.dispatcher.HttpParameters;
import org.apache.struts2.result.ServletActionRedirectResult;
import org.easymock.EasyMock;
import com.opensymphony.xwork2.Action;
@@ -40,7 +38,6 @@ import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionSupport;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@@ -76,7 +73,7 @@ public class MessageStoreInterceptorTest extends StrutsInternalTestCase {
action.addFieldError("field2", "some field error 2");
ActionContext actionContext = new ActionContext(new HashMap());
actionContext.setParameters(HttpParameters.createEmpty().build());
actionContext.setParameters(HttpParameters.create().build());
HttpSession mockedSession = EasyMock.createControl().createMock(HttpSession.class);
HttpServletRequest mockedRequest = EasyMock.createControl().createMock(HttpServletRequest.class);
@@ -151,7 +148,7 @@ public class MessageStoreInterceptorTest extends StrutsInternalTestCase {
EasyMock.replay(mockedRequest);
ActionContext actionContext = new ActionContext(new HashMap());
actionContext.setParameters(HttpParameters.createEmpty().build());
actionContext.setParameters(HttpParameters.create().build());
actionContext.put(ActionContext.SESSION, sessionMap);
mockActionInvocation.getInvocationContext();
@@ -203,7 +200,7 @@ public class MessageStoreInterceptorTest extends StrutsInternalTestCase {
action.addFieldError("field2", "some field error 2");
ActionContext actionContext = new ActionContext(new HashMap());
actionContext.setParameters(HttpParameters.createEmpty().build());
actionContext.setParameters(HttpParameters.create().build());
actionContext.put(ActionContext.SESSION, sessionMap);
HttpSession mockedSession = EasyMock.createControl().createMock(HttpSession.class);
@@ -289,7 +286,7 @@ public class MessageStoreInterceptorTest extends StrutsInternalTestCase {
public void testRequestOperationMode3() throws Exception {
ActionContext actionContext = new ActionContext(new HashMap());
actionContext.setParameters(HttpParameters.createEmpty().build());
actionContext.setParameters(HttpParameters.create().build());
ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class);
mockActionInvocation.getInvocationContext();
@@ -111,7 +111,7 @@ public class MessageStorePreResultListenerTest extends StrutsInternalTestCase {
action.addFieldError("field2", "some field error 2");
ActionContext actionContext = new ActionContext(new HashMap());
actionContext.setParameters(HttpParameters.createEmpty().build());
actionContext.setParameters(HttpParameters.create().build());
actionContext.put(ActionContext.SESSION, sessionMap);
HttpSession mockedSession = EasyMock.createControl().createMock(HttpSession.class);
@@ -191,7 +191,7 @@ public class MessageStorePreResultListenerTest extends StrutsInternalTestCase {
action.addFieldError("field2", "some field error 2");
ActionContext actionContext = new ActionContext(new HashMap());
actionContext.setParameters(HttpParameters.createEmpty().build());
actionContext.setParameters(HttpParameters.create().build());
actionContext.setSession(sessionMap);
HttpSession mockedSession = EasyMock.createControl().createMock(HttpSession.class);
@@ -88,7 +88,7 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase {
MockActionInvocation mai = createActionInvocation(mock);
HttpParameters param = HttpParameters.createEmpty().build();
HttpParameters param = HttpParameters.create().build();
mai.getInvocationContext().setParameters(param);
mock.setParameters(param.toMap());
@@ -104,7 +104,7 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase {
MockActionInvocation mai = createActionInvocation(mock);
HttpParameters param = HttpParameters.createEmpty().build();
HttpParameters param = HttpParameters.create().build();
mai.getInvocationContext().setParameters(param);
mock.setParameters(param);
@@ -113,7 +113,7 @@ public class TokenInterceptorTest extends StrutsInternalTestCase {
params = new TreeMap<>();
extraContext = new TreeMap<>();
extraContext.put(ActionContext.SESSION, session);
extraContext.put(ActionContext.PARAMETERS, HttpParameters.createEmpty().build());
extraContext.put(ActionContext.PARAMETERS, HttpParameters.create().build());
request = new StrutsMockHttpServletRequest();
httpSession = new StrutsMockHttpSession();
@@ -93,7 +93,7 @@ public class TokenHelperTest extends TestCase {
session = new HashMap();
Map ctxMap = new TreeMap();
ctxMap.put(ActionContext.SESSION, session);
ctxMap.put(ActionContext.PARAMETERS, HttpParameters.createEmpty().build());
ctxMap.put(ActionContext.PARAMETERS, HttpParameters.create().build());
ActionContext ctx = new ActionContext(ctxMap);
ActionContext.setContext(ctx);
}
@@ -23,7 +23,6 @@ package org.apache.struts2.portlet.result;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionProxy;
import com.sun.net.httpserver.HttpsParameters;
import junit.textui.TestRunner;
import org.apache.struts2.StrutsStatics;
import org.apache.struts2.dispatcher.HttpParameters;
@@ -74,7 +73,7 @@ public class PortletResultTest extends MockObjectTestCase implements StrutsStati
Map<String, Object> context = new HashMap<String, Object>();
context.put(SESSION, sessionMap);
context.put(PARAMETERS, HttpParameters.createEmpty().build());
context.put(PARAMETERS, HttpParameters.create().build());
context.put(STRUTS_PORTLET_CONTEXT, mockCtx.proxy());
ActionContext.setContext(new ActionContext(context));