-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added metadata for
org.hibernate.orm:hibernate-core:6.2.0.Final
(#263)
* Adding metadata for hibernate 6.2.0.Final * Adding metadata for hibernate 6.2.0.Final * Adding metadata for hibernate 6.2.0.Final * Adding metadata for hibernate 6.2.0.Final * Adding metadata for hibernate 6.2.0.Final * Adding metadata for hibernate 6.2.0.Final * Adding metadata for hibernate 6.2.0.Final * Modified hibernate-core index.json file
- Loading branch information
Showing
33 changed files
with
2,073 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
metadata/org.hibernate.orm/hibernate-core/6.2.0.Final/index.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[ | ||
"reflect-config.json", | ||
"resource-config.json" | ||
] |
844 changes: 844 additions & 0 deletions
844
metadata/org.hibernate.orm/hibernate-core/6.2.0.Final/reflect-config.json
Large diffs are not rendered by default.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
metadata/org.hibernate.orm/hibernate-core/6.2.0.Final/resource-config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"resources":{ | ||
"includes":[ | ||
{ | ||
"condition":{"typeReachable":"org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl"}, | ||
"pattern":"\\QMETA-INF/persistence.xml\\E" | ||
}, | ||
{ | ||
"condition":{"typeReachable":"org.hibernate.internal.util.ConfigHelper"}, | ||
"pattern":"\\Qhibernate.properties\\E" | ||
}, | ||
{ | ||
"condition":{"typeReachable":"org.hibernate.boot.jaxb.internal.stax.LocalSchemaLocator"}, | ||
"pattern":"\\Qorg/hibernate/hibernate-configuration-3.0.dtd\\E" | ||
}, | ||
{ | ||
"condition":{"typeReachable":"org.hibernate.boot.jaxb.internal.stax.LocalSchemaLocator"}, | ||
"pattern":"\\Qorg/hibernate/hibernate-mapping-3.0.dtd\\E" | ||
}, | ||
{ | ||
"condition":{"typeReachable":"org.hibernate.boot.xsd.LocalXsdResolver"}, | ||
"pattern":"\\Qorg/hibernate/jpa/persistence_2_0.xsd\\E" | ||
} | ||
]} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
tests/src/org.hibernate.orm/hibernate-core/6.2.0.Final/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
gradlew.bat | ||
gradlew | ||
gradle/ | ||
build/ | ||
generated-metadata/ |
10 changes: 10 additions & 0 deletions
10
tests/src/org.hibernate.orm/hibernate-core/6.2.0.Final/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
# Hibernate ORM | ||
|
||
The metadata has been generated by executing the following script: | ||
|
||
```bash | ||
./generate-metadata.sh | ||
``` | ||
|
||
The generated metadata can be found in the `generated-metadata` directory. |
56 changes: 56 additions & 0 deletions
56
tests/src/org.hibernate.orm/hibernate-core/6.2.0.Final/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright and related rights waived via CC0 | ||
* | ||
* You should have received a copy of the CC0 legalcode along with this | ||
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
*/ | ||
|
||
plugins { | ||
id "org.graalvm.internal.tck" | ||
} | ||
|
||
String libraryVersion = tck.testedLibraryVersion.get() | ||
|
||
dependencies { | ||
testImplementation "org.hibernate.orm:hibernate-core:$libraryVersion" | ||
testImplementation 'org.assertj:assertj-core:3.22.0' | ||
testImplementation 'com.h2database:h2:2.1.214' | ||
testImplementation 'jakarta.validation:jakarta.validation-api:3.0.2' | ||
testImplementation 'org.postgresql:postgresql:42.6.0' | ||
testImplementation 'com.oracle.database.jdbc:ojdbc11:21.9.0.0' | ||
|
||
testImplementation 'ch.qos.logback:logback-classic:1.4.5' | ||
} | ||
|
||
task updateGeneratedMetadata { | ||
doLast { | ||
final ant = new groovy.ant.AntBuilder() | ||
final metadataDir = project.projectDir.toString() + "/generated-metadata" | ||
|
||
// replace typeReachable value for entries generated by IdentifierGeneratorTest test class | ||
ant.replace(file: metadataDir + "/reflect-config.json", | ||
token: "org_hibernate_orm.hibernate_core.IdentifierGeneratorTest", | ||
value: "org.hibernate.id.factory.internal.StandardIdentifierGeneratorFactory") | ||
} | ||
} | ||
|
||
task deleteGeneratedMetadata(type: Delete) { | ||
delete files(project.projectDir.toString() + "/generated-metadata") | ||
} | ||
|
||
graalvmNative { | ||
agent { | ||
defaultMode = "conditional" | ||
modes { | ||
conditional { | ||
userCodeFilterPath = "metadata-conditions-filter.json" | ||
extraFilterPath = "metadata-extra-filter.json" | ||
} | ||
} | ||
metadataCopy { | ||
inputTaskNames.add("test") | ||
outputDirectories.add("generated-metadata") | ||
mergeWithExisting = true | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/src/org.hibernate.orm/hibernate-core/6.2.0.Final/generate-metadata.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
./gradlew deleteGeneratedMetadata | ||
./gradlew test --tests "org_hibernate_orm.hibernate_core.H2DialectHibernateTest" -Pagent metadataCopy | ||
./gradlew test --tests "org_hibernate_orm.hibernate_core.MariaDBDialectHibernateTest" -Pagent metadataCopy | ||
./gradlew test --tests "org_hibernate_orm.hibernate_core.MSSQLDialectHibernateTest" -Pagent metadataCopy | ||
./gradlew test --tests "org_hibernate_orm.hibernate_core.MySQLDialectHibernateTest" -Pagent metadataCopy | ||
./gradlew test --tests "org_hibernate_orm.hibernate_core.OracleDialectHibernateTest" -Pagent metadataCopy | ||
./gradlew test --tests "org_hibernate_orm.hibernate_core.PostgresDialectHibernateTest" -Pagent metadataCopy | ||
./gradlew test --tests "org_hibernate_orm.hibernate_core.HibernateDialectTest" -Pagent metadataCopy | ||
./gradlew test --tests "org_hibernate_orm.hibernate_core.UrlMessageBundleTest" -Pagent metadataCopy | ||
./gradlew test --tests "org_hibernate_orm.hibernate_core.IdentifierGeneratorTest" -Pagent metadataCopy | ||
./gradlew test --tests "org_hibernate_orm.hibernate_core.OptimizerTest" -Pagent metadataCopy | ||
./gradlew updateGeneratedMetadata |
2 changes: 2 additions & 0 deletions
2
tests/src/org.hibernate.orm/hibernate-core/6.2.0.Final/gradle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
library.version = 6.2.0.Final | ||
metadata.dir = org.hibernate.orm/hibernate-core/6.2.0.Final/ |
6 changes: 6 additions & 0 deletions
6
tests/src/org.hibernate.orm/hibernate-core/6.2.0.Final/metadata-conditions-filter.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"rules": [ | ||
{"includeClasses": "org.hibernate.**"}, | ||
{"includeClasses": "org_hibernate_orm.hibernate_core.IdentifierGeneratorTest"} | ||
] | ||
} |
11 changes: 11 additions & 0 deletions
11
tests/src/org.hibernate.orm/hibernate-core/6.2.0.Final/metadata-extra-filter.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"rules": [ | ||
{"excludeClasses": "**"}, | ||
{"includeClasses": "org.hibernate.**"}, | ||
{"includeClasses": "[Lorg.hibernate.**"}, | ||
{"includeClasses": "org_hibernate_orm.hibernate_core.IdentifierGeneratorTest"} | ||
], | ||
"regexRules": [ | ||
{"excludeClasses": "org\\.hibernate.*_\\$logger_en.*"} | ||
] | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/src/org.hibernate.orm/hibernate-core/6.2.0.Final/settings.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
pluginManagement { | ||
def tckPath = Objects.requireNonNullElse( | ||
System.getenv("GVM_TCK_TCKDIR"), | ||
"../../../../tck-build-logic" | ||
) | ||
includeBuild(tckPath) | ||
} | ||
|
||
plugins { | ||
id "org.graalvm.internal.tck-settings" version "1.0.0-SNAPSHOT" | ||
} | ||
|
||
rootProject.name = 'org.hibernate.orm.hibernate-core_tests' |
199 changes: 199 additions & 0 deletions
199
...ore/6.2.0.Final/src/test/java/org_hibernate_orm/hibernate_core/AbstractHibernateTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
/* | ||
* Copyright and related rights waived via CC0 | ||
* | ||
* You should have received a copy of the CC0 legalcode along with this | ||
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
*/ | ||
package org_hibernate_orm.hibernate_core; | ||
|
||
import jakarta.persistence.EntityManager; | ||
import jakarta.persistence.EntityManagerFactory; | ||
import jakarta.persistence.Persistence; | ||
import org.junit.jupiter.api.AfterAll; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestInstance; | ||
import org_hibernate_orm.hibernate_core.entity.Course; | ||
import org_hibernate_orm.hibernate_core.entity.CourseMaterial; | ||
import org_hibernate_orm.hibernate_core.entity.Gender; | ||
import org_hibernate_orm.hibernate_core.entity.Student; | ||
import org_hibernate_orm.hibernate_core.entity.Teacher; | ||
|
||
import java.util.Arrays; | ||
import java.util.Date; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@TestInstance(TestInstance.Lifecycle.PER_CLASS) | ||
abstract class AbstractHibernateTest { | ||
|
||
private EntityManagerFactory entityManagerFactory; | ||
private EntityManager entityManager; | ||
|
||
private Map<String, Long> studentIds = new HashMap<>(); | ||
|
||
private Map<String, Long> teacherIds = new HashMap<>(); | ||
|
||
private Map<String, Long> courseIds = new HashMap<>(); | ||
|
||
@BeforeAll | ||
public void init() { | ||
Map<String, String> properties = new HashMap<>(); | ||
properties.put("jakarta.persistence.jdbc.url", getJdbcUrl()); | ||
properties.put("hibernate.dialect", getHibernateDialect()); | ||
entityManagerFactory = Persistence.createEntityManagerFactory("StudentPU", properties); | ||
entityManager = entityManagerFactory.createEntityManager(); | ||
prepareTestData(); | ||
} | ||
|
||
@AfterAll | ||
public void close() { | ||
entityManager.close(); | ||
entityManagerFactory.close(); | ||
} | ||
|
||
@AfterEach | ||
public void cleanup() { | ||
entityManager.clear(); | ||
} | ||
|
||
protected abstract String getJdbcUrl(); | ||
|
||
protected abstract String getHibernateDialect(); | ||
|
||
@Test | ||
public void testLoadStudent() { | ||
Student student = entityManager.find(Student.class, studentIds.get("John Smith")); | ||
assertThat(student).isNotNull(); | ||
assertThat(student.getFirstName()).isEqualTo("John"); | ||
assertThat(student.getLastName()).isEqualTo("Smith"); | ||
assertThat(student.getGender()).isEqualTo(Gender.MALE); | ||
assertThat(student.getAge()).isEqualTo(25); | ||
} | ||
|
||
@Test | ||
public void testLoadTeacher() { | ||
Teacher teacher = entityManager.find(Teacher.class, teacherIds.get("Jennifer Brown")); | ||
assertThat(teacher).isNotNull(); | ||
assertThat(teacher.getFirstName()).isEqualTo("Jennifer"); | ||
assertThat(teacher.getLastName()).isEqualTo("Brown"); | ||
assertThat(teacher.getCourses()) | ||
.hasSize(2) | ||
.extracting(Course::getTitle) | ||
.containsExactly("Statistics", "Math"); | ||
} | ||
|
||
@Test | ||
public void testLoadCourse() { | ||
Course course = entityManager.find(Course.class, courseIds.get("Statistics")); | ||
assertThat(course).isNotNull(); | ||
assertThat(course.getTitle()).isEqualTo("Statistics"); | ||
assertThat(course.getTeacher()) | ||
.extracting(Teacher::getFirstName) | ||
.isEqualTo("Jennifer"); | ||
assertThat(course.getStudents()) | ||
.hasSize(3) | ||
.extracting(Student::getId) | ||
.containsExactly(studentIds.get("John Smith"), studentIds.get("Robert Smith"), studentIds.get("Mary Smith")); | ||
} | ||
|
||
@Test | ||
public void testFindStudentsUsingHql() { | ||
List<Student> studentsResult1 = entityManager.createQuery( | ||
"from Student where lastName = :lastName order by firstName", | ||
Student.class | ||
) | ||
.setParameter("lastName", "Smith") | ||
.getResultList(); | ||
|
||
assertThat(studentsResult1) | ||
.hasSize(3) | ||
.extracting(Student::getId) | ||
.containsExactly(studentIds.get("John Smith"), studentIds.get("Mary Smith"), studentIds.get("Robert Smith")); | ||
|
||
List<Student> studentsResult2 = entityManager.createQuery( | ||
"select s from Course as c inner join c.students as s where c.title = :courseTitle", | ||
Student.class | ||
) | ||
.setParameter("courseTitle", "Math") | ||
.getResultList(); | ||
|
||
assertThat(studentsResult2) | ||
.hasSize(4) | ||
.extracting(Student::getId) | ||
.containsExactly(studentIds.get("John Smith"), studentIds.get("Robert Smith"), studentIds.get("Mary Smith"), studentIds.get("Patricia Miller")); | ||
} | ||
|
||
@Test | ||
public void testFindCoursesUsingHql() { | ||
List<Course> coursesResult = entityManager.createQuery( | ||
"from Course where teacher.firstName = :teacherFirstName", | ||
Course.class) | ||
.setParameter("teacherFirstName", "Jennifer") | ||
.getResultList(); | ||
|
||
assertThat(coursesResult) | ||
.hasSize(2) | ||
.extracting(Course::getId) | ||
.containsExactly(courseIds.get("Statistics"), courseIds.get("Math")); | ||
} | ||
|
||
private void prepareTestData() { | ||
entityManager.getTransaction().begin(); | ||
|
||
Student student1 = createStudent("John", "Smith", Gender.MALE, 25); | ||
Student student2 = createStudent("Robert", "Smith", Gender.MALE, 24); | ||
Student student3 = createStudent("John", "Miller", Gender.MALE, 21); | ||
Student student4 = createStudent("Mary", "Smith", Gender.FEMALE, 26); | ||
Student student5 = createStudent("Patricia", "Miller", Gender.FEMALE, 21); | ||
|
||
Teacher teacher1 = createTeacher("Jennifer", "Brown"); | ||
Teacher teacher2 = createTeacher("Richard", "Davis"); | ||
|
||
createCourse("Statistics", teacher1, Arrays.asList(student1, student2, student4)); | ||
createCourse("Math", teacher1, Arrays.asList(student1, student2, student4, student5)); | ||
createCourse("Design", teacher2, Arrays.asList(student3, student4, student5)); | ||
|
||
entityManager.getTransaction().commit(); | ||
} | ||
|
||
private Student createStudent(String firstName, String lastName, Gender gender, int age) { | ||
Student student = new Student(); | ||
student.setFirstName(firstName); | ||
student.setLastName(lastName); | ||
student.setGender(gender); | ||
student.setAge(age); | ||
student.setBirthDate(new Date()); | ||
entityManager.persist(student); | ||
studentIds.put(firstName + " " + lastName, student.getId()); | ||
return student; | ||
} | ||
|
||
private Teacher createTeacher(String firstName, String lastName) { | ||
Teacher teacher = new Teacher(); | ||
teacher.setFirstName(firstName); | ||
teacher.setLastName(lastName); | ||
entityManager.persist(teacher); | ||
teacherIds.put(firstName + " " + lastName, teacher.getId()); | ||
return teacher; | ||
} | ||
|
||
private Course createCourse(String title, Teacher teacher, List<Student> students) { | ||
Course course = new Course(); | ||
course.setTitle(title); | ||
course.setTeacher(teacher); | ||
course.setStudents(students); | ||
entityManager.persist(course); | ||
courseIds.put(title, course.getId()); | ||
|
||
CourseMaterial courseMaterial = new CourseMaterial(); | ||
courseMaterial.setUrl(title + "Url"); | ||
courseMaterial.setCourse(course); | ||
entityManager.persist(courseMaterial); | ||
return course; | ||
} | ||
} |
Oops, something went wrong.