use of org.sonar.server.ws.WsActionTester in project sonarqube by SonarSource.
the class RemoveActionTest 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 = new NotificationCenter(new NotificationDispatcherMetadata[] { metadata1, metadata2, metadata3 }, new NotificationChannel[] { emailChannel, twitterChannel, defaultChannel });
notificationUpdater = new NotificationUpdater(userSession, dbClient);
underTest = new RemoveAction(notificationCenter, notificationUpdater, dbClient, new ComponentFinder(dbClient), userSession);
ws = new WsActionTester(underTest);
}
use of org.sonar.server.ws.WsActionTester in project sonarqube by SonarSource.
the class CreateActionTest method setUp.
@Before
public void setUp() {
ComponentFinder componentFinder = new ComponentFinder(dbClient);
underTest = new CreateAction(dbClient, userSession, componentFinder);
ws = new WsActionTester(underTest);
}
use of org.sonar.server.ws.WsActionTester in project sonarqube by SonarSource.
the class CreateEventActionTest method json_example.
@Test
public void json_example() {
ComponentDto project = db.components().insertProject();
SnapshotDto analysis = dbClient.snapshotDao().insert(dbSession, SnapshotTesting.newAnalysis(project).setUuid("A2"));
db.commit();
uuidFactory = mock(UuidFactory.class);
when(uuidFactory.create()).thenReturn("E1");
ws = new WsActionTester(new CreateEventAction(dbClient, uuidFactory, system, userSession));
logInAsProjectAdministrator(project);
String result = ws.newRequest().setParam(PARAM_ANALYSIS, analysis.getUuid()).setParam(PARAM_CATEGORY, OTHER.name()).setParam(PARAM_NAME, "My Custom Event").execute().getInput();
assertJson(result).isSimilarTo(getClass().getResource("create_event-example.json"));
}
use of org.sonar.server.ws.WsActionTester in project sonarqube by SonarSource.
the class SearchMyProjectsActionTest method setUp.
@Before
public void setUp() {
user = db.users().insertUser();
userSession.logIn(user);
alertStatusMetric = dbClient.metricDao().insert(dbSession, newMetricDto().setKey(ALERT_STATUS_KEY).setValueType(ValueType.LEVEL.name()));
db.commit();
ws = new WsActionTester(new SearchMyProjectsAction(dbClient, new SearchMyProjectsDataLoader(userSession, dbClient), userSession));
}
use of org.sonar.server.ws.WsActionTester in project sonarqube by SonarSource.
the class ProjectStatusActionTest method setUp.
@Before
public void setUp() {
dbClient = db.getDbClient();
dbSession = db.getSession();
ws = new WsActionTester(new ProjectStatusAction(dbClient, new ComponentFinder(dbClient), userSession));
}
Aggregations