-
Notifications
You must be signed in to change notification settings - Fork 109
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 #5469 from eclipse-ee4j/add_minimal_configuration_…
…for_integration_tests Add minimal configuration for integration tests
- Loading branch information
Showing
22 changed files
with
1,325 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
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,60 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 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.mojarra.test</groupId> | ||
<artifactId>pom</artifactId> | ||
<version>4.0.9-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>base</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>Mojarra ${project.version} - INTEGRATION TESTS - ${project.artifactId}</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<version>5.10.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.arquillian.junit5</groupId> | ||
<artifactId>arquillian-junit5-container</artifactId> | ||
<version>1.9.1.Final</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.shrinkwrap.resolver</groupId> | ||
<artifactId>shrinkwrap-resolver-impl-maven</artifactId> | ||
<version>3.3.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.seleniumhq.selenium</groupId> | ||
<artifactId>selenium-java</artifactId> | ||
<version>4.23.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.github.bonigarcia</groupId> | ||
<artifactId>webdrivermanager</artifactId> | ||
<version>5.9.2</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
110 changes: 110 additions & 0 deletions
110
test/base/src/main/java/org/eclipse/mojarra/test/base/BaseIT.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,110 @@ | ||
/* | ||
* Copyright (c) Contributors to the 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 | ||
* https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-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: GPL-2.0 with Classpath-exception-2.0 which | ||
* is available at https://openjdk.java.net/legal/gplv2+ce.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 or Apache-2.0 | ||
*/ | ||
package org.eclipse.mojarra.test.base; | ||
|
||
import static java.lang.System.getProperty; | ||
import static java.time.Duration.ofSeconds; | ||
import static org.jboss.shrinkwrap.api.ShrinkWrap.create; | ||
|
||
import java.io.File; | ||
import java.net.URL; | ||
import java.util.UUID; | ||
import java.util.function.BooleanSupplier; | ||
import java.util.logging.Level; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit5.ArquillianExtension; | ||
import org.jboss.arquillian.test.api.ArquillianResource; | ||
import org.jboss.shrinkwrap.api.importer.ZipImporter; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.junit.jupiter.api.AfterAll; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.TestInstance; | ||
import org.junit.jupiter.api.TestInstance.Lifecycle; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.openqa.selenium.JavascriptExecutor; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.chrome.ChromeDriver; | ||
import org.openqa.selenium.chrome.ChromeOptions; | ||
import org.openqa.selenium.support.PageFactory; | ||
import org.openqa.selenium.support.ui.WebDriverWait; | ||
|
||
import io.github.bonigarcia.wdm.WebDriverManager; | ||
|
||
@ExtendWith(ArquillianExtension.class) | ||
@TestInstance(Lifecycle.PER_CLASS) | ||
public abstract class BaseIT { | ||
|
||
private WebDriver browser; | ||
|
||
@ArquillianResource | ||
private URL baseURL; | ||
|
||
@Deployment(testable = false) | ||
public static WebArchive createDeployment() { | ||
String warFileName = getProperty("war.file.name") + ".war"; | ||
return create(ZipImporter.class, warFileName) | ||
.importFrom(new File("target/" + warFileName)) | ||
.as(WebArchive.class); | ||
} | ||
|
||
@BeforeAll | ||
public void setup() { | ||
String arquillianBrowser = System.getProperty("arquillian.browser"); | ||
|
||
switch (arquillianBrowser) { | ||
case "chrome": | ||
WebDriverManager.chromedriver().setup(); | ||
ChromeDriver chrome = new ChromeDriver(new ChromeOptions().addArguments("--no-sandbox", "--headless")); | ||
chrome.setLogLevel(Level.INFO); | ||
browser = chrome; | ||
break; | ||
default: | ||
throw new UnsupportedOperationException("arquillian.browser='" + arquillianBrowser + "' is not yet supported"); | ||
} | ||
|
||
PageFactory.initElements(browser, this); | ||
} | ||
|
||
@AfterAll | ||
public void teardown() { | ||
browser.quit(); | ||
} | ||
|
||
protected void open(String resource) { | ||
browser.get(baseURL + resource); | ||
} | ||
|
||
protected String getPageSource() { | ||
return browser.getPageSource(); | ||
} | ||
|
||
protected void guardAjax(Runnable action) { | ||
String uuid = UUID.randomUUID().toString(); | ||
executeScript("window.$ajax = true; faces.ajax.addOnEvent(data => { if (data.status == 'complete') window.$ajax = '" + uuid + "'; })"); | ||
action.run(); | ||
waitUntil(() -> executeScript("return window.$ajax == '" + uuid + "' || (!window.$ajax && document.readyState == 'complete');")); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
private <T> T executeScript(String script) { | ||
return (T) ((JavascriptExecutor) browser).executeScript(script); | ||
} | ||
|
||
private void waitUntil(BooleanSupplier predicate) { | ||
new WebDriverWait(browser, ofSeconds(5)).until($ -> predicate.getAsBoolean()); | ||
} | ||
} |
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) 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.mojarra.test</groupId> | ||
<artifactId>pom</artifactId> | ||
<version>4.0.9-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>issue5460</artifactId> | ||
<packaging>war</packaging> | ||
|
||
<name>Mojarra ${project.version} - INTEGRATION TESTS - ${project.artifactId}</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.eclipse.mojarra.test</groupId> | ||
<artifactId>base</artifactId> | ||
<version>${project.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
79 changes: 79 additions & 0 deletions
79
test/issue5460/src/main/java/org/eclipse/mojarra/test/issue5460/Issue5460Bean.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,79 @@ | ||
/* | ||
* Copyright (c) Contributors to the 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 | ||
* https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-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: GPL-2.0 with Classpath-exception-2.0 which | ||
* is available at https://openjdk.java.net/legal/gplv2+ce.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 or Apache-2.0 | ||
*/ | ||
package org.eclipse.mojarra.test.issue5460; | ||
|
||
import jakarta.enterprise.context.RequestScoped; | ||
import jakarta.inject.Named; | ||
|
||
@Named | ||
@RequestScoped | ||
public class Issue5460Bean { | ||
|
||
private String cc1; | ||
private String cc2; | ||
private String cc3; | ||
private String cc4; | ||
private String cc5; | ||
private String cc6; | ||
|
||
public String getCc1() { | ||
return cc1; | ||
} | ||
|
||
public void setCc1(String cc1) { | ||
this.cc1 = cc1; | ||
} | ||
|
||
public String getCc2() { | ||
return cc2; | ||
} | ||
|
||
public void setCc2(String cc2) { | ||
this.cc2 = cc2; | ||
} | ||
|
||
public String getCc3() { | ||
return cc3; | ||
} | ||
|
||
public void setCc3(String cc3) { | ||
this.cc3 = cc3; | ||
} | ||
|
||
public String getCc4() { | ||
return cc4; | ||
} | ||
|
||
public void setCc4(String cc4) { | ||
this.cc4 = cc4; | ||
} | ||
|
||
public String getCc5() { | ||
return cc5; | ||
} | ||
|
||
public void setCc5(String cc5) { | ||
this.cc5 = cc5; | ||
} | ||
|
||
public String getCc6() { | ||
return cc6; | ||
} | ||
|
||
public void setCc6(String cc6) { | ||
this.cc6 = cc6; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
test/issue5460/src/main/java/org/eclipse/mojarra/test/issue5460/Issue5460Component.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,42 @@ | ||
/* | ||
* Copyright (c) Contributors to the 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 | ||
* https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-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: GPL-2.0 with Classpath-exception-2.0 which | ||
* is available at https://openjdk.java.net/legal/gplv2+ce.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 or Apache-2.0 | ||
*/ | ||
package org.eclipse.mojarra.test.issue5460; | ||
|
||
import jakarta.faces.component.FacesComponent; | ||
import jakarta.faces.component.NamingContainer; | ||
import jakarta.faces.component.UIInput; | ||
import jakarta.faces.component.UINamingContainer; | ||
import jakarta.faces.context.FacesContext; | ||
|
||
@FacesComponent("issue5460Component") | ||
public class Issue5460Component extends UIInput implements NamingContainer { | ||
|
||
@Override | ||
public String getFamily() { | ||
return UINamingContainer.COMPONENT_FAMILY; | ||
} | ||
|
||
@Override | ||
public void decode(FacesContext context) { | ||
Object value = getValue(); | ||
setSubmittedValue(value == null ? "" : value); | ||
super.decode(context); | ||
} | ||
|
||
public String getAttributeResults() { | ||
return getAttributes().get("required") + " " + getAttributes().get("styleClass"); | ||
} | ||
} |
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,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 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" | ||
> | ||
<servlet> | ||
<servlet-name>facesServlet</servlet-name> | ||
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class> | ||
<load-on-startup>1</load-on-startup> | ||
</servlet> | ||
<servlet-mapping> | ||
<servlet-name>facesServlet</servlet-name> | ||
<url-pattern>*.xhtml</url-pattern> | ||
</servlet-mapping> | ||
</web-app> |
Oops, something went wrong.