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

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


  @Override
  public Comment parse(JSONObject json) throws JSONException {
    final URI selfUri = JsonParseUtil.getSelfUri(json);
    final Long id = JsonParseUtil.getOptionalLong(json, "id");
    final String body = json.getString("body");
    final BasicUser author = JsonParseUtil.parseBasicUser(json.optJSONObject("author"));
    final BasicUser updateAuthor = JsonParseUtil.parseBasicUser(json.optJSONObject("updateAuthor"));

    final Visibility visibility = visibilityJsonParser.parseVisibility(json);
    return new Comment(selfUri, body, author, updateAuthor, JsonParseUtil.parseDateTime(json.getString("created")),
        JsonParseUtil.parseDateTime(json.getString("updated")), visibility, id);
  }
View Full Code Here


  private final WorklogInputJsonGenerator generator = new WorklogInputJsonGenerator(
      JsonParseUtil.JIRA_DATE_TIME_FORMATTER.withZone(DateTimeZone.forID("+02:00"))
  );

  public WorklogInputJsonGeneratorTest() throws URISyntaxException {
    USER = new BasicUser(new URI("http://localhost:2990/jira/rest/api/2/user?username=wseliga"), "wseliga", "Wojciech Seliga");
    ADMIN = new BasicUser(new URI("http://localhost:2990/jira/rest/api/2/user?username=admin"), "admin", "Administrator");
  }
View Full Code Here

    assertNotNull(changelog);

    assertEquals(4, Iterables.size(changelog));
    final Iterator<ChangelogGroup> iterator = changelog.iterator();

    final BasicUser user1 = new BasicUser(toUri("http://localhost:2990/jira/rest/api/2/user?username=user1"), "user1", "User One");
    final BasicUser user2 = new BasicUser(toUri("http://localhost:2990/jira/rest/api/2/user?username=user2"), "user2", "User Two");

    verifyChangelog(iterator.next(),
        "2012-04-12T14:28:28.255+0200",
        user1,
        ImmutableList.of(
View Full Code Here

  private final BasicUserJsonParser parser = new BasicUserJsonParser();

  @Test
  public void testParseWhenAnonymousUser() throws Exception {
    final BasicUser user = parser.parse(getJsonObjectFromResource("/json/user/valid-basic-anonymous.json"));

    assertNull(user);
  }
View Full Code Here

    assertNull(user);
  }

  @Test
  public void testParseWhenDeletedUserBugJRA30263() throws Exception {
    final BasicUser user = parser.parse(getJsonObjectFromResource("/json/user/valid-basic-deleted-JRA-30263.json"));

    assertEquals("mark", user.getName());
    assertTrue(user.isSelfUriIncomplete());
  }
View Full Code Here

  }


  @Test
  public void testParseWhenValid() throws Exception {
    final BasicUser user = parser.parse(getJsonObjectFromResource("/json/user/valid.json"));

    assertNotNull(user);
    assertEquals("admin", user.getName());
    assertEquals("Administrator", user.getDisplayName());
    assertEquals(toUri("http://localhost:8090/jira/rest/api/latest/user?username=admin"), user.getSelf());
    assertFalse(user.isSelfUriIncomplete());
    System.out.println(user);
  }
View Full Code Here

    final String dueDateString = getOptionalFieldStringUnisex(shouldUseNestedValueAttribute, s, DUE_DATE_FIELD.id);
    final DateTime dueDate = dueDateString == null ? null : JsonParseUtil.parseDateTimeOrDate(dueDateString);

    final BasicPriority priority = getOptionalField(shouldUseNestedValueAttribute, s, PRIORITY_FIELD.id, priorityJsonParser);
    final BasicResolution resolution = getOptionalField(shouldUseNestedValueAttribute, s, RESOLUTION_FIELD.id, resolutionJsonParser);
    final BasicUser assignee = getOptionalField(shouldUseNestedValueAttribute, s, ASSIGNEE_FIELD.id, userJsonParser);
    final BasicUser reporter = getOptionalField(shouldUseNestedValueAttribute, s, REPORTER_FIELD.id, userJsonParser);

    final BasicProject project = projectJsonParser.parse(getFieldUnisex(s, PROJECT_FIELD.id));
    final Collection<IssueLink> issueLinks;
    if (isJira5x0OrNewer) {
      issueLinks = parseOptionalArray(shouldUseNestedValueAttribute, s,
View Full Code Here

    final BasicPriority priority = (BasicPriority) allowedValuesForPriority.iterator().next();

    // build issue input
    final String summary = "My new issue!";
    final String description = "Some description";
    final BasicUser assignee = IntegrationTestUtil.USER1;
    final List<String> affectedVersionsNames = Collections.emptyList();
    final DateTime dueDate = new DateTime(new Date().getTime());
    final ArrayList<String> fixVersionsNames = Lists.newArrayList("1.1");

    // prepare IssueInput
    final IssueInputBuilder issueInputBuilder = new IssueInputBuilder(project, issueType, summary)
        .setDescription(description)
        .setAssignee(assignee)
        .setAffectedVersionsNames(affectedVersionsNames)
        .setFixVersionsNames(fixVersionsNames)
        .setComponents(component)
        .setDueDate(dueDate)
        .setPriority(priority);

    // create
    final BasicIssue basicCreatedIssue = issueClient.createIssue(issueInputBuilder.build(), pm);
    assertNotNull(basicCreatedIssue.getKey());

    // get issue and check if everything was set as we expected
    final Issue createdIssue = issueClient.getIssue(basicCreatedIssue.getKey(), pm);
    assertNotNull(createdIssue);

    assertEquals(basicCreatedIssue.getKey(), createdIssue.getKey());
    assertEquals(project.getKey(), createdIssue.getProject().getKey());
    assertEquals(issueType.getId(), createdIssue.getIssueType().getId());
    assertEquals(summary, createdIssue.getSummary());
    assertEquals(description, createdIssue.getDescription());

    final BasicUser actualAssignee = createdIssue.getAssignee();
    assertNotNull(actualAssignee);
    assertEquals(assignee.getSelf(), actualAssignee.getSelf());

    final Iterable<String> actualAffectedVersionsNames = EntityHelper.toNamesList(createdIssue.getAffectedVersions());
    assertThat(affectedVersionsNames, containsInAnyOrder(toArray(actualAffectedVersionsNames, String.class)));

    final Iterable<String> actualFixVersionsNames = EntityHelper.toNamesList(createdIssue.getFixVersions());
View Full Code Here

    // test worklog author
    final Issue issue = client.getIssueClient().getIssue(issueKey, pm);
    final Worklog worklog = issue.getWorklogs().iterator().next();
    assertNotNull(worklog);
    final BasicUser author = worklog.getAuthor();
    assertNotNull(author);
    assertTrue(author.isSelfUriIncomplete());
  }
View Full Code Here

    // Test comment author
    final Issue issue = client.getIssueClient().getIssue(issueKey, pm);
    final Comment comment = issue.getComments().iterator().next();
    assertNotNull(comment);
    final BasicUser author = comment.getAuthor();
    assertNotNull(author);
    assertEquals(resolveURI("rest/api/" + (isJira5xOrNewer() ? "2" : "latest") + "/user?username=" + testUser), author.getSelf());
  }
View Full Code Here

TOP

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

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.