use of org.sonar.db.ce.CeTaskMessageDto in project sonarqube by SonarSource.
the class DismissAnalysisWarningActionTest method is_idempotent.
@Test
public void is_idempotent() {
UserDto user = db.users().insertUser();
ComponentDto project = db.components().insertPrivateProject();
userSession.logIn(user).addProjectPermission(UserRole.USER, project);
SnapshotDto analysis = db.components().insertSnapshot(project);
CeActivityDto activity = insertActivity("task-uuid" + counter++, project, SUCCESS, analysis, REPORT);
CeTaskMessageDto taskMessageDismissible = createTaskMessage(activity, "dismissable warning", CeTaskMessageType.SUGGEST_DEVELOPER_EDITION_UPGRADE);
underTest.newRequest().setParam("component", project.getKey()).setParam("warning", taskMessageDismissible.getUuid()).execute();
TestResponse response = underTest.newRequest().setParam("component", project.getKey()).setParam("warning", taskMessageDismissible.getUuid()).execute();
assertThat(response.getStatus()).isEqualTo(204);
assertThat(db.select("select * from user_dismissed_messages")).extracting("USER_UUID", "PROJECT_UUID", "MESSAGE_TYPE").containsExactly(tuple(userSession.getUuid(), project.uuid(), CeTaskMessageType.SUGGEST_DEVELOPER_EDITION_UPGRADE.name()));
}
use of org.sonar.db.ce.CeTaskMessageDto in project sonarqube by SonarSource.
the class DismissAnalysisWarningActionTest method createTaskMessage.
private CeTaskMessageDto createTaskMessage(CeActivityDto activity, String warning, CeTaskMessageType messageType) {
CeTaskMessageDto ceTaskMessageDto = new CeTaskMessageDto().setUuid("m-uuid-" + counter++).setTaskUuid(activity.getUuid()).setMessage(warning).setType(messageType).setCreatedAt(counter);
db.getDbClient().ceTaskMessageDao().insert(db.getSession(), ceTaskMessageDto);
db.commit();
return ceTaskMessageDto;
}
Aggregations