tests for Jakarta Data
thanks @FroMage and others for giving me an example of how to do this
This commit is contained in:
parent
af285657db
commit
ca12a4c874
|
@ -39,6 +39,16 @@ sourceSets {
|
||||||
compileClasspath += sourceSets.main.output + sourceSets.test.output
|
compileClasspath += sourceSets.main.output + sourceSets.test.output
|
||||||
runtimeClasspath += sourceSets.main.output + sourceSets.test.output
|
runtimeClasspath += sourceSets.main.output + sourceSets.test.output
|
||||||
}
|
}
|
||||||
|
jakartaData {
|
||||||
|
java {
|
||||||
|
srcDirs = ['src/jakartaData/java']
|
||||||
|
}
|
||||||
|
resources {
|
||||||
|
srcDirs tasks.processTestResources
|
||||||
|
}
|
||||||
|
compileClasspath += sourceSets.main.output + sourceSets.test.output
|
||||||
|
runtimeClasspath += sourceSets.main.output + sourceSets.test.output
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -57,6 +67,7 @@ dependencies {
|
||||||
|
|
||||||
quarkusOrmPanacheImplementation "io.quarkus:quarkus-hibernate-orm-panache:3.6.2"
|
quarkusOrmPanacheImplementation "io.quarkus:quarkus-hibernate-orm-panache:3.6.2"
|
||||||
quarkusHrPanacheImplementation "io.quarkus:quarkus-hibernate-reactive-panache:3.6.2"
|
quarkusHrPanacheImplementation "io.quarkus:quarkus-hibernate-reactive-panache:3.6.2"
|
||||||
|
jakartaDataImplementation "jakarta.data:jakarta.data-api:1.0.0-SNAPSHOT"
|
||||||
}
|
}
|
||||||
|
|
||||||
// The source set gets a custom configuration which extends the normal test implementation config
|
// The source set gets a custom configuration which extends the normal test implementation config
|
||||||
|
@ -67,6 +78,9 @@ configurations {
|
||||||
quarkusHrPanacheImplementation.extendsFrom(testImplementation)
|
quarkusHrPanacheImplementation.extendsFrom(testImplementation)
|
||||||
quarkusHrPanacheRuntimeOnly.extendsFrom(testRuntimeOnly)
|
quarkusHrPanacheRuntimeOnly.extendsFrom(testRuntimeOnly)
|
||||||
quarkusHrPanacheCompileOnly.extendsFrom(testCompileOnly)
|
quarkusHrPanacheCompileOnly.extendsFrom(testCompileOnly)
|
||||||
|
jakartaDataImplementation.extendsFrom(testImplementation)
|
||||||
|
jakartaDataRuntimeOnly.extendsFrom(testRuntimeOnly)
|
||||||
|
jakartaDataCompileOnly.extendsFrom(testCompileOnly)
|
||||||
}
|
}
|
||||||
|
|
||||||
def quarkusOrmPanacheTestTask = tasks.register( 'quarkusOrmPanacheTest', Test ) {
|
def quarkusOrmPanacheTestTask = tasks.register( 'quarkusOrmPanacheTest', Test ) {
|
||||||
|
@ -87,6 +101,15 @@ def quarkusHrPanacheTestTask = tasks.register( 'quarkusHrPanacheTest', Test ) {
|
||||||
shouldRunAfter test
|
shouldRunAfter test
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def jakartaDataTestTask = tasks.register( 'jakartaDataTest', Test ) {
|
||||||
|
description = 'Runs the Jakarta Data tests.'
|
||||||
|
group = 'verification'
|
||||||
|
|
||||||
|
testClassesDirs = sourceSets.jakartaData.output.classesDirs
|
||||||
|
classpath = sourceSets.jakartaData.runtimeClasspath
|
||||||
|
shouldRunAfter test
|
||||||
|
}
|
||||||
|
|
||||||
check.dependsOn quarkusHrPanacheTestTask
|
check.dependsOn quarkusHrPanacheTestTask
|
||||||
check.dependsOn quarkusOrmPanacheTestTask
|
check.dependsOn quarkusOrmPanacheTestTask
|
||||||
test.dependsOn quarkusHrPanacheTestTask
|
test.dependsOn quarkusHrPanacheTestTask
|
||||||
|
@ -104,14 +127,6 @@ compileTestJava {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
test {
|
|
||||||
java {
|
|
||||||
exclude '**/data/*.java'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests with records
|
// Tests with records
|
||||||
if ( jdkVersions.test.release.asInt() >= 17 && jdkVersions.explicit ) {
|
if ( jdkVersions.test.release.asInt() >= 17 && jdkVersions.explicit ) {
|
||||||
// We need to configure the source and target version to 17
|
// We need to configure the source and target version to 17
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hibernate.jpamodelgen.test.data;
|
package org.hibernate.jpamodelgen.test.data.data;
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hibernate.jpamodelgen.test.data;
|
package org.hibernate.jpamodelgen.test.data.data;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import org.hibernate.annotations.NaturalId;
|
import org.hibernate.annotations.NaturalId;
|
|
@ -1,9 +1,13 @@
|
||||||
package org.hibernate.jpamodelgen.test.data;
|
package org.hibernate.jpamodelgen.test.data.data;
|
||||||
|
|
||||||
import jakarta.data.Limit;
|
import jakarta.data.Limit;
|
||||||
import jakarta.data.Order;
|
import jakarta.data.Order;
|
||||||
import jakarta.data.Sort;
|
import jakarta.data.Sort;
|
||||||
import jakarta.data.page.PageRequest;
|
import jakarta.data.page.PageRequest;
|
||||||
|
import jakarta.data.page.Page;
|
||||||
|
import jakarta.data.page.Slice;
|
||||||
|
import jakarta.data.page.KeysetAwarePage;
|
||||||
|
import jakarta.data.page.KeysetAwareSlice;
|
||||||
import jakarta.data.repository.By;
|
import jakarta.data.repository.By;
|
||||||
import jakarta.data.repository.Delete;
|
import jakarta.data.repository.Delete;
|
||||||
import jakarta.data.repository.Find;
|
import jakarta.data.repository.Find;
|
||||||
|
@ -133,4 +137,7 @@ public interface BookAuthorRepository {
|
||||||
|
|
||||||
@Query("from Book where title like :titlePattern")
|
@Query("from Book where title like :titlePattern")
|
||||||
Slice<Book> booksByTitle2(String titlePattern, PageRequest<Book> pageRequest);
|
Slice<Book> booksByTitle2(String titlePattern, PageRequest<Book> pageRequest);
|
||||||
|
|
||||||
|
@Find
|
||||||
|
List<Book> allBooksWithLotsOfSorting(Sort<? super Book> s1, Order<? super Book> order, Sort<? super Book>... s3);
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.jpamodelgen.test.data;
|
package org.hibernate.jpamodelgen.test.data.data;
|
||||||
|
|
||||||
import org.hibernate.jpamodelgen.test.util.CompilationTest;
|
import org.hibernate.jpamodelgen.test.util.CompilationTest;
|
||||||
import org.hibernate.jpamodelgen.test.util.WithClasses;
|
import org.hibernate.jpamodelgen.test.util.WithClasses;
|
Loading…
Reference in New Issue