@Test public void testLogWork() throws JsonProcessingException, InterruptedException { String issueKey = TestHelper.createStory(bentenJiraClient); TestHelper.updateAssigneeAndReporter(bentenJiraClient,issueKey); String time = "3h 5m"; JSONObject worklog= new JSONObject(); worklog.put("timeSpent",time); worklog.put("comment","this is a comment"); Thread.sleep(2000); jiraHttpClient.logWork(issueKey,worklog); Issue issueAfterLogging = jiraHttpClient.getIssueDetails(issueKey,JiraConverter.CommonExpandedFields); Assert.assertEquals(1,issueAfterLogging.getWorkLogs().size()); }
public void logWork(String issueKey,JSONObject jsonObject){ try { HttpPost httpPost = new HttpPost(JiraHttpHelper.logWorkUri(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 logWork(String issueKey,JSONObject jsonObject){ try { HttpPost httpPost = new HttpPost(JiraHttpHelper.logWorkUri(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 logWork(String issueKey,JSONObject jsonObject){ try { HttpPost httpPost = new HttpPost(JiraHttpHelper.logWorkUri(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 logWork(String issueKey,JSONObject jsonObject){ try { HttpPost httpPost = new HttpPost(JiraHttpHelper.logWorkUri(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 logWork(String issueKey,JSONObject jsonObject){ try { HttpPost httpPost = new HttpPost(JiraHttpHelper.logWorkUri(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);  }