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

Examples of com.atlassian.jira.rest.client.api.domain.TimeTracking


    final SearchResult searchResult = client.getSearchClient().searchJql("key=TST-2", null, null, "*all").claim();
    final Issue issue = Iterables.getOnlyElement(searchResult.getIssues());

    assertEquals("TST-2", issue.getKey());
    assertEquals("Testing attachem2", issue.getSummary());
    assertEquals(new TimeTracking(0, 0, 145), issue.getTimeTracking());
    assertThat(issue.getComponents(), NamedEntityMatchers.entitiesWithNames("Component A", "Component B"));

    // comments
    final Iterable<Comment> comments = issue.getComments();
    assertEquals(3, Iterables.size(comments));
View Full Code Here


  @Override
  public TimeTracking parse(JSONObject json) throws JSONException {
    final Integer originalEstimateMinutes = JsonParseUtil.parseOptionInteger(json, "timeoriginalestimate");
    final Integer timeRemainingMinutes = JsonParseUtil.parseOptionInteger(json, "timeestimate");
    final Integer timeSpentMinutes = JsonParseUtil.parseOptionInteger(json, "timespent");
    return new TimeTracking(originalEstimateMinutes, timeRemainingMinutes, timeSpentMinutes);
  }
View Full Code Here

  @Override
  public TimeTracking parse(JSONObject json) throws JSONException {
    final Integer originalEstimateMinutes = JsonParseUtil.parseOptionInteger(json, "originalEstimateSeconds");
    final Integer timeRemainingMinutes = JsonParseUtil.parseOptionInteger(json, "remainingEstimateSeconds");
    final Integer timeSpentMinutes = JsonParseUtil.parseOptionInteger(json, "timeSpentSeconds");
    return new TimeTracking(originalEstimateMinutes != null ? originalEstimateMinutes / 60 : null,
        timeRemainingMinutes != null ? timeRemainingMinutes / 60 : null,
        timeSpentMinutes != null ? timeSpentMinutes / 60 : null);
  }
View Full Code Here

      worklogs = Collections.emptyList();
    }


    final BasicWatchers watchers = getOptionalNestedField(s, WATCHER_FIELD.id, watchersJsonParser);
    final TimeTracking timeTracking = getOptionalNestedField(s, TIMETRACKING_FIELD.id, new TimeTrackingJsonParserV5());

    final Set<String> labels = Sets
        .newHashSet(parseOptionalArrayNotNullable(s, jsonWeakParserForString, FIELDS, LABELS_FIELD.id));

    final Collection<ChangelogGroup> changelog = parseOptionalArray(
View Full Code Here

public class TimeTrackingJsonParserTest {
  @Test
  public void testParse() throws Exception {
    final TimeTrackingJsonParser parser = new TimeTrackingJsonParser();
    final TimeTracking timeTracking = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/timeTracking/valid.json")
        .getJSONObject("value"));
    Assert.assertEquals(new TimeTracking(1500, 70, 190), timeTracking);
  }
View Full Code Here

  }

  @Test
  public void testParseNoEstimation() throws Exception {
    final TimeTrackingJsonParser parser = new TimeTrackingJsonParser();
    final TimeTracking timeTracking = parser.parse(ResourceUtil
        .getJsonObjectFromResource("/json/timeTracking/valid-no-estimation.json").getJSONObject("value"));
    Assert.assertEquals(new TimeTracking(null, 170, 9), timeTracking);
  }
View Full Code Here

  }

  @Test
  public void testParseJustLoggedTime() throws Exception {
    final TimeTrackingJsonParser parser = new TimeTrackingJsonParser();
    final TimeTracking timeTracking = parser.parse(ResourceUtil
        .getJsonObjectFromResource("/json/timeTracking/valid-just-timespent.json").getJSONObject("value"));
    Assert.assertEquals(new TimeTracking(null, null, 840), timeTracking);
  }
View Full Code Here

        } else if ("datetime".equals(fieldType)) {
          value = JsonParseUtil.formatDateTime(new DateTime());
        } else if ("array".equals(fieldType) && "string".equals(fieldInfo.getSchema().getItems())) {
          value = ImmutableList.of("one", "two", "three");
        } else if ("timetracking".equals(fieldType)) {
          value = new TimeTracking(60, 40, null); // time spent is not allowed
        } else {
          if (fieldInfo.isRequired()) {
            fail("I don't know how to fill that required field, sorry.");
          } else {
            log.log("\t\t| field value is not required, leaving blank");
View Full Code Here

    final SearchResult searchResult = client.getSearchClient().searchJql(jql, null, null, fields).claim();
    final Issue issue = Iterables.getOnlyElement(searchResult.getIssues());

    assertEquals("TST-2", issue.getKey());
    assertEquals("Testing attachem2", issue.getSummary());
    assertEquals(new TimeTracking(0, 0, 145), issue.getTimeTracking());
    assertThat(issue.getComponents(), NamedEntityMatchers.entitiesWithNames("Component A", "Component B"));

    // comments
    final Iterable<Comment> comments = issue.getComments();
    assertEquals(3, Iterables.size(comments));
View Full Code Here

TOP

Related Classes of com.atlassian.jira.rest.client.api.domain.TimeTracking

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.