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

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


public class IssueUpdateJsonGeneratorTest {
    @Test
    public void testGenerate() throws Exception {
        final IssueUpdateJsonGenerator generator = new IssueUpdateJsonGenerator();
        List<FieldInput> fields = ImmutableList.of(
            new FieldInput("string", "String value"),
            new FieldInput("integer", 1),
            new FieldInput("long", 1L),
            new FieldInput("complex", new ComplexIssueInputFieldValue(ImmutableMap.<String, Object>of(
                "string", "string",
                "integer", 1,
                "long", 1L,
                "complex", ComplexIssueInputFieldValue.with("test", "id")
            )))
View Full Code Here


  @Test
  public void testGenerate() throws Exception {
    final IssueInputJsonGenerator generator = new IssueInputJsonGenerator();
    final IssueInput issueInput = IssueInput.createWithFields(
        new FieldInput("string", "String value"),
        new FieldInput("integer", 1),
        new FieldInput("long", 1L),
        new FieldInput("complex", new ComplexIssueInputFieldValue(ImmutableMap.<String, Object>of(
            "string", "string",
            "integer", 1,
            "long", 1L,
            "complex", ComplexIssueInputFieldValue.with("test", "id")
        )))
View Full Code Here

public class JerseyIssueRestClientTest extends AbstractJerseyRestClientTest {

  @Test
  public void testTransitionWithNumericCustomFieldPolishLocale() throws Exception {
    final double newValue = 123.45;
    final FieldInput fieldInput;
    if (IntegrationTestUtil.TESTING_JIRA_5_OR_NEWER) {
      fieldInput = new FieldInput(NUMERIC_CUSTOMFIELD_ID, newValue);
    } else {
      fieldInput = new FieldInput(NUMERIC_CUSTOMFIELD_ID, NumberFormat.getNumberInstance(new Locale("pl")).format(newValue));
    }
    assertTransitionWithNumericCustomField(fieldInput, newValue);
  }
View Full Code Here

  @Test
  public void testTransitionWithNumericCustomFieldEnglishLocale() throws Exception {
    setUser1();
    final double newValue = 123.45;
    final FieldInput fieldInput = new FieldInput(NUMERIC_CUSTOMFIELD_ID,
        NumberFormat.getNumberInstance(new Locale("pl")).format(newValue));

    assertErrorCode(Response.Status.BAD_REQUEST, IntegrationTestUtil.TESTING_JIRA_5_OR_NEWER
        ? "Operation value must be a number" : ("'" + fieldInput.getValue() + "' is an invalid number"), new Runnable() {
      @Override
      public void run() {
        assertTransitionWithNumericCustomField(fieldInput, newValue);
      }
    });

    final FieldInput fieldInput2 = new FieldInput(NUMERIC_CUSTOMFIELD_ID, newValue); // this will be serialized always with "." according to JSL
    assertTransitionWithNumericCustomField(fieldInput2, newValue);

  }
View Full Code Here

    assertNotNull(transitionFound);
    assertTrue(Iterables.contains(transitionFound.getFields(),
        new Transition.Field(NUMERIC_CUSTOMFIELD_ID, false, IntegrationTestUtil.TESTING_JIRA_5_OR_NEWER ? NUMERIC_CUSTOMFIELD_TYPE_V5 : NUMERIC_CUSTOMFIELD_TYPE, null)));
    final double newValue = 123;
    final FieldInput fieldInput = new FieldInput(NUMERIC_CUSTOMFIELD_ID, newValue);
    client.getIssueClient().transition(issue.getTransitionsUri(), new TransitionInput(transitionFound.getId(), Arrays.asList(fieldInput),
        Comment.valueOf("My test comment")), pm);
    final Issue changedIssue = client.getIssueClient().getIssue("TST-1", pm);
    assertEquals(newValue, changedIssue.getField(NUMERIC_CUSTOMFIELD_ID).getValue());
  }
View Full Code Here

    final Transition transitionFound = TestUtil.getTransitionByName(transitions, "Estimate");

    assertNotNull(transitionFound);
    assertTrue(Iterables.contains(transitionFound.getFields(),
        new Transition.Field(NUMERIC_CUSTOMFIELD_ID, false, TESTING_JIRA_5_OR_NEWER ? NUMERIC_CUSTOMFIELD_TYPE_V5 : NUMERIC_CUSTOMFIELD_TYPE, null)));
    final FieldInput fieldInput = new FieldInput(NUMERIC_CUSTOMFIELD_ID, "]432jl");
    // warning: Polish language here - I am asserting if the messages are indeed localized
    // since 5.0 messages are changed and not localized
    assertErrorCode(Response.Status.BAD_REQUEST, TESTING_JIRA_5_OR_NEWER
        ? "Operation value must be a number" : "']432jl' nie jest prawid\u0142ow\u0105 liczb\u0105", new Runnable() {
      @Override
View Full Code Here

    @Test
    public void testUpdateWithChangedSummary() throws Exception {
        final Issue issue = client.getIssueClient().getIssue("TST-1", pm);
        String orgSummary = issue.getSummary();
        client.getIssueClient().update(issue, ImmutableList.of(
            new FieldInput(IssueFieldId.SUMMARY_FIELD, "fooo")
        ), pm);
        Issue changedIssue = client.getIssueClient().getIssue("TST-1", pm);
        assertEquals("fooo", changedIssue.getSummary());
        client.getIssueClient().update(issue, ImmutableList.of(
            new FieldInput(IssueFieldId.SUMMARY_FIELD, orgSummary)
        ), pm);
        changedIssue = client.getIssueClient().getIssue("TST-1", pm);
        assertEquals(orgSummary, changedIssue.getSummary());
    }
View Full Code Here

    thrown.expect(RestClientException.class);
    thrown.expectMessage("project is required");

    final IssueInput issueInput = new IssueInput(ImmutableMap.of(
        "summary", new FieldInput("summary", "Summary"),
        "issuetype", new FieldInput("issuetype", ComplexIssueInputFieldValue.with("id", "1"))
    ));
    issueClient.createIssue(issueInput, pm);
  }
View Full Code Here

    final Transition resolveIssueTransition = getTransitionByName(transitions, "Resolve Issue");
    final Collection<FieldInput> fieldInputs;

    // Starting from JIRA 5, fields are handled in different way -
    if (buildNumber > ServerVersionConstants.BN_JIRA_5) {
      fieldInputs = Arrays.asList(new FieldInput("resolution", ComplexIssueInputFieldValue.with("name", "Incomplete")));
    }
    else {
      fieldInputs = Arrays.asList(new FieldInput("resolution", "Incomplete"));
    }
    final TransitionInput transitionInput = new TransitionInput(resolveIssueTransition.getId(), fieldInputs, Comment.valueOf("My comment"));
    restClient.getIssueClient().transition(issue.getTransitionsUri(), transitionInput, pm);

  }
View Full Code Here

public class JerseyIssueRestClientTest extends AbstractJerseyRestClientTest {

  @Test
  public void testTransitionWithNumericCustomFieldPolishLocale() throws Exception {
    final double newValue = 123.45;
    final FieldInput fieldInput;
    if (IntegrationTestUtil.TESTING_JIRA_5_OR_NEWER) {
      fieldInput = new FieldInput(NUMERIC_CUSTOMFIELD_ID, newValue);
    } else {
      fieldInput = new FieldInput(NUMERIC_CUSTOMFIELD_ID, NumberFormat.getNumberInstance(new Locale("pl")).format(newValue));
    }
    assertTransitionWithNumericCustomField(fieldInput, newValue);
  }
View Full Code Here

TOP

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

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.