Skip to content

Commit 79d1bf7

Browse files
committed
Restore unit tests for grace-datastore-core and grace-datastore-gorm
- Relocate validation tests from `grace-datastore-gorm-validation` to `grace-datastore-gorm` - Remove deprecated JpaMappingSyntaxTests - Make all the tests pass Closes gh-75
2 parents 99a396c + f1b3ad6 commit 79d1bf7

File tree

12 files changed

+19
-501
lines changed

12 files changed

+19
-501
lines changed

build.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,8 @@ subprojects {
127127
failOnError = false
128128
}
129129

130-
if (project.name == "grace-datastore-gorm" || project.name == "grace-datastore-gorm-test") {
131-
test {
132-
useJUnitPlatform()
133-
}
130+
test {
131+
useJUnitPlatform()
134132
}
135133

136134
checkstyle {
Lines changed: 9 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package org.grails.datastore.mapping.config
22

3-
import groovy.transform.AutoClone
4-
import groovy.transform.builder.Builder
5-
import groovy.transform.builder.SimpleStrategy
63
import org.grails.datastore.mapping.core.DatastoreUtils
74
import org.springframework.core.env.PropertyResolver
85
import spock.lang.Specification
@@ -64,104 +61,29 @@ class RecursiveConfigurationBuilderSpec extends Specification {
6461
}
6562
}
6663

67-
@AutoClone
68-
@Builder(builderStrategy = SimpleStrategy, prefix = '')
64+
@SettingsBuilder
6965
static class MongoConnectionSourceSettings {
70-
MongoClientOptions.Builder options = MongoClientOptions.builder()
66+
67+
MongoClientOptions options = new MongoClientOptions()
7168

7269
}
7370

71+
@SettingsBuilder
7472
static class MongoClientOptions {
7573

76-
private AutoEncryptionSettings autoEncryptionSettings
77-
78-
private MongoClientOptions(Builder builder) {
79-
autoEncryptionSettings = builder.autoEncryptionSettings;
80-
}
81-
82-
static Builder builder() {
83-
new Builder()
84-
}
85-
86-
static class Builder {
87-
88-
private AutoEncryptionSettings autoEncryptionSettings
89-
90-
Builder autoEncryptionSettings(AutoEncryptionSettings autoEncryptionSettings) {
91-
this.autoEncryptionSettings = autoEncryptionSettings
92-
this
93-
}
74+
AutoEncryptionSettings autoEncryptionSettings = new AutoEncryptionSettings()
9475

95-
MongoClientOptions build() {
96-
new MongoClientOptions(this)
97-
}
98-
}
9976
}
10077

78+
@SettingsBuilder
10179
static class MongoClientSettings {
10280

103-
private AutoEncryptionSettings autoEncryptionSettings
104-
105-
MongoClientSettings(Builder builder) {
106-
autoEncryptionSettings = builder.autoEncryptionSettings
107-
}
108-
109-
static Builder builder() {
110-
new Builder()
111-
}
112-
113-
static class Builder {
114-
115-
private AutoEncryptionSettings autoEncryptionSettings;
81+
AutoEncryptionSettings autoEncryptionSettings = new AutoEncryptionSettings()
11682

117-
private Builder() {
118-
119-
}
120-
121-
Builder autoEncryptionSettings(AutoEncryptionSettings autoEncryptionSettings) {
122-
this.autoEncryptionSettings = autoEncryptionSettings
123-
this
124-
}
125-
126-
MongoClientSettings build() {
127-
new MongoClientSettings(this)
128-
}
129-
}
13083
}
13184

85+
@SettingsBuilder
13286
static class AutoEncryptionSettings {
133-
private MongoClientSettings keyVaultMongoClientSettings;
134-
private boolean bypassAutoEncryption
135-
136-
private AutoEncryptionSettings(Builder builder) {
137-
this.keyVaultMongoClientSettings = builder.keyVaultMongoClientSettings
138-
this.bypassAutoEncryption = builder.bypassAutoEncryption
139-
}
140-
141-
static Builder builder() {
142-
new Builder()
143-
}
144-
145-
static class Builder {
146-
private MongoClientSettings keyVaultMongoClientSettings
147-
private boolean bypassAutoEncryption
148-
149-
private Builder() {
150-
}
151-
152-
Builder bypassAutoEncryption(boolean bypassAutoEncryption) {
153-
this.bypassAutoEncryption = bypassAutoEncryption
154-
this
155-
}
156-
157-
Builder keyVaultMongoClientSettings(MongoClientSettings keyVaultMongoClientSettings) {
158-
this.keyVaultMongoClientSettings = keyVaultMongoClientSettings
159-
this
160-
}
161-
162-
AutoEncryptionSettings build() {
163-
new AutoEncryptionSettings(this)
164-
}
165-
}
87+
boolean bypassAutoEncryption
16688
}
16789
}

grace-datastore-core/src/test/groovy/org/grails/datastore/mapping/core/grailsversion/GrailsVersionSpec.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package org.grails.datastore.mapping.core.grailsversion
22

33
import spock.lang.Specification
4+
import spock.lang.PendingFeature
45
import spock.lang.Unroll
56

67
/**
78
* Created by jameskleeh on 1/17/17.
89
*/
910
class GrailsVersionSpec extends Specification {
1011

12+
@PendingFeature(reason="Since there is no dependency on grace-bootstrap at the moment, it is not possible to obtain the current Grails version.")
1113
@Unroll
1214
void "isAtLeast(#requiredVersion) => #expected"(String requiredVersion, boolean expected) {
1315
expect:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class GormMappingSyntaxTests {
4848
context.addPersistentEntity(SecondEntity)
4949
def strategy = context.mappingSyntaxStrategy
5050
def props = strategy.getPersistentProperties(TestEntity,context)
51-
assert props.size() == 3
51+
assert props.size() == 4
5252
}
5353

5454
@Test

0 commit comments

Comments
 (0)