use of org.apache.gobblin.runtime.api.MutableJobCatalog in project incubator-gobblin by apache.
the class MockedKafkaJobMonitor method createMockCatalog.
private static MutableJobCatalog createMockCatalog(final Map<URI, JobSpec> jobSpecs) {
MutableJobCatalog jobCatalog = Mockito.mock(MutableJobCatalog.class);
Mockito.doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
JobSpec jobSpec = (JobSpec) invocation.getArguments()[0];
jobSpecs.put(jobSpec.getUri(), jobSpec);
return null;
}
}).when(jobCatalog).put(Mockito.any(JobSpec.class));
Mockito.doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
URI uri = (URI) invocation.getArguments()[0];
jobSpecs.remove(uri);
return null;
}
}).when(jobCatalog).remove(Mockito.any(URI.class));
return jobCatalog;
}
Aggregations