Skip to content

Commit

Permalink
addressing review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Santhosh Gandhe <[email protected]>
  • Loading branch information
san81 committed Nov 1, 2024
1 parent d33c493 commit e3843d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
public class JiraClient implements CrawlerClient {

private static final Logger log = LoggerFactory.getLogger(JiraClient.class);
private ObjectMapper objectMapper = new ObjectMapper();

private final JiraService service;
private final JiraIterator jiraIterator;
private final ExecutorService executorService;
private final CrawlerSourceConfig configuration;
private final int bufferWriteTimeoutInSeconds = 10;
private ObjectMapper objectMapper = new ObjectMapper();
private Instant lastPollTime;

public JiraClient(JiraService service,
Expand Down Expand Up @@ -118,7 +118,7 @@ public void executePartition(SaasWorkerProgressState state,
.collect(Collectors.toList());

try {
buffer.writeAll(recordsToWrite, (int) Duration.ofSeconds(10).toMillis());
buffer.writeAll(recordsToWrite, (int) Duration.ofSeconds(bufferWriteTimeoutInSeconds).toMillis());
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,13 @@ private IssueBean createIssueBean(boolean nullFields) {
@ParameterizedTest
@ValueSource(strings = {"basic-auth-jira-pipeline.yaml"})
public void testFetchingJiraIssue(String configFileName) {
doReturn(new ResponseEntity<>("", HttpStatus.OK)).when(restTemplate).getForEntity(any(URI.class), any(Class.class));
String exampleTicketResponse = "{\"id\":\"123\",\"key\":\"key\",\"self\":\"https://example.com/rest/api/2/issue/123\"}";
doReturn(new ResponseEntity<>(exampleTicketResponse, HttpStatus.OK)).when(restTemplate).getForEntity(any(URI.class), any(Class.class));
JiraSourceConfig jiraSourceConfig = createJiraConfigurationFromYaml(configFileName);
JiraAuthConfig authConfig = new JiraAuthFactory(jiraSourceConfig).getObject();
JiraService jiraService = new JiraService(restTemplate, jiraSourceConfig, authConfig);
String ticketDetails = jiraService.getIssue("key");
assertNotNull(ticketDetails);
assertEquals(exampleTicketResponse, ticketDetails);
}

}

0 comments on commit e3843d5

Please sign in to comment.