HHH-18500 Added slightly modifed existing test case with addition of module-info.java and set extend enhancement flag

This commit is contained in:
Čedomir Igaly 2024-08-18 11:19:54 +02:00 committed by Christian Beikov
parent b40bc61ba5
commit 979170f28a
6 changed files with 215 additions and 0 deletions

View File

@ -0,0 +1,53 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* 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.
*/
package org.hibernate.orm.tooling.gradle;
import java.nio.file.Path;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
/**
* Basic functional tests
*
* @author Steve Ebersole
*/
class ModuleInfoProjectTests extends TestsBase {
@Override
protected String getProjectName() {
return "simple-moduleinfo";
}
@Override
protected String getSourceSetName() {
return "main";
}
@Override
protected String getLanguageName() {
return "java";
}
@Override
protected String getCompileTaskName() {
return "compileJava";
}
@Test
@Override
public void testEnhancement(@TempDir Path projectDir) throws Exception {
super.testEnhancement( projectDir );
}
@Test
@Override
public void testEnhancementUpToDate(@TempDir Path projectDir) throws Exception {
super.testEnhancementUpToDate( projectDir );
}
}

View File

@ -0,0 +1,40 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* 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
*/
plugins {
id 'java'
id 'org.hibernate.orm'
}
repositories {
mavenCentral()
maven {
name 'jboss-snapshots-repository'
url 'https://repository.jboss.org/nexus/content/repositories/snapshots'
}
}
dependencies {
// NOTE : The version used here is irrelevant in terms of testing the plugin.
// We just need a resolvable version
implementation 'org.hibernate.orm:hibernate-core:6.1.0.Final'
implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1'
}
hibernate {
useSameVersion = false
enhancement {
enableLazyInitialization.set(true)
lazyInitialization = true
enableDirtyTracking.set(true)
dirtyTracking = true
enableExtendedEnhancement.set(true)
}
}

View File

@ -0,0 +1,29 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* 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.
*/
import jakarta.persistence.Embeddable;
@Embeddable
public class TheEmbeddable {
private String valueOne;
private String valueTwo;
public String getValueOne() {
return valueOne;
}
public void setValueOne(String valueOne) {
this.valueOne = valueOne;
}
public String getValueTwo() {
return valueTwo;
}
public void setValueTwo(String valueTwo) {
this.valueTwo = valueTwo;
}
}

View File

@ -0,0 +1,88 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* 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.
*/
import jakarta.persistence.ElementCollection;
import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import org.hibernate.annotations.BatchSize;
import java.util.Set;
@Entity
@BatchSize( size = 20 )
public class TheEntity {
@Id
private Integer id;
private String name;
@Embedded
private TheEmbeddable theEmbeddable;
@ManyToOne
@JoinColumn
private TheEntity theManyToOne;
@OneToMany( mappedBy = "theManyToOne" )
private Set<TheEntity> theOneToMany;
@ElementCollection
@JoinColumn( name = "owner_id" )
private Set<TheEmbeddable> theEmbeddableCollection;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public TheEmbeddable getTheEmbeddable() {
return theEmbeddable;
}
public void setTheEmbeddable(TheEmbeddable theEmbeddable) {
this.theEmbeddable = theEmbeddable;
}
public TheEntity getTheManyToOne() {
return theManyToOne;
}
public void setTheManyToOne(TheEntity theManyToOne) {
this.theManyToOne = theManyToOne;
}
public Set<TheEntity> getTheOneToMany() {
return theOneToMany;
}
public void setTheOneToMany(Set<TheEntity> theOneToMany) {
this.theOneToMany = theOneToMany;
}
public Set<TheEmbeddable> getTheEmbeddableCollection() {
return theEmbeddableCollection;
}
public void setTheEmbeddableCollection(Set<TheEmbeddable> theEmbeddableCollection) {
this.theEmbeddableCollection = theEmbeddableCollection;
}
}

View File

@ -0,0 +1,5 @@
module test {
requires org.hibernate.orm.core;
requires jakarta.persistence;
requires jakarta.annotation;
}