diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 2e76e189..5f0536eb 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,2 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar diff --git a/README.md b/README.md index ede69fda..c1fc7b5b 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,20 @@ JoinFaces War Example This SAP (Single Page Application) illustrates JSF usage inside WAR packaged Spring Boot Application. -[JoinFaces](http://joinfaces.org) autoconfigures [PrimeFaces](http://primefaces.org/), [OmniFaces](http://omnifaces.org/), [Mojarra](https://eclipse-ee4j.github.io/mojarra/) and [MyFaces](http://myfaces.apache.org) libraries to run at [Tomcat](http://tomcat.apache.org/), [Jetty](http://www.eclipse.org/jetty) or [Undertow](http://undertow.io/). It autoconfigures [Weld](http://weld.cdi-spec.org) and [Rewrite](https://www.ocpsoft.org/rewrite/) too. +[JoinFaces](https://joinfaces.org) autoconfigures +[PrimeFaces](https://primefaces.org/), +[PrimeFaces Extensions](https://primefaces-extensions.github.io/), +[Apache MyFaces Tobago](https://github.com/apache/myfaces-tobago), +[OmniFaces](https://omnifaces.org/), +[AdminFaces](https://adminfaces.github.io/site/), +[Mojarra](https://eclipse-ee4j.github.io/mojarra/) and +[MyFaces](http://myfaces.apache.org) libraries to run at embedded +[Tomcat](https://tomcat.apache.org/), +[Jetty](https://www.eclipse.org/jetty) or +[Undertow](https://undertow.io/). +It autoconfigures [Weld](https://weld.cdi-spec.org), +[Apache OpenWebBeans](https://openwebbeans.apache.org/) and +[Rewrite](https://www.ocpsoft.org/rewrite/) too. ## Run Example Application locally @@ -42,7 +55,7 @@ Includes joinfaces starter dependency. All other jsf dependencies are included t ```xml - 5.2.0-m2 + 5.2.0 diff --git a/nb-configuration.xml b/nb-configuration.xml index 974cb300..c44ead13 100644 --- a/nb-configuration.xml +++ b/nb-configuration.xml @@ -14,5 +14,9 @@ That way multiple projects can share the same settings (useful for formatting ru Any value defined here will override the pom.xml file value but is only applicable to the current project. --> JDK_17 + true + true + LF + false diff --git a/nbactions.xml b/nbactions.xml new file mode 100644 index 00000000..0c976d38 --- /dev/null +++ b/nbactions.xml @@ -0,0 +1,109 @@ + + + + run + + jar + + + process-classes + org.codehaus.mojo:exec-maven-plugin:1.2.1:exec + + + -classpath %classpath org.joinfaces.example.JoinFacesExampleApplication + java + + + + debug + + jar + + + process-classes + org.codehaus.mojo:exec-maven-plugin:1.2.1:exec + + + -Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath org.joinfaces.example.JoinFacesExampleApplication + java + true + + + + CUSTOM-duplicate-checkstyle-pmd-cpd-cycles-spotbugs-dependency + duplicate-checkstyle-pmd-cpd-cycles-spotbugs-dependency + + clean + verify + + + check-duplicate + check-checkstyle + check-cycles + check-cpd + check-pmd + check-spotbugs + check-dependency + + + true + + + + CUSTOM-site + site + + clean + site + + + + CUSTOM-skipTests + skipTests + + install + + + true + + + + CUSTOM-native + native + + package + + + native + + + true + + + + profile + + jar + + + process-classes + org.codehaus.mojo:exec-maven-plugin:1.2.1:exec + + + -classpath %classpath org.joinfaces.example.JoinFacesExampleApplication + java + + + + build + + * + + + install + + + true + + + diff --git a/pom.xml b/pom.xml index 0adc65ad..eda42cd3 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.2.0-M2 + 3.2.0 @@ -21,15 +21,15 @@ 3.0.2 - 5.2.0-m2 - 3.9.4 + 5.2.0 + 3.9.5 - 4.10.0 - 4.10.0 - 5.4.1 + 4.13.0 + 4.13.0 + 5.6.2 - 0.8.9 + 0.8.11 org/joinfaces/example/JoinFacesExampleApplication.class 0.91 0.90 @@ -40,14 +40,14 @@ 1.0.9 - 4.7.3.5 + 4.8.1.0 1.12.0 3.0.1 2.0 3.11.0 - 3.21.0 - 3.3.0 - 10.12.1 + 3.21.2 + 3.3.1 + 10.12.5 src/checkconfig ${check.dir}/checkstyle @@ -61,11 +61,11 @@ ${checkstyle.dir}/checkstyle-header.txt 2.0.1 - (about.html|mozilla/public-suffix-list.txt) - (META-INF.versions.9.module-info|jakarta.el.*) + () + () - 8.3.1 - 3.9.1.2184 + 9.0.0 + 3.10.0.2594 joinfaces_joinfaces-maven-war-example joinfaces https://sonarcloud.io @@ -80,7 +80,7 @@ org.joinfaces - joinfaces-dependencies + joinfaces-bom ${joinfaces.version} pom import @@ -211,10 +211,6 @@ io.github.bonigarcia webdrivermanager - - jakarta.enterprise - jakarta.enterprise.cdi-api - org.apache.maven maven-model @@ -242,18 +238,6 @@ true - - org.joinfaces - joinfaces-maven-plugin - ${joinfaces.version} - - - - classpath-scan - - - - org.apache.maven.plugins maven-failsafe-plugin @@ -415,13 +399,16 @@ - - org.joinfaces - joinfaces-maven-plugin - org.springframework.boot spring-boot-maven-plugin + + + + process-aot + + + org.jacoco @@ -552,6 +539,7 @@ spotbugs-maven-plugin + process-test-classes check diff --git a/src/main/java/org/joinfaces/example/SecurityConfig.java b/src/main/java/org/joinfaces/example/SecurityConfig.java index 0e19436c..1fb9736e 100644 --- a/src/main/java/org/joinfaces/example/SecurityConfig.java +++ b/src/main/java/org/joinfaces/example/SecurityConfig.java @@ -60,16 +60,16 @@ public SecurityFilterChain configure(HttpSecurity http, MvcRequestMatcher.Builde http .authorizeHttpRequests((authorize) -> authorize .requestMatchers(mvc.pattern("/")).permitAll() - .requestMatchers(new AntPathRequestMatcher("/**.jsf")).permitAll() + .requestMatchers(new AntPathRequestMatcher("/**.faces")).permitAll() .requestMatchers(new AntPathRequestMatcher("/jakarta.faces.resource/**")).permitAll() .anyRequest().authenticated()) .formLogin((formLogin) -> formLogin - .loginPage("/login.jsf") + .loginPage("/login.faces") .permitAll() - .failureUrl("/login.jsf?error=true") - .defaultSuccessUrl("/starter.jsf")) + .failureUrl("/login.faces?error=true") + .defaultSuccessUrl("/starter.faces")) .logout((logout) -> logout - .logoutSuccessUrl("/login.jsf")); + .logoutSuccessUrl("/login.faces")); return http.build(); } catch (Exception ex) { diff --git a/src/main/java/org/joinfaces/example/view/RedirectToIndexConfigurationProvider.java b/src/main/java/org/joinfaces/example/view/RedirectToIndexConfigurationProvider.java index bf8a7eb6..07d83b06 100644 --- a/src/main/java/org/joinfaces/example/view/RedirectToIndexConfigurationProvider.java +++ b/src/main/java/org/joinfaces/example/view/RedirectToIndexConfigurationProvider.java @@ -29,7 +29,7 @@ import org.springframework.web.context.annotation.ApplicationScope; /** - * Redirect to index.jsf SPA. + * Redirect to index.faces SPA. * * @author Marcelo Fernandes */ @@ -42,7 +42,7 @@ public Configuration getConfiguration(ServletContext t) { return ConfigurationBuilder.begin() .addRule() .when(Direction.isInbound().and(Path.matches("/"))) - .perform(Redirect.temporary("/starter.jsf")); + .perform(Redirect.temporary("/starter.faces")); } @Override diff --git a/src/test/java/org/joinfaces/example/view/AbstractPageComponent.java b/src/test/java/org/joinfaces/example/view/AbstractPageComponent.java index bce19b72..27266682 100644 --- a/src/test/java/org/joinfaces/example/view/AbstractPageComponent.java +++ b/src/test/java/org/joinfaces/example/view/AbstractPageComponent.java @@ -31,10 +31,10 @@ public AbstractPageComponent(WebDriver webDriver) { this.webDriver = webDriver; } - protected abstract String url(); + protected abstract String getLocation(); public void navegateTo() { - this.webDriver.navigate().to(this.preffix + url()); + this.webDriver.navigate().to(this.preffix + getLocation()); } public T initElements(Class classx) { diff --git a/src/test/java/org/joinfaces/example/view/AbstractPageIT.java b/src/test/java/org/joinfaces/example/view/AbstractPageIT.java index b0420091..a091f1d4 100644 --- a/src/test/java/org/joinfaces/example/view/AbstractPageIT.java +++ b/src/test/java/org/joinfaces/example/view/AbstractPageIT.java @@ -42,7 +42,7 @@ public class AbstractPageIT { private static int countFinish = 0; - private static final int NUMBER_OF_SUBCLASSES = 8; + private static final int NUMBER_OF_SUBCLASSES = 9; @BeforeAll public static void init() { diff --git a/src/test/java/org/joinfaces/example/view/CustomInputPage.java b/src/test/java/org/joinfaces/example/view/CustomInputPage.java index 15f85fa4..eebb2dcf 100644 --- a/src/test/java/org/joinfaces/example/view/CustomInputPage.java +++ b/src/test/java/org/joinfaces/example/view/CustomInputPage.java @@ -38,8 +38,8 @@ public CustomInputPage(WebDriver webDriver) { } @Override - protected String url() { - return "/customInput.jsf"; + protected String getLocation() { + return "/customInput.faces"; } public void submit(String message) { diff --git a/src/test/java/org/joinfaces/example/view/FileUploadPage.java b/src/test/java/org/joinfaces/example/view/FileUploadPage.java index 69940b87..f3fe3525 100644 --- a/src/test/java/org/joinfaces/example/view/FileUploadPage.java +++ b/src/test/java/org/joinfaces/example/view/FileUploadPage.java @@ -38,8 +38,8 @@ public FileUploadPage(WebDriver webDriver) { } @Override - protected String url() { - return "/fileUpload.jsf"; + protected String getLocation() { + return "/fileUpload.faces"; } private By getDownloadButtonBy() { diff --git a/src/test/java/org/joinfaces/example/view/HelloTagPage.java b/src/test/java/org/joinfaces/example/view/HelloTagPage.java index 5f7a1ff9..0eed97a4 100644 --- a/src/test/java/org/joinfaces/example/view/HelloTagPage.java +++ b/src/test/java/org/joinfaces/example/view/HelloTagPage.java @@ -30,8 +30,8 @@ public HelloTagPage(WebDriver webDriver) { } @Override - protected String url() { - return "/helloTag.jsf"; + protected String getLocation() { + return "/helloTag.faces"; } private By getHelloWorldDivBy() { diff --git a/src/test/java/org/joinfaces/example/view/HiCCPage.java b/src/test/java/org/joinfaces/example/view/HiCCPage.java index 49c4aaed..ff5ab257 100644 --- a/src/test/java/org/joinfaces/example/view/HiCCPage.java +++ b/src/test/java/org/joinfaces/example/view/HiCCPage.java @@ -30,8 +30,8 @@ public HiCCPage(WebDriver webDriver) { } @Override - protected String url() { - return "/hiCC.jsf"; + protected String getLocation() { + return "/hiCC.faces"; } private By getHiCCDivBy() { diff --git a/src/test/java/org/joinfaces/example/view/IndexPage.java b/src/test/java/org/joinfaces/example/view/IndexPage.java new file mode 100644 index 00000000..a0997ae4 --- /dev/null +++ b/src/test/java/org/joinfaces/example/view/IndexPage.java @@ -0,0 +1,35 @@ +/* + * Copyright 2016-2016 the original author or authors. + * + * Licensed 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.joinfaces.example.view; + +import org.openqa.selenium.WebDriver; + +public class IndexPage extends AbstractPageComponent { + + public IndexPage(WebDriver webDriver) { + super(webDriver); + } + + @Override + public String getLocation() { + return ""; + } + + public String getCurrentURL() { + return webDriver.getCurrentUrl(); + } +} diff --git a/src/test/java/org/joinfaces/example/view/IndexPageIT.java b/src/test/java/org/joinfaces/example/view/IndexPageIT.java new file mode 100644 index 00000000..4134cd81 --- /dev/null +++ b/src/test/java/org/joinfaces/example/view/IndexPageIT.java @@ -0,0 +1,40 @@ +/* + * Copyright 2016-2016 the original author or authors. + * + * Licensed 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.joinfaces.example.view; + +import org.joinfaces.example.JoinFacesExampleApplication; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.SpringExtension; + +import static org.assertj.core.api.Assertions.assertThat; + +@ExtendWith(SpringExtension.class) +@SpringBootTest(classes = JoinFacesExampleApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class IndexPageIT extends AbstractPageIT { + + @Test + public void checkRedirectUrl() { + IndexPage indexPage = initElements(IndexPage.class); + indexPage.navegateTo(); + + assertThat(indexPage.getCurrentURL()) + .endsWith("starter.faces"); + } +} diff --git a/src/test/java/org/joinfaces/example/view/LoginPage.java b/src/test/java/org/joinfaces/example/view/LoginPage.java index 87210288..504ea13d 100644 --- a/src/test/java/org/joinfaces/example/view/LoginPage.java +++ b/src/test/java/org/joinfaces/example/view/LoginPage.java @@ -36,8 +36,8 @@ public LoginPage(WebDriver webDriver) { } @Override - protected String url() { - return "/login.jsf"; + protected String getLocation() { + return "/login.faces"; } public StarterPage login(String username, String password) { diff --git a/src/test/java/org/joinfaces/example/view/MenuOfPage.java b/src/test/java/org/joinfaces/example/view/MenuOfPage.java index e6d15afb..c5fc91bb 100644 --- a/src/test/java/org/joinfaces/example/view/MenuOfPage.java +++ b/src/test/java/org/joinfaces/example/view/MenuOfPage.java @@ -32,8 +32,8 @@ public MenuOfPage(WebDriver webDriver) { } @Override - protected String url() { - return "/starter.jsf"; + protected String getLocation() { + return "/starter.faces"; } public StarterPage clickStarter() { diff --git a/src/test/java/org/joinfaces/example/view/StarterPage.java b/src/test/java/org/joinfaces/example/view/StarterPage.java index d96ed0ef..7b4c229a 100644 --- a/src/test/java/org/joinfaces/example/view/StarterPage.java +++ b/src/test/java/org/joinfaces/example/view/StarterPage.java @@ -53,8 +53,8 @@ public StarterPage(WebDriver webDriver) { } @Override - protected String url() { - return "/starter.jsf"; + protected String getLocation() { + return "/starter.faces"; } private void click(WebElement webElement, String technology, By tabHeaderBy) { diff --git a/src/test/java/org/joinfaces/example/view/WelcomeConverterPage.java b/src/test/java/org/joinfaces/example/view/WelcomeConverterPage.java index f489eeb6..0db601c6 100644 --- a/src/test/java/org/joinfaces/example/view/WelcomeConverterPage.java +++ b/src/test/java/org/joinfaces/example/view/WelcomeConverterPage.java @@ -38,8 +38,8 @@ public WelcomeConverterPage(WebDriver webDriver) { } @Override - protected String url() { - return "/welcomeConverter.jsf"; + protected String getLocation() { + return "/welcomeConverter.faces"; } public void submit(String message) {