SCRUM-4001: Fixed SonarQube issues
This commit is contained in:
parent
0f2b784be9
commit
b732b5e233
|
|
@ -16,6 +16,6 @@ import lombok.experimental.SuperBuilder;
|
|||
@ToString(callSuper = true)
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
public class InputCreateAuditLogDto extends com.finconsgroup.itserr.marketplace.audit.dm.dto.InputCreateAuditLogDto {
|
||||
public class InputCreateAuditLogBsDto extends com.finconsgroup.itserr.marketplace.audit.dm.dto.InputCreateAuditLogDto {
|
||||
|
||||
}
|
||||
|
|
@ -16,6 +16,6 @@ import lombok.experimental.SuperBuilder;
|
|||
@ToString(callSuper = true)
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
public class OutputAuditLogDto extends com.finconsgroup.itserr.marketplace.audit.dm.dto.OutputAuditLogDto {
|
||||
public class OutputAuditLogBsDto extends com.finconsgroup.itserr.marketplace.audit.dm.dto.OutputAuditLogDto {
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
package com.finconsgroup.itserr.marketplace.audit.bs.mapper;
|
||||
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.InputCreateAuditLogDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.OutputAuditLogDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.InputCreateAuditLogBsDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.OutputAuditLogBsDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.dm.dto.OutputAuditLogDto;
|
||||
import com.finconsgroup.itserr.messaging.dto.UntypedMessagingEventDto;
|
||||
import io.cloudevents.CloudEvent;
|
||||
import org.mapstruct.Mapper;
|
||||
|
|
@ -31,9 +32,9 @@ public interface AuditLogMapper {
|
|||
@Mapping(target = "eventActionTime", source = "messagingEventDto.timestamp")
|
||||
@Mapping(target = "eventAdditionalData", source = "messagingEventDto.additionalData")
|
||||
@Mapping(target = "eventCreationTime", source = "cloudEvent.time")
|
||||
InputCreateAuditLogDto messagingEventToInputCreateAuditLogDto(UntypedMessagingEventDto messagingEventDto, CloudEvent cloudEvent);
|
||||
InputCreateAuditLogBsDto messagingEventToInputCreateAuditLogDto(UntypedMessagingEventDto messagingEventDto, CloudEvent cloudEvent);
|
||||
|
||||
OutputAuditLogDto auditLogDmDtoToBsDto(com.finconsgroup.itserr.marketplace.audit.dm.dto.OutputAuditLogDto outputAuditLogDmDto);
|
||||
OutputAuditLogBsDto auditLogDmDtoToBsDto(OutputAuditLogDto outputAuditLogDmDto);
|
||||
|
||||
@Named(NAME_CLOUD_EVENT_SOURCE_TO_STRING)
|
||||
default String cloudEventSourceToString(URI source) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.finconsgroup.itserr.marketplace.audit.bs.messaging;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.OutputAuditLogDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.OutputAuditLogBsDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.service.AuditLogService;
|
||||
import com.finconsgroup.itserr.messaging.consumer.CloudEventConsumer;
|
||||
import com.finconsgroup.itserr.messaging.dto.UntypedMessagingEventDto;
|
||||
|
|
@ -28,8 +28,8 @@ public class MessagingEventConsumer extends CloudEventConsumer {
|
|||
}
|
||||
|
||||
private void handleEvent(UntypedMessagingEventDto eventPayload, @NonNull CloudEvent cloudEvent) {
|
||||
OutputAuditLogDto outputAuditLogDto = auditLogService.createFromMessagingEvent(eventPayload, cloudEvent);
|
||||
log.info("Created audit log with id: {}", outputAuditLogDto.getId());
|
||||
OutputAuditLogBsDto outputAuditLogBsDto = auditLogService.createFromMessagingEvent(eventPayload, cloudEvent);
|
||||
log.info("Created audit log with id: {}", outputAuditLogBsDto.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.finconsgroup.itserr.marketplace.audit.bs.service;
|
||||
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.InputCreateAuditLogDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.OutputAuditLogDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.InputCreateAuditLogBsDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.OutputAuditLogBsDto;
|
||||
import com.finconsgroup.itserr.messaging.dto.UntypedMessagingEventDto;
|
||||
import io.cloudevents.CloudEvent;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
|
@ -20,10 +20,10 @@ public interface AuditLogService {
|
|||
/**
|
||||
* Creates new AuditLog for user using the provided input data.
|
||||
*
|
||||
* @param inputCreateAuditLogDto the input DTO containing AuditLog details
|
||||
* @param inputCreateAuditLogBsDto the input DTO containing AuditLog details
|
||||
*/
|
||||
@NonNull
|
||||
OutputAuditLogDto create(@NonNull InputCreateAuditLogDto inputCreateAuditLogDto);
|
||||
OutputAuditLogBsDto create(@NonNull InputCreateAuditLogBsDto inputCreateAuditLogBsDto);
|
||||
|
||||
/**
|
||||
* Creates new audit log using the provided input data.
|
||||
|
|
@ -31,7 +31,7 @@ public interface AuditLogService {
|
|||
* @param messagingEventDto the input messaging event DTO containing audit log details
|
||||
*/
|
||||
@NonNull
|
||||
OutputAuditLogDto createFromMessagingEvent(@NonNull UntypedMessagingEventDto messagingEventDto,
|
||||
@NonNull CloudEvent cloudEvent);
|
||||
OutputAuditLogBsDto createFromMessagingEvent(@NonNull UntypedMessagingEventDto messagingEventDto,
|
||||
@NonNull CloudEvent cloudEvent);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
package com.finconsgroup.itserr.marketplace.audit.bs.service.impl;
|
||||
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.InputCreateAuditLogDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.OutputAuditLogDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.InputCreateAuditLogBsDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.OutputAuditLogBsDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.mapper.AuditLogMapper;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.service.AuditLogService;
|
||||
import com.finconsgroup.itserr.marketplace.audit.dm.client.AuditDmClient;
|
||||
import com.finconsgroup.itserr.marketplace.audit.dm.dto.OutputAuditLogDto;
|
||||
import com.finconsgroup.itserr.messaging.dto.UntypedMessagingEventDto;
|
||||
import io.cloudevents.CloudEvent;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -25,17 +26,16 @@ public class DefaultAuditLogService implements AuditLogService {
|
|||
|
||||
@NonNull
|
||||
@Override
|
||||
public OutputAuditLogDto create(@NonNull InputCreateAuditLogDto inputCreateAuditLogDto) {
|
||||
com.finconsgroup.itserr.marketplace.audit.dm.dto.OutputAuditLogDto outputAuditLogDmDto =
|
||||
auditDmClient.createAuditLog(inputCreateAuditLogDto);
|
||||
public OutputAuditLogBsDto create(@NonNull InputCreateAuditLogBsDto inputCreateAuditLogBsDto) {
|
||||
OutputAuditLogDto outputAuditLogDmDto = auditDmClient.createAuditLog(inputCreateAuditLogBsDto);
|
||||
return auditLogMapper.auditLogDmDtoToBsDto(outputAuditLogDmDto);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public OutputAuditLogDto createFromMessagingEvent(@NonNull UntypedMessagingEventDto messagingEventDto,
|
||||
@NonNull CloudEvent cloudEvent) {
|
||||
InputCreateAuditLogDto dto = auditLogMapper.messagingEventToInputCreateAuditLogDto(messagingEventDto, cloudEvent);
|
||||
public OutputAuditLogBsDto createFromMessagingEvent(@NonNull UntypedMessagingEventDto messagingEventDto,
|
||||
@NonNull CloudEvent cloudEvent) {
|
||||
InputCreateAuditLogBsDto dto = auditLogMapper.messagingEventToInputCreateAuditLogDto(messagingEventDto, cloudEvent);
|
||||
return create(dto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.finconsgroup.itserr.marketplace.audit.bs.service.impl;
|
||||
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.InputCreateAuditLogDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.OutputAuditLogDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.InputCreateAuditLogBsDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.OutputAuditLogBsDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.mapper.AuditLogMapper;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.util.MockUtils;
|
||||
import com.finconsgroup.itserr.marketplace.audit.dm.client.AuditDmClient;
|
||||
|
|
@ -41,14 +41,14 @@ class DefaultAuditLogServiceTest {
|
|||
@Test
|
||||
void givenNewAuditLog_whenCreateAuditLog_thenSaveAndReturnDto() {
|
||||
// Given
|
||||
InputCreateAuditLogDto inputDto = MockUtils.generateInputCreateAuditLogDto();
|
||||
OutputAuditLogDto expectedDto = MockUtils.generateOutputAuditLogDto();
|
||||
InputCreateAuditLogBsDto inputDto = MockUtils.generateInputCreateAuditLogDto();
|
||||
OutputAuditLogBsDto expectedDto = MockUtils.generateOutputAuditLogDto();
|
||||
|
||||
doReturn(expectedDto).when(auditDmClient).createAuditLog(inputDto);
|
||||
doReturn(expectedDto).when(auditLogMapper).auditLogDmDtoToBsDto(expectedDto);
|
||||
|
||||
// When
|
||||
OutputAuditLogDto result = service.create(inputDto);
|
||||
OutputAuditLogBsDto result = service.create(inputDto);
|
||||
|
||||
// Then
|
||||
assertThat(result).isEqualTo(expectedDto);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.finconsgroup.itserr.marketplace.audit.bs.util;
|
||||
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.InputCreateAuditLogDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.OutputAuditLogDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.InputCreateAuditLogBsDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.bs.dto.OutputAuditLogBsDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.dm.dto.InputAuditLogResourceDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.dm.dto.InputAuditLogUserDto;
|
||||
import com.finconsgroup.itserr.marketplace.audit.dm.dto.OutputAuditLogResourceDto;
|
||||
|
|
@ -34,8 +34,8 @@ public final class MockUtils {
|
|||
public static final UUID AUDIT_LOG_ID = UUID.randomUUID();
|
||||
public static final UUID RESOURCE_ID = UUID.randomUUID();
|
||||
|
||||
public static InputCreateAuditLogDto generateInputCreateAuditLogDto() {
|
||||
return InputCreateAuditLogDto.builder()
|
||||
public static InputCreateAuditLogBsDto generateInputCreateAuditLogDto() {
|
||||
return InputCreateAuditLogBsDto.builder()
|
||||
.eventId(EVENT_ID)
|
||||
.eventSource("catalog-bs")
|
||||
.eventType("catalog-item-event-created")
|
||||
|
|
@ -57,14 +57,14 @@ public final class MockUtils {
|
|||
.build();
|
||||
}
|
||||
|
||||
public static InputCreateAuditLogDto generateInputCreateAuditLogDto(Consumer<InputCreateAuditLogDto> postProcessor) {
|
||||
InputCreateAuditLogDto inputCreateAuditLogDto = MockUtils.generateInputCreateAuditLogDto();
|
||||
postProcessor.accept(inputCreateAuditLogDto);
|
||||
return inputCreateAuditLogDto;
|
||||
public static InputCreateAuditLogBsDto generateInputCreateAuditLogDto(Consumer<InputCreateAuditLogBsDto> postProcessor) {
|
||||
InputCreateAuditLogBsDto inputCreateAuditLogBsDto = MockUtils.generateInputCreateAuditLogDto();
|
||||
postProcessor.accept(inputCreateAuditLogBsDto);
|
||||
return inputCreateAuditLogBsDto;
|
||||
}
|
||||
|
||||
public static OutputAuditLogDto generateOutputAuditLogDto() {
|
||||
return OutputAuditLogDto.builder()
|
||||
public static OutputAuditLogBsDto generateOutputAuditLogDto() {
|
||||
return OutputAuditLogBsDto.builder()
|
||||
.id(AUDIT_LOG_ID)
|
||||
.eventId(EVENT_ID)
|
||||
.eventSource("catalog-bs")
|
||||
|
|
|
|||
Loading…
Reference in New Issue