WICKET-5648 CookieUtils - add #loadValues(), make #getCookie() public, properly 
initialize from the defaults

Remove the multivalue related methods


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/304e0f42
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/304e0f42
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/304e0f42

Branch: refs/heads/master
Commit: 304e0f427e3e01f182e1f916834a209281127448
Parents: b590d19
Author: Martin Tzvetanov Grigorov <[email protected]>
Authored: Mon Aug 4 12:23:18 2014 +0200
Committer: Martin Tzvetanov Grigorov <[email protected]>
Committed: Mon Aug 4 12:23:18 2014 +0200

----------------------------------------------------------------------
 .../apache/wicket/util/cookies/CookieUtils.java | 33 ++-----------
 .../wicket/util/cookies/CookieUtilsTest.java    | 49 --------------------
 2 files changed, 3 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/304e0f42/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java 
b/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java
index 1859d96..987db75 100644
--- a/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java
+++ b/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java
@@ -141,43 +141,16 @@ public class CookieUtils
        }
 
        /**
-        * Split the loaded Cookie value
-        * 
-        * @param value
-        * @return The cookie's value split into fragments
-        * @deprecated Cookies with multiple values are no more supported 
(WICKET-5648). This method will be removed in Wicket 7.x
-        */
-       @Deprecated
-       protected String[] splitValue(final String value)
-       {
-               return Strings.split(value, 
FormComponent.VALUE_SEPARATOR.charAt(0));
-       }
-
-       /**
-        * Join all fragments into one Cookie value
-        * 
-        * @param values
-        * @return The cookie's value split into its constituent parts
-        * @deprecated Cookies with multiple values are no more supported 
(WICKET-5648). This method will be removed in Wicket 7.x
-        */
-       @Deprecated
-       protected String joinValues(final String... values)
-       {
-               return Strings.join(FormComponent.VALUE_SEPARATOR, values);
-       }
-
-       /**
         * Create a Cookie with key and value and save it in the browser with 
the next response
         * 
         * @param key
         *          The cookie name
-        * @param values
-        *          The cookie values
+        * @param value
+        *          The cookie value
         */
-       public final void save(String key, final String... values)
+       public final void save(String key, final String value)
        {
                key = getSaveKey(key);
-               String value = joinValues(values);
                Cookie cookie = getCookie(key);
                if (cookie == null)
                {

http://git-wip-us.apache.org/repos/asf/wicket/blob/304e0f42/wicket-core/src/test/java/org/apache/wicket/util/cookies/CookieUtilsTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/util/cookies/CookieUtilsTest.java 
b/wicket-core/src/test/java/org/apache/wicket/util/cookies/CookieUtilsTest.java
index 9e6cf40..f32c882 100644
--- 
a/wicket-core/src/test/java/org/apache/wicket/util/cookies/CookieUtilsTest.java
+++ 
b/wicket-core/src/test/java/org/apache/wicket/util/cookies/CookieUtilsTest.java
@@ -16,8 +16,6 @@
  */
 package org.apache.wicket.util.cookies;
 
-import static org.hamcrest.Matchers.arrayContaining;
-import static org.hamcrest.Matchers.emptyArray;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.is;
 
@@ -30,7 +28,6 @@ import javax.servlet.http.Cookie;
 
 import org.apache.wicket.Page;
 import org.apache.wicket.WicketTestCase;
-import org.apache.wicket.markup.html.form.FormComponent;
 import org.apache.wicket.markup.html.form.TextField;
 import org.apache.wicket.util.cookies.CookieValuePersisterTestPage.TestForm;
 import org.junit.Before;
@@ -130,52 +127,6 @@ public class CookieUtilsTest extends WicketTestCase
        }
 
        @Test
-       public void splitValuesNullString()
-       {
-               CookieUtils utils = new CookieUtils();
-               String[] values = utils.splitValue(null);
-               assertArrayEquals(new String[0], values);
-       }
-
-       @Test
-       public void splitValuesEmptyString()
-       {
-               CookieUtils utils = new CookieUtils();
-               String[] values = utils.splitValue("");
-               assertThat(values, is(emptyArray()));
-       }
-
-       @Test
-       public void splitValuesSingleValue()
-       {
-               CookieUtils utils = new CookieUtils();
-               String value1 = "value one";
-               String[] values = utils.splitValue(value1);
-               assertThat(values, is(arrayContaining(value1)));
-       }
-
-       @Test
-       public void splitValuesManyValues()
-       {
-               CookieUtils utils = new CookieUtils();
-               String value1 = "value one";
-               String value2 = "value two";
-               String value = value1 + FormComponent.VALUE_SEPARATOR + value2;
-               String[] values = utils.splitValue(value);
-               assertThat(values, is(arrayContaining(value1, value2)));
-       }
-
-       @Test
-       public void joinValues()
-       {
-               CookieUtils utils = new CookieUtils();
-               String value1 = "value one";
-               String value2 = "value two";
-               String joined = utils.joinValues(value1, value2);
-               assertThat(joined, is(equalTo(value1 + 
FormComponent.VALUE_SEPARATOR + value2)));
-       }
-
-       @Test
        public void saveLoadValue()
        {
                CookieUtils utils = new CookieUtils();

Reply via email to