Package org.sonar.api.issue.action

Examples of org.sonar.api.issue.action.Action


      .setComponentKey("sample:src/main/xoo/sample/Sample.xoo")
      .setProjectKey("sample")
      .setRuleKey(RuleKey.of("squid", "AvoidCycle"));

    MockUserSession.set().setLogin("john");
    Action action = mock(Action.class);
    when(action.key()).thenReturn("link-to-jira");
    when(actionService.listAvailableActions(eq(issue))).thenReturn(newArrayList(action));

    testActions(issue,
      "{\"actions\": " +
        "[" +
View Full Code Here


    Preconditions.checkArgument(!Strings.isNullOrEmpty(actionKey), "Missing action");

    DbSession session = dbClient.openSession(false);
    try {
      DefaultIssue issue = issueService.getByKeyForUpdate(session, issueKey).toDefaultIssue();
      Action action = getAction(actionKey);
      if (action == null) {
        throw new IllegalArgumentException("Action is not found : " + actionKey);
      }
      if (!action.supports(issue)) {
        throw new IllegalStateException("A condition is not respected");
      }

      IssueChangeContext changeContext = IssueChangeContext.createUser(new Date(), userSession.login());
      Component project = dbClient.componentDao().getByKey(session, issue.projectKey());
      FunctionContext functionContext = new FunctionContext(issue, updater, changeContext, getProjectSettings(project));
      for (Function function : action.functions()) {
        function.execute(functionContext);
      }
      issueStorage.save(issue);
      return issue;
    } finally {
View Full Code Here

    assertThat(service.listResolutions()).isEqualTo(Issue.RESOLUTIONS);
  }

  @Test
  public void list_plugin_actions() {
    Action action = mock(Action.class);
    when(action.key()).thenReturn("link-to-jira");

    when(actionService.listAllActions()).thenReturn(newArrayList(action));

    assertThat(service.listPluginActions()).containsOnly("link-to-jira");
  }
View Full Code Here

TOP

Related Classes of org.sonar.api.issue.action.Action

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.