From 78e02ea6c1a02407dea2d74359f2bdd85f304937 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 13 Nov 2014 20:40:05 +0000 Subject: [PATCH] Upgrade to Mojarra 2.2.10 Mojarra 2.2.10 generates responses that begin with an XML declaration: This change broke the expectation in JsfAjaxHandlerTests's testSendAjaxRedirect. The test has been updated to expect the XML declaration. ResourcesBeanDefinitionParserTests has been updated to set up and tear down the mock JDF infrastructure. This ensures that it does not leave any side-effects that cause subsequent tests to fail on some platforms. --- build.gradle | 4 ++-- .../ResourcesBeanDefinitionParserTests.java | 16 ++++++++++++++++ .../faces/webflow/JsfAjaxHandlerTests.java | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 5bf16875..d54e0d73 100644 --- a/build.gradle +++ b/build.gradle @@ -280,8 +280,8 @@ project("spring-faces") { provided("javax.el:javax.el-api:2.2.4") provided("javax.servlet:javax.servlet-api:3.0.1") provided("javax.portlet:portlet-api:2.0") - provided("com.sun.faces:jsf-api:2.2.4") - provided("com.sun.faces:jsf-impl:2.2.4") + provided("com.sun.faces:jsf-api:2.2.10") + provided("com.sun.faces:jsf-impl:2.2.10") provided("org.apache.myfaces.core:myfaces-impl:2.1.14") optional("com.sun.facelets:jsf-facelets:1.1.14") optional("org.springframework.security:spring-security-core:$springSecurityVersion") diff --git a/spring-faces/src/test/java/org/springframework/faces/config/ResourcesBeanDefinitionParserTests.java b/spring-faces/src/test/java/org/springframework/faces/config/ResourcesBeanDefinitionParserTests.java index 9cdf6e1f..f74b1b58 100644 --- a/spring-faces/src/test/java/org/springframework/faces/config/ResourcesBeanDefinitionParserTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/config/ResourcesBeanDefinitionParserTests.java @@ -2,9 +2,25 @@ package org.springframework.faces.config; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.faces.webflow.JSFMockHelper; public class ResourcesBeanDefinitionParserTests extends AbstractResourcesConfigurationTests { + /** + * JSF Mock Helper + */ + private final JSFMockHelper jsfMockHelper = new JSFMockHelper(); + + public void setUp() throws Exception { + this.jsfMockHelper.setUp(); + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + this.jsfMockHelper.tearDown(); + } @Override protected ApplicationContext initApplicationContext() { diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfAjaxHandlerTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfAjaxHandlerTests.java index 98151085..6776e4b3 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfAjaxHandlerTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfAjaxHandlerTests.java @@ -23,7 +23,7 @@ public class JsfAjaxHandlerTests extends TestCase { public void testSendAjaxRedirect() throws Exception { this.ajaxHandler.sendAjaxRedirectInternal("/target", this.jsfMock.request(), this.jsfMock.response(), false); - assertTrue(this.jsfMock.contentAsString().matches("")); + assertTrue(this.jsfMock.contentAsString().matches("<\\?xml version='1.0' encoding='utf-8'\\?>\n")); assertEquals("application/xml", this.jsfMock.response().getContentType()); }