@Test
 public void testUpdatedOn() throws IOException, JSONException {
   List<Issue> redmine11Issues = loadRedmine11Issues();
   Issue issue = RedmineTestUtils.findIssueInList(redmine11Issues, 39);
   DateComparator.testLongDate(
       2011, Calendar.SEPTEMBER, 17, 21, 28, 45, "GMT-8", issue.getUpdatedOn());
 }
 @Test
 public void testCreatedOn() throws IOException, JSONException {
   List<Issue> redmine11Issues = loadRedmine11Issues();
   Issue issue = RedmineTestUtils.findIssueInList(redmine11Issues, 39);
   DateComparator.testLongDate(
       2011, Calendar.FEBRUARY, 12, 16, 0, 31, "GMT-8", issue.getCreatedOn());
 }
 @Test
 public void testMultilineIssueDescription() throws IOException, JSONException {
   final String json = MyIOUtils.getResourceAsString("issue_with_multiline_description.json");
   final Issue issue =
       RedmineJSONParser.parseIssue(RedmineJSONParser.getResponseSingleObject(json, "issue"));
   Assert.assertEquals(
       "This is a description \nwith more than \n\n\none line.", issue.getDescription());
 }
 @Test
 public void testParseDescription() {
   try {
     List<Issue> issues = loadRedmine11Issues();
     Issue issue65 = RedmineTestUtils.findIssueInList(issues, 65);
     Assert.assertTrue(
         issue65.getDescription().startsWith("This is the description for the new task."));
     Assert.assertTrue(issue65.getDescription().endsWith("This is the last line."));
   } catch (Exception e) {
     Assert.fail(e.getMessage());
   }
 }
  @Test
  public void estimatedTimeIsNULL() throws JSONException {
    try {
      List<Issue> issues = loadRedmine11Issues();
      Integer issueID = 52;
      Issue issue52 = RedmineTestUtils.findIssueInList(issues, issueID);
      Assert.assertNotNull(issue52);

      // must be NULL and not "0"
      Assert.assertNull("estimated time must be null", issue52.getEstimatedHours());
    } catch (IOException e) {
      Assert.fail(e.getMessage());
    }
  }
 /**
  * regression test for http://code.google.com/p/redmine-java-api/issues/detail?id=91 with Redmine
  * 1.3.0: NULL value returned by getIssues call is interpreted as 0.0
  */
 @Test
 public void nullEstimatedTimeProcessedCorrectlyWithRedmine122() {
   try {
     String str = MyIOUtils.getResourceAsString("redmine_1.2.2_dev_issues.json");
     List<Issue> issues =
         JsonInput.getListOrEmpty(
             RedmineJSONParser.getResponse(str), "issues", RedmineJSONParser.ISSUE_PARSER);
     Issue issue = RedmineTestUtils.findIssueInList(issues, 4808);
     assertNull(issue.getEstimatedHours());
     Issue issue1 = RedmineTestUtils.findIssueInList(issues, 4809);
     assertNull(issue1.getEstimatedHours());
   } catch (Exception e) {
     e.printStackTrace();
     Assert.fail("Error:" + e);
   }
 }
  @Test
  public void testParseIssues() throws IOException, JSONException {
    List<Issue> objects = loadRedmine11Issues();
    Integer issueId = 68;
    Issue issue68 = RedmineTestUtils.findIssueInList(objects, issueId);
    Assert.assertNotNull(issue68);
    Assert.assertEquals(issueId, issue68.getId());
    Integer statusId = 1;
    Assert.assertEquals(statusId, issue68.getStatusId());
    Assert.assertEquals("New", issue68.getStatusName());

    User author = issue68.getAuthor();
    Assert.assertNotNull(author);
    Integer userId = 1;
    Assert.assertEquals(userId, author.getId());
  }
예제 #8
0
 private static void tryCreateIssue(RedmineManager mgr)
     throws IOException, AuthenticationException, NotFoundException, RedmineException {
   Issue issue = new Issue();
   issue.setSubject("test123");
   mgr.createIssue(projectKey, issue);
 }
예제 #9
0
 private static void getIssueWithRelations(RedmineManager mgr)
     throws IOException, AuthenticationException, NotFoundException, RedmineException {
   Issue issue = mgr.getIssueById(24580, INCLUDE.relations);
   List<IssueRelation> r = issue.getRelations();
   logger.debug("Retrieved relations " + r);
 }
예제 #10
0
 private static void changeIssueStatus(RedmineManager mgr)
     throws IOException, AuthenticationException, RedmineException, NotFoundException {
   Issue issue = mgr.getIssueById(1771);
   issue.setSubject("new");
   mgr.update(issue);
 }
예제 #11
0
 private static void tryGetAllIssues(RedmineManager mgr) throws Exception {
   List<Issue> issues = mgr.getIssues(projectKey, null);
   for (Issue issue : issues) {
     logger.debug(issue.toString());
   }
 }