struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject struts git commit: WW-4720 HttpParameters implements Map interface
Date Wed, 23 Nov 2016 12:54:29 GMT
Repository: struts
Updated Branches:
  refs/heads/master 7872fa80f -> 6d623ebb5


WW-4720 HttpParameters implements Map interface


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/6d623ebb
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/6d623ebb
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/6d623ebb

Branch: refs/heads/master
Commit: 6d623ebb56a6fb801753b2c64614c6188e9c149d
Parents: 7872fa8
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Wed Nov 23 13:54:20 2016 +0100
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Wed Nov 23 13:54:20 2016 +0100

----------------------------------------------------------------------
 .../interceptor/ParameterFilterInterceptor.java |   2 +-
 .../interceptor/ParametersInterceptor.java      |   4 +-
 .../AnnotationParameterFilterInterceptor.java   |   4 +-
 .../struts2/dispatcher/HttpParameters.java      | 100 ++++++++++++++++---
 .../interceptor/CheckboxInterceptor.java        |   2 +-
 .../interceptor/DateTextFieldInterceptor.java   |   2 +-
 .../interceptor/MultiselectInterceptor.java     |   2 +-
 .../opensymphony/xwork2/ActionContextTest.java  |   2 +-
 .../ParameterFilterInterceptorTest.java         |   2 +-
 .../ParameterRemoverInterceptorTest.java        |   6 +-
 .../StaticParametersInterceptorTest.java        |   2 +-
 ...nnotationParameterFilterInterceptorTest.java |   8 +-
 .../struts2/components/ActionComponentTest.java |   2 +-
 .../interceptor/CheckboxInterceptorTest.java    |  16 +--
 .../DateTextFieldInterceptorTest.java           |   4 +-
 .../interceptor/FileUploadInterceptorTest.java  |   4 +-
 .../interceptor/MultiselectInterceptorTest.java |   6 +-
 .../apache/struts2/views/jsp/ActionTagTest.java |   4 +-
 18 files changed, 123 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/main/java/com/opensymphony/xwork2/interceptor/ParameterFilterInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ParameterFilterInterceptor.java
b/core/src/main/java/com/opensymphony/xwork2/interceptor/ParameterFilterInterceptor.java
index 16bb897..cb4cd1a 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ParameterFilterInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/ParameterFilterInterceptor.java
@@ -112,7 +112,7 @@ public class ParameterFilterInterceptor extends AbstractInterceptor {
 
         Map<String, Boolean> includesExcludesMap = getIncludesExcludesMap();
 
-        for (String param : parameters.getNames()) {
+        for (String param : parameters.keySet()) {
             boolean currentAllowed = !isDefaultBlock();
 
             for (String currRule : includesExcludesMap.keySet()) {

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
b/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
index 6867b3d..c1c52d9 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
@@ -168,7 +168,7 @@ public class ParametersInterceptor extends MethodFilterInterceptor {
             acceptableParameters = new TreeMap<>();
         }
 
-        for (String name : params.getNames()) {
+        for (String name : params.keySet()) {
             Parameter parameter = params.get(name);
             if (isAcceptableParameter(name, action)) {
                 acceptableParameters.put(name, parameter);
@@ -262,7 +262,7 @@ public class ParametersInterceptor extends MethodFilterInterceptor {
         }
 
         StringBuilder logEntry = new StringBuilder();
-        for (String name : parameters.getNames()) {
+        for (String name : parameters.keySet()) {
             logEntry.append(String.valueOf(name));
             logEntry.append(" => ");
             logEntry.append(parameters.get(name).getValue());

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationParameterFilterInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationParameterFilterInterceptor.java
b/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationParameterFilterInterceptor.java
index 3898a5b..b7c6e0e 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationParameterFilterInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationParameterFilterInterceptor.java
@@ -54,7 +54,7 @@ public class AnnotationParameterFilterInterceptor extends AbstractInterceptor
{
                 AnnotationUtils.addAllFields(Allowed.class, model.getClass(), annotatedFields);
             }
 
-            for (String paramName : parameters.getNames()) {
+            for (String paramName : parameters.keySet()) {
                 boolean allowed = false;
 
                 for (Field field : annotatedFields) {
@@ -76,7 +76,7 @@ public class AnnotationParameterFilterInterceptor extends AbstractInterceptor
{
                 AnnotationUtils.addAllFields(Blocked.class, model.getClass(), annotatedFields);
             }
 
-            for (String paramName : parameters.getNames()) {
+            for (String paramName : parameters.keySet()) {
                 for (Field field : annotatedFields) {
                     //TODO only matches exact field names.  need to change to it matches
start of ognl expression
                     //i.e take param name up to first . (period) and match against that

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java b/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java
index 360bb8f..6c00ca5 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/HttpParameters.java
@@ -1,7 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package org.apache.struts2.dispatcher;
 
 import org.apache.struts2.interceptor.ParameterAware;
 
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -10,7 +31,8 @@ import java.util.Set;
 import java.util.TreeMap;
 import java.util.TreeSet;
 
-public class HttpParameters implements Cloneable {
+@SuppressWarnings("unchecked")
+public class HttpParameters implements Map<String, Parameter>, Cloneable {
 
     private Map<String, Parameter> parameters;
 
@@ -26,18 +48,6 @@ public class HttpParameters implements Cloneable {
         return new Builder(new HashMap<String, Object>());
     }
 
-    public Parameter get(String name) {
-        if (parameters.containsKey(name)) {
-            return parameters.get(name);
-        } else {
-            return new Parameter.Empty(name);
-        }
-    }
-
-    public Set<String> getNames() {
-        return new TreeSet<>(parameters.keySet());
-    }
-
     public HttpParameters remove(Set<String> paramsToRemove) {
         for (String paramName : paramsToRemove) {
             parameters.remove(paramName);
@@ -78,6 +88,70 @@ public class HttpParameters implements Cloneable {
         parameterAware.setParameters(toMap());
     }
 
+    @Override
+    public int size() {
+        return parameters.size();
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return parameters.isEmpty();
+    }
+
+    @Override
+    public boolean containsKey(Object key) {
+        return parameters.containsKey(key);
+    }
+
+    @Override
+    public boolean containsValue(Object value) {
+        return parameters.containsValue(value);
+    }
+
+    @Override
+    public Parameter get(Object key) {
+        if (parameters.containsKey(key)) {
+            return parameters.get(key);
+        } else {
+            return new Parameter.Empty(String.valueOf(key));
+        }
+    }
+
+    @Override
+    public Parameter put(String key, Parameter value) {
+        throw new IllegalAccessError("HttpParameters are immutable, you cannot put value
directly!");
+    }
+
+    @Override
+    public Parameter remove(Object key) {
+        throw new IllegalAccessError("HttpParameters are immutable, you cannot remove object
directly!");
+    }
+
+    @Override
+    public void putAll(Map<? extends String, ? extends Parameter> m) {
+        throw new IllegalAccessError("HttpParameters are immutable, you cannot put values
directly!");
+    }
+
+    @Override
+    public void clear() {
+        throw new IllegalAccessError("HttpParameters are immutable, you cannot clear values
directly!");
+    }
+
+    @Override
+    public Set<String> keySet() {
+        return Collections.unmodifiableSet(new TreeSet<>(parameters.keySet()));
+    }
+
+    @Override
+    public Collection<Parameter> values() {
+        return Collections.unmodifiableCollection(parameters.values());
+    }
+
+    @Override
+    public Set<Entry<String, Parameter>> entrySet() {
+        return Collections.unmodifiableSet(parameters.entrySet());
+    }
+
     public static class Builder {
         private Map<String, Object> requestParameterMap;
         private HttpParameters parent;

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java
index 369f81e..ee57dc5 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java
@@ -63,7 +63,7 @@ public class CheckboxInterceptor extends AbstractInterceptor {
         HttpParameters parameters = ai.getInvocationContext().getParameters();
         Map<String, Parameter> extraParams = new HashMap<>();
 
-        for (String name : parameters.getNames()) {
+        for (String name : parameters.keySet()) {
             if (name.startsWith("__checkbox_")) {
                 String checkboxName = name.substring("__checkbox_".length());
 

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/main/java/org/apache/struts2/interceptor/DateTextFieldInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/DateTextFieldInterceptor.java
b/core/src/main/java/org/apache/struts2/interceptor/DateTextFieldInterceptor.java
index acadde2..d6a8212 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/DateTextFieldInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/DateTextFieldInterceptor.java
@@ -70,7 +70,7 @@ public class DateTextFieldInterceptor implements Interceptor {
         DateWord[] dateWords = DateWord.getAll();
 
         // Get all the values of date type
-        Set<String> names = parameters.getNames();
+        Set<String> names = parameters.keySet();
         for (String name : names) {
 
             for (DateWord dateWord : dateWords) {

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/main/java/org/apache/struts2/interceptor/MultiselectInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/MultiselectInterceptor.java
b/core/src/main/java/org/apache/struts2/interceptor/MultiselectInterceptor.java
index a62de22..0d9f285 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/MultiselectInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/MultiselectInterceptor.java
@@ -50,7 +50,7 @@ public class MultiselectInterceptor extends AbstractInterceptor {
         HttpParameters parameters = ai.getInvocationContext().getParameters();
         Map<String, Parameter> newParams = new HashMap<>();
 
-        for (String name : parameters.getNames()) {
+        for (String name : parameters.keySet()) {
             if (name.startsWith("__multiselect_")) {
                 String key = name.substring("__multiselect_".length());
 

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/test/java/com/opensymphony/xwork2/ActionContextTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/ActionContextTest.java b/core/src/test/java/com/opensymphony/xwork2/ActionContextTest.java
index c8b8d5d..fdefc25 100644
--- a/core/src/test/java/com/opensymphony/xwork2/ActionContextTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/ActionContextTest.java
@@ -90,7 +90,7 @@ public class ActionContextTest extends XWorkTestCase {
 
     public void testParameters() {
         context.setParameters(HttpParameters.create().build());
-        assertEquals(0, context.getParameters().getNames().size());
+        assertEquals(0, context.getParameters().keySet().size());
     }
 
     public void testConversionErrors() {

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/test/java/com/opensymphony/xwork2/interceptor/ParameterFilterInterceptorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/interceptor/ParameterFilterInterceptorTest.java
b/core/src/test/java/com/opensymphony/xwork2/interceptor/ParameterFilterInterceptorTest.java
index 798f135..bd470e6 100644
--- a/core/src/test/java/com/opensymphony/xwork2/interceptor/ParameterFilterInterceptorTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/interceptor/ParameterFilterInterceptorTest.java
@@ -116,7 +116,7 @@ public class ParameterFilterInterceptorTest extends XWorkTestCase {
     }
     
     private Collection getParameterNames() {
-        return ((HttpParameters)contextMap.get(ActionContext.PARAMETERS)).getNames();
+        return ((HttpParameters)contextMap.get(ActionContext.PARAMETERS)).keySet();
     }
     
     public void runAction() throws Exception  {

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/test/java/com/opensymphony/xwork2/interceptor/ParameterRemoverInterceptorTest.java
----------------------------------------------------------------------
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 854aed6..2bfceac 100644
--- a/core/src/test/java/com/opensymphony/xwork2/interceptor/ParameterRemoverInterceptorTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/interceptor/ParameterRemoverInterceptorTest.java
@@ -50,7 +50,7 @@ public class ParameterRemoverInterceptorTest extends TestCase {
 		interceptor.intercept(actionInvocation);
 		
 		HttpParameters params = (HttpParameters) contextMap.get(ActionContext.PARAMETERS);
-		assertEquals(params.getNames().size(), 2);
+		assertEquals(params.keySet().size(), 2);
 		assertTrue(params.contains("param3"));
 		assertTrue(params.contains("param"));
 		assertEquals(params.get("param3").getValue(), "paramValue3");
@@ -76,7 +76,7 @@ public class ParameterRemoverInterceptorTest extends TestCase {
 		interceptor.intercept(actionInvocation);
 		
 		HttpParameters params = (HttpParameters) contextMap.get(ActionContext.PARAMETERS);
-		assertEquals(params.getNames().size(), 0);
+		assertEquals(params.keySet().size(), 0);
 		
 		verify(actionInvocation);
 	}
@@ -98,7 +98,7 @@ public class ParameterRemoverInterceptorTest extends TestCase {
 		interceptor.intercept(actionInvocation);
 		
 		HttpParameters params = (HttpParameters) contextMap.get(ActionContext.PARAMETERS);
-		assertEquals(params.getNames().size(), 2);
+		assertEquals(params.keySet().size(), 2);
 		assertTrue(params.contains("param1"));
 		assertTrue(params.contains("param2"));
 		assertEquals(params.get("param1").getValue(), "paramValueOne");

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/test/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptorTest.java
b/core/src/test/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptorTest.java
index fad3655..dea1ef4 100644
--- a/core/src/test/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptorTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptorTest.java
@@ -133,7 +133,7 @@ public class StaticParametersInterceptorTest extends XWorkTestCase {
 
         assertEquals(before, ActionContext.getContext().getValueStack().size());
         assertEquals("${top.hero}", user.getName());
-        assertEquals(0, ActionContext.getContext().getParameters().getNames().size());
+        assertEquals(0, ActionContext.getContext().getParameters().keySet().size());
     }
 
     public void testFewParametersParse() throws Exception {

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/test/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationParameterFilterInterceptorTest.java
----------------------------------------------------------------------
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 1e271f4..04b878c 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
@@ -59,7 +59,7 @@ public class AnnotationParameterFilterInterceptorTest extends TestCase {
 		interceptor.intercept(invocation);
 
 		HttpParameters parameters = invocation.getInvocationContext().getParameters();
-		assertEquals("Parameter map should contain one entry", 1, parameters.getNames().size());
+		assertEquals("Parameter map should contain one entry", 1, parameters.keySet().size());
 		assertFalse(parameters.get("job").isDefined());
 		assertTrue(parameters.get("name").isDefined());
 		
@@ -97,7 +97,7 @@ public class AnnotationParameterFilterInterceptorTest extends TestCase {
 		interceptor.intercept(invocation);
 
 		HttpParameters parameters = invocation.getInvocationContext().getParameters();
-		assertEquals("Paramwter map should contain one entry", 1, parameters.getNames().size());
+		assertEquals("Paramwter map should contain one entry", 1, parameters.keySet().size());
 		assertTrue(parameters.get("job").isDefined());
 		assertFalse(parameters.get("name").isDefined());
 		
@@ -135,7 +135,7 @@ public class AnnotationParameterFilterInterceptorTest extends TestCase
{
 		interceptor.intercept(invocation);
 
 		HttpParameters parameters = invocation.getInvocationContext().getParameters();
-		assertEquals("Parameter map should contain two entries", 2, parameters.getNames().size());
+		assertEquals("Parameter map should contain two entries", 2, parameters.keySet().size());
 		assertFalse(parameters.get("job").isDefined());
 		assertTrue(parameters.get("name").isDefined());
 		assertTrue(parameters.get("m1").isDefined());
@@ -175,7 +175,7 @@ public class AnnotationParameterFilterInterceptorTest extends TestCase
{
 		interceptor.intercept(invocation);
 
 		HttpParameters parameters = invocation.getInvocationContext().getParameters();
-		assertEquals("Parameter map should contain two entries", 2, parameters.getNames().size());
+		assertEquals("Parameter map should contain two entries", 2, parameters.keySet().size());
 		assertTrue(parameters.get("job").isDefined());
 		assertFalse(parameters.get("name").isDefined());
 		assertFalse(parameters.get("m1").isDefined());

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/test/java/org/apache/struts2/components/ActionComponentTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/components/ActionComponentTest.java b/core/src/test/java/org/apache/struts2/components/ActionComponentTest.java
index 1af2e6f..5d12b1b 100644
--- a/core/src/test/java/org/apache/struts2/components/ActionComponentTest.java
+++ b/core/src/test/java/org/apache/struts2/components/ActionComponentTest.java
@@ -47,7 +47,7 @@ public class ActionComponentTest extends StrutsInternalTestCase {
         comp.addParameter("baz", new String[]{"jim", "sarah"});
         HttpParameters params = comp.createParametersForContext();
         assertNotNull(params);
-        assertEquals(2, params.getNames().size());
+        assertEquals(2, params.keySet().size());
         assertEquals("bar", params.get("foo").getValue());
         assertEquals(2, params.get("baz").getMultipleValues().length);
         mockValueStack.verify();

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/test/java/org/apache/struts2/interceptor/CheckboxInterceptorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/interceptor/CheckboxInterceptorTest.java
b/core/src/test/java/org/apache/struts2/interceptor/CheckboxInterceptorTest.java
index c7f2010..e63d133 100644
--- a/core/src/test/java/org/apache/struts2/interceptor/CheckboxInterceptorTest.java
+++ b/core/src/test/java/org/apache/struts2/interceptor/CheckboxInterceptorTest.java
@@ -72,7 +72,7 @@ public class CheckboxInterceptorTest extends StrutsInternalTestCase {
 		interceptor.intercept(ai);
 		interceptor.destroy();
 		
-		assertEquals(1, ai.getInvocationContext().getParameters().getNames().size());
+		assertEquals(1, ai.getInvocationContext().getParameters().keySet().size());
 	}
 
 	public void testPassthroughTwo() throws Exception {
@@ -85,7 +85,7 @@ public class CheckboxInterceptorTest extends StrutsInternalTestCase {
 		interceptor.intercept(ai);
 		interceptor.destroy();
 		
-		assertEquals(2, ai.getInvocationContext().getParameters().getNames().size());
+		assertEquals(2, ai.getInvocationContext().getParameters().keySet().size());
 	}
 
 	public void testOneCheckboxTrue() throws Exception {
@@ -103,7 +103,7 @@ public class CheckboxInterceptorTest extends StrutsInternalTestCase {
 
 		HttpParameters parameters = ai.getInvocationContext().getParameters();
 		assertFalse(parameters.contains("__checkbox_superpower"));
-		assertEquals(3, parameters.getNames().size()); // should be 3 as __checkbox_ should be
removed
+		assertEquals(3, parameters.keySet().size()); // should be 3 as __checkbox_ should be removed
 		assertEquals("true", parameters.get("superpower").getValue());
 	}
 
@@ -121,7 +121,7 @@ public class CheckboxInterceptorTest extends StrutsInternalTestCase {
 
 		HttpParameters parameters = ai.getInvocationContext().getParameters();
 		assertFalse(parameters.contains("__checkbox_superpower"));
-		assertEquals(3, parameters.getNames().size()); // should be 3 as __checkbox_ should be
removed
+		assertEquals(3, parameters.keySet().size()); // should be 3 as __checkbox_ should be removed
 		assertEquals("false", parameters.get("superpower").getValue());
 	}
 
@@ -140,7 +140,7 @@ public class CheckboxInterceptorTest extends StrutsInternalTestCase {
 
 		HttpParameters parameters = ai.getInvocationContext().getParameters();
 		assertFalse(parameters.contains("__checkbox_superpower"));
-		assertEquals(3, parameters.getNames().size()); // should be 3 as __checkbox_ should be
removed
+		assertEquals(3, parameters.keySet().size()); // should be 3 as __checkbox_ should be removed
 		assertEquals("off", parameters.get("superpower").getValue());
 	}
 
@@ -157,7 +157,7 @@ public class CheckboxInterceptorTest extends StrutsInternalTestCase {
 
 		HttpParameters parameters = ai.getInvocationContext().getParameters();
 		assertFalse(parameters.contains("__checkbox_superpower"));
-		assertEquals(2, parameters.getNames().size()); // should be 2 as __checkbox_ should be
removed
+		assertEquals(2, parameters.keySet().size()); // should be 2 as __checkbox_ should be removed
 		assertFalse(parameters.get("superpower").isDefined());
     }
 
@@ -179,7 +179,7 @@ public class CheckboxInterceptorTest extends StrutsInternalTestCase {
 		HttpParameters parameters = ai.getInvocationContext().getParameters();
 		assertFalse(parameters.contains("__checkbox_superpower"));
 		assertFalse(parameters.contains("__checkbox_cool"));
-		assertEquals(4, parameters.getNames().size()); // should be 4 as __checkbox_ should be
removed
+		assertEquals(4, parameters.keySet().size()); // should be 4 as __checkbox_ should be removed
 		assertEquals("yes", parameters.get("superpower").getValue());
 		assertEquals("false", parameters.get("cool").getValue()); // will use false as default
and not 'no'
 	}
@@ -203,7 +203,7 @@ public class CheckboxInterceptorTest extends StrutsInternalTestCase {
 		HttpParameters parameters = ai.getInvocationContext().getParameters();
 		assertFalse(parameters.contains("__checkbox_superpower"));
 		assertFalse(parameters.contains("__checkbox_cool"));
-		assertEquals(4, parameters.getNames().size()); // should be 4 as __checkbox_ should be
removed
+		assertEquals(4, parameters.keySet().size()); // should be 4 as __checkbox_ should be removed
 		assertEquals("yes", parameters.get("superpower").getValue());
 		assertEquals("no", parameters.get("cool").getValue());
 	}

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/test/java/org/apache/struts2/interceptor/DateTextFieldInterceptorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/interceptor/DateTextFieldInterceptorTest.java
b/core/src/test/java/org/apache/struts2/interceptor/DateTextFieldInterceptorTest.java
index b68319d..dab0571 100644
--- a/core/src/test/java/org/apache/struts2/interceptor/DateTextFieldInterceptorTest.java
+++ b/core/src/test/java/org/apache/struts2/interceptor/DateTextFieldInterceptorTest.java
@@ -36,7 +36,7 @@ public class DateTextFieldInterceptorTest extends StrutsInternalTestCase
{
 		interceptor.intercept(ai);
 		interceptor.destroy();
 
-		assertEquals(0, ai.getInvocationContext().getParameters().getNames().size());
+		assertEquals(0, ai.getInvocationContext().getParameters().keySet().size());
 	}
 
 	public void testOneDateTextField() throws Exception {
@@ -55,7 +55,7 @@ public class DateTextFieldInterceptorTest extends StrutsInternalTestCase
{
 		assertFalse(parameters.contains("__month_name"));
 		assertFalse(parameters.contains("__day_name"));
 		assertTrue(parameters.contains("name"));
-		assertEquals(1, parameters.getNames().size());
+		assertEquals(1, parameters.keySet().size());
 		Date date = new SimpleDateFormat("yyyy-MM-dd").parse("2000-06-15"); 
 		assertEquals(date, parameters.get("name").getObject());
 	}

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java
b/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java
index 6668b4c..a7df38f 100644
--- a/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java
+++ b/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java
@@ -262,7 +262,7 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase
{
         assertTrue(!action.hasErrors());
 
         HttpParameters parameters = mai.getInvocationContext().getParameters();
-        assertTrue(parameters.getNames().size() == 3);
+        assertTrue(parameters.keySet().size() == 3);
         File[] files = (File[]) parameters.get("file").getObject();
         String[] fileContentTypes = parameters.get("fileContentType").getMultipleValues();
         String[] fileRealFilenames = parameters.get("fileFileName").getMultipleValues();
@@ -322,7 +322,7 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase
{
         interceptor.intercept(mai);
 
         HttpParameters parameters = mai.getInvocationContext().getParameters();
-        assertEquals(3, parameters.getNames().size());
+        assertEquals(3, parameters.keySet().size());
         File[] files = (File[]) parameters.get("file").getObject();
         String[] fileContentTypes = parameters.get("fileContentType").getMultipleValues();
         String[] fileRealFilenames = parameters.get("fileFileName").getMultipleValues();

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/test/java/org/apache/struts2/interceptor/MultiselectInterceptorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/interceptor/MultiselectInterceptorTest.java
b/core/src/test/java/org/apache/struts2/interceptor/MultiselectInterceptorTest.java
index 31623c6..1121a9a 100644
--- a/core/src/test/java/org/apache/struts2/interceptor/MultiselectInterceptorTest.java
+++ b/core/src/test/java/org/apache/struts2/interceptor/MultiselectInterceptorTest.java
@@ -93,7 +93,7 @@ public class MultiselectInterceptorTest extends StrutsInternalTestCase {
 
         HttpParameters parameters = ai.getInvocationContext().getParameters();
         assertFalse(parameters.contains("__multiselect_superpower"));
-        assertEquals(3, parameters.getNames().size()); // should be 3 as __multiselect_ should
be removed
+        assertEquals(3, parameters.keySet().size()); // should be 3 as __multiselect_ should
be removed
         assertEquals("robin", parameters.get("superpower").getValue());
     }
 
@@ -111,7 +111,7 @@ public class MultiselectInterceptorTest extends StrutsInternalTestCase
{
 
         HttpParameters parameters = ai.getInvocationContext().getParameters();
         assertFalse(parameters.contains("__multiselect_superpower"));
-        assertEquals(3, parameters.getNames().size()); // should be 3 as __multiselect_ should
be removed
+        assertEquals(3, parameters.keySet().size()); // should be 3 as __multiselect_ should
be removed
         assertFalse(parameters.get("superpower").isDefined());
     }
 
@@ -133,7 +133,7 @@ public class MultiselectInterceptorTest extends StrutsInternalTestCase
{
         HttpParameters parameters = ai.getInvocationContext().getParameters();
         assertFalse(parameters.contains("__multiselect_superpower"));
         assertFalse(parameters.contains("__multiselect_cool"));
-        assertEquals(4, parameters.getNames().size()); // should be 4 as __multiselect_ should
be removed
+        assertEquals(4, parameters.keySet().size()); // should be 4 as __multiselect_ should
be removed
         assertEquals("yes", parameters.get("superpower").getValue());
         assertFalse(parameters.get("cool").isDefined());
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/6d623ebb/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
index 1ad2b79..32a4125 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
@@ -227,7 +227,7 @@ public class ActionTagTest extends AbstractTagTest {
         // check parameters, there should be one
         ActionInvocation ai = component.getProxy().getInvocation();
         ActionContext ac = ai.getInvocationContext();
-        assertEquals(1, ac.getParameters().getNames().size());
+        assertEquals(1, ac.getParameters().keySet().size());
     }
 
     public void testIngoreContextParamsTrue() throws Exception {
@@ -252,7 +252,7 @@ public class ActionTagTest extends AbstractTagTest {
         // check parameters, there should be one
         ActionInvocation ai = component.getProxy().getInvocation();
         ActionContext ac = ai.getInvocationContext();
-        assertEquals(0, ac.getParameters().getNames().size());
+        assertEquals(0, ac.getParameters().keySet().size());
     }
 
     public void testNoNameDefined() throws Exception {


Mime
View raw message