Skip to content

Commit 8f1a819

Browse files
authored
Merge pull request #1834 from grails/restore-domain-inheritance
Restore domain inheritance tests
2 parents ceeb6fe + 76c8e8d commit 8f1a819

File tree

9 files changed

+37
-42
lines changed

9 files changed

+37
-42
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ subprojects {
117117

118118

119119
dependencies {
120+
implementation platform("org.grails:grails-bom:$grailsVersion")
120121
api "jakarta.annotation:jakarta.annotation-api:$jakartaAnnotationApiVersion"
121122
implementation "jakarta.validation:jakarta.validation-api:$jakartaValidationVersion"
122123
compileOnly "com.github.spotbugs:spotbugs-annotations:$jsr305Version"

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ gradleNexusPluginVersion=2.3.1
1616
gradleNexusPublishPluginVersion=1.3.0
1717
grailsAsyncVersion=6.0.0-SNAPSHOT
1818
grailsVersion=7.0.0-SNAPSHOT
19-
groovyVersion=4.0.23
19+
groovyVersion=4.0.24-SNAPSHOT
2020
h2Version=2.3.232
2121
hibernateValidatorVersion=7.0.5.Final
2222
jansiVersion=2.4.1

grails-datastore-core/src/test/groovy/org/grails/datastore/mapping/model/GormMappingInheritanceTests.groovy

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import static org.junit.jupiter.api.Assertions.*
1212
/**
1313
* Tests for correct mapping of entities with inheritance.
1414
*/
15-
@Ignore("https://issues.apache.org/jira/browse/GROOVY-5106 - The interface GormEntity cannot be implemented more than once with different arguments: org.grails.datastore.gorm.GormEntity<grails.gorm.tests.XXX> and org.grails.datastore.gorm.GormEntity<grails.gorm.tests.XXX>")
1615
class GormMappingInheritanceTests {
1716

1817
@Test
@@ -105,14 +104,14 @@ class GormMappingInheritanceTests {
105104
}
106105
}
107106

108-
//@Entity
107+
@Entity
109108
class DerivedEntity extends SecondEntity {
110109
String baz
111110

112111
static transients = ['baz']
113112
}
114113

115-
//@Entity
114+
@Entity
116115
class SpecialUser extends User {
117116
Set specialFriends
118117

@@ -130,7 +129,7 @@ class Parent {
130129
static hasMany = [children: BaseChild]
131130
}
132131

133-
//@Entity
132+
@Entity
134133
class BaseChild {
135134
Long id
136135

@@ -144,7 +143,7 @@ class DerivedChild extends BaseChild {
144143
String prop
145144
}
146145

147-
//@Entity
146+
@Entity
148147
class EmbeddedTest {
149148
Long id
150149

@@ -159,7 +158,7 @@ class DerivedEmbeddedTest extends EmbeddedTest {
159158
static embedded = ['testEntity2']
160159
}
161160

162-
//@Entity
161+
@Entity
163162
class MappingTest {
164163
Long id
165164

@@ -170,7 +169,7 @@ class MappingTest {
170169
}
171170
}
172171

173-
//@Entity
172+
@Entity
174173
class MappingTest2 extends MappingTest {
175174

176175
String toIndex2
@@ -182,14 +181,14 @@ class MappingTest2 extends MappingTest {
182181
}
183182
}
184183

185-
//@Entity
184+
@Entity
186185
class DerivedEntityChildA extends DerivedEntity {
187186
}
188187

189-
//@Entity
188+
@Entity
190189
class DerivedEntityChildB extends DerivedEntity {
191190
}
192191

193-
//@Entity
192+
@Entity
194193
class DerivedEntityChildC extends DerivedEntity {
195194
}

grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/InheritanceSpec.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import grails.persistence.Entity
77
/**
88
* @author graemerocher
99
*/
10-
@Ignore("https://issues.apache.org/jira/browse/GROOVY-5106 - The interface GormEntity cannot be implemented more than once with different arguments: org.grails.datastore.gorm.GormEntity<grails.gorm.tests.XXX> and org.grails.datastore.gorm.GormEntity<grails.gorm.tests.XXX>")
1110
class InheritanceSpec extends GormDatastoreSpec {
1211

1312
@Override
@@ -100,7 +99,7 @@ class Practice implements Serializable {
10099
static hasMany = [locations: Location]
101100
}
102101

103-
//@Entity
102+
@Entity
104103
class Location implements Serializable {
105104
// Long id
106105
Long version

grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/BidirectionalOneToManyWithInheritanceSpec.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import grails.persistence.Entity
88
/**
99
* @author graemerocher
1010
*/
11-
@Ignore("https://issues.apache.org/jira/browse/GROOVY-5106 - The interface GormEntity cannot be implemented more than once with different arguments: org.grails.datastore.gorm.GormEntity<grails.gorm.tests.XXX> and org.grails.datastore.gorm.GormEntity<grails.gorm.tests.XXX>")
1211
class BidirectionalOneToManyWithInheritanceSpec extends GormDatastoreSpec {
1312

1413
void "Test a bidirectional one-to-many association with inheritance"() {
@@ -34,7 +33,7 @@ class BidirectionalOneToManyWithInheritanceSpec extends GormDatastoreSpec {
3433
}
3534
}
3635

37-
//@Entity
36+
@Entity
3837
class ConfigurationItem {
3938
Long id
4039
Long version

grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/InheritanceWithOneToManySpec.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import grails.persistence.Entity
77

88
import spock.lang.Issue
99

10-
@Ignore("https://issues.apache.org/jira/browse/GROOVY-5106 - The interface GormEntity cannot be implemented more than once with different arguments: org.grails.datastore.gorm.GormEntity<grails.gorm.tests.XXX> and org.grails.datastore.gorm.GormEntity<grails.gorm.tests.XXX>")
1110
class InheritanceWithOneToManySpec extends GormDatastoreSpec{
1211

1312
@Issue('GRAILS-9010')
@@ -38,7 +37,7 @@ class Group {
3837
Collection members
3938
}
4039

41-
//@Entity
40+
@Entity
4241
class Member {
4342
Long id
4443
String name

grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/validation/UniqueConstraintSpec.groovy

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import spock.lang.AutoCleanup
1414
import spock.lang.Specification
1515

1616
@Transactional
17-
@Ignore("https://issues.apache.org/jira/browse/GROOVY-5106 - The interface GormEntity cannot be implemented more than once with different arguments: org.grails.datastore.gorm.GormEntity<grails.gorm.tests.XXX> and org.grails.datastore.gorm.GormEntity<grails.gorm.tests.XXX>")
1817
class UniqueConstraintSpec extends Specification {
1918

2019
@AutoCleanup SimpleMapDatastore datastore = new SimpleMapDatastore(
@@ -145,7 +144,7 @@ class UniqueConstraintSpec extends Specification {
145144
}
146145

147146

148-
//@Entity
147+
@Entity
149148
class Channel {
150149

151150
String name
@@ -177,7 +176,7 @@ class ListChannel extends Channel {
177176
}
178177

179178

180-
//@Entity
179+
@Entity
181180
class OtherListChannel extends ListChannel {
182181

183182
static constraints = {

grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/GormEntityApi.groovy

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,93 +8,93 @@ package org.grails.datastore.gorm
88
*
99
* @param <D> The entity type
1010
*/
11-
interface GormEntityApi<D> {
11+
trait GormEntityApi<D> {
1212
/**
1313
* Proxy aware instanceOf implementation.
1414
*/
15-
boolean instanceOf(Class cls)
15+
abstract boolean instanceOf(Class cls)
1616
/**
1717
* Upgrades an existing persistence instance to a write lock
1818
* @return The instance
1919
*/
20-
D lock()
20+
abstract D lock()
2121
/**
2222
* Locks the instance for updates for the scope of the passed closure
2323
*
2424
* @param callable The closure
2525
* @return The result of the closure
2626
*/
27-
def mutex(Closure callable)
27+
abstract def mutex(Closure callable)
2828
/**
2929
* Refreshes the state of the current instance
3030
* @return The instance
3131
*/
32-
D refresh()
32+
abstract D refresh()
3333
/**
3434
* Saves an object the datastore
3535
* @return Returns the instance
3636
*/
37-
D save()
37+
abstract D save()
3838
/**
3939
* Forces an insert of an object to the datastore
4040
* @return Returns the instance
4141
*/
42-
D insert()
42+
abstract D insert()
4343
/**
4444
* Forces an insert of an object to the datastore
4545
* @return Returns the instance
4646
*/
47-
D insert(Map params)
47+
abstract D insert(Map params)
4848
/**
4949
* Saves an object the datastore
5050
* @return Returns the instance
5151
*/
52-
D merge()
52+
abstract D merge()
5353
/**
5454
* Saves an object the datastore
5555
* @return Returns the instance
5656
*/
57-
D merge(Map params)
57+
abstract D merge(Map params)
5858
/**
5959
* Save method that takes a boolean which indicates whether to perform validation or not
6060
*
6161
* @param validate Whether to perform validation
6262
*
6363
* @return The instance or null if validation fails
6464
*/
65-
D save(boolean validate)
65+
abstract D save(boolean validate)
6666
/**
6767
* Saves an object with the given parameters
6868
* @param instance The instance
6969
* @param params The parameters
7070
* @return The instance
7171
*/
72-
D save(Map params)
72+
abstract D save(Map params)
7373
/**
7474
* Returns the objects identifier
7575
*/
76-
Serializable ident()
76+
abstract Serializable ident()
7777
/**
7878
* Attaches an instance to an existing session. Requries a session-based model
7979
* @return
8080
*/
81-
D attach()
81+
abstract D attach()
8282
/**
8383
* No concept of session-based model so defaults to true
8484
*/
85-
boolean isAttached()
85+
abstract boolean isAttached()
8686
/**
8787
* Discards any pending changes. Requires a session-based model.
8888
*/
89-
void discard()
89+
abstract void discard()
9090
/**
9191
* Deletes an instance from the datastore
9292
*/
93-
void delete()
93+
abstract void delete()
9494
/**
9595
* Deletes an instance from the datastore
9696
*/
97-
void delete(Map params)
97+
abstract void delete(Map params)
9898
/**
9999
* Checks whether a field is dirty
100100
*
@@ -103,12 +103,12 @@ interface GormEntityApi<D> {
103103
*
104104
* @return true if the field is dirty
105105
*/
106-
boolean isDirty(String fieldName)
106+
abstract boolean isDirty(String fieldName)
107107
/**
108108
* Checks whether an entity is dirty
109109
*
110110
* @param instance The instance
111111
* @return true if it is dirty
112112
*/
113-
boolean isDirty()
113+
abstract boolean isDirty()
114114
}

grails-datastore-gorm/src/test/groovy/org/grails/compiler/gorm/EntityWithGenericSignaturesSpec.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import spock.lang.Specification
1111
/**
1212
* Created by graemerocher on 16/09/2016.
1313
*/
14-
@Ignore("https://issues.apache.org/jira/browse/GROOVY-5106 - The interface GormEntity cannot be implemented more than once with different arguments: org.grails.datastore.gorm.GormEntity<grails.gorm.tests.XXX> and org.grails.datastore.gorm.GormEntity<grails.gorm.tests.XXX>")
1514
class EntityWithGenericSignaturesSpec extends Specification {
1615

1716
void "Test compile entity with generic signatures"() {
@@ -35,7 +34,7 @@ abstract class WidgetSetting {
3534
String name
3635
}
3736
38-
//@Entity
37+
@Entity
3938
class HotWidgetSetting extends WidgetSetting {
4039
Integer temperature
4140
}

0 commit comments

Comments
 (0)