/** * 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")); }
/** * 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)); }
/** * 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)); }