Search in sources :

Example 1 with CloseableJobListener

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);
}
Also used : CloseableJobListener(org.apache.gobblin.runtime.listeners.CloseableJobListener) JobListener(org.apache.gobblin.runtime.listeners.JobListener) CloseableJobListener(org.apache.gobblin.runtime.listeners.CloseableJobListener) Test(org.testng.annotations.Test)

Aggregations

CloseableJobListener (org.apache.gobblin.runtime.listeners.CloseableJobListener)1 JobListener (org.apache.gobblin.runtime.listeners.JobListener)1 Test (org.testng.annotations.Test)1