use of org.sonar.db.event.EventDto in project sonarqube by SonarSource.
the class UpdateEventActionTest method update_name_in_db.
@Test
public void update_name_in_db() {
SnapshotDto analysis = createAnalysisAndLogInAsProjectAdministrator("5.6");
EventDto originalEvent = db.events().insertEvent(newEvent(analysis).setUuid("E1").setName("Original Name"));
call("E1", "name");
EventDto newEvent = dbClient.eventDao().selectByUuid(dbSession, "E1").get();
assertThat(newEvent.getName()).isEqualTo("name");
assertThat(newEvent.getDescription()).isNull();
assertThat(newEvent.getCategory()).isEqualTo(originalEvent.getCategory());
assertThat(newEvent.getDate()).isEqualTo(originalEvent.getDate());
assertThat(newEvent.getCreatedAt()).isEqualTo(originalEvent.getCreatedAt());
}
use of org.sonar.db.event.EventDto in project sonarqube by SonarSource.
the class UpdateEventActionTest method update_name_only_in_db.
@Test
public void update_name_only_in_db() {
SnapshotDto analysis = createAnalysisAndLogInAsProjectAdministrator("5.6");
EventDto originalEvent = db.events().insertEvent(newEvent(analysis).setUuid("E1").setName("Original Name").setDescription("Original Description"));
call("E1", "name");
EventDto newEvent = dbClient.eventDao().selectByUuid(dbSession, "E1").get();
assertThat(newEvent.getName()).isEqualTo("name");
assertThat(newEvent.getDescription()).isEqualTo(originalEvent.getDescription());
}
use of org.sonar.db.event.EventDto in project sonarqube by SonarSource.
the class CreateEventActionTest method create_2_version_events_on_same_project.
@Test
public void create_2_version_events_on_same_project() {
ComponentDto project = newProjectDto(db.organizations().insert());
SnapshotDto firstAnalysis = db.components().insertProjectAndSnapshot(project);
CreateEventRequest.Builder firstRequest = CreateEventRequest.builder().setAnalysis(firstAnalysis.getUuid()).setCategory(VERSION).setName("5.6.3");
SnapshotDto secondAnalysis = dbClient.snapshotDao().insert(dbSession, newAnalysis(project));
db.commit();
CreateEventRequest.Builder secondRequest = CreateEventRequest.builder().setAnalysis(secondAnalysis.getUuid()).setCategory(VERSION).setName("6.3");
logInAsProjectAdministrator(project);
call(firstRequest);
call(secondRequest);
List<EventDto> events = dbClient.eventDao().selectByComponentUuid(dbSession, project.uuid());
assertThat(events).hasSize(2);
}
use of org.sonar.db.event.EventDto in project sonarqube by SonarSource.
the class DeleteEventActionTest method delete_event.
@Test
public void delete_event() {
ComponentDto project = newProjectDto(db.organizations().insert());
SnapshotDto analysis = db.components().insertProjectAndSnapshot(project);
db.events().insertEvent(newEvent(analysis).setUuid("E1"));
db.events().insertEvent(newEvent(analysis).setUuid("E2"));
logInAsProjectAdministrator(project);
call("E2");
List<EventDto> events = db.getDbClient().eventDao().selectByAnalysisUuid(db.getSession(), analysis.getUuid());
assertThat(events).extracting(EventDto::getUuid).containsExactly("E1");
}
Aggregations