@Test public void testGetInputSummaryPoolAndFailure() throws ExecutionException, InterruptedException, IOException { ExecutorService pool = mock(ExecutorService.class); when(pool.submit(any(Runnable.class))).thenReturn(mock(Future.class)); Set<Path> pathNeedProcess = new HashSet<>(); pathNeedProcess.add(new Path("dummy-path1")); pathNeedProcess.add(new Path("dummy-path2")); pathNeedProcess.add(new Path("dummy-path3")); SessionState.start(new HiveConf()); JobConf jobConf = new JobConf(); Context context = new Context(jobConf); Utilities.getInputSummaryWithPool(context, pathNeedProcess, mock(MapWork.class), new long[3], pool); verify(pool, times(3)).submit(any(Runnable.class)); verify(pool).shutdown(); verify(pool).shutdownNow(); }
@Test public void testGetInputSummaryPool() throws ExecutionException, InterruptedException, IOException { ExecutorService pool = mock(ExecutorService.class); when(pool.submit(any(Runnable.class))).thenReturn(mock(Future.class)); Set<Path> pathNeedProcess = new HashSet<>(); pathNeedProcess.add(new Path("dummy-path1")); pathNeedProcess.add(new Path("dummy-path2")); pathNeedProcess.add(new Path("dummy-path3")); SessionState.start(new HiveConf()); JobConf jobConf = new JobConf(); Context context = new Context(jobConf); Utilities.getInputSummaryWithPool(context, pathNeedProcess, mock(MapWork.class), new long[3], pool); verify(pool, times(3)).submit(any(Runnable.class)); verify(pool).shutdown(); verify(pool).shutdownNow(); }
executor = null; ContentSummary cs = getInputSummaryWithPool(ctx, pathNeedProcess, work, summary, executor); perfLogger.PerfLogEnd(CLASS_NAME, PerfLogger.INPUT_SUMMARY); return cs;