Search in sources :

Example 26 with WsTester

use of org.sonar.server.ws.WsTester in project sonarqube by SonarSource.

the class UpdateActionTest method setUp.

@Before
public void setUp() {
    dbClient.groupDao().insert(session, newGroupDto().setName("sonar-users"));
    session.commit();
    userIndexer = new UserIndexer(dbClient, esTester.client());
    tester = new WsTester(new UsersWs(new UpdateAction(new UserUpdater(mock(NewUserNotifier.class), settings, dbClient, userIndexer, system2, defaultOrganizationProvider, ORGANIZATION_CREATION_NOT_USED_FOR_UPDATE), userSessionRule, new UserJsonWriter(userSessionRule), dbClient)));
}
Also used : WsTester(org.sonar.server.ws.WsTester) NewUserNotifier(org.sonar.server.user.NewUserNotifier) UserIndexer(org.sonar.server.user.index.UserIndexer) UserUpdater(org.sonar.server.user.UserUpdater) Before(org.junit.Before)

Example 27 with WsTester

use of org.sonar.server.ws.WsTester in project sonarqube by SonarSource.

the class RemoveUserActionTest method setUp.

@Before
public void setUp() {
    GroupWsSupport groupSupport = new GroupWsSupport(db.getDbClient(), defaultOrganizationProvider);
    ws = new WsTester(new UserGroupsWs(new RemoveUserAction(db.getDbClient(), userSession, groupSupport)));
}
Also used : WsTester(org.sonar.server.ws.WsTester) Before(org.junit.Before)

Example 28 with WsTester

use of org.sonar.server.ws.WsTester in project sonarqube by SonarSource.

the class UserTokensWsTest method setUp.

@Before
public void setUp() {
    UserSession userSession = mock(UserSession.class);
    DbClient dbClient = mock(DbClient.class);
    System2 system = mock(System2.class);
    TokenGenerator tokenGenerator = mock(TokenGenerator.class);
    ws = new WsTester(new UserTokensWs(new GenerateAction(dbClient, userSession, system, tokenGenerator), new RevokeAction(dbClient, userSession), new SearchAction(dbClient, userSession)));
}
Also used : TokenGenerator(org.sonar.server.usertoken.TokenGenerator) DbClient(org.sonar.db.DbClient) WsTester(org.sonar.server.ws.WsTester) UserSession(org.sonar.server.user.UserSession) System2(org.sonar.api.utils.System2) Before(org.junit.Before)

Example 29 with WsTester

use of org.sonar.server.ws.WsTester in project sonarqube by SonarSource.

the class UpdateActionTest method setUp.

@Before
public void setUp() throws Exception {
    GroupWsSupport groupSupport = new GroupWsSupport(db.getDbClient(), defaultOrganizationProvider);
    ws = new WsTester(new UserGroupsWs(new UpdateAction(db.getDbClient(), userSession, groupSupport, settings, defaultOrganizationProvider)));
    when(settings.getString(DEFAULT_GROUP_NAME_KEY)).thenReturn(DEFAULT_GROUP_NAME_VALUE);
}
Also used : WsTester(org.sonar.server.ws.WsTester) Before(org.junit.Before)

Example 30 with WsTester

use of org.sonar.server.ws.WsTester in project sonarqube by SonarSource.

the class UserGroupsWsTest method setUp.

@Before
public void setUp() {
    GroupWsSupport wsSupport = mock(GroupWsSupport.class);
    WsTester tester = new WsTester(new UserGroupsWs(new SearchAction(mock(DbClient.class), mock(UserSession.class), wsSupport), new CreateAction(mock(DbClient.class), mock(UserSession.class), wsSupport)));
    controller = tester.controller("api/user_groups");
}
Also used : DbClient(org.sonar.db.DbClient) WsTester(org.sonar.server.ws.WsTester) UserSession(org.sonar.server.user.UserSession) Before(org.junit.Before)

Aggregations

WsTester (org.sonar.server.ws.WsTester)71 Before (org.junit.Before)50 Test (org.junit.Test)21 DbClient (org.sonar.db.DbClient)18 ComponentFinder (org.sonar.server.component.ComponentFinder)15 WebService (org.sonar.api.server.ws.WebService)12 UserSession (org.sonar.server.user.UserSession)5 Languages (org.sonar.api.resources.Languages)4 QProfileFactory (org.sonar.server.qualityprofile.QProfileFactory)4 UserDto (org.sonar.db.user.UserDto)3 DefaultOrganizationProvider (org.sonar.server.organization.DefaultOrganizationProvider)3 UserJsonWriter (org.sonar.server.user.ws.UserJsonWriter)3 I18n (org.sonar.api.i18n.I18n)2 System2 (org.sonar.api.utils.System2)2 OrganizationDao (org.sonar.db.organization.OrganizationDao)2 RuleRepositoryDto (org.sonar.db.rule.RuleRepositoryDto)2 DefaultOrganization (org.sonar.server.organization.DefaultOrganization)2 UserUpdater (org.sonar.server.user.UserUpdater)2 UserIndex (org.sonar.server.user.index.UserIndex)2 Locale (java.util.Locale)1