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

Examples of com.atlassian.jira.rest.client.domain.input.WorklogInput


    ADMIN = new BasicUser(new URI("http://localhost:2990/jira/rest/api/2/user?username=admin"), "admin", "Administrator");
  }

  @Test
  public void testGenerate() throws JSONException {
    final WorklogInput worklogInput = new WorklogInput(
        toUri("http://localhost:8090/jira/rest/api/latest/worklog/10010"),
        toUri("http://localhost:8090/jira/rest/api/latest/issue/TST-2"), USER, ADMIN, "my first work",
        JsonParseUtil.parseDateTime("2010-08-15T16:35:00.000+0200"), 60, Visibility.group("some-group"));

    assertThat(generator.generate(worklogInput), JSONObjectMatcher.isEqual(
View Full Code Here


        ResourceUtil.getJsonObjectFromResource("/json/worklogInput/valid.json")));
  }

  @Test
  public void testGenerateWithoutVisibility() throws JSONException {
    final WorklogInput worklogInput = new WorklogInput(
        toUri("http://localhost:8090/jira/rest/api/latest/worklog/10010"),
        toUri("http://localhost:8090/jira/rest/api/latest/issue/TST-2"), ADMIN, USER, "my first work",
        JsonParseUtil.parseDateTime("2010-08-15T16:35:00.000+0200"), 60, null);

    assertThat(generator.generate(worklogInput), JSONObjectMatcher.isEqual(
View Full Code Here

        ResourceUtil.getJsonObjectFromResource("/json/worklogInput/valid-without-visibility.json")));
  }

  @Test
  public void testGenerateWithoutAuthorAndUpdateAuthor() throws JSONException {
    final WorklogInput worklogInput = new WorklogInput(
        toUri("http://localhost:8090/jira/rest/api/latest/worklog/10010"),
        toUri("http://localhost:8090/jira/rest/api/latest/issue/TST-2"), null, null, "my first work",
        JsonParseUtil.parseDateTime("2010-08-15T16:35:00.000+0200"), 60, Visibility.group("some-group"));

    assertThat(generator.generate(worklogInput), JSONObjectMatcher.isEqual(
View Full Code Here

    // get issue
    final Issue initialIssue = issueClient.getIssue(issueKey, pm);

    // # First change - test auto
    final WorklogInput worklogInput = worklogInputBuilder
        .setIssueUri(initialIssue.getSelf())
        .setMinutesSpent(2)
        .build();
    issueClient.addWorklog(initialIssue.getWorklogUri(), worklogInput, pm);

    // check if estimate has changed
    final Issue issueAfterFirstChange = issueClient.getIssue(issueKey, pm);
    final Integer actualTimeSpentAfterChange = getTimeSpentMinutesNotNull(issueAfterFirstChange.getTimeTracking());
    final Integer expectedTimeSpentAfterChange = getTimeSpentMinutesNotNull(initialIssue.getTimeTracking()) + worklogInput.getMinutesSpent();
    assertEquals(expectedTimeSpentAfterChange, actualTimeSpentAfterChange);

    final int actualRemainingEstimate = getRemainingEstimateMinutesNotNull(issueAfterFirstChange.getTimeTracking());
    final int expectedRemaningEstimate = getRemainingEstimateMinutesNotNull(initialIssue.getTimeTracking()) - worklogInput.getMinutesSpent();
    assertEquals(expectedRemaningEstimate, actualRemainingEstimate);

    // # Second change - test new; also we want to be sure that logged time are added, and not set to given value
    final Integer newEstimateValue = 15;
    final WorklogInput worklogInput2 = worklogInputBuilder
        .setIssueUri(initialIssue.getSelf())
        .setMinutesSpent(2)
        .setAdjustEstimateNew(newEstimateValue)
        .build();
    issueClient.addWorklog(initialIssue.getWorklogUri(), worklogInput2, pm);

    // check if logged time has changed
    final Issue issueAfterSecondChange = issueClient.getIssue(issueKey, pm);
    final Integer actualTimeSpentAfterChange2 = getTimeSpentMinutesNotNull(issueAfterSecondChange.getTimeTracking());
    final Integer expectedTimeSpentAfterChange2 = getTimeSpentMinutesNotNull(issueAfterFirstChange.getTimeTracking()) + worklogInput2.getMinutesSpent();
    assertEquals(expectedTimeSpentAfterChange2, actualTimeSpentAfterChange2);

    // check if estimate has changed
    final Integer actualRemainingEstimate2 = getRemainingEstimateMinutesNotNull(issueAfterSecondChange.getTimeTracking());
    assertEquals(newEstimateValue, actualRemainingEstimate2);

    // # Third change - test leave
    final WorklogInput worklogInput3 = worklogInputBuilder
        .setIssueUri(initialIssue.getSelf())
        .setMinutesSpent(2)
        .setAdjustEstimateLeave()
        .build();
    issueClient.addWorklog(initialIssue.getWorklogUri(), worklogInput3, pm);

    // check if logged time has changed
    final Issue issueAfterThirdChange = issueClient.getIssue(issueKey, pm);
    final Integer actualTimeSpentAfterChange3 = getTimeSpentMinutesNotNull(issueAfterThirdChange.getTimeTracking());
    final Integer expectedTimeSpentAfterChange3 = getTimeSpentMinutesNotNull(issueAfterSecondChange.getTimeTracking()) + worklogInput3.getMinutesSpent();
    assertEquals(expectedTimeSpentAfterChange3, actualTimeSpentAfterChange3);

    // check if estimate has NOT changed
    final Integer actualRemainingEstimate3 = getRemainingEstimateMinutesNotNull(issueAfterThirdChange.getTimeTracking());
    final Integer expectedRemainingEstimate3 = getRemainingEstimateMinutesNotNull(issueAfterSecondChange.getTimeTracking());
    assertEquals(expectedRemainingEstimate3, actualRemainingEstimate3);

    // # Fourth change - test manual
    final int reduceByValueManual = 7;
    final WorklogInput worklogInput4 = worklogInputBuilder
        .setIssueUri(initialIssue.getSelf())
        .setMinutesSpent(2)
        .setAdjustEstimateManual(reduceByValueManual)
        .build();

    issueClient.addWorklog(initialIssue.getWorklogUri(), worklogInput4, pm);

    // check if logged time has changed
    final Issue issueAfterFourthChange = issueClient.getIssue(issueKey, pm);
    final Integer actualTimeSpentAfterChange4 = getTimeSpentMinutesNotNull(issueAfterFourthChange.getTimeTracking());
    final Integer expectedTimeSpentAfterChange4 = getTimeSpentMinutesNotNull(issueAfterThirdChange.getTimeTracking()) + worklogInput4.getMinutesSpent();
    assertEquals(expectedTimeSpentAfterChange4, actualTimeSpentAfterChange4);

    // check if estimate has NOT changed
    final Integer actualRemainingEstimate4 = getRemainingEstimateMinutesNotNull(issueAfterFourthChange.getTimeTracking());
    final Integer expectedRemainingEstimate4 = getRemainingEstimateMinutesNotNull(issueAfterThirdChange.getTimeTracking()) - reduceByValueManual;
View Full Code Here

    // add worklog
    final int estimateWeeks = 2;
    final int estimateDays = 3;
    final int estimateHours = 4;
    final int estimateMinutes = 7;
    final WorklogInput worklogInput = worklogInputBuilder
        .setIssueUri(initialIssue.getSelf())
        .setAdjustEstimateNew(String.format("%sw %sd %sh %sm", estimateWeeks, estimateDays, estimateHours, estimateMinutes))
        .build();
    issueClient.addWorklog(initialIssue.getWorklogUri(), worklogInput, pm);
View Full Code Here

    // get initial worklogs
    final Issue issue = issueClient.getIssue(issueKey, pm);
    final Set<Worklog> initialWorklogs = ImmutableSet.copyOf(issue.getWorklogs());

    // create and add new
    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

    USER = new BasicUser(new URI("http://localhost:2990/jira/rest/api/2/user?username=wseliga"), "wseliga", "Wojciech Seliga");
  }

  @Test
  public void testGenerate() throws JSONException {
    final WorklogInput worklogInput = new WorklogInput(
        toUri("http://localhost:8090/jira/rest/api/latest/worklog/10010"),
        toUri("http://localhost:8090/jira/rest/api/latest/issue/TST-2"), USER, USER, "my first work",
        JsonParseUtil.parseDateTime("2010-08-15T16:35:00.000+0200"), 60, Visibility.group("some-group"));

    assertThat(generator.generate(worklogInput), JSONObjectMatcher.isEqual(
View Full Code Here

        ResourceUtil.getJsonObjectFromResource("/json/worklogInput/valid.json")));
  }

  @Test
  public void testGenerateWithoutVisibility() throws JSONException {
    final WorklogInput worklogInput = new WorklogInput(
        toUri("http://localhost:8090/jira/rest/api/latest/worklog/10010"),
        toUri("http://localhost:8090/jira/rest/api/latest/issue/TST-2"), USER, USER, "my first work",
        JsonParseUtil.parseDateTime("2010-08-15T16:35:00.000+0200"), 60, null);

    assertThat(generator.generate(worklogInput), JSONObjectMatcher.isEqual(
View Full Code Here

        ResourceUtil.getJsonObjectFromResource("/json/worklogInput/valid-without-visibility.json")));
  }

  @Test
  public void testGenerateWithoutAuthorAndUpdateAuthor() throws JSONException {
    final WorklogInput worklogInput = new WorklogInput(
        toUri("http://localhost:8090/jira/rest/api/latest/worklog/10010"),
        toUri("http://localhost:8090/jira/rest/api/latest/issue/TST-2"), null, null, "my first work",
        JsonParseUtil.parseDateTime("2010-08-15T16:35:00.000+0200"), 60, Visibility.group("some-group"));

    assertThat(generator.generate(worklogInput), JSONObjectMatcher.isEqual(
View Full Code Here

    // get issue
    final Issue initialIssue = issueClient.getIssue(issueKey, pm);

    // # First change - test auto
    final WorklogInput worklogInput = worklogInputBuilder
        .setIssueUri(initialIssue.getSelf())
        .setMinutesSpent(2)
        .build();
    issueClient.addWorklog(initialIssue.getWorklogUri(), worklogInput, pm);

    // check if estimate nad logged has changed
    final Issue issueAfterFirstChange = issueClient.getIssue(issueKey, pm);
    final Integer actualTimeSpentAfterChange = getTimeSpentMinutesNotNull(issueAfterFirstChange.getTimeTracking());
    final Integer expectedTimeSpentAfterChange = getTimeSpentMinutesNotNull(initialIssue.getTimeTracking()) + worklogInput.getMinutesSpent();
    assertEquals(expectedTimeSpentAfterChange, actualTimeSpentAfterChange);

    final int actualRemainingEstimate = getRemainingEstimateMinutesNotNull(issueAfterFirstChange.getTimeTracking());
    final int expectedRemaningEstimate = getRemainingEstimateMinutesNotNull(initialIssue.getTimeTracking()) - worklogInput.getMinutesSpent();
    assertEquals(expectedRemaningEstimate, actualRemainingEstimate);

    // # Second change - test new; also we want to be sure that logged time are added, and not set to given value
    final Integer newEstimateValue = 15;
    final WorklogInput worklogInput2 = worklogInputBuilder
        .setIssueUri(initialIssue.getSelf())
        .setMinutesSpent(2)
        .setAdjustEstimateNew(newEstimateValue.toString())
        .build();
    issueClient.addWorklog(initialIssue.getWorklogUri(), worklogInput2, pm);

    // check if logged time has changed
    final Issue issueAfterSecondChange = issueClient.getIssue(issueKey, pm);
    final Integer actualTimeSpentAfterChange2 = getTimeSpentMinutesNotNull(issueAfterSecondChange.getTimeTracking());
    final Integer expectedTimeSpentAfterChange2 = getTimeSpentMinutesNotNull(issueAfterFirstChange.getTimeTracking()) + worklogInput2.getMinutesSpent();
    assertEquals(expectedTimeSpentAfterChange2, actualTimeSpentAfterChange2);

    // check if estimate has changed
    final Integer actualRemainingEstimate2 = getRemainingEstimateMinutesNotNull(issueAfterSecondChange.getTimeTracking());
    assertEquals(newEstimateValue, actualRemainingEstimate2);

    // # Third change - test leave
    final WorklogInput worklogInput3 = worklogInputBuilder
        .setIssueUri(initialIssue.getSelf())
        .setMinutesSpent(2)
        .setAdjustEstimateLeave()
        .build();
    issueClient.addWorklog(initialIssue.getWorklogUri(), worklogInput3, pm);

    // check if logged time has changed
    final Issue issueAfterThirdChange = issueClient.getIssue(issueKey, pm);
    final Integer actualTimeSpentAfterChange3 = getTimeSpentMinutesNotNull(issueAfterThirdChange.getTimeTracking());
    final Integer expectedTimeSpentAfterChange3 = getTimeSpentMinutesNotNull(issueAfterSecondChange.getTimeTracking()) + worklogInput3.getMinutesSpent();
    assertEquals(expectedTimeSpentAfterChange3, actualTimeSpentAfterChange3);

    // check if estimate has NOT changed
    final Integer actualRemainingEstimate3 = getRemainingEstimateMinutesNotNull(issueAfterThirdChange.getTimeTracking());
    final Integer expectedRemainingEstimate3 = getRemainingEstimateMinutesNotNull(issueAfterSecondChange.getTimeTracking());
    assertEquals(expectedRemainingEstimate3, actualRemainingEstimate3);

    // # Fourth change - test manual
    final Integer reduceByValueManual = 7;
    final WorklogInput worklogInput4 = worklogInputBuilder
        .setIssueUri(initialIssue.getSelf())
        .setMinutesSpent(2)
        .setAdjustEstimateManual(reduceByValueManual.toString())
        .build();

    issueClient.addWorklog(initialIssue.getWorklogUri(), worklogInput4, pm);

    // check if logged time has changed
    final Issue issueAfterFourthChange = issueClient.getIssue(issueKey, pm);
    final Integer actualTimeSpentAfterChange4 = getTimeSpentMinutesNotNull(issueAfterFourthChange.getTimeTracking());
    final Integer expectedTimeSpentAfterChange4 = getTimeSpentMinutesNotNull(issueAfterThirdChange.getTimeTracking()) + worklogInput4.getMinutesSpent();
    assertEquals(expectedTimeSpentAfterChange4, actualTimeSpentAfterChange4);

    // check if estimate has NOT changed
    final Integer actualRemainingEstimate4 = getRemainingEstimateMinutesNotNull(issueAfterFourthChange.getTimeTracking());
    final Integer expectedRemainingEstimate4 = getRemainingEstimateMinutesNotNull(issueAfterThirdChange.getTimeTracking()) - reduceByValueManual;
View Full Code Here

TOP

Related Classes of com.atlassian.jira.rest.client.domain.input.WorklogInput

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.