-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create integration test for myfaces-4623
- Loading branch information
Showing
10 changed files
with
472 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
* 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. | ||
--> | ||
<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/maven-v4_0_0.xsd"> | ||
<parent> | ||
<groupId>org.apache.myfaces.core</groupId> | ||
<artifactId>myfaces-integration-tests</artifactId> | ||
<version>5.0.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.apache.myfaces.core.integration-tests</groupId> | ||
<artifactId>myfaces4623</artifactId> | ||
<name>Apache MyFaces Core 5.0 - Integration Tests - protectedViews</name> | ||
<packaging>war</packaging> | ||
|
||
</project> |
51 changes: 51 additions & 0 deletions
51
...ration-tests/myfaces4623/src/main/java/org/apache/myfaces/core/integrationtests/Bean.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 @@ | ||
/* | ||
* 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.core.integrationtests; | ||
|
||
import jakarta.inject.Named; | ||
|
||
import jakarta.enterprise.context.SessionScoped; | ||
|
||
@SessionScoped | ||
@Named("bean") | ||
public class Bean implements java.io.Serializable | ||
{ | ||
|
||
private Integer arraySize = 0; | ||
|
||
public Integer[] getCount() | ||
{ | ||
if(arraySize == 1) | ||
{ | ||
return new Integer[]{1}; | ||
} | ||
return new Integer[]{}; | ||
} | ||
|
||
public void setToOne() | ||
{ | ||
this.arraySize = 1; | ||
} | ||
|
||
public void resetToZero() | ||
{ | ||
this.arraySize = 0; | ||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
...s/myfaces4623/src/main/java/org/apache/myfaces/core/integrationtests/CustomComponent.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,40 @@ | ||
/* | ||
* 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.core.integrationtests; | ||
|
||
import jakarta.faces.application.ResourceDependency; | ||
import jakarta.faces.component.FacesComponent; | ||
import jakarta.faces.component.html.HtmlOutputText; | ||
import jakarta.faces.event.ComponentSystemEvent; | ||
|
||
@FacesComponent( | ||
createTag = true, | ||
namespace = "test" | ||
) | ||
@ResourceDependency( | ||
library = "default", | ||
name = "js/test.js" | ||
) | ||
public class CustomComponent extends HtmlOutputText | ||
{ | ||
public void processEvent(ComponentSystemEvent event) | ||
{ | ||
super.processEvent(event); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
integration-tests/myfaces4623/src/main/webapp/WEB-INF/beans.xml
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,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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. | ||
--> | ||
<beans 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 http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" | ||
bean-discovery-mode="annotated"> | ||
</beans> |
26 changes: 26 additions & 0 deletions
26
integration-tests/myfaces4623/src/main/webapp/WEB-INF/faces-config.xml
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,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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. | ||
--> | ||
<faces-config version="2.2" | ||
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 http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"> | ||
|
||
|
||
</faces-config> |
54 changes: 54 additions & 0 deletions
54
integration-tests/myfaces4623/src/main/webapp/WEB-INF/web.xml
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,54 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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. | ||
--> | ||
<web-app version="3.1" 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 http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> | ||
|
||
<context-param> | ||
<param-name>jakarta.faces.PROJECT_STAGE</param-name> | ||
<param-value>Development</param-value> | ||
</context-param> | ||
|
||
<servlet> | ||
<servlet-name>Faces Servlet</servlet-name> | ||
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class> | ||
<load-on-startup>1</load-on-startup> | ||
</servlet> | ||
|
||
<servlet-mapping> | ||
<servlet-name>Faces Servlet</servlet-name> | ||
<url-pattern>*.xhtml</url-pattern> | ||
</servlet-mapping> | ||
|
||
<welcome-file-list> | ||
<welcome-file>index.xhtml</welcome-file> | ||
</welcome-file-list> | ||
|
||
<context-param> | ||
<param-name>org.apache.myfaces.STRICT_JSF_2_FACELETS_COMPATIBILITY</param-name> | ||
<param-value>true</param-value> | ||
</context-param> | ||
|
||
<context-param> | ||
<param-name>org.apache.myfaces.CHECK_ID_PRODUCTION_MODE</param-name> | ||
<param-value>true</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,55 @@ | ||
<!-- | ||
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. | ||
--> | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" | ||
xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core" | ||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:jsf="http://xmlns.jcp.org/jsf" xmlns:test="test"> | ||
<h:head> | ||
<title>Test DupId with c:ForEach</title> | ||
</h:head> | ||
<h:body> | ||
<h:form id="form1"> | ||
|
||
<script type="text/javascript"> | ||
faces.ajax.addOnError(function(data){ | ||
//alert("error occurred! " + data.message); | ||
document.querySelector("#message").innerHTML = data.errorName; | ||
}); | ||
</script> | ||
|
||
<div jsf:id="loop"> | ||
<c:forEach var="item" items="${bean.count}"> | ||
<test:customComponent id="text" value="DISPLAYING COMPONENT" styleClass="input" /> | ||
</c:forEach> | ||
</div> | ||
|
||
<h:commandButton id="display" value="display" action="${bean.setToOne()}"> | ||
<f:ajax execute="@form" render="loop" /> | ||
</h:commandButton> | ||
|
||
<h:commandButton id="close" value="close" action="${bean.resetToZero()}"> | ||
<f:ajax execute="@form" render="loop" /> | ||
</h:commandButton> | ||
|
||
<div id="message"> </div> | ||
</h:form> | ||
|
||
</h:body> | ||
|
||
</html> |
19 changes: 19 additions & 0 deletions
19
integration-tests/myfaces4623/src/main/webapp/resources/default/js/test.js
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,19 @@ | ||
/* | ||
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. | ||
*/ | ||
console.log("js resource added succesfully!"); |
Oops, something went wrong.