|
1 | 1 | package org.grails.datastore.mapping.config |
2 | 2 |
|
3 | | -import groovy.transform.AutoClone |
4 | | -import groovy.transform.builder.Builder |
5 | | -import groovy.transform.builder.SimpleStrategy |
6 | 3 | import org.grails.datastore.mapping.core.DatastoreUtils |
7 | 4 | import org.springframework.core.env.PropertyResolver |
8 | 5 | import spock.lang.Specification |
@@ -64,104 +61,29 @@ class RecursiveConfigurationBuilderSpec extends Specification { |
64 | 61 | } |
65 | 62 | } |
66 | 63 |
|
67 | | - @AutoClone |
68 | | - @Builder(builderStrategy = SimpleStrategy, prefix = '') |
| 64 | + @SettingsBuilder |
69 | 65 | static class MongoConnectionSourceSettings { |
70 | | - MongoClientOptions.Builder options = MongoClientOptions.builder() |
| 66 | + |
| 67 | + MongoClientOptions options = new MongoClientOptions() |
71 | 68 |
|
72 | 69 | } |
73 | 70 |
|
| 71 | + @SettingsBuilder |
74 | 72 | static class MongoClientOptions { |
75 | 73 |
|
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() |
94 | 75 |
|
95 | | - MongoClientOptions build() { |
96 | | - new MongoClientOptions(this) |
97 | | - } |
98 | | - } |
99 | 76 | } |
100 | 77 |
|
| 78 | + @SettingsBuilder |
101 | 79 | static class MongoClientSettings { |
102 | 80 |
|
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() |
116 | 82 |
|
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 | | - } |
130 | 83 | } |
131 | 84 |
|
| 85 | + @SettingsBuilder |
132 | 86 | 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 |
166 | 88 | } |
167 | 89 | } |
0 commit comments