Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a couple of new tests for Faces 4.1 #1901

Merged
merged 2 commits into from Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 36 additions & 0 deletions tck/faces41/facesMessage/pom.xml
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2024 Contributors to Eclipse Foundation.

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.eclipse.ee4j.tck.faces.faces41</groupId>
<artifactId>pom</artifactId>
<version>4.1.0-SNAPSHOT</version>
</parent>

<artifactId>facesMessage</artifactId>
<packaging>war</packaging>

<name>Jakarta Faces TCK ${project.version} - Test - Faces 4.1 - facesMessage</name>

<build>
<finalName>test-faces41-facesMessage</finalName>
</build>
</project>
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2024 Contributors to Eclipse Foundation.
*
* 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 org.eclipse.ee4j.tck.faces.faces41.facesMessage;

import org.eu.ingwar.tools.arquillian.extension.suite.annotations.ArquillianSuiteDeployment;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.spec.WebArchive;

import ee.jakarta.tck.faces.test.util.selenium.BaseITNG;

/**
* Given Arquilian has no single deployment testsuite
* mechanism we have to rely on a third party library.
* This improves the performance in a major area, namely
* we are only deploying once and then run all tests
* on the same deployment (cuts down by 95% the test time)
*/
@ArquillianSuiteDeployment
public class Deployments {
@Deployment(testable = false)
public static WebArchive createDeployment() {
return BaseITNG.createDeployment();
}
}

@@ -0,0 +1,109 @@
/*
* Copyright (c) 2024 Contributors to Eclipse Foundation.
*
* 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 org.eclipse.ee4j.tck.faces.faces41.facesMessage;

import static jakarta.faces.application.FacesMessage.SEVERITY_INFO;
import static jakarta.faces.application.FacesMessage.SEVERITY_WARN;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

import jakarta.faces.application.FacesMessage;

import org.junit.Test;

public class Spec1823IT {

private static final FacesMessage MESSAGE1A = new FacesMessage(SEVERITY_INFO, "summary1", "detail1");
private static final FacesMessage MESSAGE1B = new FacesMessage(SEVERITY_INFO, "summary1", "detail1");
private static final FacesMessage MESSAGE2A = new FacesMessage(SEVERITY_INFO, "summary1", "detail2");
private static final FacesMessage MESSAGE2B = new FacesMessage(SEVERITY_INFO, "summary1", "detail2");
private static final FacesMessage MESSAGE3A = new FacesMessage(SEVERITY_INFO, "summary2", "detail1");
private static final FacesMessage MESSAGE3B = new FacesMessage(SEVERITY_INFO, "summary2", "detail1");
private static final FacesMessage MESSAGE4A = new FacesMessage(SEVERITY_INFO, "summary2", "detail2");
private static final FacesMessage MESSAGE4B = new FacesMessage(SEVERITY_INFO, "summary2", "detail2");
private static final FacesMessage MESSAGE5A = new FacesMessage(SEVERITY_WARN, "summary1", "detail1");
private static final FacesMessage MESSAGE5B = new FacesMessage(SEVERITY_WARN, "summary1", "detail1");
private static final FacesMessage MESSAGE6A = new FacesMessage(SEVERITY_WARN, "summary1", "detail2");
private static final FacesMessage MESSAGE6B = new FacesMessage(SEVERITY_WARN, "summary1", "detail2");
private static final FacesMessage MESSAGE7A = new FacesMessage(SEVERITY_WARN, "summary2", "detail1");
private static final FacesMessage MESSAGE7B = new FacesMessage(SEVERITY_WARN, "summary2", "detail1");
private static final FacesMessage MESSAGE8A = new FacesMessage(SEVERITY_WARN, "summary2", "detail2");
private static final FacesMessage MESSAGE8B = new FacesMessage(SEVERITY_WARN, "summary2", "detail2");

public static class CustomFacesMessage extends FacesMessage {
private static final long serialVersionUID = 1L;

public CustomFacesMessage(Severity severity, String summary, String detail) {
super(severity, summary, detail);
}
}

/**
* @see FacesMessage
* @see https://github.com/jakartaee/faces/issues/1823
*/
@Test
public void testEquals() {
assertEquals(MESSAGE1A, MESSAGE1A);
assertEquals(MESSAGE1A, MESSAGE1B);
assertNotEquals(MESSAGE1A, MESSAGE2A);
assertNotEquals(MESSAGE1A, MESSAGE2B);
assertNotEquals(MESSAGE1A, MESSAGE3A);
assertNotEquals(MESSAGE1A, MESSAGE3B);
assertNotEquals(MESSAGE1A, MESSAGE4A);
assertNotEquals(MESSAGE1A, MESSAGE4B);
assertNotEquals(MESSAGE1A, MESSAGE5A);
assertNotEquals(MESSAGE1A, MESSAGE5B);
assertNotEquals(MESSAGE1A, MESSAGE6A);
assertNotEquals(MESSAGE1A, MESSAGE6B);
assertNotEquals(MESSAGE1A, MESSAGE7A);
assertNotEquals(MESSAGE1A, MESSAGE7B);
assertNotEquals(MESSAGE1A, MESSAGE8A);
assertNotEquals(MESSAGE1A, MESSAGE8B);
assertEquals(MESSAGE1A, new FacesMessage(SEVERITY_INFO, "summary1", "detail1"));
assertNotEquals(MESSAGE1A, new CustomFacesMessage(SEVERITY_INFO, "summary1", "detail1"));
assertEquals(new CustomFacesMessage(SEVERITY_INFO, "summary1", "detail1"), new CustomFacesMessage(SEVERITY_INFO, "summary1", "detail1"));
assertNotEquals(new CustomFacesMessage(SEVERITY_INFO, "summary1", "detail1"), new CustomFacesMessage(SEVERITY_WARN, "summary1", "detail1"));
}

/**
* @see FacesMessage
* @see https://github.com/jakartaee/faces/issues/1823
*/
@Test
public void testHashCode() {
assertEquals(MESSAGE1A.hashCode(), MESSAGE1A.hashCode());
assertEquals(MESSAGE1A.hashCode(), MESSAGE1B.hashCode());
assertNotEquals(MESSAGE1A.hashCode(), MESSAGE2A.hashCode());
assertNotEquals(MESSAGE1A.hashCode(), MESSAGE2B.hashCode());
assertNotEquals(MESSAGE1A.hashCode(), MESSAGE3A.hashCode());
assertNotEquals(MESSAGE1A.hashCode(), MESSAGE3B.hashCode());
assertNotEquals(MESSAGE1A.hashCode(), MESSAGE4A.hashCode());
assertNotEquals(MESSAGE1A.hashCode(), MESSAGE4B.hashCode());
assertNotEquals(MESSAGE1A.hashCode(), MESSAGE5A.hashCode());
assertNotEquals(MESSAGE1A.hashCode(), MESSAGE5B.hashCode());
assertNotEquals(MESSAGE1A.hashCode(), MESSAGE6A.hashCode());
assertNotEquals(MESSAGE1A.hashCode(), MESSAGE6B.hashCode());
assertNotEquals(MESSAGE1A.hashCode(), MESSAGE7A.hashCode());
assertNotEquals(MESSAGE1A.hashCode(), MESSAGE7B.hashCode());
assertNotEquals(MESSAGE1A.hashCode(), MESSAGE8A.hashCode());
assertNotEquals(MESSAGE1A.hashCode(), MESSAGE8B.hashCode());
assertEquals(MESSAGE1A.hashCode(), new FacesMessage(SEVERITY_INFO, "summary1", "detail1").hashCode());
assertNotEquals(MESSAGE1A, new CustomFacesMessage(SEVERITY_INFO, "summary1", "detail1").hashCode());
assertEquals(new CustomFacesMessage(SEVERITY_INFO, "summary1", "detail1").hashCode(), new CustomFacesMessage(SEVERITY_INFO, "summary1", "detail1").hashCode());
assertNotEquals(new CustomFacesMessage(SEVERITY_INFO, "summary1", "detail1").hashCode(), new CustomFacesMessage(SEVERITY_WARN, "summary1", "detail1").hashCode());
}
}
36 changes: 36 additions & 0 deletions tck/faces41/headAndBodyRenderer/pom.xml
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2024 Contributors to Eclipse Foundation.

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.eclipse.ee4j.tck.faces.faces41</groupId>
<artifactId>pom</artifactId>
<version>4.1.0-SNAPSHOT</version>
</parent>

<artifactId>headAndBodyRenderer</artifactId>
<packaging>war</packaging>

<name>Jakarta Faces TCK ${project.version} - Test - Faces 4.1 - headAndBodyRenderer</name>

<build>
<finalName>test-faces41-headAndBodyRenderer</finalName>
</build>
</project>
24 changes: 24 additions & 0 deletions tck/faces41/headAndBodyRenderer/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2024 Contributors to Eclipse Foundation.

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

-->
<beans
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_1.xsd"
version="4.1" bean-discovery-mode="annotated">
</beans>
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2024 Contributors to Eclipse Foundation.

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

-->
<faces-config
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd"
version="4.0">
<faces-config-extension>
<facelets-processing>
<file-extension>.xhtmlAsXml</file-extension>
<process-as>xml</process-as>
</facelets-processing>
<facelets-processing>
<file-extension>.xhtmlAsXhtml</file-extension>
<process-as>xhtml</process-as>
</facelets-processing>
</faces-config-extension>
</faces-config>
48 changes: 48 additions & 0 deletions tck/faces41/headAndBodyRenderer/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2024 Contributors to Eclipse Foundation.

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="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
version="6.0"
>
<context-param>
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
<param-value>${webapp.projectStage}</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>

<servlet>
<servlet-name>facesServlet</servlet-name>
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>facesServlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
<url-pattern>*.xhtmlAsXhtml</url-pattern>
<url-pattern>*.xhtmlAsXml</url-pattern>
</servlet-mapping>
</web-app>
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<!--

Copyright (c) 2024 Contributors to Eclipse Foundation.

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 xmlns:h="jakarta.faces.html">
<h:head id="headId">
<title>Spec1760: h:head and h:body with ID while using default HTML5 output processing</title>
</h:head>
<h:body id="bodyId">
<h1>TEST</h1>
</h:body>
</html>
@@ -0,0 +1,26 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--

Copyright (c) 2024 Contributors to Eclipse Foundation.

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 xmlns:h="jakarta.faces.html">
<h:head id="headId">
<title>Spec1760: h:head and h:body with ID while explicitly output as XHTML</title>
</h:head>
<h:body id="bodyId">
<h1>TEST</h1>
</h:body>
</html>