use of org.sonar.server.user.index.UserIndex in project sonarqube by SonarSource.
the class ScmAccountToUserLoaderTest method load_by_multiple_scm_accounts_is_not_supported_yet.
@Test
public void load_by_multiple_scm_accounts_is_not_supported_yet() {
UserIndex index = new UserIndex(esTester.client());
ScmAccountToUserLoader underTest = new ScmAccountToUserLoader(index);
try {
underTest.loadAll(Collections.<String>emptyList());
fail();
} catch (UnsupportedOperationException ignored) {
}
}
use of org.sonar.server.user.index.UserIndex in project sonarqube by SonarSource.
the class ScmAccountToUserLoaderTest method load_login_for_scm_account.
@Test
public void load_login_for_scm_account() throws Exception {
UserDoc user = new UserDoc().setLogin("charlie").setName("Charlie").setEmail("charlie@hebdo.com").setActive(true).setScmAccounts(asList("charlie", "jesuis@charlie.com"));
esTester.putDocuments(UserIndexDefinition.INDEX_TYPE_USER.getIndex(), UserIndexDefinition.INDEX_TYPE_USER.getType(), user);
UserIndex index = new UserIndex(esTester.client());
ScmAccountToUserLoader underTest = new ScmAccountToUserLoader(index);
assertThat(underTest.load("missing")).isNull();
assertThat(underTest.load("jesuis@charlie.com")).isEqualTo("charlie");
}
use of org.sonar.server.user.index.UserIndex in project sonarqube by SonarSource.
the class ScmAccountToUserLoaderTest method warn_if_multiple_users_share_the_same_scm_account.
@Test
public void warn_if_multiple_users_share_the_same_scm_account() throws Exception {
UserDoc user1 = new UserDoc().setLogin("charlie").setName("Charlie").setEmail("charlie@hebdo.com").setActive(true).setScmAccounts(asList("charlie", "jesuis@charlie.com"));
esTester.putDocuments(UserIndexDefinition.INDEX_TYPE_USER.getIndex(), UserIndexDefinition.INDEX_TYPE_USER.getType(), user1);
UserDoc user2 = new UserDoc().setLogin("another.charlie").setName("Another Charlie").setActive(true).setScmAccounts(asList("charlie"));
esTester.putDocuments(UserIndexDefinition.INDEX_TYPE_USER.getIndex(), UserIndexDefinition.INDEX_TYPE_USER.getType(), user2);
UserIndex index = new UserIndex(esTester.client());
ScmAccountToUserLoader underTest = new ScmAccountToUserLoader(index);
assertThat(underTest.load("charlie")).isNull();
assertThat(logTester.logs(LoggerLevel.WARN)).contains("Multiple users share the SCM account 'charlie': another.charlie, charlie");
}
use of org.sonar.server.user.index.UserIndex in project sonarqube by SonarSource.
the class DeactivateActionTest method setUp.
@Before
public void setUp() {
userIndexer = new UserIndexer(dbClient, esTester.client());
index = new UserIndex(esTester.client());
userIndexer = new UserIndexer(dbClient, esTester.client());
ws = new WsActionTester(new DeactivateAction(dbClient, userIndexer, userSession, new UserJsonWriter(userSession), defaultOrganizationProvider));
}
use of org.sonar.server.user.index.UserIndex in project sonarqube by SonarSource.
the class UsersActionTest method before.
@Before
public void before() {
userIndex = new UserIndex(es.client());
usersAction = new UsersAction(userIndex, userSessionRule);
tester = new WsTester(new BatchWs(usersAction));
}
Aggregations