@Test public void testUpdateIssue() throws JsonProcessingException, InterruptedException { String issueKey = TestHelper.createStory(bentenJiraClient); TestHelper.updateAssigneeAndReporter(bentenJiraClient,issueKey); JSONObject fields= new JSONObject(); User assignee = new User(); assignee.setName(TestHelper.assigneeName); String string = JiraConverter.objectMapper.writeValueAsString(assignee); fields.put("assignee",string); Thread.sleep(2000); jiraHttpClient.updateIssue(issueKey,fields); Issue issue = jiraHttpClient.getIssueDetails(issueKey,JiraConverter.CommonExpandedFields); Assert.assertEquals(TestHelper.assigneeName,issue.getAssignee().getName().toString()); Assert.assertEquals(issueKey,issue.getKey()); }
public void updateIssue(String issueKey,Map<String,Object> fields){ try { HttpPut httpPut = new HttpPut(JiraHttpHelper.issueUri(issueKey)); JSONObject jsonObject = new JSONObject(); jsonObject.put("fields",fields); StringEntity stringEntity = formPayload(jsonObject); stringEntity.setContentType("application/json"); httpPut.setEntity(stringEntity); HttpResponse httpResponse = request(httpPut); if(httpResponse.getStatusLine().getStatusCode()!=204){ handleJiraException(httpResponse); } }catch (Exception ex) { throw new RuntimeException(ex); } }
JiraHttpClient extends BentenHttpClient { public void updateIssue(String issueKey,Map<String,Object> fields){ try { HttpPut httpPut = new HttpPut(JiraHttpHelper.issueUri(issueKey)); JSONObject jsonObject = new JSONObject(); jsonObject.put("fields",fields); StringEntity stringEntity = formPayload(jsonObject); stringEntity.setContentType("application/json"); httpPut.setEntity(stringEntity); HttpResponse httpResponse = request(httpPut); if(httpResponse.getStatusLine().getStatusCode()!=204){ handleJiraException(httpResponse); } }catch (Exception ex) { throw new RuntimeException(ex); } } }
JiraHttpClient extends BentenHttpClient { public void updateIssue(String issueKey,Map<String,Object> fields){ try { HttpPut httpPut = new HttpPut(JiraHttpHelper.issueUri(issueKey)); JSONObject jsonObject = new JSONObject(); jsonObject.put("fields",fields); StringEntity stringEntity = formPayload(jsonObject); stringEntity.setContentType("application/json"); httpPut.setEntity(stringEntity); HttpResponse httpResponse = request(httpPut); if(httpResponse.getStatusLine().getStatusCode()!=204){ handleJiraException(httpResponse); } }catch (Exception ex) { throw new RuntimeException(ex); } }  }
JiraHttpClient extends BentenHttpClient { public void updateIssue(String issueKey,Map<String,Object> fields){ try { HttpPut httpPut = new HttpPut(JiraHttpHelper.issueUri(issueKey)); JSONObject jsonObject = new JSONObject(); jsonObject.put("fields",fields); StringEntity stringEntity = formPayload(jsonObject); stringEntity.setContentType("application/json"); httpPut.setEntity(stringEntity); HttpResponse httpResponse = request(httpPut); if(httpResponse.getStatusLine().getStatusCode()!=204){ 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 updateIssue(String issueKey,Map<String,Object> fields){ try { HttpPut httpPut = new HttpPut(JiraHttpHelper.issueUri(issueKey)); JSONObject jsonObject = new JSONObject(); jsonObject.put("fields",fields); StringEntity stringEntity = formPayload(jsonObject); stringEntity.setContentType("application/json"); httpPut.setEntity(stringEntity); HttpResponse httpResponse = request(httpPut); if(httpResponse.getStatusLine().getStatusCode()!=204){ 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);  }