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()); }
.mapToObj(i -> new EventComponentChangeDto() .setCategory(randomChangeCategory()) .setUuid(rowBase + eventUuid1 + i) .setEventUuid(eventUuid1) .setComponentUuid(rowBase + eventUuid1 + "_component_uuid" + i) .mapToObj(i -> new EventComponentChangeDto() .setCategory(randomChangeCategory()) .setUuid(rowBase + eventUuid2 + i) .setEventUuid(eventUuid2) .setComponentUuid(rowBase + eventUuid2 + "_component_uuid" + i)
@Test public void selectByEventUuid_branchKey_can_be_null() { String eventBase = randomAlphabetic(5); String rowBase = randomAlphabetic(6); String eventUuid = eventBase + "_event_uuid"; EventComponentChangeDto dto = new EventComponentChangeDto() .setCategory(randomChangeCategory()) .setUuid(rowBase + "_uuid") .setEventUuid(eventUuid) .setComponentUuid(rowBase + "_component_uuid") .setComponentKey(rowBase + "_component_key") .setComponentName(rowBase + "_component_name") .setComponentBranchKey(null); EventPurgeData purgeData = new EventPurgeData(eventBase + "_component_uuid", eventBase + "_analysis_uuid"); long now = random.nextLong(); when(system2.now()) .thenReturn(now) .thenThrow(new IllegalStateException("now should not be called twice")); underTest.insert(dbSession, dto, purgeData); assertThat(underTest.selectByEventUuid(dbSession, eventUuid)) .extracting(EventComponentChangeDto::getUuid, EventComponentChangeDto::getComponentBranchKey) .containsOnly(tuple(dto.getUuid(), null)); }
public EventComponentChangeDto insertEventComponentChanges(EventDto event, SnapshotDto analysis, ChangeCategory changeCategory, ComponentDto component, @Nullable BranchDto branch) { EventComponentChangeDto eventComponentChange = new EventComponentChangeDto() .setUuid(UuidFactoryFast.getInstance().create()) .setCategory(changeCategory) .setEventUuid(event.getUuid()) .setComponentUuid(component.uuid()) .setComponentKey(component.getKey()) .setComponentName(component.name()) .setComponentBranchKey(Optional.ofNullable(branch).map(BranchDto::getKey).orElse(null)); EventPurgeData eventPurgeData = new EventPurgeData(analysis.getComponentUuid(), analysis.getUuid()); dbClient.eventComponentChangeDao().insert(dbSession, eventComponentChange, eventPurgeData); db.commit(); return eventComponentChange; }
.mapToObj(i -> new EventComponentChangeDto() .setCategory(randomChangeCategory()) .setUuid(rowBase + eventUuid1 + i) .setEventUuid(eventUuid1) .setComponentUuid(rowBase + eventUuid1 + "_component_uuid" + i) .mapToObj(i -> new EventComponentChangeDto() .setCategory(randomChangeCategory()) .setUuid(rowBase + eventUuid2 + i) .setEventUuid(eventUuid2) .setComponentUuid(rowBase + eventUuid2 + "_component_uuid" + i)
EventComponentChangeDto dto = new EventComponentChangeDto() .setCategory(randomChangeCategory()) .setUuid(uuid) .setEventUuid(eventUuid) .setComponentUuid(rowBase + "_component_uuid")
EventComponentChangeDto dto = new EventComponentChangeDto() .setCategory(randomChangeCategory()) .setUuid(uuid) .setEventUuid(eventUuid) .setComponentUuid(rowBase + "_component_uuid")