Package com.atlassian.jira.rest.client.domain

Examples of com.atlassian.jira.rest.client.domain.IssueType


    final URI issueUri = JsonParseUtil.parseURI(json.getString("self"));
    final String issueKey = json.getString("key");
    final JSONObject fields = json.getJSONObject("fields");
    final String summary = fields.getString("summary");
    final Status status = statusJsonParser.parse(fields.getJSONObject("status"));
    final IssueType issueType = issueTypeJsonParser.parse(fields.getJSONObject("issuetype"));
    return new Subtask(issueKey, issueUri, summary, issueType, status);
  }
View Full Code Here


        final Long id = JsonParseUtil.getOptionalLong(json, "id");
        final String name = json.getString("name");
        final boolean isSubtask = json.getBoolean("subtask");
        final String iconUrl = JsonParseUtil.getOptionalString(json, "iconUrl");
        return iconUrl != null
            ? new IssueType(selfUri, id, name, isSubtask, null, JsonParseUtil.parseURI(iconUrl))
            : new BasicIssueType(selfUri, id, name, isSubtask);
    }
View Full Code Here

  public IssueType parse(JSONObject json) throws JSONException {
    final BasicIssueType basicIssueType = basicIssueTypeJsonParser.parse(json);
    final String iconUrl = JsonParseUtil.getOptionalString(json, "iconUrl");
    final URI iconUri = iconUrl == null ? null : JsonParseUtil.parseURI(iconUrl);
    final String description = JsonParseUtil.getOptionalString(json, "description");
    return new IssueType(basicIssueType.getSelf(), basicIssueType.getId(), basicIssueType.getName(), basicIssueType.isSubtask(), description, iconUri);
  }
View Full Code Here

  final IssueTypeJsonParser issueTypeJsonParser = new IssueTypeJsonParser();
  final CimFieldsInfoMapJsonParser fieldsParser = new CimFieldsInfoMapJsonParser();

  @Override
  public CimIssueType parse(final JSONObject json) throws JSONException {
    final IssueType issueType = issueTypeJsonParser.parse(json);
    final JSONObject jsonFieldsMap = json.optJSONObject("fields");
   
    final Map<String, CimFieldInfo> fields = (jsonFieldsMap == null) ?
        Collections.<String, CimFieldInfo>emptyMap() : fieldsParser.parse(jsonFieldsMap);

    return new CimIssueType(issueType.getSelf(), issueType.getId(), issueType.getName(),
        issueType.isSubtask(), issueType.getDescription(), issueType.getIconUri(), fields);
  }
View Full Code Here

public class IssueTypeJsonParserTest {
  @Test
  public void testParse() throws JSONException {
    IssueTypeJsonParser parser = new IssueTypeJsonParser();
    final IssueType issueType = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/issueType/complete.json"));
    assertEquals(new IssueType(toUri("http://localhost:8090/jira/rest/api/latest/issueType/1"), 1L, "Bug", true,
        "A problem which impairs or prevents the functions of the product.",
        TestUtil.toUri("http://localhost:8090/jira/images/icons/bug.gif")), issueType);
  }
View Full Code Here

    assertEquals(new DateMidnight(2010, 8, 25).toInstant(), Iterables.getLast(project.getVersions()).getReleaseDate().toInstant());
        assertEquals("Test Project", project.getName());
    final OptionalIterable<IssueType> issueTypes = project.getIssueTypes();
    assertTrue(issueTypes.isSupported());
    assertThat(issueTypes, containsInAnyOrder(
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issueType/1"), null, "Bug", false, null, null),
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issueType/2"), null, "New Feature", false, null, null),
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issueType/3"), null, "Task", false, null, null),
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issueType/4"), null, "Improvement", false, null, null),
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issueType/5"), null, "Sub-task", true, null, null)
    ));
  }
View Full Code Here

    assertEquals(new DateMidnight(2010, 8, 25).toInstant(), Iterables.getLast(project.getVersions()).getReleaseDate().toInstant());
    assertEquals("Test Project", project.getName());
    final OptionalIterable<IssueType> issueTypes = project.getIssueTypes();
    assertTrue(issueTypes.isSupported());
    assertThat(issueTypes, containsInAnyOrder(
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issuetype/1"), 1L, "Bug", false, "A problem which impairs or prevents the functions of the product.", TestUtil.toUri("http://localhost:2990/jira/images/icons/bug.gif")),
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issuetype/2"), 2L, "New Feature", false, "A new feature of the product, which has yet to be developed.", TestUtil.toUri("http://localhost:2990/jira/images/icons/newfeature.gif")),
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issuetype/3"), 3L, "Task", false, "A task that needs to be done.", TestUtil.toUri("http://localhost:2990/jira/images/icons/task.gif")),
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issuetype/4"), 4L, "Improvement", false, "An improvement or enhancement to an existing feature or task.", TestUtil.toUri("http://localhost:2990/jira/images/icons/improvement.gif")),
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issuetype/5"), 5L, "Sub-task", true, "The sub-task of the issue", TestUtil.toUri("http://localhost:2990/jira/images/icons/issue_subtask.gif"))
    ));
  }
View Full Code Here

  }

  @Test
  public void testGetIssueType() {
    final BasicIssueType basicIssueType = client.getIssueClient().getIssue("TST-1", pm).getIssueType();
    final IssueType issueType = client.getMetadataClient().getIssueType(basicIssueType.getSelf(), pm);
    assertEquals("Bug", issueType.getName());
    assertEquals("A problem which impairs or prevents the functions of the product.", issueType.getDescription());
    Long expectedId = isJira5xOrNewer() ? 1L : null;
    assertEquals(expectedId, issueType.getId());
//    assertTrue(issueType.getIconUri().toString().startsWith(jiraUri.toString()));
    assertThat(issueType.getIconUri().toString(), anyOf(
        endsWith("bug.gif"),
        endsWith("issuetypes/bug.png")
    ));
  }
View Full Code Here

    final OptionalIterable<IssueType> issueTypes = project.getIssueTypes();
    if (isJira4x4OrNewer()) {
      assertTrue(issueTypes.isSupported());
      final Iterator<IssueType> issueTypesIterator = issueTypes.iterator();
      assertTrue(issueTypesIterator.hasNext());
      final IssueType it = issueTypesIterator.next();
      if (isJira5xOrNewer()) {
        assertEquals(Long.valueOf(1), it.getId());
      }
      else {
        assertNull(it.getId());
      }
      assertEquals(it.getName(), "Bug");
    }
    else {
      assertFalse(issueTypes.isSupported());
    }
  }
View Full Code Here

  @JiraBuildNumberDependent(BN_JIRA_5)
  public void testGetIssueTypes() {
    final Iterable<IssueType> issueTypes = client.getMetadataClient().getIssueTypes(pm);
    assertEquals(5, Iterables.size(issueTypes));

    final IssueType issueType = findEntityBySelfAddressSuffix(issueTypes, "/5");
    assertEquals("Sub-task", issueType.getName());
    assertEquals("The sub-task of the issue", issueType.getDescription());
    assertEquals(Long.valueOf(5), issueType.getId());
    assertTrue(issueType.isSubtask());
    assertNotNull(issueType.getSelf());
  }
View Full Code Here

TOP

Related Classes of com.atlassian.jira.rest.client.domain.IssueType

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.