@@ -129,7 +129,7 @@ void yieldsDeleteActionsBeforeInsertActions() {
129
129
130
130
assertThat (extractActions (change )).extracting (DbAction ::getClass , DbAction ::getEntityType ).containsSubsequence ( //
131
131
Tuple .tuple (DbAction .Delete .class , Intermediate .class ), //
132
- Tuple .tuple (DbAction .InsertBatch .class , Intermediate .class ));
132
+ Tuple .tuple (DbAction .BatchInsert .class , Intermediate .class ));
133
133
}
134
134
135
135
@ Test
@@ -157,14 +157,14 @@ void yieldsInsertActionsAsBatchInserts_groupedByIdValueSource() {
157
157
.extracting (DbAction ::getClass , DbAction ::getEntityType , DbActionTestSupport ::insertIdValueSource ) //
158
158
.containsSubsequence ( //
159
159
Tuple .tuple (DbAction .InsertRoot .class , Root .class , IdValueSource .GENERATED ), //
160
- Tuple .tuple (DbAction .InsertBatch .class , Intermediate .class , IdValueSource .PROVIDED )) //
160
+ Tuple .tuple (DbAction .BatchInsert .class , Intermediate .class , IdValueSource .PROVIDED )) //
161
161
.containsSubsequence ( //
162
162
Tuple .tuple (DbAction .InsertRoot .class , Root .class , IdValueSource .GENERATED ), //
163
- Tuple .tuple (DbAction .InsertBatch .class , Intermediate .class , IdValueSource .GENERATED )) //
163
+ Tuple .tuple (DbAction .BatchInsert .class , Intermediate .class , IdValueSource .GENERATED )) //
164
164
.doesNotContain (Tuple .tuple (DbAction .Insert .class , Intermediate .class ));
165
- assertThat (getInsertBatchAction (actions , Intermediate .class , IdValueSource .GENERATED ).getActions ())
165
+ assertThat (getBatchInsertAction (actions , Intermediate .class , IdValueSource .GENERATED ).getActions ())
166
166
.containsExactly (intermediateInsertGeneratedId );
167
- assertThat (getInsertBatchAction (actions , Intermediate .class , IdValueSource .PROVIDED ).getActions ())
167
+ assertThat (getBatchInsertAction (actions , Intermediate .class , IdValueSource .PROVIDED ).getActions ())
168
168
.containsExactly (intermediateInsertProvidedId );
169
169
}
170
170
@@ -205,11 +205,11 @@ void yieldsNestedInsertActionsInTreeOrderFromRootToLeaves() {
205
205
assertThat (actions )
206
206
.extracting (DbAction ::getClass , DbAction ::getEntityType , DbActionTestSupport ::insertIdValueSource )
207
207
.containsSubsequence ( //
208
- Tuple .tuple (DbAction .InsertBatch .class , Intermediate .class , IdValueSource .GENERATED ),
209
- Tuple .tuple (DbAction .InsertBatch .class , Leaf .class , IdValueSource .GENERATED ));
210
- assertThat (getInsertBatchAction (actions , Intermediate .class ).getActions ()) //
208
+ Tuple .tuple (DbAction .BatchInsert .class , Intermediate .class , IdValueSource .GENERATED ),
209
+ Tuple .tuple (DbAction .BatchInsert .class , Leaf .class , IdValueSource .GENERATED ));
210
+ assertThat (getBatchInsertAction (actions , Intermediate .class ).getActions ()) //
211
211
.containsExactly (root1IntermediateInsert , root2IntermediateInsert );
212
- assertThat (getInsertBatchAction (actions , Leaf .class ).getActions ()) //
212
+ assertThat (getBatchInsertAction (actions , Leaf .class ).getActions ()) //
213
213
.containsExactly (root1LeafInsert );
214
214
}
215
215
@@ -237,33 +237,33 @@ void yieldsInsertsWithSameLengthReferences_asSeparateInserts() {
237
237
assertThat (actions )
238
238
.extracting (DbAction ::getClass , DbAction ::getEntityType , DbActionTestSupport ::insertIdValueSource )
239
239
.containsSubsequence ( //
240
- Tuple .tuple (DbAction .InsertBatch .class , Intermediate .class , IdValueSource .GENERATED ),
241
- Tuple .tuple (DbAction .InsertBatch .class , Intermediate .class , IdValueSource .GENERATED ));
242
- List <DbAction .InsertBatch <Intermediate >> insertBatchActions = getInsertBatchActions (actions , Intermediate .class );
243
- assertThat (insertBatchActions ).hasSize (2 );
244
- assertThat (insertBatchActions .get (0 ).getActions ()).containsExactly (oneInsert );
245
- assertThat (insertBatchActions .get (1 ).getActions ()).containsExactly (twoInsert );
240
+ Tuple .tuple (DbAction .BatchInsert .class , Intermediate .class , IdValueSource .GENERATED ),
241
+ Tuple .tuple (DbAction .BatchInsert .class , Intermediate .class , IdValueSource .GENERATED ));
242
+ List <DbAction .BatchInsert <Intermediate >> batchInsertActions = getBatchInsertActions (actions , Intermediate .class );
243
+ assertThat (batchInsertActions ).hasSize (2 );
244
+ assertThat (batchInsertActions .get (0 ).getActions ()).containsExactly (oneInsert );
245
+ assertThat (batchInsertActions .get (1 ).getActions ()).containsExactly (twoInsert );
246
246
}
247
247
248
- private <T > DbAction .InsertBatch <T > getInsertBatchAction (List <DbAction <?>> actions , Class <T > entityType ,
249
- IdValueSource idValueSource ) {
250
- return getInsertBatchActions (actions , entityType ).stream ()
251
- .filter (insertBatch -> insertBatch .getBatchValue () == idValueSource ).findFirst ().orElseThrow (
252
- () -> new RuntimeException (String .format ("No InsertBatch with includeId '%s' found!" , idValueSource )));
248
+ private <T > DbAction .BatchInsert <T > getBatchInsertAction (List <DbAction <?>> actions , Class <T > entityType ,
249
+ IdValueSource idValueSource ) {
250
+ return getBatchInsertActions (actions , entityType ).stream ()
251
+ .filter (batchInsert -> batchInsert .getBatchValue () == idValueSource ).findFirst ().orElseThrow (
252
+ () -> new RuntimeException (String .format ("No BatchInsert with batch value '%s' found!" , idValueSource )));
253
253
}
254
254
255
- private <T > DbAction .InsertBatch <T > getInsertBatchAction (List <DbAction <?>> actions , Class <T > entityType ) {
256
- return getInsertBatchActions (actions , entityType ).stream ().findFirst ()
257
- .orElseThrow (() -> new RuntimeException ("No InsertBatch action found!" ));
255
+ private <T > DbAction .BatchInsert <T > getBatchInsertAction (List <DbAction <?>> actions , Class <T > entityType ) {
256
+ return getBatchInsertActions (actions , entityType ).stream ().findFirst ()
257
+ .orElseThrow (() -> new RuntimeException ("No BatchInsert action found!" ));
258
258
}
259
259
260
260
@ SuppressWarnings ("unchecked" )
261
- private <T > List <DbAction .InsertBatch <T >> getInsertBatchActions (List <DbAction <?>> actions , Class <T > entityType ) {
261
+ private <T > List <DbAction .BatchInsert <T >> getBatchInsertActions (List <DbAction <?>> actions , Class <T > entityType ) {
262
262
263
263
return actions .stream () //
264
- .filter (dbAction -> dbAction instanceof DbAction .InsertBatch ) //
264
+ .filter (dbAction -> dbAction instanceof DbAction .BatchInsert ) //
265
265
.filter (dbAction -> dbAction .getEntityType ().equals (entityType )) //
266
- .map (dbAction -> (DbAction .InsertBatch <T >) dbAction ).collect (Collectors .toList ());
266
+ .map (dbAction -> (DbAction .BatchInsert <T >) dbAction ).collect (Collectors .toList ());
267
267
}
268
268
269
269
private <T > List <DbAction <?>> extractActions (MergedAggregateChange <T , AggregateChangeWithRoot <T >> change ) {
0 commit comments