コード例 #1
0
 /**
  * Make sure that URLs for analyzers and logviewers are fetched correctly by setting it manually
  * and then fetching them
  */
 @Test
 public void testFetchURL() {
   azkProps.put(
       ServerProperties.AZKABAN_SERVER_EXTERNAL_TOPIC_URL.replace("${topic}", "someTopic"),
       "This is a link");
   assertTrue(ExternalLinkUtils.getURLForTopic("someTopic", azkProps).equals("This is a link"));
 }
コード例 #2
0
  /**
   * Test validates the happy path when an log viewer is configured with '${execid}' and '${jobid}
   * as the format in 'azkaban.properties'.
   */
  @Test
  public void testGetExternalLogViewerValidFormat() {
    azkProps.put(
        ServerProperties.AZKABAN_SERVER_EXTERNAL_LOGVIEWER_TOPIC, EXTERNAL_LOGVIEWER_TOPIC);
    azkProps.put(
        ServerProperties.AZKABAN_SERVER_EXTERNAL_TOPIC_URL.replace(
            "${topic}", EXTERNAL_LOGVIEWER_TOPIC),
        EXTERNAL_LOGVIEWER_URL_VALID_FORMAT);

    String externalURL = ExternalLinkUtils.getExternalLogViewer(azkProps, jobId, jobProps);
    assertTrue(externalURL.equals(EXTERNAL_LOGVIEWER_EXPECTED_URL));
  }
コード例 #3
0
  /**
   * Test validates the happy path when an external analyzer is configured with '${url}' as the
   * format in 'azkaban.properties'.
   */
  @Test
  public void testGetExternalAnalyzerValidFormat() {
    azkProps.put(ServerProperties.AZKABAN_SERVER_EXTERNAL_ANALYZER_TOPIC, EXTERNAL_ANALYZER_TOPIC);
    azkProps.put(
        ServerProperties.AZKABAN_SERVER_EXTERNAL_TOPIC_URL.replace(
            "${topic}", EXTERNAL_ANALYZER_TOPIC),
        EXTERNAL_ANALYZER_URL_VALID_FORMAT);

    when(mockRequest.getRequestURL()).thenReturn(new StringBuffer(EXEC_URL));
    when(mockRequest.getQueryString()).thenReturn(EXEC_QUERY_STRING);

    String externalURL = ExternalLinkUtils.getExternalAnalyzerOnReq(azkProps, mockRequest);
    assertTrue(externalURL.equals(EXTERNAL_ANALYZER_EXPECTED_URL));
  }
コード例 #4
0
 /** Test validates that when we encode URLs to UTF-8, it does not give us incorrect encodings. */
 @Test
 public void testEncodingToUFT8() {
   assertTrue(ExternalLinkUtils.encodeToUTF8(" ").equals("%20"));
   assertTrue(ExternalLinkUtils.encodeToUTF8("+").equals("%2B"));
   assertTrue(ExternalLinkUtils.encodeToUTF8("/").equals("%2F"));
   assertTrue(ExternalLinkUtils.encodeToUTF8(":").equals("%3A"));
   assertTrue(ExternalLinkUtils.encodeToUTF8("?").equals("%3F"));
   assertTrue(ExternalLinkUtils.encodeToUTF8("=").equals("%3D"));
 }
コード例 #5
0
 /**
  * Test validates the condition when an external log viewer is not configured in
  * 'azkaban.properties'.
  */
 @Test
 public void testGetLogViewerNotConfigured() {
   String executionExternalLinkURL =
       ExternalLinkUtils.getExternalLogViewer(azkProps, jobId, jobProps);
   assertTrue(executionExternalLinkURL.equals(""));
 }
コード例 #6
0
 /**
  * Test validates the condition when an external analyzer is not configured in
  * 'azkaban.properties'.
  */
 @Test
 public void testGetExternalAnalyzerNotConfigured() {
   String executionExternalLinkURL =
       ExternalLinkUtils.getExternalAnalyzerOnReq(azkProps, mockRequest);
   assertTrue(executionExternalLinkURL.equals(""));
 }