Source:
public void testAgreeingOnSameRunIdForBatch() throws InterruptedException { publishKafkaEvents(inputKafkaTopic, 0, NUM_KAFKA_EVENTS, PROCESSOR_IDS[0]); Map<String, String> configMap = buildStreamApplicationConfigMap(ImmutableList.of(inputKafkaTopic), testStreamAppName, testStreamAppId, true); configMap.put(JobConfig.PROCESSOR_ID(), PROCESSOR_IDS[0]); applicationConfig1 = new ApplicationConfig(new MapConfig(configMap)); configMap.put(JobConfig.PROCESSOR_ID(), PROCESSOR_IDS[1]); applicationConfig2 = new ApplicationConfig(new MapConfig(configMap)); CountDownLatch processedMessagesLatch1 = new CountDownLatch(1); CountDownLatch processedMessagesLatch2 = new CountDownLatch(1); ApplicationRunner appRunner1 = ApplicationRunners.getApplicationRunner(TestStreamApplication.getInstance( TEST_SYSTEM, ImmutableList.of(inputKafkaTopic), outputKafkaTopic, processedMessagesLatch1, null, null, applicationConfig1), applicationConfig1); ApplicationRunner appRunner2 = ApplicationRunners.getApplicationRunner(TestStreamApplication.getInstance( TEST_SYSTEM, ImmutableList.of(inputKafkaTopic), outputKafkaTopic, processedMessagesLatch2, null, null, applicationConfig2), applicationConfig2); executeRun(appRunner1, applicationConfig1); executeRun(appRunner2, applicationConfig2); processedMessagesLatch1.await(); processedMessagesLatch2.await(); LocalApplicationRunner localApplicationRunner1 = (LocalApplicationRunner) appRunner1; LocalApplicationRunner localApplicationRunner2 = (LocalApplicationRunner) appRunner2; assertEquals("RunId of the two processors does not match", localApplicationRunner2.getRunId().orElse(null), localApplicationRunner1.getRunId().orElse(null)); appRunner1.kill(); appRunner1.waitForFinish(); appRunner2.kill(); appRunner2.waitForFinish(); }

Target:
public void testAgreeingOnSameRunIdForBatch() throws InterruptedException { publishKafkaEvents(inputKafkaTopic, 0, NUM_KAFKA_EVENTS, PROCESSOR_IDS[0]); Map<String, String> configMap = buildStreamApplicationConfigMap(ImmutableList.of(inputKafkaTopic), testStreamAppName, testStreamAppId, true); configMap.put(JobConfig.PROCESSOR_ID(), PROCESSOR_IDS[0]); applicationConfig1 = new ApplicationConfig(new MapConfig(configMap)); configMap.put(JobConfig.PROCESSOR_ID(), PROCESSOR_IDS[1]); applicationConfig2 = new ApplicationConfig(new MapConfig(configMap)); CountDownLatch processedMessagesLatch1 = new CountDownLatch(1); CountDownLatch processedMessagesLatch2 = new CountDownLatch(1); ApplicationRunner appRunner1 = ApplicationRunners.getApplicationRunner(TestStreamApplication.getInstance( TEST_SYSTEM, ImmutableList.of(inputKafkaTopic), outputKafkaTopic, processedMessagesLatch1, null, null, applicationConfig1), applicationConfig1); ApplicationRunner appRunner2 = ApplicationRunners.getApplicationRunner(TestStreamApplication.getInstance( TEST_SYSTEM, ImmutableList.of(inputKafkaTopic), outputKafkaTopic, processedMessagesLatch2, null, null, applicationConfig2), applicationConfig2); executeRun(appRunner1, applicationConfig1); executeRun(appRunner2, applicationConfig2); processedMessagesLatch1.await(); processedMessagesLatch2.await(); LocalApplicationRunner localApplicationRunner1 = (LocalApplicationRunner) appRunner1; LocalApplicationRunner localApplicationRunner2 = (LocalApplicationRunner) appRunner2; assertEquals("RunId of the two processors does not match", localApplicationRunner2.getRunId(), localApplicationRunner1.getRunId()); appRunner1.kill(); appRunner1.waitForFinish(); appRunner2.kill(); appRunner2.waitForFinish(); }