@Test public void testComment() throws InterruptedException { String issueKey = TestHelper.createStory(bentenJiraClient); TestHelper.updateAssigneeAndReporter(bentenJiraClient,issueKey); String comment = "this is a new comment"; JSONObject jsonObject = new JSONObject(); jsonObject.put("body",comment); Thread.sleep(2000); jiraHttpClient.comment(issueKey,jsonObject); Issue issue = jiraHttpClient.getIssueDetails(issueKey,JiraConverter.CommonExpandedFields); Assert.assertEquals(comment,issue.getComments().get(issue.getComments().size()-1).getBody()); }
public void comment(String issueKey,JSONObject jsonObject){ try { HttpPost httpPost = new HttpPost(JiraHttpHelper.commentUri(issueKey)); StringEntity stringEntity = formPayload(jsonObject); httpPost.setEntity(stringEntity); HttpResponse httpResponse = request(httpPost); if(httpResponse.getStatusLine().getStatusCode()!=201){ handleJiraException(httpResponse); } }catch (Exception ex) { throw new RuntimeException(ex); } }
JiraHttpClient extends BentenHttpClient { public void comment(String issueKey,JSONObject jsonObject){ try { HttpPost httpPost = new HttpPost(JiraHttpHelper.commentUri(issueKey)); StringEntity stringEntity = formPayload(jsonObject); httpPost.setEntity(stringEntity); HttpResponse httpResponse = request(httpPost); if(httpResponse.getStatusLine().getStatusCode()!=201){ handleJiraException(httpResponse); } }catch (Exception ex) { throw new RuntimeException(ex); } } }
JiraHttpClient extends BentenHttpClient { public void comment(String issueKey,JSONObject jsonObject){ try { HttpPost httpPost = new HttpPost(JiraHttpHelper.commentUri(issueKey)); StringEntity stringEntity = formPayload(jsonObject); httpPost.setEntity(stringEntity); HttpResponse httpResponse = request(httpPost); if(httpResponse.getStatusLine().getStatusCode()!=201){ handleJiraException(httpResponse); } }catch (Exception ex) { throw new RuntimeException(ex); } }  }
JiraHttpClient extends BentenHttpClient { public void comment(String issueKey,JSONObject jsonObject){ try { HttpPost httpPost = new HttpPost(JiraHttpHelper.commentUri(issueKey)); StringEntity stringEntity = formPayload(jsonObject); httpPost.setEntity(stringEntity); HttpResponse httpResponse = request(httpPost); if(httpResponse.getStatusLine().getStatusCode()!=201){ handleJiraException(httpResponse); } }catch (Exception ex) { throw new RuntimeException(ex); } }  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 void comment(String issueKey,JSONObject jsonObject){ try { HttpPost httpPost = new HttpPost(JiraHttpHelper.commentUri(issueKey)); StringEntity stringEntity = formPayload(jsonObject); httpPost.setEntity(stringEntity); HttpResponse httpResponse = request(httpPost); if(httpResponse.getStatusLine().getStatusCode()!=201){ handleJiraException(httpResponse); } }catch (Exception ex) { throw new RuntimeException(ex); } }  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);  }