use of org.apache.gobblin.runtime.listeners.CloseableJobListener in project incubator-gobblin by apache.
the class JobListenersTest method testParallelJobListener.
@Test
public void testParallelJobListener() throws Exception {
JobContext jobContext = mock(JobContext.class);
JobListener mockJobListener1 = mock(JobListener.class);
JobListener mockJobListener2 = mock(JobListener.class);
CloseableJobListener closeableJobListener = JobListeners.parallelJobListener(Lists.newArrayList(mockJobListener1, mockJobListener2));
closeableJobListener.onJobCompletion(jobContext);
closeableJobListener.onJobCancellation(jobContext);
closeableJobListener.close();
verify(mockJobListener1, times(1)).onJobCompletion(jobContext);
verify(mockJobListener1, times(1)).onJobCancellation(jobContext);
verify(mockJobListener2, times(1)).onJobCompletion(jobContext);
verify(mockJobListener2, times(1)).onJobCancellation(jobContext);
}
Aggregations