Search in sources :

Example 16 with WsActionTester

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

the class RuleQueryFactoryTest method execute.

private RuleQuery execute(String... paramsKeyAndValue) {
    WsActionTester ws = new WsActionTester(fakeAction);
    TestRequest request = ws.newRequest();
    for (int i = 0; i < paramsKeyAndValue.length; i += 2) {
        request.setParam(paramsKeyAndValue[i], paramsKeyAndValue[i + 1]);
    }
    request.execute();
    return fakeAction.getRuleQuery();
}
Also used : WsActionTester(org.sonar.server.ws.WsActionTester) TestRequest(org.sonar.server.ws.TestRequest)

Example 17 with WsActionTester

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

the class SearchActionTest method setUp.

@Before
public void setUp() {
    xoo1 = LanguageTesting.newLanguage("xoo1");
    xoo2 = LanguageTesting.newLanguage("xoo2");
    Languages languages = new Languages(xoo1, xoo2);
    ws = new WsActionTester(new SearchAction(new SearchDataLoader(languages, new QProfileLookup(dbClient), new QProfileFactory(dbClient, defaultOrganizationProvider), dbClient, new ComponentFinder(dbClient), activeRuleIndex), languages));
}
Also used : ComponentFinder(org.sonar.server.component.ComponentFinder) QProfileFactory(org.sonar.server.qualityprofile.QProfileFactory) Languages(org.sonar.api.resources.Languages) WsActionTester(org.sonar.server.ws.WsActionTester) QProfileLookup(org.sonar.server.qualityprofile.QProfileLookup) Before(org.junit.Before)

Example 18 with WsActionTester

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

the class TreeActionTest method setUp.

@Before
public void setUp() {
    ws = new WsActionTester(new TreeAction(dbClient, new ComponentFinder(dbClient), resourceTypes, userSession, Mockito.mock(I18n.class)));
    resourceTypes.setChildrenQualifiers(Qualifiers.MODULE, Qualifiers.FILE, Qualifiers.DIRECTORY);
    resourceTypes.setLeavesQualifiers(Qualifiers.FILE, Qualifiers.UNIT_TEST_FILE);
}
Also used : ComponentFinder(org.sonar.server.component.ComponentFinder) WsActionTester(org.sonar.server.ws.WsActionTester) I18n(org.sonar.api.i18n.I18n) Before(org.junit.Before)

Example 19 with WsActionTester

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

the class SearchActionTest method setUp.

@Before
public void setUp() {
    resourceTypes.setAllQualifiers(PROJECT, MODULE, DIRECTORY, FILE);
    when(languages.all()).thenReturn(javaLanguage());
    ws = new WsActionTester(new SearchAction(db.getDbClient(), resourceTypes, i18n, userSession, languages, defaultOrganizationProvider));
    user = db.users().insertUser("john");
    userSession.logIn(user);
}
Also used : WsActionTester(org.sonar.server.ws.WsActionTester) Before(org.junit.Before)

Example 20 with WsActionTester

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

the class ListActionTest method setUp.

@Before
public void setUp() {
    NotificationDispatcherMetadata metadata1 = NotificationDispatcherMetadata.create(NOTIF_MY_NEW_ISSUES).setProperty(GLOBAL_NOTIFICATION, "true").setProperty(PER_PROJECT_NOTIFICATION, "true");
    NotificationDispatcherMetadata metadata2 = NotificationDispatcherMetadata.create(NOTIF_NEW_ISSUES).setProperty(GLOBAL_NOTIFICATION, "true");
    NotificationDispatcherMetadata metadata3 = NotificationDispatcherMetadata.create(NOTIF_NEW_QUALITY_GATE_STATUS).setProperty(GLOBAL_NOTIFICATION, "true").setProperty(PER_PROJECT_NOTIFICATION, "true");
    NotificationCenter notificationCenter = new NotificationCenter(new NotificationDispatcherMetadata[] { metadata1, metadata2, metadata3 }, new NotificationChannel[] { emailChannel, twitterChannel });
    notificationUpdater = new NotificationUpdater(userSession, dbClient);
    ListAction underTest = new ListAction(notificationCenter, dbClient, userSession);
    ws = new WsActionTester(underTest);
}
Also used : NotificationCenter(org.sonar.server.notification.NotificationCenter) NotificationDispatcherMetadata(org.sonar.server.notification.NotificationDispatcherMetadata) NotificationUpdater(org.sonar.server.notification.NotificationUpdater) WsActionTester(org.sonar.server.ws.WsActionTester) Before(org.junit.Before)

Aggregations

WsActionTester (org.sonar.server.ws.WsActionTester)27 Before (org.junit.Before)21 ComponentFinder (org.sonar.server.component.ComponentFinder)13 Page (org.sonar.api.web.page.Page)3 PluginRepository (org.sonar.core.platform.PluginRepository)3 NotificationCenter (org.sonar.server.notification.NotificationCenter)3 NotificationDispatcherMetadata (org.sonar.server.notification.NotificationDispatcherMetadata)3 NotificationUpdater (org.sonar.server.notification.NotificationUpdater)3 PageRepository (org.sonar.server.ui.PageRepository)3 Test (org.junit.Test)2 NotificationChannel (org.sonar.api.notifications.NotificationChannel)2 ComponentDto (org.sonar.db.component.ComponentDto)2 I18n (org.sonar.api.i18n.I18n)1 Languages (org.sonar.api.resources.Languages)1 ResourceTypes (org.sonar.api.resources.ResourceTypes)1 UuidFactory (org.sonar.core.util.UuidFactory)1 DbClient (org.sonar.db.DbClient)1 SnapshotDto (org.sonar.db.component.SnapshotDto)1 H2 (org.sonar.db.dialect.H2)1 IssueDto (org.sonar.db.issue.IssueDto)1