@@ -113,7 +113,7 @@ class ResultCollectingListenerSpec
113
113
}
114
114
115
115
test(" union of two sources with additional variable in only one of the branches - without sinks" ) {
116
- val scenario = removeSinks(
116
+ val scenario =
117
117
ScenarioBuilder
118
118
.streaming(" sample-union" )
119
119
.sources(
@@ -134,14 +134,13 @@ class ResultCollectingListenerSpec
134
134
" bar" -> List (" Output expression" -> " 'bar source'" .spel)
135
135
)
136
136
)
137
- .emptySink( " end " , " dead-end " ) // sink must be created by the DSL, but is then removed
137
+ .endWithoutSink
138
138
)
139
- )
140
139
141
140
withCollectingTestResults(
142
141
scenario,
143
142
testResults => {
144
- assertNumberOfSamplesThatFinishedInNode(testResults, " artificialDeadEndSink-after- union" , 8 )
143
+ assertNumberOfSamplesThatFinishedInNode(testResults, " union" , 8 )
145
144
transitionVariables(testResults, " start-foo" , Some (" union" )) shouldBe Set (
146
145
Map (" input" -> 10 ),
147
146
Map (" input" -> 20 ),
@@ -160,17 +159,7 @@ class ResultCollectingListenerSpec
160
159
Map (" input" -> 300 , " customVariableInBarBranch" -> 150 ),
161
160
Map (" input" -> 400 , " customVariableInBarBranch" -> 200 ),
162
161
)
163
- transitionVariables(testResults, " union" , Some (" artificialDeadEndSink-after-union" )) shouldBe Set (
164
- Map (" input" -> 10 , " dataIsFrom" -> " foo source" ),
165
- Map (" input" -> 20 , " dataIsFrom" -> " foo source" ),
166
- Map (" input" -> 30 , " dataIsFrom" -> " foo source" ),
167
- Map (" input" -> 40 , " dataIsFrom" -> " foo source" ),
168
- Map (" input" -> 100 , " customVariableInBarBranch" -> 50 , " dataIsFrom" -> " bar source" ),
169
- Map (" input" -> 200 , " customVariableInBarBranch" -> 100 , " dataIsFrom" -> " bar source" ),
170
- Map (" input" -> 300 , " customVariableInBarBranch" -> 150 , " dataIsFrom" -> " bar source" ),
171
- Map (" input" -> 400 , " customVariableInBarBranch" -> 200 , " dataIsFrom" -> " bar source" ),
172
- )
173
- transitionVariables(testResults, " artificialDeadEndSink-after-union" , None ) shouldBe Set (
162
+ transitionVariables(testResults, " union" , None ) shouldBe Set (
174
163
Map (" input" -> 10 , " dataIsFrom" -> " foo source" ),
175
164
Map (" input" -> 20 , " dataIsFrom" -> " foo source" ),
176
165
Map (" input" -> 30 , " dataIsFrom" -> " foo source" ),
@@ -292,20 +281,19 @@ class ResultCollectingListenerSpec
292
281
}
293
282
294
283
test(" there is a split - fail to compile without sinks" ) {
295
- val scenario = removeSinks(
284
+ val scenario =
296
285
ScenarioBuilder
297
286
.streaming(" sample-split" )
298
287
.source(" start-foo" , " start1" )
299
288
.split(
300
289
" split" ,
301
290
GraphBuilder
302
291
.buildSimpleVariable(" bv1" , " timesTwo" , " #input*2" .spel)
303
- .emptySink( " end1 " , " dead-end " ) ,
292
+ .endWithoutSink ,
304
293
GraphBuilder
305
294
.buildSimpleVariable(" bv2" , " timesFour" , " #input*4" .spel)
306
- .emptySink( " end2 " , " dead-end " )
295
+ .endWithoutSink
307
296
)
308
- )
309
297
310
298
catchExceptionMessage(
311
299
withCollectingTestResults(scenario, _ => ())
@@ -314,26 +302,25 @@ class ResultCollectingListenerSpec
314
302
}
315
303
316
304
test(" there is a split - without sinks" ) {
317
- val scenario = removeSinks(
305
+ val scenario =
318
306
ScenarioBuilder
319
307
.streaming(" sample-split" )
320
308
.source(" start-foo" , " start1" )
321
309
.split(
322
310
" split" ,
323
311
GraphBuilder
324
312
.buildSimpleVariable(" bv1" , " timesTwo" , " #input*2" .spel)
325
- .emptySink( " end1 " , " dead-end " ) ,
313
+ .endWithoutSink ,
326
314
GraphBuilder
327
315
.buildSimpleVariable(" bv2" , " timesFour" , " #input*4" .spel)
328
- .emptySink( " end2 " , " dead-end " )
316
+ .endWithoutSink
329
317
)
330
- )
331
318
332
319
withCollectingTestResults(
333
320
scenario,
334
321
testResults => {
335
- assertNumberOfSamplesThatFinishedInNode(testResults, " artificialDeadEndSink-after- bv1" , 4 )
336
- assertNumberOfSamplesThatFinishedInNode(testResults, " artificialDeadEndSink-after- bv2" , 4 )
322
+ assertNumberOfSamplesThatFinishedInNode(testResults, " bv1" , 4 )
323
+ assertNumberOfSamplesThatFinishedInNode(testResults, " bv2" , 4 )
337
324
transitionVariables(testResults, " start-foo" , Some (" split" )) shouldBe Set (
338
325
Map (" input" -> 10 ),
339
326
Map (" input" -> 20 ),
@@ -352,25 +339,13 @@ class ResultCollectingListenerSpec
352
339
Map (" input" -> 30 ),
353
340
Map (" input" -> 40 ),
354
341
)
355
- transitionVariables(testResults, " bv1" , Some ( " artificialDeadEndSink-after-bv1 " ) ) shouldBe Set (
342
+ transitionVariables(testResults, " bv1" , None ) shouldBe Set (
356
343
Map (" input" -> 10 , " timesTwo" -> 20 ),
357
344
Map (" input" -> 20 , " timesTwo" -> 40 ),
358
345
Map (" input" -> 30 , " timesTwo" -> 60 ),
359
346
Map (" input" -> 40 , " timesTwo" -> 80 ),
360
347
)
361
- transitionVariables(testResults, " bv2" , Some (" artificialDeadEndSink-after-bv2" )) shouldBe Set (
362
- Map (" input" -> 10 , " timesFour" -> 40 ),
363
- Map (" input" -> 20 , " timesFour" -> 80 ),
364
- Map (" input" -> 30 , " timesFour" -> 120 ),
365
- Map (" input" -> 40 , " timesFour" -> 160 ),
366
- )
367
- transitionVariables(testResults, " artificialDeadEndSink-after-bv1" , None ) shouldBe Set (
368
- Map (" input" -> 10 , " timesTwo" -> 20 ),
369
- Map (" input" -> 20 , " timesTwo" -> 40 ),
370
- Map (" input" -> 30 , " timesTwo" -> 60 ),
371
- Map (" input" -> 40 , " timesTwo" -> 80 ),
372
- )
373
- transitionVariables(testResults, " artificialDeadEndSink-after-bv2" , None ) shouldBe Set (
348
+ transitionVariables(testResults, " bv2" , None ) shouldBe Set (
374
349
Map (" input" -> 10 , " timesFour" -> 40 ),
375
350
Map (" input" -> 20 , " timesFour" -> 80 ),
376
351
Map (" input" -> 30 , " timesFour" -> 120 ),
@@ -447,7 +422,7 @@ class ResultCollectingListenerSpec
447
422
}
448
423
449
424
test(" there is a fragment - without sinks" ) {
450
- val scenarioWithFragment = removeSinks(
425
+ val scenarioWithFragment =
451
426
ScenarioBuilder
452
427
.streaming(" sample-scenario-with-fragment" )
453
428
.source(" source" , " start1" )
@@ -456,9 +431,8 @@ class ResultCollectingListenerSpec
456
431
" fragment1" ,
457
432
List (" fragment1_input" -> " #input" .spel),
458
433
Map (" output" -> " fragmentResult" ),
459
- Map (" output" -> GraphBuilder .emptySink( " end " , " dead-end " ) )
434
+ Map (" output" -> None )
460
435
)
461
- )
462
436
463
437
val fragment = ScenarioBuilder
464
438
.fragment(" fragment1" , " fragment1_input" -> classOf [Int ])
@@ -470,7 +444,7 @@ class ResultCollectingListenerSpec
470
444
withCollectingTestResults(
471
445
scenario,
472
446
testResults => {
473
- assertNumberOfSamplesThatFinishedInNode(testResults, " artificialDeadEndSink-after- sub-fragmentEnd" , 3 )
447
+ assertNumberOfSamplesThatFinishedInNode(testResults, " sub-fragmentEnd" , 3 )
474
448
assertNumberOfSamplesThatFinishedInNode(testResults, " sub-filter" , 1 )
475
449
transitionVariables(testResults, " source" , Some (" sub" )) shouldBe Set (
476
450
Map (" input" -> 10 ),
@@ -502,17 +476,12 @@ class ResultCollectingListenerSpec
502
476
transitionVariables(
503
477
testResults,
504
478
" sub-fragmentEnd" ,
505
- Some ( " artificialDeadEndSink-after-sub-fragmentEnd " )
479
+ None
506
480
) shouldBe Set (
507
481
Map (" input" -> 20 , " fragmentResult" -> Map (" output" -> 20 )),
508
482
Map (" input" -> 30 , " fragmentResult" -> Map (" output" -> 30 )),
509
483
Map (" input" -> 40 , " fragmentResult" -> Map (" output" -> 40 )),
510
484
)
511
- transitionVariables(testResults, " artificialDeadEndSink-after-sub-fragmentEnd" , None ) shouldBe Set (
512
- Map (" input" -> 20 , " fragmentResult" -> Map (" output" -> 20 )),
513
- Map (" input" -> 30 , " fragmentResult" -> Map (" output" -> 30 )),
514
- Map (" input" -> 40 , " fragmentResult" -> Map (" output" -> 40 )),
515
- )
516
485
},
517
486
allowEndingScenarioWithoutSink = true ,
518
487
)
0 commit comments