Search in sources :

Example 1 with WsTester

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

the class ComponentsWsTest method setUp.

@Before
public void setUp() {
    Languages languages = mock(Languages.class, RETURNS_DEEP_STUBS);
    when(languages.all()).thenReturn(new Language[0]);
    WsTester tester = new WsTester(new ComponentsWs(new AppAction(mock(DbClient.class), userSessionRule, mock(ComponentFinder.class)), new SuggestionsAction(mock(DbClient.class), mock(ComponentIndex.class)), new SearchAction(mock(DbClient.class), mock(ResourceTypes.class), mock(I18n.class), userSessionRule, languages, TestDefaultOrganizationProvider.fromUuid("foo"))));
    controller = tester.controller("api/components");
}
Also used : ComponentFinder(org.sonar.server.component.ComponentFinder) ResourceTypes(org.sonar.api.resources.ResourceTypes) DbClient(org.sonar.db.DbClient) WsTester(org.sonar.server.ws.WsTester) Languages(org.sonar.api.resources.Languages) ComponentIndex(org.sonar.server.component.index.ComponentIndex) I18n(org.sonar.api.i18n.I18n) Before(org.junit.Before)

Example 2 with WsTester

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

the class SearchActionComponentsMediumTest method setUp.

@Before
public void setUp() {
    tester.clearDbAndIndexes();
    db = tester.get(DbClient.class);
    wsTester = tester.get(WsTester.class);
    session = db.openSession(false);
    OrganizationDao organizationDao = db.organizationDao();
    DefaultOrganization defaultOrganization = tester.get(DefaultOrganizationProvider.class).get();
    this.defaultOrganization = organizationDao.selectByUuid(session, defaultOrganization.getUuid()).get();
    this.otherOrganization1 = OrganizationTesting.newOrganizationDto().setKey("my-org-1");
    this.otherOrganization2 = OrganizationTesting.newOrganizationDto().setKey("my-org-2");
    organizationDao.insert(session, this.otherOrganization1);
    organizationDao.insert(session, this.otherOrganization2);
    session.commit();
}
Also used : DbClient(org.sonar.db.DbClient) WsTester(org.sonar.server.ws.WsTester) DefaultOrganizationProvider(org.sonar.server.organization.DefaultOrganizationProvider) OrganizationDao(org.sonar.db.organization.OrganizationDao) DefaultOrganization(org.sonar.server.organization.DefaultOrganization) Before(org.junit.Before)

Example 3 with WsTester

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

the class ComponentTagsActionTest method setUp.

@Before
public void setUp() {
    componentTagsAction = new ComponentTagsAction(service, queryService);
    tester = new WsTester(new IssuesWs(componentTagsAction));
}
Also used : WsTester(org.sonar.server.ws.WsTester) Before(org.junit.Before)

Example 4 with WsTester

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

the class SearchActionMediumTest method setUp.

@Before
public void setUp() {
    tester.clearDbAndIndexes();
    db = tester.get(DbClient.class);
    wsTester = tester.get(WsTester.class);
    session = db.openSession(false);
    OrganizationDao organizationDao = db.organizationDao();
    DefaultOrganization defaultOrganization = tester.get(DefaultOrganizationProvider.class).get();
    this.defaultOrganization = organizationDao.selectByUuid(session, defaultOrganization.getUuid()).get();
    this.otherOrganization1 = OrganizationTesting.newOrganizationDto().setKey("my-org-1");
    this.otherOrganization2 = OrganizationTesting.newOrganizationDto().setKey("my-org-2");
    organizationDao.insert(session, this.otherOrganization1);
    organizationDao.insert(session, this.otherOrganization2);
    session.commit();
}
Also used : DbClient(org.sonar.db.DbClient) WsTester(org.sonar.server.ws.WsTester) DefaultOrganizationProvider(org.sonar.server.organization.DefaultOrganizationProvider) OrganizationDao(org.sonar.db.organization.OrganizationDao) DefaultOrganization(org.sonar.server.organization.DefaultOrganization) Before(org.junit.Before)

Example 5 with WsTester

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

the class CustomMeasuresWsTest method setUp.

@Before
public void setUp() {
    DbClient dbClient = mock(DbClient.class);
    UserSession userSession = mock(UserSession.class);
    ws = new WsTester(new CustomMeasuresWs(new DeleteAction(dbClient, userSession), new CreateAction(dbClient, userSession, System2.INSTANCE, mock(CustomMeasureValidator.class), mock(CustomMeasureJsonWriter.class), mock(ComponentFinder.class)), new UpdateAction(dbClient, userSession, System2.INSTANCE, mock(CustomMeasureValidator.class), mock(CustomMeasureJsonWriter.class))));
}
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