use of org.apache.gobblin.runtime.api.JobCatalogListenersContainer in project incubator-gobblin by apache.
the class TestJobLifecycleListenersList method testHappyPath.
@Test
public void testHappyPath() {
Logger log = LoggerFactory.getLogger("testHappyPath");
JobCatalogListenersContainer jobCatalog = mock(JobCatalogListenersContainer.class);
JobSpecSchedulerListenersContainer jobScheduler = mock(JobSpecSchedulerListenersContainer.class);
JobExecutionDriver mockDriver = mock(JobExecutionDriver.class);
JobExecutionState mockState = mock(JobExecutionState.class);
JobLifecycleListener listener1 = mock(JobLifecycleListener.class);
JobLifecycleListener listener2 = mock(JobLifecycleListener.class);
JobLifecycleListenersList disp = new JobLifecycleListenersList(jobCatalog, jobScheduler, log);
disp.registerJobLifecycleListener(listener1);
disp.onJobLaunch(mockDriver);
disp.registerWeakJobLifecycleListener(listener2);
disp.onMetadataChange(mockState, "key", "oldValue", "newValue");
verify(jobCatalog).addListener(eq(listener1));
verify(jobScheduler).registerJobSpecSchedulerListener(eq(listener1));
verify(listener1).onJobLaunch(eq(mockDriver));
verify(listener2, never()).onJobLaunch(eq(mockDriver));
verify(jobCatalog).registerWeakJobCatalogListener(eq(listener2));
verify(jobScheduler).registerWeakJobSpecSchedulerListener(eq(listener2));
verify(listener1).onMetadataChange(eq(mockState), eq("key"), eq("oldValue"), eq("newValue"));
verify(listener2).onMetadataChange(eq(mockState), eq("key"), eq("oldValue"), eq("newValue"));
}
Aggregations