ExternalLinkUtils { public static String getExternalAnalyzerOnReq(final Props azkProps, final HttpServletRequest req) { if (!azkProps.containsKey(Constants.ConfigurationKeys.AZKABAN_SERVER_EXTERNAL_ANALYZER_TOPIC)) { return ""; } final String topic = azkProps .getString(Constants.ConfigurationKeys.AZKABAN_SERVER_EXTERNAL_ANALYZER_TOPIC); return getLinkFromRequest(topic, azkProps, req); }  static String getExternalAnalyzerOnReq(final Props azkProps,
      final HttpServletRequest req); static String getExternalLogViewer(final Props azkProps, final String jobId,
      final Props jobProps);  }
@Test public void testGetExternalAnalyzerValidFormat() { this.azkProps.put(Constants.ConfigurationKeys.AZKABAN_SERVER_EXTERNAL_ANALYZER_TOPIC, EXTERNAL_ANALYZER_TOPIC); this.azkProps.put( Constants.ConfigurationKeys.AZKABAN_SERVER_EXTERNAL_TOPIC_URL .replace("${topic}", EXTERNAL_ANALYZER_TOPIC), EXTERNAL_ANALYZER_URL_VALID_FORMAT); when(this.mockRequest.getRequestURL()).thenReturn(new StringBuffer(EXEC_URL)); when(this.mockRequest.getQueryString()).thenReturn(EXEC_QUERY_STRING); final String externalURL = ExternalLinkUtils.getExternalAnalyzerOnReq(this.azkProps, this.mockRequest); assertTrue(externalURL.equals(EXTERNAL_ANALYZER_EXPECTED_URL)); }
@Test public void testGetExternalAnalyzerNotConfigured() { final String executionExternalLinkURL = ExternalLinkUtils.getExternalAnalyzerOnReq(this.azkProps, this.mockRequest); assertTrue(executionExternalLinkURL.equals("")); }