Package com.taskadapter.redmineapi.bean

Examples of com.taskadapter.redmineapi.bean.IssueRelation


            List<Issue> issues = createIssues(issueManager, projectKey, 2);
            Issue src = issues.get(0);
            Issue target = issues.get(1);

            String relationText = IssueRelation.TYPE.precedes.toString();
            IssueRelation r = issueManager.createRelation(src.getId(), target.getId(),
                    relationText);
            assertEquals(src.getId(), r.getIssueId());
            assertEquals(target.getId(), r.getIssueToId());
            assertEquals(relationText, r.getType());
        } catch (Exception e) {
            fail(e.toString());
        }
    }
View Full Code Here


    }

    @Test
    public void issueRelationsAreCreatedAndLoadedOK() {
        try {
            IssueRelation relation = createTwoRelatedIssues();
            Issue issue = issueManager.getIssueById(relation.getIssueId(),
                    Include.relations);
            Issue issueTarget = issueManager.getIssueById(relation.getIssueToId(),
                    Include.relations);

            assertThat(issue.getRelations().size()).isEqualTo(1);
            assertThat(issueTarget.getRelations().size()).isEqualTo(1);

            IssueRelation relation1 = issue.getRelations().iterator().next();
            assertEquals(issue.getId(), relation1.getIssueId());
            assertEquals(issueTarget.getId(), relation1.getIssueToId());
            assertEquals("precedes", relation1.getType());
            assertEquals((Integer) 0, relation1.getDelay());

            IssueRelation reverseRelation = issueTarget.getRelations().iterator().next();
            // both forward and reverse relations are the same!
            assertEquals(relation1, reverseRelation);
        } catch (Exception e) {
            fail(e.toString());
        }
View Full Code Here

    return result;
  }

  public static IssueRelation parseRelation(JSONObject content)
      throws JSONException {
    final IssueRelation result = IssueRelationFactory.create(JsonInput.getIntOrNull(content, "id"));
    result.setIssueId(JsonInput.getIntOrNull(content, "issue_id"));
    result.setIssueToId(JsonInput.getIntOrNull(content, "issue_to_id"));
    result.setType(JsonInput.getStringOrNull(content, "relation_type"));
    result.setDelay(JsonInput.getInt(content, "delay", 0));
    return result;
  }
View Full Code Here

        }
    }

    @Test
    public void testIssureRelationDelete() throws RedmineException {
        IssueRelation relation = createTwoRelatedIssues();

        issueManager.deleteRelation(relation.getId());
        Issue issue = issueManager
                .getIssueById(relation.getIssueId(), Include.relations);
        assertTrue(issue.getRelations().isEmpty());
    }
View Full Code Here

        return transport.getObjectsList(Issue.class, params);
    }

    public IssueRelation createRelation(Integer issueId, Integer issueToId, String type) throws RedmineException {
        IssueRelation toCreate = IssueRelationFactory.create();
        toCreate.setIssueId(issueId);
        toCreate.setIssueToId(issueToId);
        toCreate.setType(type);
        return transport.addChildEntry(Issue.class, issueId.toString(),
                toCreate);
    }
View Full Code Here

  }

  @SuppressWarnings("unused")
  private static void tryCreateRelation(IssueManager issueManager)
      throws RedmineException {
    IssueRelation r = issueManager.createRelation(49, 50,
        IssueRelation.TYPE.precedes.toString());
    logger.debug("Created relation " + r);
  }
View Full Code Here

    final Issue tmp = IssueFactory.createWithSubject("this is a test");
    final Issue issue1 = issueManager.createIssue(projectKey, tmp);
    try {
      final Issue issue2 = issueManager.createIssue(projectKey, tmp);
      try {
        final IssueRelation relation = issueManager.createRelation(
            issue1.getId(), issue2.getId(), "blocks");
        Assert.assertNotNull(relation.getId());
        Assert.assertEquals(issue1.getId(), relation.getIssueId());
        Assert.assertEquals(issue2.getId(), relation.getIssueToId());
        Assert.assertEquals("blocks", relation.getType());
        Assert.assertEquals(Integer.valueOf(0), relation.getDelay());
      } finally {
        issueManager.deleteIssue(issue2.getId());
      }
    } finally {
      issueManager.deleteIssue(issue1.getId());
View Full Code Here

  }

  @Test
  public void testRelationDefaults() throws JSONException {
    final String MINIMAL_RELATION = "{\"relation\":{\"issue_to_id\":1934,\"issue_id\":1933,\"id\":162,\"relation_type\":\"blocks\"}}";
    final IssueRelation relation = parse(MINIMAL_RELATION, "relation",
        RedmineJSONParser.RELATION_PARSER);
    Assert.assertEquals(Integer.valueOf(0), relation.getDelay());
  }
View Full Code Here

TOP

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

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.