@Test
  public void testGetLogFileNamesIgnoreMultipleRequestsForSameHostComponent() throws Exception {
    final String expectedHostName = "c6401.ambari.apache.org";
    final String expectedComponentName = "DATANODE";
    final String expectedClusterName = "clusterone";

    EasyMockSupport mockSupport = new EasyMockSupport();

    LoggingRequestHelperFactory helperFactoryMock = mockSupport.createMock(LoggingRequestHelperFactory.class);

    Executor executorMock = mockSupport.createMock(Executor.class);

    Configuration configurationMock =
      mockSupport.createMock(Configuration.class);

    expect(configurationMock.getLogSearchMetadataCacheExpireTimeout()).andReturn(1).atLeastOnce();

    mockSupport.replayAll();

    LogSearchDataRetrievalService retrievalService = new LogSearchDataRetrievalService();
    retrievalService.setLoggingRequestHelperFactory(helperFactoryMock);
    retrievalService.setConfiguration(configurationMock);
    // call the initialization routine called by the Google framework
    retrievalService.doStart();
    // there should be no expectations set on this mock
    retrievalService.setExecutor(executorMock);

    // set the current requests to include this expected HostComponent
    // this simulates the case where a request is ongoing for this HostComponent,
    // but is not yet completed.
    retrievalService.getCurrentRequests().add(expectedComponentName + "+" + expectedHostName);

    Set<String> resultSet = retrievalService.getLogFileNames(expectedComponentName, expectedHostName, expectedClusterName);

    assertNull("Inital query on the retrieval service should be null, since cache is empty by default", resultSet);

    mockSupport.verifyAll();
  }
This test verifies the basic behavior of the
  LogSearchDataRetrievalServiceTest, and should
  verify the interaction with its dependencies, as
  well as the interaction with the LogSearch
  server.
ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogSearchDataRetrievalServiceTest.java