@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, null, 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();
  }
Verifies that if the LogSearch admin configuration for user/password credentials
is not available, the integration layer will attempt to locate the LogSearch credential
in the CredentialStoreService as a fallback mechanism.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImplTest.java