diff --git a/.github/workflows/jakartified.maven.yml b/.github/workflows/jakartified.maven.yml index 0e45cb1..cd23dba 100644 --- a/.github/workflows/jakartified.maven.yml +++ b/.github/workflows/jakartified.maven.yml @@ -47,4 +47,4 @@ jobs: sudo -u postgres psql postgres -c "CREATE USER test WITH ENCRYPTED PASSWORD 'test';" sudo -u postgres psql postgres -c "GRANT ALL PRIVILEGES ON DATABASE test TO test;" - name: Test with Maven - run: mvn -B verify -Dmaven.javadoc.skip=true -P ${{matrix.server}} + run: mvn verify -Dmaven.javadoc.skip=true -P ${{matrix.server}} diff --git a/pom.xml b/pom.xml index 960eb4c..f6db540 100644 --- a/pom.xml +++ b/pom.xml @@ -69,10 +69,10 @@ 33.0.1.Final 7.0.17 - 9.1.3 + 9.1.3 5.0.0-B03 6.1.7.Final - 2.3.232 + 2.3.232 8.0.33 42.7.4 4.5.1 @@ -81,7 +81,7 @@ - + jakarta.platform jakarta.jakartaee-web-api @@ -405,9 +405,6 @@ ${project.activeProfiles[0].id} ${project.build.directory}/${project.build.finalName}.jar - ${test.h2-driver.version} - ${test.mysql-driver.version} - ${test.postgresql-driver.version} ${test.omnifaces.version} ${test.primefaces.version} ${test.glassfish-hibernate.version} @@ -455,6 +452,44 @@ + + install-mysql-driver-in-wildfly + pre-integration-test + + copy + + + + + mysql + mysql-connector-java + ${test.mysql-driver.version} + jar + ${project.build.directory}/wildfly-preview-${test.wildfly.version}/standalone/deployments + mysql.jar + + + + + + install-psql-driver-in-wildfly + pre-integration-test + + copy + + + + + org.postgresql + postgresql + ${test.postgresql-driver.version} + jar + ${project.build.directory}/wildfly-preview-${test.wildfly.version}/standalone/deployments + postgresql.jar + + + + @@ -499,6 +534,44 @@ + + install-mysql-driver-in-wildfly + pre-integration-test + + copy + + + + + mysql + mysql-connector-java + ${test.mysql-driver.version} + jar + ${project.build.directory}/wildfly-preview-${test.wildfly.version}/standalone/deployments + mysql.jar + + + + + + install-psql-driver-in-wildfly + pre-integration-test + + copy + + + + + org.postgresql + postgresql + ${test.postgresql-driver.version} + jar + ${project.build.directory}/wildfly-preview-${test.wildfly.version}/standalone/deployments + postgresql.jar + + + + install-eclipselink-in-wildfly pre-integration-test @@ -587,6 +660,60 @@ + + install-h2-in-glassfish + pre-integration-test + + copy + + + + + com.h2database + h2 + ${test.h2.version} + jar + ${project.build.directory}/glassfish7/glassfish/modules + + + + + + install-mysql-driver-in-glassfish + pre-integration-test + + copy + + + + + mysql + mysql-connector-java + ${test.mysql-driver.version} + jar + ${project.build.directory}/glassfish7/glassfish/modules + + + + + + install-psql-driver-in-glassfish + pre-integration-test + + copy + + + + + org.postgresql + postgresql + ${test.postgresql-driver.version} + jar + ${project.build.directory}/glassfish7/glassfish/modules + + + + @@ -631,6 +758,60 @@ + + install-h2-in-glassfish + pre-integration-test + + copy + + + + + com.h2database + h2 + ${test.h2.version} + jar + ${project.build.directory}/glassfish7/glassfish/modules + + + + + + install-mysql-driver-in-glassfish + pre-integration-test + + copy + + + + + mysql + mysql-connector-java + ${test.mysql-driver.version} + jar + ${project.build.directory}/glassfish7/glassfish/modules + + + + + + install-psql-driver-in-glassfish + pre-integration-test + + copy + + + + + org.postgresql + postgresql + ${test.postgresql-driver.version} + jar + ${project.build.directory}/glassfish7/glassfish/modules + + + + @@ -676,6 +857,60 @@ + + install-h2-in-tomee + pre-integration-test + + copy + + + + + com.h2database + h2 + ${test.h2.version} + jar + ${project.build.directory}/apache-tomee-webprofile-${test.tomee.version}/lib + + + + + + install-mysql-driver-in-tomee + pre-integration-test + + copy + + + + + mysql + mysql-connector-java + ${test.mysql-driver.version} + jar + ${project.build.directory}/apache-tomee-webprofile-${test.tomee.version}/lib + + + + + + install-psql-driver-in-tomee + pre-integration-test + + copy + + + + + org.postgresql + postgresql + ${test.postgresql-driver.version} + jar + ${project.build.directory}/apache-tomee-webprofile-${test.tomee.version}/lib + + + + diff --git a/src/test/java/org/omnifaces/optimusfaces/test/OptimusFacesIT.java b/src/test/java/org/omnifaces/optimusfaces/test/OptimusFacesIT.java index 499e697..c1b9d55 100644 --- a/src/test/java/org/omnifaces/optimusfaces/test/OptimusFacesIT.java +++ b/src/test/java/org/omnifaces/optimusfaces/test/OptimusFacesIT.java @@ -31,8 +31,6 @@ import static org.omnifaces.optimusfaces.model.PagedDataModel.QUERY_PARAMETER_SELECTION; import static org.omnifaces.optimusfaces.test.service.StartupService.ROWS_PER_PAGE; import static org.omnifaces.optimusfaces.test.service.StartupService.TOTAL_RECORDS; -import static org.omnifaces.persistence.Database.H2; -import static org.omnifaces.persistence.Database.MYSQL; import static org.omnifaces.persistence.Database.POSTGRESQL; import static org.openqa.selenium.Keys.BACK_SPACE; import static org.openqa.selenium.Keys.SPACE; @@ -123,21 +121,19 @@ protected static WebArchive createArchive(Class te .addAsLibraries(maven.loadPomFromFile("pom.xml").importCompileAndRuntimeDependencies().resolve().withTransitivity().asFile()) .addAsLibraries(maven.resolve("org.omnifaces:omnifaces:" + getProperty("test.omnifaces.version"), "org.primefaces:primefaces:jar:jakarta:" + getProperty("test.primefaces.version")).withTransitivity().asFile()); - addDataSourceConfig(maven, archive, database); + addDataSourceConfig(database, archive); addPersistenceConfig(maven, archive); addResources(new File(testClass.getClassLoader().getResource(packageName).getFile()), "", archive::addAsWebResource); return archive; } - private static void addDataSourceConfig(MavenResolverSystem maven, WebArchive archive, Database database) { - var jdbcDriverDependency = database == H2 ? "com.h2database:h2:" + getProperty("test.h2-driver.version") - : database == MYSQL ? "mysql:mysql-connector-java:" + getProperty("test.mysql-driver.version") - : database == POSTGRESQL ? "org.postgresql:postgresql:" + getProperty("test.postgresql-driver.version") - : null; - archive - .addAsWebInfResource("WEB-INF/web.xml/" + database.name().toLowerCase() + ".xml", "web.xml") - .addAsLibraries(maven.resolve(jdbcDriverDependency).withTransitivity().asFile()); + private static void addDataSourceConfig(Database database, WebArchive archive) { + var dataSourceConfigXml = isWildFly() ? "wildfly-ds.xml" : isGlassFish() ? "glassfish-resources.xml" : isTomEE() ? "resources.xml" : null; + + if (dataSourceConfigXml != null) { + archive.addAsWebInfResource("WEB-INF/" + dataSourceConfigXml + "/" + database.name().toLowerCase() + ".xml", dataSourceConfigXml); + } } private static void addPersistenceConfig(MavenResolverSystem maven, WebArchive archive) { diff --git a/src/test/resources/META-INF/persistence.xml/tomee-openjpa.xml b/src/test/resources/META-INF/persistence.xml/tomee-openjpa.xml index 26af2ae..60499e9 100644 --- a/src/test/resources/META-INF/persistence.xml/tomee-openjpa.xml +++ b/src/test/resources/META-INF/persistence.xml/tomee-openjpa.xml @@ -20,7 +20,7 @@ version="3.0" > - java:app/OptimusFacesIT + java:openejb/Resource/OptimusFacesIT org.omnifaces.persistence.model.BaseEntity diff --git a/src/test/resources/META-INF/persistence.xml/wildfly-eclipselink.xml b/src/test/resources/META-INF/persistence.xml/wildfly-eclipselink.xml index d7aaa6f..a60dec5 100644 --- a/src/test/resources/META-INF/persistence.xml/wildfly-eclipselink.xml +++ b/src/test/resources/META-INF/persistence.xml/wildfly-eclipselink.xml @@ -21,7 +21,7 @@ > org.eclipse.persistence.jpa.PersistenceProvider - java:app/OptimusFacesIT + OptimusFacesIT diff --git a/src/test/resources/META-INF/persistence.xml/wildfly-hibernate.xml b/src/test/resources/META-INF/persistence.xml/wildfly-hibernate.xml index c7d9c56..b9c0cb9 100644 --- a/src/test/resources/META-INF/persistence.xml/wildfly-hibernate.xml +++ b/src/test/resources/META-INF/persistence.xml/wildfly-hibernate.xml @@ -20,7 +20,7 @@ version="3.0" > - java:app/OptimusFacesIT + OptimusFacesIT diff --git a/src/test/resources/WEB-INF/glassfish-resources.xml/h2.xml b/src/test/resources/WEB-INF/glassfish-resources.xml/h2.xml new file mode 100644 index 0000000..e171249 --- /dev/null +++ b/src/test/resources/WEB-INF/glassfish-resources.xml/h2.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/WEB-INF/glassfish-resources.xml/mysql.xml b/src/test/resources/WEB-INF/glassfish-resources.xml/mysql.xml new file mode 100644 index 0000000..080d17d --- /dev/null +++ b/src/test/resources/WEB-INF/glassfish-resources.xml/mysql.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/WEB-INF/glassfish-resources.xml/postgresql.xml b/src/test/resources/WEB-INF/glassfish-resources.xml/postgresql.xml new file mode 100644 index 0000000..39bd963 --- /dev/null +++ b/src/test/resources/WEB-INF/glassfish-resources.xml/postgresql.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/WEB-INF/resources.xml/h2.xml b/src/test/resources/WEB-INF/resources.xml/h2.xml new file mode 100644 index 0000000..111230b --- /dev/null +++ b/src/test/resources/WEB-INF/resources.xml/h2.xml @@ -0,0 +1,27 @@ + + + + + + JdbcDriver org.h2.Driver + JdbcUrl jdbc:h2:mem:test;MODE=LEGACY + UserName sa + Password sa + jtaManaged = true + + diff --git a/src/test/resources/WEB-INF/resources.xml/mysql.xml b/src/test/resources/WEB-INF/resources.xml/mysql.xml new file mode 100644 index 0000000..fc7dbdf --- /dev/null +++ b/src/test/resources/WEB-INF/resources.xml/mysql.xml @@ -0,0 +1,27 @@ + + + + + + JdbcDriver com.mysql.jdbc.Driver + JdbcUrl jdbc:mysql://localhost:3306/test + UserName root + Password root + jtaManaged = true + + diff --git a/src/test/resources/WEB-INF/resources.xml/postgresql.xml b/src/test/resources/WEB-INF/resources.xml/postgresql.xml new file mode 100644 index 0000000..606944a --- /dev/null +++ b/src/test/resources/WEB-INF/resources.xml/postgresql.xml @@ -0,0 +1,27 @@ + + + + + + JdbcDriver org.postgresql.Driver + JdbcUrl jdbc:postgresql:test + UserName test + Password test + jtaManaged = true + + diff --git a/src/test/resources/WEB-INF/web.xml/h2.xml b/src/test/resources/WEB-INF/web.xml/h2.xml deleted file mode 100644 index b3ed42b..0000000 --- a/src/test/resources/WEB-INF/web.xml/h2.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - java:app/OptimusFacesIT - org.h2.jdbcx.JdbcDataSource - jdbc:h2:mem:playground;MODE=LEGACY - sa - sa - true - TRANSACTION_READ_COMMITTED - - diff --git a/src/test/resources/WEB-INF/web.xml/mysql.xml b/src/test/resources/WEB-INF/web.xml/mysql.xml deleted file mode 100644 index 4cfd6ae..0000000 --- a/src/test/resources/WEB-INF/web.xml/mysql.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - java:app/OptimusFacesIT - com.mysql.cj.jdbc.MysqlXADataSource - jdbc:mysql://localhost:3306/test - root - root - true - TRANSACTION_READ_COMMITTED - - diff --git a/src/test/resources/WEB-INF/web.xml/postgresql.xml b/src/test/resources/WEB-INF/web.xml/postgresql.xml deleted file mode 100644 index 5bb37a1..0000000 --- a/src/test/resources/WEB-INF/web.xml/postgresql.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - java:app/OptimusFacesIT - org.postgresql.xa.PGXADataSource - jdbc:postgresql:test - test - test - true - TRANSACTION_READ_COMMITTED - - diff --git a/src/test/resources/WEB-INF/wildfly-ds.xml/h2.xml b/src/test/resources/WEB-INF/wildfly-ds.xml/h2.xml new file mode 100644 index 0000000..7da9a6b --- /dev/null +++ b/src/test/resources/WEB-INF/wildfly-ds.xml/h2.xml @@ -0,0 +1,28 @@ + + + + + + jdbc:h2:mem:test;MODE=LEGACY + h2 + + sa + sa + + + \ No newline at end of file diff --git a/src/test/resources/WEB-INF/wildfly-ds.xml/mysql.xml b/src/test/resources/WEB-INF/wildfly-ds.xml/mysql.xml new file mode 100644 index 0000000..2cf7ed0 --- /dev/null +++ b/src/test/resources/WEB-INF/wildfly-ds.xml/mysql.xml @@ -0,0 +1,28 @@ + + + + + + jdbc:mysql://localhost:3306/test + mysql.jar + + root + root + + + \ No newline at end of file diff --git a/src/test/resources/WEB-INF/wildfly-ds.xml/postgresql.xml b/src/test/resources/WEB-INF/wildfly-ds.xml/postgresql.xml new file mode 100644 index 0000000..24295c2 --- /dev/null +++ b/src/test/resources/WEB-INF/wildfly-ds.xml/postgresql.xml @@ -0,0 +1,28 @@ + + + + + + jdbc:postgresql:test + postgresql.jar + + test + test + + + \ No newline at end of file