-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1626 from jakartaee/add_base_class_for_integratio…
…n_tests Consolidate changes into master
- Loading branch information
Showing
14 changed files
with
283 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. | ||
This program and the accompanying materials are made available under the | ||
terms of the Eclipse Public License v. 2.0, which is available at | ||
http://www.eclipse.org/legal/epl-2.0. | ||
This Source Code may also be made available under the following Secondary | ||
Licenses when the conditions for such availability set forth in the | ||
Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
version 2 with the GNU Classpath Exception, which is available at | ||
https://www.gnu.org/software/classpath/license.html. | ||
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
--> | ||
|
||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.glassfish.mojarra.faces23</groupId> | ||
<artifactId>pom</artifactId> | ||
<version>4.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>flash</artifactId> | ||
<packaging>war</packaging> | ||
|
||
<name>Mojarra ${project.version} - Test - Faces 2.3 - Flash</name> | ||
|
||
<build> | ||
<finalName>test-faces23-flash</finalName> | ||
</build> | ||
</project> |
37 changes: 37 additions & 0 deletions
37
tck/faces23/flash/src/main/java/ee/jakarta/tck/faces/test/javaee8/flash/Issue4167.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0, which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception, which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
*/ | ||
|
||
package ee.jakarta.tck.faces.test.javaee8.flash; | ||
|
||
import jakarta.enterprise.inject.Model; | ||
import jakarta.faces.context.FacesContext; | ||
import jakarta.faces.context.Flash; | ||
|
||
@Model | ||
public class Issue4167 { | ||
|
||
public String keepAndRedirect() { | ||
FacesContext.getCurrentInstance().getExternalContext().getFlash().put("message", "issue4167"); | ||
return "issue4167?faces-redirect=true"; | ||
} | ||
|
||
public String keepAndGet() { | ||
Flash flash = FacesContext.getCurrentInstance().getExternalContext().getFlash(); | ||
flash.keep("message"); | ||
return (String) flash.get("message"); | ||
} | ||
|
||
} |
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. | ||
This program and the accompanying materials are made available under the | ||
terms of the Eclipse Public License v. 2.0, which is available at | ||
http://www.eclipse.org/legal/epl-2.0. | ||
This Source Code may also be made available under the following Secondary | ||
Licenses when the conditions for such availability set forth in the | ||
Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
version 2 with the GNU Classpath Exception, which is available at | ||
https://www.gnu.org/software/classpath/license.html. | ||
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
--> | ||
|
||
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee web-app_3_1.xsd" | ||
version="3.1" | ||
> | ||
<context-param> | ||
<param-name>jakarta.faces.PROJECT_STAGE</param-name> | ||
<param-value>${webapp.projectStage}</param-value> | ||
</context-param> | ||
<context-param> | ||
<param-name>jakarta.faces.PARTIAL_STATE_SAVING</param-name> | ||
<param-value>${webapp.partialStateSaving}</param-value> | ||
</context-param> | ||
<context-param> | ||
<param-name>jakarta.faces.STATE_SAVING_METHOD</param-name> | ||
<param-value>${webapp.stateSavingMethod}</param-value> | ||
</context-param> | ||
<context-param> | ||
<param-name>jakarta.faces.SERIALIZE_SERVER_STATE</param-name> | ||
<param-value>${webapp.serializeServerState}</param-value> | ||
</context-param> | ||
</web-app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. | ||
This program and the accompanying materials are made available under the | ||
terms of the Eclipse Public License v. 2.0, which is available at | ||
http://www.eclipse.org/legal/epl-2.0. | ||
This Source Code may also be made available under the following Secondary | ||
Licenses when the conditions for such availability set forth in the | ||
Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
version 2 with the GNU Classpath Exception, which is available at | ||
https://www.gnu.org/software/classpath/license.html. | ||
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
--> | ||
|
||
<html lang="en" | ||
xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:f="http://xmlns.jcp.org/jsf/core" | ||
xmlns:h="http://xmlns.jcp.org/jsf/html"> | ||
|
||
|
||
|
||
<h:head> | ||
<title>Issue4167IT - Flash#keep() should not remove current entry</title> | ||
</h:head> | ||
<h:body> | ||
<h:form id="form"> | ||
<h:commandButton id="button" action="#{issue4167.keepAndRedirect}" /> | ||
</h:form> | ||
<h:outputText id="result1" value="#{flash.message}" /> | ||
<h:outputText id="result2" value="#{issue4167.keepAndGet()}" /> | ||
<h:outputText id="result3" value="#{flash.message}" /> | ||
</h:body> | ||
</html> |
51 changes: 51 additions & 0 deletions
51
tck/faces23/flash/src/test/java/ee/jakarta/tck/faces/test/javaee8/flash/Issue4167IT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0, which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception, which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
*/ | ||
|
||
package ee.jakarta.tck.faces.test.javaee8.flash; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
import org.junit.Test; | ||
|
||
import com.gargoylesoftware.htmlunit.html.HtmlPage; | ||
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput; | ||
|
||
import ee.jakarta.tck.faces.test.util.arquillian.ITBase; | ||
import jakarta.faces.context.Flash; | ||
|
||
public class Issue4167IT extends ITBase { | ||
|
||
/** | ||
* @see Flash#keep(String) | ||
* @see https://github.com/eclipse-ee4j/mojarra/issues/4171 | ||
*/ | ||
@Test | ||
public void test() throws Exception { | ||
HtmlPage page = getPage("issue4167.xhtml"); | ||
|
||
assertTrue(page.getHtmlElementById("result1").asNormalizedText().isEmpty()); | ||
assertTrue(page.getHtmlElementById("result2").asNormalizedText().isEmpty()); | ||
assertTrue(page.getHtmlElementById("result3").asNormalizedText().isEmpty()); | ||
|
||
HtmlSubmitInput button = (HtmlSubmitInput) page.getHtmlElementById("form:button"); | ||
page = button.click(); | ||
|
||
assertTrue(page.getHtmlElementById("result1").asNormalizedText().equals("issue4167")); | ||
assertTrue(page.getHtmlElementById("result2").asNormalizedText().equals("issue4167")); | ||
assertTrue(page.getHtmlElementById("result3").asNormalizedText().equals("issue4167")); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
tck/util/src/main/java/ee/jakarta/tck/faces/test/util/arquillian/ITBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package ee.jakarta.tck.faces.test.util.arquillian; | ||
|
||
import static java.lang.System.getProperty; | ||
import static org.jboss.shrinkwrap.api.ShrinkWrap.create; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.net.URL; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.arquillian.test.api.ArquillianResource; | ||
import org.jboss.shrinkwrap.api.importer.ZipImporter; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.runner.RunWith; | ||
|
||
import com.gargoylesoftware.htmlunit.WebClient; | ||
import com.gargoylesoftware.htmlunit.html.HtmlPage; | ||
|
||
import ee.jakarta.tck.faces.test.util.htmlunit.DebugOptions; | ||
import ee.jakarta.tck.faces.test.util.htmlunit.IgnoringIncorrectnessListener; | ||
|
||
@RunWith(Arquillian.class) | ||
public abstract class ITBase { | ||
|
||
@ArquillianResource | ||
protected URL webUrl; | ||
protected WebClient webClient; | ||
|
||
@Deployment(testable = false) | ||
public static WebArchive createDeployment() { | ||
return create(ZipImporter.class, getProperty("finalName") + ".war") | ||
.importFrom(new File("target/" + getProperty("finalName") + ".war")) | ||
.as(WebArchive.class); | ||
} | ||
|
||
@Before | ||
public void setUp() { | ||
webClient = new WebClient(); | ||
webClient.getOptions().setJavaScriptEnabled(true); | ||
webClient.setJavaScriptTimeout(120000); | ||
webClient.setIncorrectnessListener(new IgnoringIncorrectnessListener()); | ||
DebugOptions.setDebugOptions(webClient); | ||
} | ||
|
||
protected HtmlPage getPage(String viewId) throws IOException { | ||
return webClient.getPage(webUrl + viewId); | ||
} | ||
|
||
@After | ||
public void tearDown() { | ||
webClient.close(); | ||
} | ||
|
||
} |