@Test public void testSearchIssues() throws InterruptedException { String issueKey = TestHelper.createStory(bentenJiraClient); TestHelper.updateAssigneeAndReporter(bentenJiraClient,issueKey); String jql = "assignee="+TestHelper.assigneeName+" ORDER BY updated DESC"; int maxResults = 10; String expandedFields = Field.ASSIGNEE .concat(","+Field.STATUS) .concat(","+Field.PRIORITY) .concat(","+Field.ISSUE_TYPE) .concat(","+Field.PRIORITY) .concat(","+Field.SUMMARY); List<Issue> issues = jiraHttpClient.searchIssues(jql,expandedFields,maxResults); Assert.assertTrue(issues.size() > 0); Assert.assertEquals(issues.get(0).getAssignee().getName().toString(),TestHelper.assigneeName); Assert.assertTrue(issues.get(0).getSummary() instanceof String); }
public List<Issue> searchIssues(String jql,String expandedFields,int maxResults){ List<Issue> issues; try { HttpGet httpGet = new HttpGet(JiraHttpHelper.createSearchUri(jql, null, expandedFields, maxResults, 0)); HttpResponse httpResponse = request(httpGet); if(httpResponse.getStatusLine().getStatusCode()!=200){ handleJiraException(httpResponse); } String json = EntityUtils.toString(httpResponse.getEntity()); JSONObject issuesJson = JiraConverter.objectMapper.readValue(json,JSONObject.class); issues = JiraConverter.convertIssuesMapToIssues(issuesJson); }catch (Exception ex) { logger.error(ex.getMessage(),ex); throw new RuntimeException(ex); } return issues; }
JiraHttpClient extends BentenHttpClient { public List<Issue> searchIssues(String jql,String expandedFields,int maxResults){ List<Issue> issues; try { HttpGet httpGet = new HttpGet(JiraHttpHelper.createSearchUri(jql, null, expandedFields, maxResults, 0)); HttpResponse httpResponse = request(httpGet); if(httpResponse.getStatusLine().getStatusCode()!=200){ handleJiraException(httpResponse); } String json = EntityUtils.toString(httpResponse.getEntity()); JSONObject issuesJson = JiraConverter.objectMapper.readValue(json,JSONObject.class); issues = JiraConverter.convertIssuesMapToIssues(issuesJson); }catch (Exception ex) { logger.error(ex.getMessage(),ex); throw new RuntimeException(ex); } return issues; } }
JiraHttpClient extends BentenHttpClient { public List<Issue> searchIssues(String jql,String expandedFields,int maxResults){ List<Issue> issues; try { HttpGet httpGet = new HttpGet(JiraHttpHelper.createSearchUri(jql, null, expandedFields, maxResults, 0)); HttpResponse httpResponse = request(httpGet); if(httpResponse.getStatusLine().getStatusCode()!=200){ handleJiraException(httpResponse); } String json = EntityUtils.toString(httpResponse.getEntity()); JSONObject issuesJson = JiraConverter.objectMapper.readValue(json,JSONObject.class); issues = JiraConverter.convertIssuesMapToIssues(issuesJson); }catch (Exception ex) { logger.error(ex.getMessage(),ex); throw new RuntimeException(ex); } return issues; }  }
JiraHttpClient extends BentenHttpClient { public List<Issue> searchIssues(String jql,String expandedFields,int maxResults){ List<Issue> issues; try { HttpGet httpGet = new HttpGet(JiraHttpHelper.createSearchUri(jql, null, expandedFields, maxResults, 0)); HttpResponse httpResponse = request(httpGet); if(httpResponse.getStatusLine().getStatusCode()!=200){ handleJiraException(httpResponse); } String json = EntityUtils.toString(httpResponse.getEntity()); JSONObject issuesJson = JiraConverter.objectMapper.readValue(json,JSONObject.class); issues = JiraConverter.convertIssuesMapToIssues(issuesJson); }catch (Exception ex) { logger.error(ex.getMessage(),ex); throw new RuntimeException(ex); } return issues; }  List<Issue> searchIssues(String jql,String expandedFields,int maxResults); Issue getIssueDetails(String issueKey,String expandedFields); void updateIssue(String issueKey,Map<String,Object> fields); void logWork(String issueKey,JSONObject jsonObject); void transitionIssue(String issueKey,JSONObject jsonObject); List<Transition> getPossibleTransitions(String issueKey); void comment(String issueKey,JSONObject jsonObject); JSONObject getCreateMetaData(String projectKey, String issueType); String createIssue(Map<String,Object> fields); }
JiraHttpClient extends BentenHttpClient { public List<Issue> searchIssues(String jql,String expandedFields,int maxResults){ List<Issue> issues; try { HttpGet httpGet = new HttpGet(JiraHttpHelper.createSearchUri(jql, null, expandedFields, maxResults, 0)); HttpResponse httpResponse = request(httpGet); if(httpResponse.getStatusLine().getStatusCode()!=200){ handleJiraException(httpResponse); } String json = EntityUtils.toString(httpResponse.getEntity()); JSONObject issuesJson = JiraConverter.objectMapper.readValue(json,JSONObject.class); issues = JiraConverter.convertIssuesMapToIssues(issuesJson); }catch (Exception ex) { logger.error(ex.getMessage(),ex); throw new RuntimeException(ex); } return issues; }  List<Issue> searchIssues(String jql,String expandedFields,int maxResults); Issue getIssueDetails(String issueKey,String expandedFields); void updateIssue(String issueKey,Map<String,Object> fields); void logWork(String issueKey,JSONObject jsonObject); void transitionIssue(String issueKey,JSONObject jsonObject); List<Transition> getPossibleTransitions(String issueKey); void comment(String issueKey,JSONObject jsonObject); JSONObject getCreateMetaData(String projectKey, String issueType); String createIssue(Map<String,Object> fields);  }