Package org.sonar.core.user

Examples of org.sonar.core.user.DefaultUser


    @Override
    public IssueHandler.Context assign(@Nullable String assignee) {
      User user = null;
      if(assignee != null) {
        user = new DefaultUser().setLogin(assignee).setName(assignee);
      }
      updater.assign(issue, user, changeContext);
      return this;
    }
View Full Code Here


    updater = new IssueUpdater();
  }

  @Test
  public void assign() throws Exception {
    User user = new DefaultUser().setLogin("emmerik").setName("Emmerik");

    boolean updated = updater.assign(issue, user, context);
    assertThat(updated).isTrue();
    assertThat(issue.assignee()).isEqualTo("emmerik");
    assertThat(issue.mustSendNotifications()).isTrue();
View Full Code Here

    assertThat(diff.newValue()).isNull();
  }

  @Test
  public void change_assignee() throws Exception {
    User user = new DefaultUser().setLogin("emmerik").setName("Emmerik");

    issue.setAssignee("morgan");
    boolean updated = updater.assign(issue, user, context);
    assertThat(updated).isTrue();
    assertThat(issue.assignee()).isEqualTo("emmerik");
View Full Code Here

    assertThat(diff.newValue()).isEqualTo("Emmerik");
  }

  @Test
  public void not_change_assignee() throws Exception {
    User user = new DefaultUser().setLogin("morgan").setName("Morgan");

    issue.setAssignee("morgan");
    boolean updated = updater.assign(issue, user, context);
    assertThat(updated).isFalse();
    assertThat(issue.currentChange()).isNull();
View Full Code Here

import static org.mockito.Mockito.*;

public class SetAssigneeTest {
  @Test
  public void assign() throws Exception {
    User user = new DefaultUser().setLogin("eric").setName("eric");
    SetAssignee function = new SetAssignee(user);
    Function.Context context = mock(Function.Context.class);
    function.execute(context);
    verify(context, times(1)).setAssignee(user);
  }
View Full Code Here

      .setAssignee("john")
      .setReporter("steven")
      .setAuthorLogin("Henry");
    when(issueService.getByKey(issue.key())).thenReturn(issue);

    when(userFinder.findByLogin("john")).thenReturn(new DefaultUser().setLogin("john").setName("John"));
    when(userFinder.findByLogin("steven")).thenReturn(new DefaultUser().setLogin("steven").setName("Steven"));

    MockUserSession.set();
    WsTester.TestRequest request = tester.newGetRequest("api/issues", "show").setParam("key", issue.key());
    request.execute().assertJson(getClass(), "show_issue_with_users.json");
  }
View Full Code Here

        .setMarkdownText("Another comment")
        .setUserLogin("arthur")
        .setCreatedAt(date2)
      ));

    when(userFinder.findByLogin("john")).thenReturn(new DefaultUser().setLogin("john").setName("John"));
    when(userFinder.findByLogin("arthur")).thenReturn(new DefaultUser().setLogin("arthur").setName("Arthur"));

    when(i18n.ageFromNow(any(Locale.class), eq(date1))).thenReturn("9 days");
    when(i18n.ageFromNow(any(Locale.class), eq(date2))).thenReturn("10 days");

    MockUserSession.set().setLogin("arthur");
View Full Code Here

    when(issueService.getByKey(issue.key())).thenReturn(issue);

    Date date1 = DateUtils.parseDateTime("2014-02-22T19:10:03+0100");
    Date date2 = DateUtils.parseDateTime("2014-02-23T19:10:03+0100");

    List<User> users = Lists.<User>newArrayList(new DefaultUser().setLogin("john").setName("John"));
    FieldDiffs userChange = new FieldDiffs()
      .setUserLogin("john")
      .setDiff("actionPlan", null, "1.0")
      .setCreationDate(date1);
    FieldDiffs scanChange = new FieldDiffs()
View Full Code Here

      .setCreationDate(SIMPLE_DATE_FORMAT.parse("2013-04-24"))
      .setUpdateDate(SIMPLE_DATE_FORMAT.parse("2013-04-25"))
      .setNew(false);
    when(ruleFinder.findByKey(RuleKey.of("squid", "AvoidCycles"))).thenReturn(new Rule().setName("Avoid Cycles"));
    when(jsonReport.getIssues()).thenReturn(Lists.newArrayList(issue));
    DefaultUser user1 = new DefaultUser().setLogin("julien").setName("Julien");
    DefaultUser user2 = new DefaultUser().setLogin("simon").setName("Simon");
    when(userFinder.findByLogins(anyListOf(String.class))).thenReturn(Lists.<User>newArrayList(user1, user2));

    StringWriter writer = new StringWriter();
    jsonReport.writeJson(writer);
View Full Code Here

    action = new AssignAction(userFinder, issueUpdater);
  }

  @Test
  public void should_execute() {
    User assignee = new DefaultUser();

    Map<String, Object> properties = newHashMap();
    properties.put(AssignAction.VERIFIED_ASSIGNEE, assignee);
    DefaultIssue issue = mock(DefaultIssue.class);
View Full Code Here

TOP

Related Classes of org.sonar.core.user.DefaultUser

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.