public List<EventDto> selectByAnalysisUuid(DbSession dbSession, String uuid) { return mapper(dbSession).selectByAnalysisUuid(uuid); }
public void delete(DbSession session, Long id) { mapper(session).deleteById(id); }
@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()); }
private EventComponentChangeDto generateEventComponentChange(EventDto event, ChangeCategory category, String name, String key, @Nullable String branch, String componentUuid) { return new EventComponentChangeDto() .setCategory(category) .setUuid(uuidFactoryFast.create()) .setComponentName(name) .setComponentKey(key) .setComponentBranchKey(branch) .setComponentUuid(componentUuid) .setEventUuid(event.getUuid()); }
@Test public void fail_if_category_other_than_other_or_version() { SnapshotDto analysis = createAnalysisAndLogInAsProjectAdministrator("5.6"); db.events().insertEvent(newEvent(analysis).setUuid("E1").setCategory("Profile")); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Event of category 'QUALITY_PROFILE' cannot be modified. Authorized categories: VERSION, OTHER"); call("E1", "name"); }
@Test public void delete_by_uuid() { dbTester.events().insertEvent(newEvent(newAnalysis(ComponentTesting.newPrivateProjectDto(dbTester.getDefaultOrganization()))).setUuid("E1")); underTest.delete(dbTester.getSession(), "E1"); dbTester.commit(); assertThat(dbTester.countRowsOfTable("events")).isEqualTo(0); }
@Test public void fail_if_no_name() { SnapshotDto analysis = createAnalysisAndLogInAsProjectAdministrator("5.6"); db.events().insertEvent(newEvent(analysis).setUuid("E1")); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("The 'name' parameter is missing"); call("E1", null); }
public void delete(DbSession session, String uuid) { mapper(session).deleteByUuid(uuid); }
public Optional<EventDto> selectByUuid(DbSession dbSession, String uuid) { return Optional.ofNullable(mapper(dbSession).selectByUuid(uuid)); }
private Consumer<EventDto> checkPermissions() { return event -> userSession.checkComponentUuidPermission(UserRole.ADMIN, event.getComponentUuid()); } }
public List<EventDto> selectVersionsByMostRecentFirst(DbSession session, String componentUuid) { return mapper(session).selectVersions(componentUuid); }
/** * The name of an event should not be null, but we must accept null values as the DB column is not nullable */ public EventDto setName(@Nullable String name) { this.name = checkEventName(name); return this; }
/** * The category of an event should not be null, but we must accept null values as the DB column is not nullable */ public EventDto setCategory(@Nullable String category) { this.category = checkEventCategory(category); return this; }
public EventDto setDescription(@Nullable String description) { this.description = checkEventDescription(description); return this; }
public List<EventComponentChangeDto> selectByEventUuid(DbSession dbSession, String eventUuid) { return getMapper(dbSession).selectByEventUuid(eventUuid); }
@Test public void fail_if_blank_name() { SnapshotDto analysis = createAnalysisAndLogInAsProjectAdministrator("5.6"); db.events().insertEvent(newEvent(analysis).setUuid("E1")); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("A non empty name is required"); call("E1", " "); }