@Test
public void testCreateLogFileTailURI() throws Exception {

  LoggingCookieStore.INSTANCE.getCookiesMap().clear();
  final String expectedHostName = "c6401.ambari.apache.org";
  final String expectedPort = "61888";
  final String expectedComponentName = "hdfs_namenode";
  final String expectedBaseURI =
    "http://" + expectedHostName + ":" + expectedPort + "/api/v1/clusters/clusterone/logging/searchEngine";
  final String expectedTailFileURI = expectedBaseURI + "?component_name=" + expectedComponentName
    + "&host_name=" + expectedHostName + "&pageSize=50";
  EasyMockSupport mockSupport =
    new EasyMockSupport();
  CredentialStoreService credentialStoreServiceMock =
    mockSupport.createMock(CredentialStoreService.class);
  Cluster clusterMock =
    mockSupport.createMock(Cluster.class);
  LoggingRequestHelperImpl.NetworkConnection networkConnectionMock =
    mockSupport.createMock(LoggingRequestHelperImpl.NetworkConnection.class);
  mockSupport.replayAll();
  LoggingRequestHelper helper =
    new LoggingRequestHelperImpl("c6401.ambari.apache.org", "61888", "http", credentialStoreServiceMock, clusterMock, networkConnectionMock);
  String result = helper.createLogFileTailURI(expectedBaseURI, expectedComponentName, expectedHostName);
  // verify that the URI contains the expected LogSearch query parameters,
  // including the correct default page size
  assertEquals("LogFile Tail URI was not generated as expected",
    expectedTailFileURI,
    result);
  mockSupport.verifyAll();
}