Source:
<code>public void testShouldGenerateJobModelOnPartitionCountChange() throws Exception { publishKafkaEvents(inputKafkaTopic, 0, NUM_KAFKA_EVENTS, PROCESSOR_IDS[0]); CountDownLatch kafkaEventsConsumedLatch1 = new CountDownLatch(NUM_KAFKA_EVENTS); CountDownLatch processedMessagesLatch1 = new CountDownLatch(1); ApplicationRunner appRunner1 = ApplicationRunners.getApplicationRunner(TestStreamApplication.getInstance( TEST_SYSTEM, inputKafkaTopic, outputKafkaTopic, processedMessagesLatch1, null, kafkaEventsConsumedLatch1, applicationConfig1), applicationConfig1); appRunner1.run(); processedMessagesLatch1.await(); kafkaEventsConsumedLatch1.await(); String jobModelVersion = zkUtils.getJobModelVersion(); JobModel jobModel = zkUtils.getJobModel(jobModelVersion); Set<SystemStreamPartition> ssps = getSystemStreamPartitions(jobModel); Assert.assertEquals(5, ssps.size()); AdminUtils.addPartitions(zkUtils(), inputKafkaTopic, 100, "", true, RackAwareMode.Enforced$.MODULE$); publishKafkaEvents(inputKafkaTopic, 0, NUM_KAFKA_EVENTS, PROCESSOR_IDS[0]); CountDownLatch kafkaEventsConsumedLatch2 = new CountDownLatch(NUM_KAFKA_EVENTS); CountDownLatch processedMessagesLatch2 = new CountDownLatch(1); <START> ApplicationRunner appRunner2 = ApplicationRunners.getApplicationRunner(TestStreamApplication.getInstance( <END> TEST_SYSTEM, inputKafkaTopic, outputKafkaTopic, processedMessagesLatch2, null, kafkaEventsConsumedLatch2, applicationConfig2), applicationConfig2); appRunner2.run(); processedMessagesLatch2.await(); String newJobModelVersion = zkUtils.getJobModelVersion(); JobModel newJobModel = zkUtils.getJobModel(newJobModelVersion); ssps = getSystemStreamPartitions(newJobModel); Assert.assertEquals(100, ssps.size()); appRunner1.kill(); appRunner1.waitForFinish(); appRunner2.kill(); appRunner2.waitForFinish(); assertEquals(ApplicationStatus.SuccessfulFinish, appRunner1.status()); assertEquals(ApplicationStatus.SuccessfulFinish, appRunner2.status()); }</code><technical_language>do need start another processor? monitor trigger job model regeneration, it</technical_language>

Target:
public void testShouldGenerateJobModelOnPartitionCountChange() throws Exception { publishKafkaEvents(inputKafkaTopic, 0, NUM_KAFKA_EVENTS, PROCESSOR_IDS[0]); CountDownLatch kafkaEventsConsumedLatch1 = new CountDownLatch(NUM_KAFKA_EVENTS); CountDownLatch processedMessagesLatch1 = new CountDownLatch(1); ApplicationRunner appRunner1 = ApplicationRunners.getApplicationRunner(TestStreamApplication.getInstance( TEST_SYSTEM, inputKafkaTopic, outputKafkaTopic, processedMessagesLatch1, null, kafkaEventsConsumedLatch1, applicationConfig1), applicationConfig1); appRunner1.run(); processedMessagesLatch1.await(); String jobModelVersion = zkUtils.getJobModelVersion(); JobModel jobModel = zkUtils.getJobModel(jobModelVersion); Set<SystemStreamPartition> ssps = getSystemStreamPartitions(jobModel); Assert.assertEquals(5, ssps.size()); AdminUtils.addPartitions(zkUtils(), inputKafkaTopic, 100, "", true, RackAwareMode.Enforced$.MODULE$); long jobModelWaitTimeInMillis = 10; while (Objects.equals(zkUtils.getJobModelVersion(), jobModelVersion)) { LOGGER.info("Waiting for new jobModel to be published"); Thread.sleep(jobModelWaitTimeInMillis); jobModelWaitTimeInMillis = jobModelWaitTimeInMillis * 2; } String newJobModelVersion = zkUtils.getJobModelVersion(); JobModel newJobModel = zkUtils.getJobModel(newJobModelVersion); ssps = getSystemStreamPartitions(newJobModel); Assert.assertEquals(100, ssps.size()); appRunner1.kill(); appRunner1.waitForFinish(); assertEquals(ApplicationStatus.SuccessfulFinish, appRunner1.status()); }