### Question:
ATSHistoryLoggingService extends HistoryLoggingService { public void handle(DAGHistoryEvent event) { eventQueue.add(event); } ATSHistoryLoggingService(); @Override void serviceInit(Configuration conf); @Override void serviceStart(); @Override void serviceStop(); void handle(DAGHistoryEvent event);  }### Answer:
@Test(timeout=20000) public void testATSHistoryLoggingServiceShutdown() { TezDAGID tezDAGID = TezDAGID.getInstance( ApplicationId.newInstance(100l, 1), 1); DAGHistoryEvent historyEvent = new DAGHistoryEvent(tezDAGID, new DAGStartedEvent(tezDAGID, 1001l, "user1", "dagName1")); for (int i = 0; i < 20; ++i) { atsHistoryLoggingService.handle(historyEvent); } try { Thread.sleep(2500l); } catch (InterruptedException e) { } atsHistoryLoggingService.stop(); Assert.assertTrue(atsInvokeCounter >= 4); Assert.assertTrue(atsInvokeCounter < 10); }