21
21
import org .apache .kafka .streams .KeyValue ;
22
22
import org .apache .kafka .streams .KeyValueTimestamp ;
23
23
import org .apache .kafka .streams .StreamsBuilder ;
24
+ import org .apache .kafka .streams .StreamsConfig ;
24
25
import org .apache .kafka .streams .TestInputTopic ;
25
26
import org .apache .kafka .streams .TestOutputTopic ;
26
27
import org .apache .kafka .streams .Topology ;
28
+ import org .apache .kafka .streams .TopologyConfig ;
27
29
import org .apache .kafka .streams .TopologyTestDriver ;
28
30
import org .apache .kafka .streams .TopologyTestDriverWrapper ;
29
31
import org .apache .kafka .streams .TopologyWrapper ;
35
37
import org .apache .kafka .streams .processor .api .MockProcessorContext ;
36
38
import org .apache .kafka .streams .processor .api .Processor ;
37
39
import org .apache .kafka .streams .processor .api .Record ;
40
+ import org .apache .kafka .streams .state .BuiltInDslStoreSuppliers ;
38
41
import org .apache .kafka .streams .state .Stores ;
39
42
import org .apache .kafka .streams .test .TestRecord ;
40
43
import org .apache .kafka .test .MockApiProcessor ;
@@ -70,9 +73,14 @@ public class KTableKTableLeftJoinTest {
70
73
private final Consumed <Integer , String > consumed = Consumed .with (Serdes .Integer (), Serdes .String ());
71
74
private final Properties props = StreamsTestUtils .getStreamsConfig (Serdes .Integer (), Serdes .String ());
72
75
76
+ private StreamsBuilder createStreamBuilderInMemory () {
77
+ props .put (StreamsConfig .DSL_STORE_SUPPLIERS_CLASS_CONFIG , BuiltInDslStoreSuppliers .InMemoryDslStoreSuppliers .class .getName ());
78
+ return new StreamsBuilder (new TopologyConfig (new StreamsConfig (props )));
79
+ }
80
+
73
81
@ Test
74
82
public void testJoin () {
75
- final StreamsBuilder builder = new StreamsBuilder ();
83
+ final StreamsBuilder builder = createStreamBuilderInMemory ();
76
84
77
85
final int [] expectedKeys = new int [] {0 , 1 , 2 , 3 };
78
86
@@ -193,7 +201,7 @@ public void testJoin() {
193
201
194
202
@ Test
195
203
public void testNotSendingOldValue () {
196
- final StreamsBuilder builder = new StreamsBuilder ();
204
+ final StreamsBuilder builder = createStreamBuilderInMemory ();
197
205
198
206
final int [] expectedKeys = new int [] {0 , 1 , 2 , 3 };
199
207
@@ -309,7 +317,7 @@ public void testNotSendingOldValue() {
309
317
310
318
@ Test
311
319
public void testSendingOldValue () {
312
- final StreamsBuilder builder = new StreamsBuilder ();
320
+ final StreamsBuilder builder = createStreamBuilderInMemory ();
313
321
314
322
final int [] expectedKeys = new int [] {0 , 1 , 2 , 3 };
315
323
@@ -443,7 +451,7 @@ public void shouldNotThrowIllegalStateExceptionWhenMultiCacheEvictions() {
443
451
final String tableSix = "tableSix" ;
444
452
final String [] inputs = {agg , tableOne , tableTwo , tableThree , tableFour , tableFive , tableSix };
445
453
446
- final StreamsBuilder builder = new StreamsBuilder ();
454
+ final StreamsBuilder builder = createStreamBuilderInMemory ();
447
455
final Consumed <Long , String > consumed = Consumed .with (Serdes .Long (), Serdes .String ());
448
456
final KTable <Long , String > aggTable = builder
449
457
.table (agg , consumed , Materialized .as (Stores .inMemoryKeyValueStore ("agg-base-store" )))
@@ -453,30 +461,12 @@ public void shouldNotThrowIllegalStateExceptionWhenMultiCacheEvictions() {
453
461
MockReducer .STRING_ADDER ,
454
462
Materialized .as (Stores .inMemoryKeyValueStore ("agg-store" )));
455
463
456
- final KTable <Long , String > one = builder .table (
457
- tableOne ,
458
- consumed ,
459
- Materialized .as (Stores .inMemoryKeyValueStore ("tableOne-base-store" )));
460
- final KTable <Long , String > two = builder .table (
461
- tableTwo ,
462
- consumed ,
463
- Materialized .as (Stores .inMemoryKeyValueStore ("tableTwo-base-store" )));
464
- final KTable <Long , String > three = builder .table (
465
- tableThree ,
466
- consumed ,
467
- Materialized .as (Stores .inMemoryKeyValueStore ("tableThree-base-store" )));
468
- final KTable <Long , String > four = builder .table (
469
- tableFour ,
470
- consumed ,
471
- Materialized .as (Stores .inMemoryKeyValueStore ("tableFour-base-store" )));
472
- final KTable <Long , String > five = builder .table (
473
- tableFive ,
474
- consumed ,
475
- Materialized .as (Stores .inMemoryKeyValueStore ("tableFive-base-store" )));
476
- final KTable <Long , String > six = builder .table (
477
- tableSix ,
478
- consumed ,
479
- Materialized .as (Stores .inMemoryKeyValueStore ("tableSix-base-store" )));
464
+ final KTable <Long , String > one = builder .table (tableOne , consumed );
465
+ final KTable <Long , String > two = builder .table (tableTwo , consumed );
466
+ final KTable <Long , String > three = builder .table (tableThree , consumed );
467
+ final KTable <Long , String > four = builder .table (tableFour , consumed );
468
+ final KTable <Long , String > five = builder .table (tableFive , consumed );
469
+ final KTable <Long , String > six = builder .table (tableSix , consumed );
480
470
481
471
final ValueMapper <String , String > mapper = value -> value .toUpperCase (Locale .ROOT );
482
472
@@ -515,7 +505,7 @@ public void shouldNotThrowIllegalStateExceptionWhenMultiCacheEvictions() {
515
505
516
506
@ Test
517
507
public void shouldLogAndMeterSkippedRecordsDueToNullLeftKey () {
518
- final StreamsBuilder builder = new StreamsBuilder ();
508
+ final StreamsBuilder builder = createStreamBuilderInMemory ();
519
509
520
510
@ SuppressWarnings ("unchecked" )
521
511
final Processor <String , Change <String >, String , Change <Object >> join = new KTableKTableLeftJoin <>(
0 commit comments