diff --git a/.github/workflows/jakartified.maven.yml b/.github/workflows/jakartified.maven.yml index cd23dba..0e45cb1 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 verify -Dmaven.javadoc.skip=true -P ${{matrix.server}} + run: mvn -B verify -Dmaven.javadoc.skip=true -P ${{matrix.server}} diff --git a/pom.xml b/pom.xml index bd53b8c..96ec4ea 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,6 +405,9 @@ ${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} @@ -452,44 +455,6 @@ - - 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 - - - - @@ -534,44 +499,6 @@ - - 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 @@ -660,60 +587,6 @@ - - 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 - - - - @@ -758,60 +631,6 @@ - - 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 - - - - @@ -857,60 +676,6 @@ - - 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 c1b9d55..499e697 100644 --- a/src/test/java/org/omnifaces/optimusfaces/test/OptimusFacesIT.java +++ b/src/test/java/org/omnifaces/optimusfaces/test/OptimusFacesIT.java @@ -31,6 +31,8 @@ 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; @@ -121,19 +123,21 @@ 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(database, archive); + addDataSourceConfig(maven, archive, database); addPersistenceConfig(maven, archive); addResources(new File(testClass.getClassLoader().getResource(packageName).getFile()), "", archive::addAsWebResource); return archive; } - 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 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 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 60499e9..26af2ae 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:openejb/Resource/OptimusFacesIT + java:app/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 a60dec5..d7aaa6f 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 - OptimusFacesIT + java:app/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 b9c0cb9..c7d9c56 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" > - OptimusFacesIT + java:app/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 deleted file mode 100644 index e171249..0000000 --- a/src/test/resources/WEB-INF/glassfish-resources.xml/h2.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - \ 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 deleted file mode 100644 index 080d17d..0000000 --- a/src/test/resources/WEB-INF/glassfish-resources.xml/mysql.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - \ 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 deleted file mode 100644 index 39bd963..0000000 --- a/src/test/resources/WEB-INF/glassfish-resources.xml/postgresql.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - \ 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 deleted file mode 100644 index 111230b..0000000 --- a/src/test/resources/WEB-INF/resources.xml/h2.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - 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 deleted file mode 100644 index fc7dbdf..0000000 --- a/src/test/resources/WEB-INF/resources.xml/mysql.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - 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 deleted file mode 100644 index 606944a..0000000 --- a/src/test/resources/WEB-INF/resources.xml/postgresql.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - 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 new file mode 100644 index 0000000..b3ed42b --- /dev/null +++ b/src/test/resources/WEB-INF/web.xml/h2.xml @@ -0,0 +1,34 @@ + + + + + + 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 new file mode 100644 index 0000000..4cfd6ae --- /dev/null +++ b/src/test/resources/WEB-INF/web.xml/mysql.xml @@ -0,0 +1,34 @@ + + + + + + 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 new file mode 100644 index 0000000..5bb37a1 --- /dev/null +++ b/src/test/resources/WEB-INF/web.xml/postgresql.xml @@ -0,0 +1,34 @@ + + + + + + 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 deleted file mode 100644 index 7da9a6b..0000000 --- a/src/test/resources/WEB-INF/wildfly-ds.xml/h2.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - 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 deleted file mode 100644 index 2cf7ed0..0000000 --- a/src/test/resources/WEB-INF/wildfly-ds.xml/mysql.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - 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 deleted file mode 100644 index 24295c2..0000000 --- a/src/test/resources/WEB-INF/wildfly-ds.xml/postgresql.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - jdbc:postgresql:test - postgresql.jar - - test - test - - - \ No newline at end of file