use of org.sonarqube.ws.Ce.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method search_task_by_component_id.
@Test
public void search_task_by_component_id() {
ComponentDto project = db.components().insertPrivateProject();
insertQueue("T1", project, IN_PROGRESS);
insertActivity("T1", project, SUCCESS);
userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
ActivityResponse result = call(ws.newRequest().setParam(PARAM_COMPONENT_ID, project.uuid()).setParam(PARAM_TYPE, CeTaskTypes.REPORT).setParam(PARAM_STATUS, "SUCCESS,FAILED,CANCELED,IN_PROGRESS,PENDING"));
assertThat(result.getTasksCount()).isOne();
}
use of org.sonarqube.ws.Ce.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method pull_request_in_past_activity.
@Test
public void pull_request_in_past_activity() {
logInAsSystemAdministrator();
ComponentDto project = db.components().insertPrivateProject();
userSession.addProjectPermission(UserRole.USER, project);
ComponentDto pullRequest = db.components().insertProjectBranch(project, b -> b.setBranchType(BranchType.PULL_REQUEST));
SnapshotDto analysis = db.components().insertSnapshot(pullRequest);
CeActivityDto activity = insertActivity("T1", project, SUCCESS, analysis);
insertCharacteristic(activity, PULL_REQUEST, pullRequest.getPullRequest());
ActivityResponse response = ws.newRequest().executeProtobuf(ActivityResponse.class);
assertThat(response.getTasksList()).extracting(Task::getId, Ce.Task::getPullRequest, Ce.Task::hasPullRequestTitle, Ce.Task::getStatus, Ce.Task::getComponentKey).containsExactlyInAnyOrder(// TODO the pull request title must be loaded from db
tuple("T1", pullRequest.getPullRequest(), false, Ce.TaskStatus.SUCCESS, pullRequest.getKey()));
}
use of org.sonarqube.ws.Ce.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method filter_by_min_submitted_and_max_executed_at_include_day.
@Test
public void filter_by_min_submitted_and_max_executed_at_include_day() {
logInAsSystemAdministrator();
ComponentDto project = db.components().insertPrivateProject();
insertActivity("T1", project, SUCCESS);
String today = formatDate(new Date(EXECUTED_AT));
ActivityResponse activityResponse = call(ws.newRequest().setParam(PARAM_MIN_SUBMITTED_AT, today).setParam(PARAM_MAX_EXECUTED_AT, today));
assertThat(activityResponse.getTasksCount()).isOne();
}
use of org.sonarqube.ws.Ce.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method pull_request_in_queue_analysis.
@Test
public void pull_request_in_queue_analysis() {
logInAsSystemAdministrator();
String branch = "pr-123";
CeQueueDto queue1 = insertQueue("T1", null, IN_PROGRESS);
insertCharacteristic(queue1, PULL_REQUEST, branch);
CeQueueDto queue2 = insertQueue("T2", null, PENDING);
insertCharacteristic(queue2, PULL_REQUEST, branch);
ActivityResponse response = ws.newRequest().setParam("status", "FAILED,IN_PROGRESS,PENDING").executeProtobuf(ActivityResponse.class);
assertThat(response.getTasksList()).extracting(Task::getId, Ce.Task::getPullRequest, Ce.Task::hasPullRequestTitle, Ce.Task::getStatus).containsExactlyInAnyOrder(tuple("T1", branch, false, Ce.TaskStatus.IN_PROGRESS), tuple("T2", branch, false, Ce.TaskStatus.PENDING));
}
use of org.sonarqube.ws.Ce.ActivityResponse in project sonarqube by SonarSource.
the class ActivityActionTest method filter_by_max_executed_at_exclude.
@Test
public void filter_by_max_executed_at_exclude() {
logInAsSystemAdministrator();
ComponentDto project1 = db.components().insertPrivateProject();
ComponentDto project2 = db.components().insertPrivateProject();
insertActivity("T1", project1, SUCCESS);
insertActivity("T2", project2, FAILED);
insertQueue("T3", project1, IN_PROGRESS);
ActivityResponse activityResponse = call(ws.newRequest().setParam("status", "FAILED,IN_PROGRESS,SUCCESS").setParam(PARAM_MAX_EXECUTED_AT, "2016-02-15"));
assertThat(activityResponse.getTasksCount()).isZero();
}
Aggregations