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

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


    final Collection<Transition.Field> fields = Lists.newArrayList();
    while(keys.hasNext()) {
      final String fieldId = keys.next().toString();
      fields.add(transitionFieldJsonParser.parse(fieldsObj.getJSONObject(fieldId), fieldId));
    }
        return new Transition(name, id, fields);
    }
View Full Code Here


    public Transition parse(JSONObject json, int id) throws JSONException {
        final String name = json.getString("name");
        final Collection<Transition.Field> fields = JsonParseUtil.parseJsonArray(json.getJSONArray("fields"),
                transitionFieldJsonParser);
        return new Transition(name, id, fields);
    }
View Full Code Here

  @Test
  public void testGetResolution() {
    final Issue issue = client.getIssueClient().getIssue("TST-2", pm);
    assertNull(issue.getResolution());
    final Iterable<Transition> transitions = client.getIssueClient().getTransitions(issue, pm);
    final Transition resolveTransition = TestUtil.getTransitionByName(transitions, "Resolve Issue");

    client.getIssueClient().transition(issue, new TransitionInput(resolveTransition.getId()), pm);

    final Issue resolvedIssue = client.getIssueClient().getIssue("TST-2", pm);
    final BasicResolution basicResolution = resolvedIssue.getResolution();
    assertNotNull(basicResolution);
View Full Code Here

    }
  }

  @Nullable
  public static Transition getTransitionByName(Iterable<Transition> transitions, String transitionName) {
    Transition transitionFound = null;
    for (Transition transition : transitions) {
      if (transition.getName().equals(transitionName)) {
        transitionFound = transition;
        break;
      }
View Full Code Here

public class TransitionJsonParserTest {
    @Test
    public void testParse() throws Exception {
        final TransitionJsonParser parser = new TransitionJsonParser();

        final Transition transition = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/transition/valid.json"), 5);
        assertEquals(4, Iterables.size(transition.getFields()));
        assertEquals(new Transition.Field("assignee", false, "com.opensymphony.user.User", null), Iterables.getLast(transition.getFields()));
        assertEquals(5, transition.getId());
    }
View Full Code Here

          final Iterator<String> iterator = jsonObject.keys();
          while (iterator.hasNext()) {
            final String key = iterator.next();
            try {
              final int id = Integer.parseInt(key);
              final Transition transition = transitionJsonParser.parse(jsonObject.getJSONObject(key), id);
              transitions.add(transition);
            } catch (JSONException e) {
              throw new RestClientException(e);
            } catch (NumberFormatException e) {
              throw new RestClientException("Transition id should be an integer, but found [" + key + "]", e);
View Full Code Here

  @Test
  public void testGetTransitions() throws Exception {
    final Issue issue = client.getIssueClient().getIssue("TST-1", new NullProgressMonitor());
    final Iterable<Transition> transitions = client.getIssueClient().getTransitions(issue, pm);
    assertEquals(4, Iterables.size(transitions));
    assertTrue(Iterables.contains(transitions, new Transition("Start Progress", IntegrationTestUtil.START_PROGRESS_TRANSITION_ID, Collections.<Transition.Field>emptyList())));
  }
View Full Code Here

  @Test
  public void testTransition() throws Exception {
    final Issue issue = client.getIssueClient().getIssue("TST-1", new NullProgressMonitor());
    final Iterable<Transition> transitions = client.getIssueClient().getTransitions(issue, pm);
    assertEquals(4, Iterables.size(transitions));
    final Transition startProgressTransition = new Transition("Start Progress", IntegrationTestUtil.START_PROGRESS_TRANSITION_ID, Collections.<Transition.Field>emptyList());
    assertTrue(Iterables.contains(transitions, startProgressTransition));

    client.getIssueClient().transition(issue, new TransitionInput(IntegrationTestUtil.START_PROGRESS_TRANSITION_ID,
        Collections.<FieldInput>emptyList(), Comment.valueOf("My test comment")), new NullProgressMonitor()) ;
    final Issue transitionedIssue = client.getIssueClient().getIssue("TST-1", new NullProgressMonitor());
    assertEquals("In Progress", transitionedIssue.getStatus().getName());
    final Iterable<Transition> transitionsAfterTransition = client.getIssueClient().getTransitions(issue, pm);
    assertFalse(Iterables.contains(transitionsAfterTransition, startProgressTransition));
    final Transition stopProgressTransition = new Transition("Stop Progress", IntegrationTestUtil.STOP_PROGRESS_TRANSITION_ID, Collections.<Transition.Field>emptyList());
    assertTrue(Iterables.contains(transitionsAfterTransition, stopProgressTransition));
  }
View Full Code Here

      restClient.getIssueClient().watch(watchers.getSelf(), pm);
    }

    // now let's start progress on this issue
    final Iterable<Transition> transitions = restClient.getIssueClient().getTransitions(issue.getTransitionsUri(), pm);
    final Transition startProgressTransition = getTransitionByName(transitions, "Start Progress");
    restClient.getIssueClient().transition(issue.getTransitionsUri(), new TransitionInput(startProgressTransition.getId()), pm);

    // and now let's resolve it as Incomplete
    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

  @Test
  public void testGetResolution() {
    final Issue issue = client.getIssueClient().getIssue("TST-2", pm);
    assertNull(issue.getResolution());
    final Iterable<Transition> transitions = client.getIssueClient().getTransitions(issue, pm);
    final Transition resolveTransition = TestUtil.getTransitionByName(transitions, "Resolve Issue");

    client.getIssueClient().transition(issue, new TransitionInput(resolveTransition.getId()), pm);

    final Issue resolvedIssue = client.getIssueClient().getIssue("TST-2", pm);
    final BasicResolution basicResolution = resolvedIssue.getResolution();
    assertNotNull(basicResolution);
View Full Code Here

TOP

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

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.