Search in sources :

Example 6 with WsTester

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

the class LanguageWsTest method setUp.

@Before
public void setUp() {
    Mockito.when(languages.all()).thenReturn(new Language[] { new Ook(), new LolCode(), new Whitespace(), new ArnoldC() });
    tester = new WsTester(new LanguageWs(new ListAction(languages)));
}
Also used : WsTester(org.sonar.server.ws.WsTester) Before(org.junit.Before)

Example 7 with WsTester

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

the class CreateActionTest method setUp.

@Before
public void setUp() {
    ws = new WsTester(new CustomMeasuresWs(new CreateAction(dbClient, userSession, System2.INSTANCE, new CustomMeasureValidator(newFullTypeValidations()), new CustomMeasureJsonWriter(new UserJsonWriter(userSession)), new ComponentFinder(dbClient))));
    db.getDbClient().userDao().insert(dbSession, new UserDto().setLogin("login").setName("Login").setEmail("login@login.com").setActive(true));
    dbSession.commit();
    userSession.logIn("login").addProjectUuidPermissions(UserRole.ADMIN, DEFAULT_PROJECT_UUID);
}
Also used : ComponentFinder(org.sonar.server.component.ComponentFinder) WsTester(org.sonar.server.ws.WsTester) UserJsonWriter(org.sonar.server.user.ws.UserJsonWriter) UserDto(org.sonar.db.user.UserDto) Before(org.junit.Before)

Example 8 with WsTester

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

the class CreateActionTest method setUp.

@Before
public void setUp() {
    ws = new WsTester(new MetricsWs(new CreateAction(dbClient, userSessionRule)));
    userSessionRule.logIn().setSystemAdministrator();
}
Also used : WsTester(org.sonar.server.ws.WsTester) Before(org.junit.Before)

Example 9 with WsTester

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

the class DeleteActionTest method setUp.

@Before
public void setUp() {
    userSessionRule.logIn().setSystemAdministrator();
    ws = new WsTester(new MetricsWs(new DeleteAction(dbClient, userSessionRule)));
    metricDao = dbClient.metricDao();
}
Also used : WsTester(org.sonar.server.ws.WsTester) Before(org.junit.Before)

Example 10 with WsTester

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

the class UpdateActionTest method setUp.

@Before
public void setUp() {
    ws = new WsTester(new MetricsWs(new UpdateAction(dbClient, userSessionRule)));
    userSessionRule.logIn().setSystemAdministrator();
}
Also used : WsTester(org.sonar.server.ws.WsTester) 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