Examples of Worklog


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

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_BASIC_DEPRECATED, worklog.getAuthor());
    assertEquals(TestConstants.USER_ADMIN_BASIC_DEPRECATED, 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());
    assertNull(worklog.getVisibility());
  }
View Full Code Here

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

  }

  @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_BASIC_DEPRECATED, worklog.getAuthor());
    assertEquals(TestConstants.USER1_BASIC_DEPRECATED, 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

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

  }

  @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

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

  }

  @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

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

  }

  @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

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

        resolveURI("rest/api/2/issue/10010/worklog/10012"),
        resolveURI("rest/api/2/issue/10010/worklog/10020"),
        resolveURI("rest/api/2/issue/10010/worklog/10021")
    ));

    final Worklog actualWorklog = Iterables.getLast(worklogs);
    final Worklog expectedWorklog = new Worklog(resolveURI("rest/api/2/issue/10010/worklog/10021"),
        resolveURI("rest/api/latest/issue/10010"), IntegrationTestUtil.USER_ADMIN, IntegrationTestUtil.USER_ADMIN,
        "Another work for 7 min", toDateTime("2010-08-27T15:00:02.104"), toDateTime("2010-08-27T15:00:02.104"),
        toDateTime("2010-08-27T14:59:00.000"), 7, null);
    assertEquals(expectedWorklog, actualWorklog);
View Full Code Here

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

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

    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

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

    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

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

    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
TOP
Copyright © 2018 www.massapi.com. 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.