use of org.apache.tez.runtime.library.common.shuffle.ShuffleUtils.FetchStatsLogger in project tez by apache.
the class TestShuffleUtils method testFetchStatsLogger.
@Test
public void testFetchStatsLogger() throws Exception {
Logger activeLogger = mock(Logger.class);
Logger aggregateLogger = mock(Logger.class);
FetchStatsLogger logger = new FetchStatsLogger(activeLogger, aggregateLogger);
InputAttemptIdentifier ident = new InputAttemptIdentifier(1, 1);
when(activeLogger.isInfoEnabled()).thenReturn(false);
for (int i = 0; i < 1000; i++) {
logger.logIndividualFetchComplete(10, 100, 1000, "testType", ident);
}
verify(activeLogger, times(0)).info(anyString());
verify(aggregateLogger, times(1)).info(anyString(), Matchers.<Object[]>anyVararg());
when(activeLogger.isInfoEnabled()).thenReturn(true);
for (int i = 0; i < 1000; i++) {
logger.logIndividualFetchComplete(10, 100, 1000, "testType", ident);
}
verify(activeLogger, times(1000)).info(anyString());
verify(aggregateLogger, times(1)).info(anyString(), Matchers.<Object[]>anyVararg());
}
Aggregations