use of org.sonar.server.user.index.UserDoc in project sonarqube by SonarSource.
the class MyNewIssuesEmailTemplateTest method setUp.
@Before
public void setUp() {
EmailSettings settings = mock(EmailSettings.class);
when(settings.getServerBaseURL()).thenReturn("http://nemo.sonarsource.org");
i18n = mock(DefaultI18n.class);
date = new Date();
userIndex = mock(UserIndex.class);
// returns the login passed in parameter
when(userIndex.getNullableByLogin(anyString())).thenAnswer(new Answer<UserDoc>() {
@Override
public UserDoc answer(InvocationOnMock invocationOnMock) throws Throwable {
return new UserDoc().setName((String) invocationOnMock.getArguments()[0]);
}
});
when(i18n.message(any(Locale.class), eq("severity.BLOCKER"), anyString())).thenReturn("Blocker");
when(i18n.message(any(Locale.class), eq("severity.CRITICAL"), anyString())).thenReturn("Critical");
when(i18n.message(any(Locale.class), eq("severity.MAJOR"), anyString())).thenReturn("Major");
when(i18n.message(any(Locale.class), eq("severity.MINOR"), anyString())).thenReturn("Minor");
when(i18n.message(any(Locale.class), eq("severity.INFO"), anyString())).thenReturn("Info");
underTest = new MyNewIssuesEmailTemplate(settings, i18n);
}
use of org.sonar.server.user.index.UserDoc in project sonarqube by SonarSource.
the class NewIssuesEmailTemplateTest method setUp.
@Before
public void setUp() {
EmailSettings settings = mock(EmailSettings.class);
when(settings.getServerBaseURL()).thenReturn("http://nemo.sonarsource.org");
i18n = mock(DefaultI18n.class);
userIndex = mock(UserIndex.class);
// returns the login passed in parameter
when(userIndex.getNullableByLogin(anyString())).thenAnswer(new Answer<UserDoc>() {
@Override
public UserDoc answer(InvocationOnMock invocationOnMock) throws Throwable {
return new UserDoc().setName((String) invocationOnMock.getArguments()[0]);
}
});
when(i18n.message(any(Locale.class), eq("severity.BLOCKER"), anyString())).thenReturn("Blocker");
when(i18n.message(any(Locale.class), eq("severity.CRITICAL"), anyString())).thenReturn("Critical");
when(i18n.message(any(Locale.class), eq("severity.MAJOR"), anyString())).thenReturn("Major");
when(i18n.message(any(Locale.class), eq("severity.MINOR"), anyString())).thenReturn("Minor");
when(i18n.message(any(Locale.class), eq("severity.INFO"), anyString())).thenReturn("Info");
template = new NewIssuesEmailTemplate(settings, i18n);
}
use of org.sonar.server.user.index.UserDoc in project sonarqube by SonarSource.
the class MetricsActionTest method setUp.
@Before
public void setUp() throws Exception {
es.putDocuments(UserIndexDefinition.INDEX_TYPE_USER.getIndex(), UserIndexDefinition.INDEX_TYPE_USER.getType(), new UserDoc().setLogin("login").setName("Login").setEmail("login@login.com").setActive(true));
ws = new WsTester(new CustomMeasuresWs(new MetricsAction(dbClient, userSession, new ComponentFinder(dbClient))));
defaultProject = insertDefaultProject();
userSession.logIn().addProjectUuidPermissions(UserRole.ADMIN, defaultProject.uuid());
}
Aggregations