Skip to content

Commit

Permalink
Merge pull request #1720 from jakartaee/mojarra_issue_5171
Browse files Browse the repository at this point in the history
Mojarra issue 5171
  • Loading branch information
arjantijms committed Nov 14, 2022
2 parents 51f772e + 32ed99a commit 3547465
Show file tree
Hide file tree
Showing 9 changed files with 284 additions and 9 deletions.
37 changes: 37 additions & 0 deletions tck/faces40/beanValidation/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2022 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.faces40</groupId>
<artifactId>pom</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>

<artifactId>beanValidation</artifactId>
<packaging>war</packaging>

<name>Jakarta Faces TCK ${project.version} - Test - Faces 4.0 - beanValidation</name>

<build>
<finalName>test-faces40-beanValidation</finalName>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2022 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 ee.jakarta.tck.faces.test.servlet50.beanValidation;

import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Named;
import jakarta.validation.constraints.NotEmpty;

@Named
@RequestScoped
public class Issue5171Bean {

@NotEmpty
private String string1;

@NotEmpty
private String string2;

public String getString1() {
return string1;
}

public void setString1(String string1) {
this.string1 = string1;
}

public String getString2() {
return string2;
}

public void setString2(String string2) {
this.string2 = string2;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2022 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="http://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>
45 changes: 45 additions & 0 deletions tck/faces40/beanValidation/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2022 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_5_0.xsd"
version="5.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.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>

<welcome-file-list>
<welcome-file>issue5171.xhtml</welcome-file>
</welcome-file-list>
</web-app>
40 changes: 40 additions & 0 deletions tck/faces40/beanValidation/src/main/webapp/issue5171.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<!--
Copyright (c) 2022 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:f="jakarta.faces.core"
xmlns:h="jakarta.faces.html"
xmlns:my="jakarta.faces.composite/components"
>
<h:head>
<title>Issue5171IT</title>
</h:head>
<h:body>
<h:form id="form">
<div>
<h:inputText id="simpleInput" value="#{issue5171Bean.string1}"/>
<h:message id="simpleInputMessage" for="simpleInput"/>
</div>
<div>
<my:component id="composite" value="#{issue5171Bean.string2}"/>
<h:message id="compositeInputMessage" for="composite:input"/>
</div>
<h:commandButton id="submit" value="Submit"/>
</h:form>
</h:body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!--
Copyright (c) 2022 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
-->
<ui:component
xmlns:ui="jakarta.faces.facelets"
xmlns:f="jakarta.faces.core"
xmlns:h="jakarta.faces.html"
xmlns:cc="jakarta.faces.composite"
>
<cc:interface>
<cc:attribute name="value"/>
</cc:interface>
<cc:implementation>
<h:inputText id="input" value="#{cc.attrs.value}" rendered="#{cc.rendered}" label="Composite input"/>
</cc:implementation>
</ui:component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (c) 2022 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 ee.jakarta.tck.faces.test.servlet50.beanValidation;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;

import ee.jakarta.tck.faces.test.util.arquillian.ITBase;

public class Issue5171IT extends ITBase {

/**
* @see https://github.com/eclipse-ee4j/mojarra/issues/5171
*/
@Test
public void test() throws Exception {
HtmlPage page = getPage("issue5171.xhtml");
page = page.getElementById("form:submit").click();
String simpleInputMessage = page.getElementById("form:simpleInputMessage").asNormalizedText();
String compositeInputMessage = page.getElementById("form:compositeInputMessage").asNormalizedText();
assertEquals("simple input must trigger bean validation and show message", "must not be empty", simpleInputMessage);
assertEquals("composite input must trigger bean validation and show message", "must not be empty", compositeInputMessage);

HtmlTextInput simpleInput = (HtmlTextInput) page.getElementById("form:simpleInput");
HtmlTextInput compositeInput = (HtmlTextInput) page.getElementById("form:composite:input");
simpleInput.setValueAttribute("not empty");
compositeInput.setValueAttribute("not empty");
page = page.getElementById("form:submit").click();
simpleInputMessage = page.getElementById("form:simpleInputMessage").asNormalizedText();
compositeInputMessage = page.getElementById("form:compositeInputMessage").asNormalizedText();
assertEquals("simple input must pass bean validation and clear out message", "", simpleInputMessage);
assertEquals("composite input must pass bean validation and clear out message", "", compositeInputMessage);
}
}
14 changes: 6 additions & 8 deletions tck/faces40/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,16 @@
<name>Jakarta Faces TCK ${project.version} - Test - Faces 4.0</name>

<modules>

<module>ajax</module>
<module>extensionless-mapping</module>

<module>ajax</module>
<module>beanValidation</module>
<module>cdi</module>
<module>doctype</module>

<module>extensionless-mapping</module>
<module>inputFile</module>
<module>inputText</module>
<module>namespaces</module>
<module>cdi</module>
<module>javaPage</module>
<module>javaPageWithMetadata</module>
<module>namespaces</module>
<module>resources</module>
<module>selectItemGroup</module>
<module>selectItemGroups</module>
Expand All @@ -57,4 +55,4 @@
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
</project>
2 changes: 1 addition & 1 deletion tck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@

<properties>
<!-- Explicit version of Mojarra to test -->
<mojarra.version>4.0.0</mojarra.version>
<mojarra.version>4.0.1-SNAPSHOT</mojarra.version>

<!-- Verhicle used for testing the Mojarra version -->
<glassfish.version>7.0.0-M4</glassfish.version>
Expand Down

0 comments on commit 3547465

Please sign in to comment.