use of org.apache.samza.coordinator.StreamPartitionCountMonitor in project samza by apache.
the class TestStaticResourceJobCoordinator method testPartitionCountChange.
@Test
public void testPartitionCountChange() throws IOException {
Config jobModelConfig = mock(Config.class);
JobModel jobModel = setupJobModel(jobModelConfig);
StreamPartitionCountMonitor streamPartitionCountMonitor = mock(StreamPartitionCountMonitor.class);
ArgumentCaptor<StreamPartitionCountMonitor.Callback> callbackArgumentCaptor = ArgumentCaptor.forClass(StreamPartitionCountMonitor.Callback.class);
when(this.streamPartitionCountMonitorFactory.build(eq(jobModelConfig), callbackArgumentCaptor.capture())).thenReturn(streamPartitionCountMonitor);
StreamRegexMonitor streamRegexMonitor = setupStreamRegexMonitor(jobModel, jobModelConfig);
JobCoordinatorMetadata newMetadata = setupJobCoordinatorMetadata(jobModel, jobModelConfig, ImmutableSet.of(JobMetadataChange.NEW_DEPLOYMENT, JobMetadataChange.JOB_MODEL), true);
setUpDiagnosticsManager(jobModel);
MetadataResourceUtil metadataResourceUtil = metadataResourceUtil(jobModel);
this.staticResourceJobCoordinator.start();
verifyStartLifecycle();
verify(this.staticResourceJobCoordinator).doSetLoggingContextConfig(jobModelConfig);
verify(this.diagnosticsManager).start();
verifyPrepareWorkerExecutionAndMonitor(jobModel, metadataResourceUtil, streamPartitionCountMonitor, streamRegexMonitor, newMetadata, SINGLE_SSP_FANOUT);
// call the callback from the monitor
callbackArgumentCaptor.getValue().onSystemStreamPartitionChange(ImmutableSet.of(SYSTEM_STREAM));
verify(this.jobRestartSignal).restartJob();
}
Aggregations