19
19
20
20
import java .util .List ;
21
21
import java .util .Optional ;
22
+ import java .util .UUID ;
22
23
23
24
import org .junit .jupiter .api .Assertions ;
24
25
import org .junit .jupiter .api .Test ;
40
41
import software .xdev .spring .data .eclipse .store .integration .isolated .tests .id .model .CustomerWithIdLongRepository ;
41
42
import software .xdev .spring .data .eclipse .store .integration .isolated .tests .id .model .CustomerWithIdString ;
42
43
import software .xdev .spring .data .eclipse .store .integration .isolated .tests .id .model .CustomerWithIdStringRepository ;
44
+ import software .xdev .spring .data .eclipse .store .integration .isolated .tests .id .model .CustomerWithIdUuid ;
45
+ import software .xdev .spring .data .eclipse .store .integration .isolated .tests .id .model .CustomerWithIdUuidRepository ;
43
46
import software .xdev .spring .data .eclipse .store .integration .isolated .tests .id .model .CustomerWithPurchase ;
44
47
import software .xdev .spring .data .eclipse .store .integration .isolated .tests .id .model .CustomerWithPurchaseRepository ;
45
48
import software .xdev .spring .data .eclipse .store .integration .isolated .tests .id .model .Purchase ;
@@ -60,7 +63,7 @@ public IdTest(final IdTestConfiguration configuration)
60
63
}
61
64
62
65
@ Test
63
- void testCreateSingleWithAutoIdInteger (@ Autowired final CustomerWithIdIntegerRepository customerRepository )
66
+ void createSingleWithAutoIdInteger (@ Autowired final CustomerWithIdIntegerRepository customerRepository )
64
67
{
65
68
final CustomerWithIdInteger customer1 = new CustomerWithIdInteger (TestData .FIRST_NAME , TestData .LAST_NAME );
66
69
customerRepository .save (customer1 );
@@ -138,7 +141,7 @@ void saveBulkWithAutoIdIntAndHardcodedId(@Autowired final CustomerWithIdIntRepos
138
141
* no previous method is called before the test.
139
142
*/
140
143
@ Test
141
- void testSaveSingleWithoutAnyPreviousCall (@ Autowired final CustomerWithIdIntegerRepository customerRepository )
144
+ void saveSingleWithoutAnyPreviousCall (@ Autowired final CustomerWithIdIntegerRepository customerRepository )
142
145
{
143
146
restartDatastore (this .configuration );
144
147
final CustomerWithIdInteger customer1 = new CustomerWithIdInteger (TestData .FIRST_NAME , TestData .LAST_NAME );
@@ -155,7 +158,7 @@ void testSaveSingleWithoutAnyPreviousCall(@Autowired final CustomerWithIdInteger
155
158
}
156
159
157
160
@ Test
158
- void testCreateSingleWithAutoIdIntegerWorkingCopyIdSet (
161
+ void createSingleWithAutoIdIntegerWorkingCopyIdSet (
159
162
@ Autowired final CustomerWithIdIntegerRepository customerRepository
160
163
)
161
164
{
@@ -166,7 +169,7 @@ void testCreateSingleWithAutoIdIntegerWorkingCopyIdSet(
166
169
}
167
170
168
171
@ Test
169
- void testCreateMultipleWithAutoIdInteger (@ Autowired final CustomerWithIdIntegerRepository customerRepository )
172
+ void createMultipleWithAutoIdInteger (@ Autowired final CustomerWithIdIntegerRepository customerRepository )
170
173
{
171
174
final CustomerWithIdInteger customer1 = new CustomerWithIdInteger (TestData .FIRST_NAME , TestData .LAST_NAME );
172
175
customerRepository .save (customer1 );
@@ -186,7 +189,7 @@ void testCreateMultipleWithAutoIdInteger(@Autowired final CustomerWithIdIntegerR
186
189
}
187
190
188
191
@ Test
189
- void testCreateMultipleWithAutoIdIntegerSingleFinds (
192
+ void createMultipleWithAutoIdIntegerSingleFinds (
190
193
@ Autowired final CustomerWithIdIntegerRepository customerRepository
191
194
)
192
195
{
@@ -208,7 +211,32 @@ void testCreateMultipleWithAutoIdIntegerSingleFinds(
208
211
}
209
212
210
213
@ Test
211
- void testCreateSingleWithAutoIdInt (@ Autowired final CustomerWithIdIntRepository customerRepository )
214
+ void createMultipleWithAutoIdUuidSingleFinds (
215
+ @ Autowired final CustomerWithIdUuidRepository customerRepository
216
+ )
217
+ {
218
+ final CustomerWithIdUuid customer1 = new CustomerWithIdUuid (TestData .FIRST_NAME , TestData .LAST_NAME );
219
+ customerRepository .save (customer1 );
220
+ final CustomerWithIdUuid customer2 =
221
+ new CustomerWithIdUuid (TestData .FIRST_NAME_ALTERNATIVE , TestData .LAST_NAME_ALTERNATIVE );
222
+ customerRepository .save (customer2 );
223
+
224
+ final UUID generatedId1 = customerRepository .findAll ().get (0 ).getId ();
225
+ final UUID generatedId2 = customerRepository .findAll ().get (1 ).getId ();
226
+
227
+ TestUtil .doBeforeAndAfterRestartOfDatastore (
228
+ this .configuration ,
229
+ () -> {
230
+ final Optional <CustomerWithIdUuid > loadedCustomer1 = customerRepository .findById (generatedId1 );
231
+ Assertions .assertEquals (customer1 , loadedCustomer1 .get ());
232
+ final Optional <CustomerWithIdUuid > loadedCustomer2 = customerRepository .findById (generatedId2 );
233
+ Assertions .assertEquals (customer2 , loadedCustomer2 .get ());
234
+ }
235
+ );
236
+ }
237
+
238
+ @ Test
239
+ void createSingleWithAutoIdInt (@ Autowired final CustomerWithIdIntRepository customerRepository )
212
240
{
213
241
final CustomerWithIdInt customer1 = new CustomerWithIdInt (TestData .FIRST_NAME , TestData .LAST_NAME );
214
242
customerRepository .save (customer1 );
@@ -224,7 +252,7 @@ void testCreateSingleWithAutoIdInt(@Autowired final CustomerWithIdIntRepository
224
252
}
225
253
226
254
@ Test
227
- void testCreateSingleWithAutoIdString (@ Autowired final CustomerWithIdStringRepository customerRepository )
255
+ void createSingleWithAutoIdString (@ Autowired final CustomerWithIdStringRepository customerRepository )
228
256
{
229
257
final CustomerWithIdString customer1 = new CustomerWithIdString (TestData .FIRST_NAME , TestData .LAST_NAME );
230
258
customerRepository .save (customer1 );
@@ -240,7 +268,25 @@ void testCreateSingleWithAutoIdString(@Autowired final CustomerWithIdStringRepos
240
268
}
241
269
242
270
@ Test
243
- void testSaveAfterRestartSingleWithAutoIdString (@ Autowired final CustomerWithIdStringRepository customerRepository )
271
+ void createSingleWithAutoIdUuid (@ Autowired final CustomerWithIdUuidRepository customerRepository )
272
+ {
273
+ final CustomerWithIdUuid customer1 = new CustomerWithIdUuid (TestData .FIRST_NAME , TestData .LAST_NAME );
274
+ customerRepository .save (customer1 );
275
+
276
+ final UUID generatedId = customerRepository .findAll ().get (0 ).getId ();
277
+
278
+ TestUtil .doBeforeAndAfterRestartOfDatastore (
279
+ this .configuration ,
280
+ () -> {
281
+ final Optional <CustomerWithIdUuid > loadedCustomer = customerRepository .findById (generatedId );
282
+ Assertions .assertTrue (loadedCustomer .isPresent ());
283
+ Assertions .assertEquals (customer1 , loadedCustomer .get ());
284
+ }
285
+ );
286
+ }
287
+
288
+ @ Test
289
+ void saveAfterRestartSingleWithAutoIdString (@ Autowired final CustomerWithIdStringRepository customerRepository )
244
290
{
245
291
final CustomerWithIdString customer1 = new CustomerWithIdString (TestData .FIRST_NAME , TestData .LAST_NAME );
246
292
customerRepository .save (customer1 );
@@ -263,7 +309,7 @@ void testSaveAfterRestartSingleWithAutoIdString(@Autowired final CustomerWithIdS
263
309
}
264
310
265
311
@ Test
266
- void testCreateMultipleWithAutoIdString (@ Autowired final CustomerWithIdStringRepository customerRepository )
312
+ void createMultipleWithAutoIdString (@ Autowired final CustomerWithIdStringRepository customerRepository )
267
313
{
268
314
final CustomerWithIdString customer1 = new CustomerWithIdString (TestData .FIRST_NAME , TestData .LAST_NAME );
269
315
customerRepository .save (customer1 );
@@ -283,7 +329,7 @@ void testCreateMultipleWithAutoIdString(@Autowired final CustomerWithIdStringRep
283
329
}
284
330
285
331
@ Test
286
- void testCreateSingleWithAutoIdLong (@ Autowired final CustomerWithIdLongRepository customerRepository )
332
+ void createSingleWithAutoIdLong (@ Autowired final CustomerWithIdLongRepository customerRepository )
287
333
{
288
334
final CustomerWithIdLong customer1 = new CustomerWithIdLong (TestData .FIRST_NAME , TestData .LAST_NAME );
289
335
customerRepository .save (customer1 );
@@ -300,7 +346,7 @@ void testCreateSingleWithAutoIdLong(@Autowired final CustomerWithIdLongRepositor
300
346
}
301
347
302
348
@ Test
303
- void testCreateMultipleWithAutoIdLong (@ Autowired final CustomerWithIdLongRepository customerRepository )
349
+ void createMultipleWithAutoIdLong (@ Autowired final CustomerWithIdLongRepository customerRepository )
304
350
{
305
351
final CustomerWithIdLong customer1 = new CustomerWithIdLong (TestData .FIRST_NAME , TestData .LAST_NAME );
306
352
customerRepository .save (customer1 );
@@ -323,7 +369,7 @@ void testCreateMultipleWithAutoIdLong(@Autowired final CustomerWithIdLongReposit
323
369
}
324
370
325
371
@ Test
326
- void testCreateSingleWithNoAutoIdInteger (
372
+ void createSingleWithNoAutoIdInteger (
327
373
@ Autowired final CustomerWithIdIntegerNoAutoGenerateRepository customerRepository )
328
374
{
329
375
final CustomerWithIdIntegerNoAutoGenerate customer1 =
@@ -341,7 +387,7 @@ void testCreateSingleWithNoAutoIdInteger(
341
387
}
342
388
343
389
@ Test
344
- void testCreateMultipleWithNoAutoIdInteger (
390
+ void createMultipleWithNoAutoIdInteger (
345
391
@ Autowired final CustomerWithIdIntegerNoAutoGenerateRepository customerRepository )
346
392
{
347
393
final CustomerWithIdIntegerNoAutoGenerate customer1 =
@@ -364,7 +410,7 @@ void testCreateMultipleWithNoAutoIdInteger(
364
410
}
365
411
366
412
@ Test
367
- void testSaveSingleWithAutoIdInteger (
413
+ void saveSingleWithAutoIdInteger (
368
414
@ Autowired final CustomerWithIdIntegerRepository customerRepository
369
415
)
370
416
{
@@ -385,7 +431,7 @@ void testSaveSingleWithAutoIdInteger(
385
431
}
386
432
387
433
@ Test
388
- void testSaveSingleWithNoAutoIdInteger (
434
+ void saveSingleWithNoAutoIdInteger (
389
435
@ Autowired final CustomerWithIdIntegerNoAutoGenerateRepository customerRepository )
390
436
{
391
437
final CustomerWithIdIntegerNoAutoGenerate customer1 =
@@ -397,7 +443,7 @@ void testSaveSingleWithNoAutoIdInteger(
397
443
}
398
444
399
445
@ Test
400
- void testAutoIdWithSubnodeWithId (
446
+ void autoIdWithSubnodeWithId (
401
447
@ Autowired final CustomerWithPurchaseRepository customerRepository )
402
448
{
403
449
final String purchaseName = "bag" ;
@@ -419,7 +465,7 @@ void testAutoIdWithSubnodeWithId(
419
465
}
420
466
421
467
@ Test
422
- void testAutoIdWithTwoSubnodeWithId (
468
+ void autoIdWithTwoSubnodeWithId (
423
469
@ Autowired final CustomerWithPurchaseRepository customerRepository )
424
470
{
425
471
final String purchaseName = "bag" ;
@@ -442,7 +488,7 @@ void testAutoIdWithTwoSubnodeWithId(
442
488
}
443
489
444
490
@ Test
445
- void testAutoIdWithTwoSameSubnodesWithSameIdDifferentNod (
491
+ void autoIdWithTwoSameSubnodesWithSameIdDifferentNod (
446
492
@ Autowired final CustomerWithPurchaseRepository customerRepository )
447
493
{
448
494
final Purchase purchase = new Purchase ("bag" );
@@ -475,7 +521,7 @@ void testAutoIdWithTwoSameSubnodesWithSameIdDifferentNod(
475
521
}
476
522
477
523
@ Test
478
- void testAutoIdWithTwoSameSubnodesWithSameIdSameNode (
524
+ void autoIdWithTwoSameSubnodesWithSameIdSameNode (
479
525
@ Autowired final CustomerWithPurchaseRepository customerRepository )
480
526
{
481
527
final Purchase purchase = new Purchase ("bag" );
@@ -498,7 +544,7 @@ void testAutoIdWithTwoSameSubnodesWithSameIdSameNode(
498
544
}
499
545
500
546
@ Test
501
- void testReplaceWithId (@ Autowired final CustomerWithIdIntegerNoAutoGenerateRepository customerRepository )
547
+ void replaceWithId (@ Autowired final CustomerWithIdIntegerNoAutoGenerateRepository customerRepository )
502
548
{
503
549
final CustomerWithIdIntegerNoAutoGenerate existingCustomer =
504
550
new CustomerWithIdIntegerNoAutoGenerate (1 , TestData .FIRST_NAME , TestData .LAST_NAME );
@@ -523,7 +569,7 @@ void testReplaceWithId(@Autowired final CustomerWithIdIntegerNoAutoGenerateRepos
523
569
}
524
570
525
571
@ Test
526
- void testReplaceWithAutoId (@ Autowired final CustomerWithIdIntegerRepository customerRepository )
572
+ void replaceWithAutoId (@ Autowired final CustomerWithIdIntegerRepository customerRepository )
527
573
{
528
574
final CustomerWithIdInteger existingCustomer =
529
575
new CustomerWithIdInteger (TestData .FIRST_NAME , TestData .LAST_NAME );
@@ -550,7 +596,7 @@ void testReplaceWithAutoId(@Autowired final CustomerWithIdIntegerRepository cust
550
596
}
551
597
552
598
@ Test
553
- void testReplaceWithIdSaveAll (@ Autowired final CustomerWithIdIntegerNoAutoGenerateRepository customerRepository )
599
+ void replaceWithIdSaveAll (@ Autowired final CustomerWithIdIntegerNoAutoGenerateRepository customerRepository )
554
600
{
555
601
final CustomerWithIdIntegerNoAutoGenerate existingCustomer =
556
602
new CustomerWithIdIntegerNoAutoGenerate (1 , TestData .FIRST_NAME , TestData .LAST_NAME );
@@ -565,7 +611,7 @@ void testReplaceWithIdSaveAll(@Autowired final CustomerWithIdIntegerNoAutoGenera
565
611
}
566
612
567
613
@ Test
568
- void testAddTwoWithId (@ Autowired final CustomerWithIdIntegerNoAutoGenerateRepository customerRepository )
614
+ void addTwoWithId (@ Autowired final CustomerWithIdIntegerNoAutoGenerateRepository customerRepository )
569
615
{
570
616
final CustomerWithIdIntegerNoAutoGenerate existingCustomer =
571
617
new CustomerWithIdIntegerNoAutoGenerate (1 , TestData .FIRST_NAME , TestData .LAST_NAME );
@@ -588,7 +634,7 @@ void testAddTwoWithId(@Autowired final CustomerWithIdIntegerNoAutoGenerateReposi
588
634
}
589
635
590
636
@ Test
591
- void testIdsInMultipleTransactions (
637
+ void idsInMultipleTransactions (
592
638
@ Autowired final CustomerWithIdIntegerNoAutoGenerateRepository customerRepository ,
593
639
@ Autowired final PlatformTransactionManager transactionManager
594
640
)
@@ -626,7 +672,7 @@ void testIdsInMultipleTransactions(
626
672
}
627
673
628
674
@ Test
629
- void testIdsInSingleTransactions (
675
+ void idsInSingleTransactions (
630
676
@ Autowired final CustomerWithIdIntegerNoAutoGenerateRepository customerRepository ,
631
677
@ Autowired final PlatformTransactionManager transactionManager
632
678
)
0 commit comments