Search in sources :

Example 41 with WsTester

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

the class SearchActionTest method setUp.

@Before
public void setUp() {
    CustomMeasureJsonWriter customMeasureJsonWriter = new CustomMeasureJsonWriter(new UserJsonWriter(userSessionRule));
    ws = new WsTester(new CustomMeasuresWs(new SearchAction(dbClient, customMeasureJsonWriter, userSessionRule, new ComponentFinder(dbClient))));
    defaultProject = insertDefaultProject();
    userSessionRule.logIn().addProjectUuidPermissions(UserRole.ADMIN, defaultProject.uuid());
    db.getDbClient().userDao().insert(dbSession, new UserDto().setLogin("login").setName("Login").setEmail("login@login.com").setActive(true));
    dbSession.commit();
}
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 42 with WsTester

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

the class UpdateActionTest method setUp.

@Before
public void setUp() {
    CustomMeasureValidator validator = new CustomMeasureValidator(newFullTypeValidations());
    ws = new WsTester(new CustomMeasuresWs(new UpdateAction(dbClient, userSessionRule, system, validator, new CustomMeasureJsonWriter(new UserJsonWriter(userSessionRule)))));
    db.getDbClient().userDao().insert(dbSession, new UserDto().setLogin("login").setName("Login").setEmail("login@login.com").setActive(true));
    dbSession.commit();
}
Also used : WsTester(org.sonar.server.ws.WsTester) UserJsonWriter(org.sonar.server.user.ws.UserJsonWriter) UserDto(org.sonar.db.user.UserDto) Before(org.junit.Before)

Example 43 with WsTester

use of org.sonar.server.ws.WsTester 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());
}
Also used : ComponentFinder(org.sonar.server.component.ComponentFinder) WsTester(org.sonar.server.ws.WsTester) UserDoc(org.sonar.server.user.index.UserDoc) Before(org.junit.Before)

Example 44 with WsTester

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

the class TimeMachineWsTest method setUp.

@Before
public void setUp() {
    WsTester tester = new WsTester(new TimeMachineWs());
    controller = tester.controller("api/timemachine");
}
Also used : WsTester(org.sonar.server.ws.WsTester) Before(org.junit.Before)

Example 45 with WsTester

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

the class DomainsActionTest method setUp.

@Before
public void setUp() {
    dbClient = new DbClient(db.database(), db.myBatis(), new MetricDao());
    dbSession = dbClient.openSession(false);
    ws = new WsTester(new MetricsWs(new DomainsAction(dbClient)));
}
Also used : DbClient(org.sonar.db.DbClient) WsTester(org.sonar.server.ws.WsTester) MetricDao(org.sonar.db.metric.MetricDao) 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