You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ja...@apache.org on 2010/05/18 14:25:44 UTC
svn commit: r945617 -
/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/NavigationHandlerImplTest.java
Author: jakobk
Date: Tue May 18 12:25:44 2010
New Revision: 945617
URL: http://svn.apache.org/viewvc?rev=945617&view=rev
Log:
MYFACES-2719 faces-redirect=true lost the url parameters (test case)
Modified:
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/NavigationHandlerImplTest.java
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/NavigationHandlerImplTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/NavigationHandlerImplTest.java?rev=945617&r1=945616&r2=945617&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/NavigationHandlerImplTest.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/NavigationHandlerImplTest.java Tue May 18 12:25:44 2010
@@ -1,7 +1,26 @@
+/*
+ * 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.myfaces.application;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashSet;
@@ -469,4 +488,28 @@ public class NavigationHandlerImplTest e
assertEquals("/b.jsp", nc.getToViewId(facesContext));
}
}
-}
\ No newline at end of file
+
+ /**
+ * Tests if the URL parameters of an outcome are correctly
+ * added to the NavigationCase.
+ */
+ public void testFacesRedirectAddsUrlParameters()
+ {
+ NavigationHandlerImpl nh = new NavigationHandlerImpl();
+
+ // get the NavigationCase
+ // note that the URL parameters can be separated via & or &
+ NavigationCase navigationCase = nh.getNavigationCase(facesContext, null,
+ "test.xhtml?faces-redirect=true&a=b&includeViewParams=true&c=d&e=f");
+
+ // created the expected parameter map
+ Map<String, List<String>> expected = new HashMap<String, List<String>>();
+ expected.put("a", Arrays.asList("b"));
+ expected.put("c", Arrays.asList("d"));
+ expected.put("e", Arrays.asList("f"));
+ // note that faces-redirect and includeViewParams
+ // should not be added as a parameter
+
+ assertEquals(expected, navigationCase.getParameters());
+ }
+}