Package com.taskadapter.redmineapi.bean

Examples of com.taskadapter.redmineapi.bean.Issue


    @Ignore
    @Test
    public void issueFixVersionIsSet() throws Exception {

        String existingProjectKey = "test";
        Issue toCreate = IssueHelper.generateRandomIssue();
        Version v = VersionFactory.create(1);
        String versionName = "1.0";
        v.setName("1.0");
        v.setProject(mgr.getProjectManager().getProjectByKey(projectKey));
        v = mgr.getProjectManager().createVersion(v);
        toCreate.setTargetVersion(v);
        Issue createdIssue = issueManager.createIssue(existingProjectKey, toCreate);

        assertNotNull(createdIssue.getTargetVersion());
        assertEquals(createdIssue.getTargetVersion().getName(),
                versionName);
    }
View Full Code Here


     */
    @Ignore
    @Test
    public void testSpentTimeFieldLoaded() {
        try {
            Issue issue = new Issue();
            String subject = "Issue " + new Date();
            issue.setSubject(subject);
            float spentHours = 2;
            issue.setSpentHours(spentHours);

            Issue createdIssue = issueManager.createIssue(projectKey, issue);
            Issue newIssue = issueManager.getIssueById(createdIssue.getId());
            assertEquals((Float) spentHours, newIssue.getSpentHours());
        } catch (Exception e) {
            fail();
        }
    }
View Full Code Here

    }

    @Test
    public void testUpdateIssueDoesNotChangeEstimatedTime() {
        try {
            Issue issue = new Issue();
            String originalSubject = "Issue " + new Date();
            issue.setSubject(originalSubject);

            Issue newIssue = issueManager.createIssue(projectKey, issue);
            assertEquals("Estimated hours must be NULL", null,
                    newIssue.getEstimatedHours());

            issueManager.update(newIssue);

            Issue reloadedFromRedmineIssue = issueManager.getIssueById(newIssue.getId());
            assertEquals("Estimated hours must be NULL", null,
                    reloadedFromRedmineIssue.getEstimatedHours());
        } catch (Exception e) {
            fail();
        }
    }
View Full Code Here

     * @throws NotFoundException              thrown in case the objects requested for could not be found
     */
    @Test
    public void testCreateAndGetIssueWithCategory() throws RedmineException {
        IssueCategory newIssueCategory = null;
        Issue newIssue = null;
        try {
            Project project = projectManager.getProjectByKey(projectKey);
            // create an issue category
            IssueCategory category = IssueCategoryFactory.create(project, "Category_"
                    + new Date().getTime());
            category.setAssignee(IntegrationTestHelper.getOurUser());
            newIssueCategory = issueManager.createCategory(category);
            // create an issue
            Issue issueToCreate = IssueFactory.createWithSubject("getIssueWithCategory_" + UUID.randomUUID());
            issueToCreate.setCategory(newIssueCategory);
            newIssue = issueManager.createIssue(projectKey, issueToCreate);
            // retrieve issue
            Issue retrievedIssue = issueManager.getIssueById(newIssue.getId());
            // assert retrieved category of issue
            IssueCategory retrievedCategory = retrievedIssue.getCategory();
            assertNotNull("Category retrieved for issue " + newIssue.getId()
                    + " should not be null", retrievedCategory);
            assertEquals("ID of category retrieved for issue "
                            + newIssue.getId() + " is wrong", newIssueCategory.getId(),
                    retrievedCategory.getId());
View Full Code Here

    }

    @Test
    public void nullStartDateIsPreserved() {
        try {
            Issue issue = IssueFactory.createWithSubject("test start date");
            issue.setStartDate(null);

            Issue newIssue = issueManager.createIssue(projectKey, issue);

            Issue loadedIssue = issueManager.getIssueById(newIssue.getId());
            assertNull(loadedIssue.getStartDate());
        } catch (Exception e) {
            e.printStackTrace();
            fail();
        }
    }
View Full Code Here

     * <p/>
     * See feature request http://www.redmine.org/issues/9664
     */
    @Test
    public void testCustomFields() throws Exception {
        Issue issue = createIssues(issueManager, projectKey, 1).get(0);
        // default empty values
        assertThat(issue.getCustomFields().size()).isEqualTo(2);

        // TODO update this!
        int id1 = 1; // TODO this is pretty much a hack, we don't generally know
        // these ids!
        String custom1FieldName = "my_custom_1";
        String custom1Value = "some value 123";

        int id2 = 2;
        String custom2FieldName = "custom_boolean_1";
        String custom2Value = "true";

        issue.clearCustomFields();

        issue.addCustomField(CustomFieldFactory.create(id1, custom1FieldName, custom1Value));
        issue.addCustomField(CustomFieldFactory.create(id2, custom2FieldName, custom2Value));
        issueManager.update(issue);

        Issue updatedIssue = issueManager.getIssueById(issue.getId());
        assertThat(updatedIssue.getCustomFields().size()).isEqualTo(2);
        assertEquals(custom1Value,
                updatedIssue.getCustomField(custom1FieldName));
        assertEquals(custom2Value,
                updatedIssue.getCustomField(custom2FieldName));
    }
View Full Code Here

    }

    @Ignore
    @Test
    public void testChangesets() throws RedmineException {
        final Issue issue = issueManager.getIssueById(89, Include.changesets);
        assertThat(issue.getChangesets().size()).isEqualTo(2);
        final Changeset firstChange = issue.getChangesets().iterator().next();
        assertNotNull(firstChange.getComments());
    }
View Full Code Here

        assertTrue(queries.size() > 0);
    }

    @Test
    public void statusIsUpdated() throws RedmineException {
        Issue issue = createIssues(issueManager, projectKey, 1).get(0);
        Issue retrievedIssue = issueManager.getIssueById(issue.getId());
        Integer initialStatusId = retrievedIssue.getStatusId();

        List<IssueStatus> statuses = issueManager.getStatuses();
        // get some status ID that is not equal to the initial one
        Integer newStatusId = null;
        for (IssueStatus status : statuses) {
            if (!status.getId().equals(initialStatusId)) {
                newStatusId = status.getId();
                break;
            }
        }
        if (newStatusId == null) {
            throw new RuntimeException("can't run this test: no Issue Statuses are available except for the initial one");
        }
        retrievedIssue.setStatusId(newStatusId);
        issueManager.update(retrievedIssue);

        Issue issueWithUpdatedStatus = issueManager.getIssueById(retrievedIssue.getId());
        assertThat(issueWithUpdatedStatus.getStatusId()).isEqualTo(newStatusId);
    }
View Full Code Here

  @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"
      assertNull("estimated time must be null",
                    issue52.getEstimatedHours());
    } catch (IOException e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

  @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) {
      fail(e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of com.taskadapter.redmineapi.bean.Issue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.