Skip to content

Commit 979170f

Browse files
cigalybeikov
authored andcommitted
HHH-18500 Added slightly modifed existing test case with addition of module-info.java and set extend enhancement flag
1 parent b40bc61 commit 979170f

File tree

6 files changed

+215
-0
lines changed

6 files changed

+215
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Hibernate, Relational Persistence for Idiomatic Java
3+
*
4+
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
5+
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
6+
*/
7+
package org.hibernate.orm.tooling.gradle;
8+
9+
import java.nio.file.Path;
10+
11+
import org.junit.jupiter.api.Test;
12+
import org.junit.jupiter.api.io.TempDir;
13+
14+
15+
/**
16+
* Basic functional tests
17+
*
18+
* @author Steve Ebersole
19+
*/
20+
class ModuleInfoProjectTests extends TestsBase {
21+
22+
@Override
23+
protected String getProjectName() {
24+
return "simple-moduleinfo";
25+
}
26+
27+
@Override
28+
protected String getSourceSetName() {
29+
return "main";
30+
}
31+
32+
@Override
33+
protected String getLanguageName() {
34+
return "java";
35+
}
36+
37+
@Override
38+
protected String getCompileTaskName() {
39+
return "compileJava";
40+
}
41+
42+
@Test
43+
@Override
44+
public void testEnhancement(@TempDir Path projectDir) throws Exception {
45+
super.testEnhancement( projectDir );
46+
}
47+
48+
@Test
49+
@Override
50+
public void testEnhancementUpToDate(@TempDir Path projectDir) throws Exception {
51+
super.testEnhancementUpToDate( projectDir );
52+
}
53+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Hibernate, Relational Persistence for Idiomatic Java
3+
*
4+
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
5+
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
6+
*/
7+
8+
plugins {
9+
id 'java'
10+
id 'org.hibernate.orm'
11+
}
12+
13+
repositories {
14+
mavenCentral()
15+
16+
maven {
17+
name 'jboss-snapshots-repository'
18+
url 'https://repository.jboss.org/nexus/content/repositories/snapshots'
19+
}
20+
}
21+
22+
dependencies {
23+
// NOTE : The version used here is irrelevant in terms of testing the plugin.
24+
// We just need a resolvable version
25+
implementation 'org.hibernate.orm:hibernate-core:6.1.0.Final'
26+
implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1'
27+
}
28+
29+
hibernate {
30+
useSameVersion = false
31+
enhancement {
32+
enableLazyInitialization.set(true)
33+
lazyInitialization = true
34+
35+
enableDirtyTracking.set(true)
36+
dirtyTracking = true
37+
38+
enableExtendedEnhancement.set(true)
39+
}
40+
}

tooling/hibernate-gradle-plugin/src/test/resources/projects/simple-moduleinfo/settings.gradle

Whitespace-only changes.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Hibernate, Relational Persistence for Idiomatic Java
3+
*
4+
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
5+
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
6+
*/
7+
import jakarta.persistence.Embeddable;
8+
9+
@Embeddable
10+
public class TheEmbeddable {
11+
private String valueOne;
12+
private String valueTwo;
13+
14+
public String getValueOne() {
15+
return valueOne;
16+
}
17+
18+
public void setValueOne(String valueOne) {
19+
this.valueOne = valueOne;
20+
}
21+
22+
public String getValueTwo() {
23+
return valueTwo;
24+
}
25+
26+
public void setValueTwo(String valueTwo) {
27+
this.valueTwo = valueTwo;
28+
}
29+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/*
2+
* Hibernate, Relational Persistence for Idiomatic Java
3+
*
4+
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
5+
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
6+
*/
7+
import jakarta.persistence.ElementCollection;
8+
import jakarta.persistence.Embedded;
9+
import jakarta.persistence.Entity;
10+
import jakarta.persistence.Id;
11+
import jakarta.persistence.JoinColumn;
12+
import jakarta.persistence.ManyToOne;
13+
import jakarta.persistence.OneToMany;
14+
15+
import org.hibernate.annotations.BatchSize;
16+
17+
import java.util.Set;
18+
19+
@Entity
20+
@BatchSize( size = 20 )
21+
public class TheEntity {
22+
@Id
23+
private Integer id;
24+
private String name;
25+
26+
@Embedded
27+
private TheEmbeddable theEmbeddable;
28+
29+
@ManyToOne
30+
@JoinColumn
31+
private TheEntity theManyToOne;
32+
33+
@OneToMany( mappedBy = "theManyToOne" )
34+
private Set<TheEntity> theOneToMany;
35+
36+
@ElementCollection
37+
@JoinColumn( name = "owner_id" )
38+
private Set<TheEmbeddable> theEmbeddableCollection;
39+
40+
41+
public Integer getId() {
42+
return id;
43+
}
44+
45+
public void setId(Integer id) {
46+
this.id = id;
47+
}
48+
49+
public String getName() {
50+
return name;
51+
}
52+
53+
public void setName(String name) {
54+
this.name = name;
55+
}
56+
57+
public TheEmbeddable getTheEmbeddable() {
58+
return theEmbeddable;
59+
}
60+
61+
public void setTheEmbeddable(TheEmbeddable theEmbeddable) {
62+
this.theEmbeddable = theEmbeddable;
63+
}
64+
65+
public TheEntity getTheManyToOne() {
66+
return theManyToOne;
67+
}
68+
69+
public void setTheManyToOne(TheEntity theManyToOne) {
70+
this.theManyToOne = theManyToOne;
71+
}
72+
73+
public Set<TheEntity> getTheOneToMany() {
74+
return theOneToMany;
75+
}
76+
77+
public void setTheOneToMany(Set<TheEntity> theOneToMany) {
78+
this.theOneToMany = theOneToMany;
79+
}
80+
81+
public Set<TheEmbeddable> getTheEmbeddableCollection() {
82+
return theEmbeddableCollection;
83+
}
84+
85+
public void setTheEmbeddableCollection(Set<TheEmbeddable> theEmbeddableCollection) {
86+
this.theEmbeddableCollection = theEmbeddableCollection;
87+
}
88+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module test {
2+
requires org.hibernate.orm.core;
3+
requires jakarta.persistence;
4+
requires jakarta.annotation;
5+
}

0 commit comments

Comments
 (0)