Skip to content

Commit

Permalink
huge commit because synchronization with joinfaces-maven-jar-example.
Browse files Browse the repository at this point in the history
  • Loading branch information
persapiens committed Nov 26, 2023
1 parent 06a29fd commit befcf20
Show file tree
Hide file tree
Showing 19 changed files with 254 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -42,7 +55,7 @@ Includes joinfaces starter dependency. All other jsf dependencies are included t

```xml
<properties>
<joinfaces.version>5.2.0-m2</joinfaces.version>
<joinfaces.version>5.2.0</joinfaces.version>
</properties>

<dependencyManagement>
Expand Down
4 changes: 4 additions & 0 deletions nb-configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
-->
<netbeans.hint.jdkPlatform>JDK_17</netbeans.hint.jdkPlatform>
<com-junichi11-netbeans-changelf.enable>true</com-junichi11-netbeans-changelf.enable>
<com-junichi11-netbeans-changelf.use-project>true</com-junichi11-netbeans-changelf.use-project>
<com-junichi11-netbeans-changelf.lf-kind>LF</com-junichi11-netbeans-changelf.lf-kind>
<com-junichi11-netbeans-changelf.use-global>false</com-junichi11-netbeans-changelf.use-global>
</properties>
</project-shared-configuration>
109 changes: 109 additions & 0 deletions nbactions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath org.joinfaces.example.JoinFacesExampleApplication</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath org.joinfaces.example.JoinFacesExampleApplication</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
</action>
<action>
<actionName>CUSTOM-duplicate-checkstyle-pmd-cpd-cycles-spotbugs-dependency</actionName>
<displayName>duplicate-checkstyle-pmd-cpd-cycles-spotbugs-dependency</displayName>
<goals>
<goal>clean</goal>
<goal>verify</goal>
</goals>
<activatedProfiles>
<activatedProfile>check-duplicate</activatedProfile>
<activatedProfile>check-checkstyle</activatedProfile>
<activatedProfile>check-cycles</activatedProfile>
<activatedProfile>check-cpd</activatedProfile>
<activatedProfile>check-pmd</activatedProfile>
<activatedProfile>check-spotbugs</activatedProfile>
<activatedProfile>check-dependency</activatedProfile>
</activatedProfiles>
<properties>
<skipTests>true</skipTests>
</properties>
</action>
<action>
<actionName>CUSTOM-site</actionName>
<displayName>site</displayName>
<goals>
<goal>clean</goal>
<goal>site</goal>
</goals>
</action>
<action>
<actionName>CUSTOM-skipTests</actionName>
<displayName>skipTests</displayName>
<goals>
<goal>install</goal>
</goals>
<properties>
<skipTests>true</skipTests>
</properties>
</action>
<action>
<actionName>CUSTOM-native</actionName>
<displayName>native</displayName>
<goals>
<goal>package</goal>
</goals>
<activatedProfiles>
<activatedProfile>native</activatedProfile>
</activatedProfiles>
<properties>
<skipTests>true</skipTests>
</properties>
</action>
<action>
<actionName>profile</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath org.joinfaces.example.JoinFacesExampleApplication</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
<action>
<actionName>build</actionName>
<packagings>
<packaging>*</packaging>
</packagings>
<goals>
<goal>install</goal>
</goals>
<properties>
<skipTests>true</skipTests>
</properties>
</action>
</actions>
60 changes: 24 additions & 36 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.0-M2</version>
<version>3.2.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand All @@ -21,15 +21,15 @@
<properties>
<!-- compile library versions -->
<jakarta.validation-api.version>3.0.2</jakarta.validation-api.version>
<joinfaces.version>5.2.0-m2</joinfaces.version>
<maven-model.version>3.9.4</maven-model.version>
<joinfaces.version>5.2.0</joinfaces.version>
<maven-model.version>3.9.5</maven-model.version>

<!-- test library versions -->
<selenium.version>4.10.0</selenium.version>
<htmlunit-driver.version>4.10.0</htmlunit-driver.version>
<webdrivermanager.version>5.4.1</webdrivermanager.version>
<selenium.version>4.13.0</selenium.version>
<htmlunit-driver.version>4.13.0</htmlunit-driver.version>
<webdrivermanager.version>5.6.2</webdrivermanager.version>

<jacoco-maven-plugin.version>0.8.9</jacoco-maven-plugin.version>
<jacoco-maven-plugin.version>0.8.11</jacoco-maven-plugin.version>
<jacoco.exclude>org/joinfaces/example/JoinFacesExampleApplication.class</jacoco.exclude>
<jacoco.totalLineRate>0.91</jacoco.totalLineRate>
<jacoco.packageLineRate>0.90</jacoco.packageLineRate>
Expand All @@ -40,14 +40,14 @@

<!-- check library versions -->
<no-package-cycles-enforcer-rule.version>1.0.9</no-package-cycles-enforcer-rule.version>
<spotbugs-maven-plugin.version>4.7.3.5</spotbugs-maven-plugin.version>
<spotbugs-maven-plugin.version>4.8.1.0</spotbugs-maven-plugin.version>
<findsecbugs-plugin.version>1.12.0</findsecbugs-plugin.version>
<findbugs-annotations.version>3.0.1</findbugs-annotations.version>
<jdepend-maven-plugin.version>2.0</jdepend-maven-plugin.version>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-pmd-plugin.version>3.21.0</maven-pmd-plugin.version>
<maven-checkstyle-plugin.version>3.3.0</maven-checkstyle-plugin.version>
<checkstyle.version>10.12.1</checkstyle.version>
<maven-pmd-plugin.version>3.21.2</maven-pmd-plugin.version>
<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
<checkstyle.version>10.12.5</checkstyle.version>

<check.dir>src/checkconfig</check.dir>
<checkstyle.dir>${check.dir}/checkstyle</checkstyle.dir>
Expand All @@ -61,11 +61,11 @@
<checkstyle.headerLocation>${checkstyle.dir}/checkstyle-header.txt</checkstyle.headerLocation>
<checkstyle.excludes />
<duplicate-finder-maven-plugin.version>2.0.1</duplicate-finder-maven-plugin.version>
<duplicate.ignoredResourcePattern>(about.html|mozilla/public-suffix-list.txt)</duplicate.ignoredResourcePattern>
<duplicate.ignoredClassPattern>(META-INF.versions.9.module-info|jakarta.el.*)</duplicate.ignoredClassPattern>
<duplicate.ignoredResourcePattern>()</duplicate.ignoredResourcePattern>
<duplicate.ignoredClassPattern>()</duplicate.ignoredClassPattern>

<dependency-check-maven.version>8.3.1</dependency-check-maven.version>
<sonar-maven-plugin.version>3.9.1.2184</sonar-maven-plugin.version>
<dependency-check-maven.version>9.0.0</dependency-check-maven.version>
<sonar-maven-plugin.version>3.10.0.2594</sonar-maven-plugin.version>
<sonar.projectKey>joinfaces_joinfaces-maven-war-example</sonar.projectKey>
<sonar.organization>joinfaces</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
Expand All @@ -80,7 +80,7 @@
</dependency>
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>joinfaces-dependencies</artifactId>
<artifactId>joinfaces-bom</artifactId>
<version>${joinfaces.version}</version>
<type>pom</type>
<scope>import</scope>
Expand Down Expand Up @@ -211,10 +211,6 @@
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
Expand Down Expand Up @@ -242,18 +238,6 @@
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.joinfaces</groupId>
<artifactId>joinfaces-maven-plugin</artifactId>
<version>${joinfaces.version}</version>
<executions>
<execution>
<goals>
<goal>classpath-scan</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
Expand Down Expand Up @@ -415,13 +399,16 @@
</pluginManagement>

<plugins>
<plugin>
<groupId>org.joinfaces</groupId>
<artifactId>joinfaces-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>process-aot</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
Expand Down Expand Up @@ -552,6 +539,7 @@
<artifactId>spotbugs-maven-plugin</artifactId>
<executions>
<execution>
<phase>process-test-classes</phase>
<goals>
<goal>check</goal>
</goals>
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/joinfaces/example/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.springframework.web.context.annotation.ApplicationScope;

/**
* Redirect to index.jsf SPA.
* Redirect to index.faces SPA.
*
* @author Marcelo Fernandes
*/
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 extends AbstractPageComponent> T initElements(Class<T> classx) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/joinfaces/example/view/CustomInputPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/joinfaces/example/view/FileUploadPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public FileUploadPage(WebDriver webDriver) {
}

@Override
protected String url() {
return "/fileUpload.jsf";
protected String getLocation() {
return "/fileUpload.faces";
}

private By getDownloadButtonBy() {
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/joinfaces/example/view/HelloTagPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public HelloTagPage(WebDriver webDriver) {
}

@Override
protected String url() {
return "/helloTag.jsf";
protected String getLocation() {
return "/helloTag.faces";
}

private By getHelloWorldDivBy() {
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/joinfaces/example/view/HiCCPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public HiCCPage(WebDriver webDriver) {
}

@Override
protected String url() {
return "/hiCC.jsf";
protected String getLocation() {
return "/hiCC.faces";
}

private By getHiCCDivBy() {
Expand Down
Loading

0 comments on commit befcf20

Please sign in to comment.