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

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


    final DateTime updateDate = JsonParseUtil.parseDateTime(json, "updated");
    final DateTime startDate = JsonParseUtil.parseDateTime(json, "started");
    // timeSpentSeconds is not required due to bug: JRADEV-8825 (fixed in 5.0, Iteration 14).
    final int secondsSpent = json.optInt("timeSpentSeconds", 0);
    final Visibility visibility = new VisibilityJsonParser().parseVisibility(json);
        return new Worklog(self, issue, author, updateAuthor, comment, creationDate, updateDate, startDate, secondsSpent / 60, visibility);
  }
View Full Code Here


    final DateTime creationDate = JsonParseUtil.parseDateTime(json, "created");
    final DateTime updateDate = JsonParseUtil.parseDateTime(json, "updated");
    final DateTime startDate = JsonParseUtil.parseDateTime(json, "started");
    final int minutesSpent = json.getInt("minutesSpent");
    final Visibility visibility = new VisibilityJsonParser().parseVisibility(json);
        return new Worklog(self, issueUri, author, updateAuthor, comment, creationDate, updateDate, startDate, minutesSpent, visibility);
  }
View Full Code Here

    final WorklogInput worklogInput = worklogInputBuilder.setIssueUri(issue.getSelf()).build();
    issueClient.addWorklog(issue.getWorklogUri(), worklogInput, pm);

    // check if added correctly
    final Issue issueWithWorklog = issueClient.getIssue(issueKey, pm);
    final Worklog addedWorklog = getAddedWorklog(initialWorklogs, issueWithWorklog);
    assertEquals(worklogInput.getStartDate(), addedWorklog.getStartDate());
    assertEquals(worklogInput.getMinutesSpent(), addedWorklog.getMinutesSpent());
    assertEquals(worklogInput.getIssueUri(), addedWorklog.getIssueUri());
    assertEquals(worklogInput.getComment(), addedWorklog.getComment());
    assertEquals(worklogInput.getVisibility(), worklogInput.getVisibility());
  }
View Full Code Here

    assertEquals("transparent-png.png", lastAttachment.getFilename());

    // worklogs
    final Iterable<Worklog> worklogs = issue.getWorklogs();
    assertEquals(5, Iterables.size(worklogs));
    final Worklog worklog = Iterables.get(worklogs, 2);
    assertEquals(new Worklog(toUri("http://localhost:8090/jira/rest/api/latest/worklog/10012"),
        toUri("http://localhost:8090/jira/rest/api/latest/issue/TST-2"), TestConstants.USER1,
        TestConstants.USER1, "a worklog viewable just by jira-users",
        toDateTime("2010-08-17T16:53:15.848+0200"), toDateTime("2010-08-17T16:53:15.848+0200"),
        toDateTime("2010-08-11T16:52:00.000+0200"), 3, Visibility.group("jira-users")), worklog);

    final Worklog worklog3 = Iterables.get(worklogs, 3);
    assertEquals("", worklog3.getComment());

    // comments
    assertEquals(3, Iterables.size(issue.getComments()));
    final Comment comment = issue.getComments().iterator().next();
    assertEquals(Visibility.Type.ROLE, comment.getVisibility().getType());
View Full Code Here

    @Test
    public void testParseIssueJiraRepresentationJrjc49() throws JSONException {
        final Issue issue = parseIssue("/json/issue/jrjc49.json");
        final Iterable<Worklog> worklogs = issue.getWorklogs();
        assertEquals(1, Iterables.size(worklogs));
        final Worklog worklog = Iterables.get(worklogs, 0);
        assertNull(worklog.getComment());
        assertEquals(180, worklog.getMinutesSpent());
        assertEquals("Sample, User", worklog.getAuthor().getDisplayName());

    }
View Full Code Here

public class WorklogJsonParserTest {
    @Test
    public void testParse() throws Exception {
        final WorklogJsonParser parser = new WorklogJsonParser();
        final Worklog worklog = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/worklog/valid.json"));
        assertEquals(toUri("http://localhost:8090/jira/rest/api/latest/worklog/10010"), worklog.getSelf());
        assertEquals(toUri("http://localhost:8090/jira/rest/api/latest/issue/TST-2"), worklog.getIssueUri());
        assertEquals(TestConstants.USER_ADMIN, worklog.getAuthor());
        assertEquals(TestConstants.USER_ADMIN, worklog.getUpdateAuthor());
        assertEquals("my first work", worklog.getComment());
        assertEquals(TestUtil.toDateTime("2010-08-17T16:35:47.466+0200"), worklog.getCreationDate());
        assertEquals(TestUtil.toDateTime("2010-08-17T16:35:47.466+0200"), worklog.getUpdateDate());
        assertEquals(TestUtil.toDateTime("2010-08-15T16:35:00.000+0200"), worklog.getStartDate());
        assertEquals(60, worklog.getMinutesSpent());
        Assert.assertNull(worklog.getVisibility());
    }
View Full Code Here

    }

    @Test
    public void testParseWithRoleLevel() throws Exception {
        final WorklogJsonParser parser = new WorklogJsonParser();
        final Worklog worklog = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/worklog/valid-roleLevel.json"));
        assertEquals(toUri("http://localhost:8090/jira/rest/api/latest/worklog/10011"), worklog.getSelf());
        assertEquals(toUri("http://localhost:8090/jira/rest/api/latest/issue/TST-2"), worklog.getIssueUri());
        assertEquals(TestConstants.USER1, worklog.getAuthor());
        assertEquals(TestConstants.USER1, worklog.getUpdateAuthor());
        assertEquals("another piece of work", worklog.getComment());
        assertEquals(TestUtil.toDateTime("2010-08-17T16:38:00.013+0200"), worklog.getCreationDate());
        assertEquals(TestUtil.toDateTime("2010-08-17T16:38:24.948+0200"), worklog.getUpdateDate());
        assertEquals(TestUtil.toDateTime("2010-08-17T16:37:00.000+0200"), worklog.getStartDate());
        assertEquals(Visibility.role("Developers"), worklog.getVisibility());
        assertEquals(15, worklog.getMinutesSpent());
    }
View Full Code Here

    }

    @Test
    public void testParseWithGroupLevel() throws Exception {
        final WorklogJsonParser parser = new WorklogJsonParser();
        final Worklog worklog = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/worklog/valid-groupLevel.json"));
        assertEquals(Visibility.group("jira-users"), worklog.getVisibility());
    }
View Full Code Here

    }

  @Test
  public void testParseWhenAuthorIsAnonymous() throws Exception {
    final WorklogJsonParser parser = new WorklogJsonParser();
    final Worklog worklog = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/worklog/valid-anonymousAuthor.json"));
    assertNull(worklog.getAuthor());
    assertNull(worklog.getUpdateAuthor());
  }
View Full Code Here

  }

  @Test
  public void testParseWhenAuthorIsAnonymousInOldRepresentation() throws Exception {
    final WorklogJsonParser parser = new WorklogJsonParser();
    final Worklog worklog = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/worklog/valid-anonymousAuthor-oldRepresentation.json"));
    assertNull(worklog.getAuthor());
    assertNull(worklog.getUpdateAuthor());
  }
View Full Code Here

TOP

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

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.