16
16
17
17
package za .co .absa .atum .server .api
18
18
19
- import io .circe .{ Json , parser }
19
+ import io .circe .parser
20
20
import za .co .absa .atum .model .dto ._
21
21
import za .co .absa .atum .server .model .CheckpointFromDB
22
22
@@ -47,24 +47,6 @@ trait TestData {
47
47
authorIfNew = " "
48
48
)
49
49
50
- protected val checkpointQueryDTO1 : CheckpointQueryDTO = CheckpointQueryDTO (
51
- partitioning = partitioningDTO1,
52
- limit = Option (2 ),
53
- checkpointName = Option (" checkpointName" )
54
- )
55
-
56
- protected val checkpointQueryDTO2 : CheckpointQueryDTO = CheckpointQueryDTO (
57
- partitioning = partitioningDTO2,
58
- limit = Option (5 ),
59
- checkpointName = Option (" noCheckpoints" )
60
- )
61
-
62
- protected val checkpointQueryDTO3 : CheckpointQueryDTO = CheckpointQueryDTO (
63
- partitioning = partitioningDTO3,
64
- limit = None ,
65
- checkpointName = None
66
- )
67
-
68
50
// PartitioningSubmitDTO with different author
69
51
protected val partitioningSubmitDTO2 : PartitioningSubmitDTO =
70
52
partitioningSubmitDTO1.copy(authorIfNew = " differentAuthor" )
@@ -137,87 +119,7 @@ trait TestData {
137
119
" key3" -> Some (" value3" )
138
120
)
139
121
140
- // Checkpoint DTO
141
- protected val checkpointDTO1 : CheckpointDTO = CheckpointDTO (
142
- id = UUID .randomUUID(),
143
- name = " name" ,
144
- author = " author" ,
145
- partitioning = checkpointQueryDTO1.partitioning,
146
- processStartTime = ZonedDateTime .now(),
147
- processEndTime = Some (ZonedDateTime .now()),
148
- measurements = measurementsDTO1.toSet
149
- )
150
-
151
- protected val checkpointDTO2 : CheckpointDTO = CheckpointDTO (
152
- id = UUID .randomUUID(),
153
- name = " name2" ,
154
- author = " author2" ,
155
- partitioning = checkpointQueryDTO1.partitioning,
156
- processStartTime = ZonedDateTime .now(),
157
- processEndTime = Some (ZonedDateTime .now()),
158
- measurements = measurementsDTO2.toSet
159
- )
160
-
161
- protected val checkpointDTO3 : CheckpointDTO = checkpointDTO1.copy(id = UUID .randomUUID())
162
-
163
- // Additional Data DTO as a map
164
- val defaultJsonString : String = """
165
- |{
166
- | "mainValue": {
167
- | "value": "123",
168
- | "valueType": "Long"
169
- | },
170
- | "supportValues": {
171
- | "key1": {
172
- | "value": "123456789",
173
- | "valueType": "Long"
174
- | },
175
- | "key2": {
176
- | "value": "12345.6789",
177
- | "valueType": "BigDecimal"
178
- | }
179
- | }
180
- |}
181
- |""" .stripMargin
182
-
183
- protected val defaultJson : Json = parser.parse(defaultJsonString).getOrElse(throw new Exception (" Failed to pass JSON" ))
184
-
185
- // Checkpoint from DB DTO
186
- protected val checkpointFromDB1 : CheckpointFromDB = CheckpointFromDB (
187
- idCheckpoint = checkpointDTO1.id,
188
- checkpointName = " name" ,
189
- author = " author" ,
190
- measureName = measureDTO1.measureName,
191
- measuredColumns = Seq (" col_A1" , " col_B1" ),
192
- measurementValue = defaultJson,
193
- checkpointStartTime = checkpointDTO1.processStartTime,
194
- checkpointEndTime = checkpointDTO1.processEndTime
195
- )
196
-
197
- protected val checkpointFromDB2 : CheckpointFromDB = CheckpointFromDB (
198
- idCheckpoint = checkpointDTO2.id,
199
- checkpointName = " name2" ,
200
- author = " author2" ,
201
- measureName = measureDTO2.measureName,
202
- measuredColumns = Seq (" col_A2" , " col_B2" ),
203
- measurementValue = defaultJson,
204
- checkpointStartTime = checkpointDTO2.processStartTime,
205
- checkpointEndTime = checkpointDTO2.processEndTime
206
- )
207
-
208
- protected val checkpointFromDB3 : CheckpointFromDB = CheckpointFromDB (
209
- idCheckpoint = checkpointDTO1.id,
210
- checkpointName = " name" ,
211
- author = " author" ,
212
- measuredByAtumAgent = true ,
213
- measureName = " cnt" ,
214
- measuredColumns = Seq (" col3_A" , " col3_B" ),
215
- measurementValue = defaultJson,
216
- checkpointStartTime = checkpointDTO3.processStartTime,
217
- checkpointEndTime = None ,
218
- )
219
-
220
- // Additional Data submit DTO
122
+ // Additional Data Submit DTO
221
123
protected val additionalDataSubmitDTO1 : AdditionalDataSubmitDTO = AdditionalDataSubmitDTO (
222
124
partitioning = Seq .empty,
223
125
additionalData = Map .empty,
@@ -241,49 +143,57 @@ trait TestData {
241
143
measures = Set (MeasureDTO (" count" , Seq (" 1" )))
242
144
)
243
145
244
- // Checkpoint
146
+ // Checkpoint Query DTO
147
+ protected val checkpointQueryDTO1 : CheckpointQueryDTO = CheckpointQueryDTO (
148
+ partitioning = partitioningDTO1,
149
+ limit = Option (2 ),
150
+ checkpointName = Option (" checkpointName" )
151
+ )
152
+
153
+ protected val checkpointQueryDTO2 : CheckpointQueryDTO = CheckpointQueryDTO (
154
+ partitioning = partitioningDTO2,
155
+ limit = Option (5 ),
156
+ checkpointName = Option (" noCheckpoints" )
157
+ )
158
+
159
+ protected val checkpointQueryDTO3 : CheckpointQueryDTO = CheckpointQueryDTO (
160
+ partitioning = partitioningDTO3,
161
+ limit = None ,
162
+ checkpointName = None
163
+ )
164
+
165
+ // Checkpoint DTO
245
166
protected val checkpointDTO1 : CheckpointDTO = CheckpointDTO (
246
167
id = UUID .randomUUID(),
247
168
name = " name" ,
248
169
author = " author" ,
249
- partitioning = Seq .empty,
250
- measuredByAtumAgent = true ,
170
+ partitioning = checkpointQueryDTO1.partitioning,
251
171
processStartTime = ZonedDateTime .now(),
252
- processEndTime = None ,
253
- measurements = Set (
254
- MeasurementDTO (
255
- MeasureDTO (measureName = " cnt" , measuredColumns = Seq (" col1" , " col2" )),
256
- MeasureResultDTO (
257
- mainValue = MeasureResultDTO .TypedValue (" 123" , MeasureResultDTO .ResultValueType .Long ),
258
- supportValues = Map (
259
- " help1" -> MeasureResultDTO .TypedValue (" 666" , MeasureResultDTO .ResultValueType .Long ),
260
- " help2" -> MeasureResultDTO .TypedValue (" 99.9" , MeasureResultDTO .ResultValueType .Double ),
261
- )
262
- )
263
- )
264
- )
172
+ processEndTime = Some (ZonedDateTime .now()),
173
+ measurements = measurementsDTO1.toSet
265
174
)
266
- protected val checkpointDTO2 : CheckpointDTO = checkpointDTO1.copy(id = UUID .randomUUID(), partitioning = partitioningDTO1)
267
-
268
- protected val checkpointDTO3 : CheckpointDTO = checkpointDTO1.copy(id = UUID .randomUUID())
269
175
270
- protected val checkpointQueryDTO1 : CheckpointQueryDTO = CheckpointQueryDTO (
271
- partitioning = Seq .empty,
272
- limit = Some (5 ),
273
- checkpointName = None
176
+ protected val checkpointDTO2 : CheckpointDTO = CheckpointDTO (
177
+ id = UUID .randomUUID(),
178
+ name = " name2" ,
179
+ author = " author2" ,
180
+ partitioning = checkpointQueryDTO1.partitioning,
181
+ processStartTime = ZonedDateTime .now(),
182
+ processEndTime = Some (ZonedDateTime .now()),
183
+ measurements = measurementsDTO2.toSet
274
184
)
275
185
276
- protected val checkpointQueryDTO2 : CheckpointQueryDTO = checkpointQueryDTO1.copy(partitioning = partitioningDTO1)
277
- protected val checkpointQueryDTO3 : CheckpointQueryDTO = checkpointQueryDTO1.copy(partitioning = partitioningDTO2)
186
+ protected val checkpointDTO3 : CheckpointDTO = checkpointDTO1.copy(id = UUID .randomUUID())
278
187
188
+ // Checkpoint From DB
279
189
protected val checkpointFromDB1 : CheckpointFromDB = CheckpointFromDB (
280
190
idCheckpoint = checkpointDTO1.id,
281
191
checkpointName = " name" ,
282
192
author = " author" ,
283
193
measuredByAtumAgent = true ,
284
194
measureName = " cnt" ,
285
195
measuredColumns = Seq (" col1" , " col2" ),
286
- measurementValue = parse(
196
+ measurementValue = parser. parse(
287
197
"""
288
198
|{
289
199
| "mainValue": {
0 commit comments