Commit 78c5ca61 authored by dietricf's avatar dietricf
Browse files

SI-446_ Umbenennung veröffentlicheungstext nach vorauss. Grund

parent bfc21d5c
...@@ -37,8 +37,8 @@ public interface FailureInformationMapper { ...@@ -37,8 +37,8 @@ public interface FailureInformationMapper {
@Mapping(source = "refBranch.colorCode", target = "branchColorCode"), @Mapping(source = "refBranch.colorCode", target = "branchColorCode"),
@Mapping(source = "refRadius.uuid", target = "radiusId"), @Mapping(source = "refRadius.uuid", target = "radiusId"),
@Mapping(source = "refRadius.radius", target = "radius"), @Mapping(source = "refRadius.radius", target = "radius"),
@Mapping(source = "refPublicationText.uuid", target = "publicationTextId"), @Mapping(source = "refExpectedReason.uuid", target = "expectedReasonId"),
@Mapping(source = "refPublicationText.text", target = "publicationText") @Mapping(source = "refExpectedReason.text", target = "expectedReasonText")
}) })
FailureInformationDto toFailureInformationDto(TblFailureInformation tblFailureInformation); FailureInformationDto toFailureInformationDto(TblFailureInformation tblFailureInformation);
...@@ -56,8 +56,8 @@ public interface FailureInformationMapper { ...@@ -56,8 +56,8 @@ public interface FailureInformationMapper {
@Mapping(target = "refBranch.colorCode", source = "branchColorCode"), @Mapping(target = "refBranch.colorCode", source = "branchColorCode"),
@Mapping(target = "refRadius.uuid", source = "radiusId"), @Mapping(target = "refRadius.uuid", source = "radiusId"),
@Mapping(target = "refRadius.radius", source = "radius"), @Mapping(target = "refRadius.radius", source = "radius"),
@Mapping(target = "refPublicationText.uuid", source = "publicationTextId"), @Mapping(target = "refExpectedReason.uuid", source = "expectedReasonId"),
@Mapping(target = "refPublicationText.text", source = "publicationText") @Mapping(target = "refExpectedReason.text", source = "expectedReasonText")
}) })
TblFailureInformation toTblFailureInformation(FailureInformationDto failureInformationDto); TblFailureInformation toTblFailureInformation(FailureInformationDto failureInformationDto);
......
...@@ -154,10 +154,10 @@ public class FailureInformationService { ...@@ -154,10 +154,10 @@ public class FailureInformationService {
destTblFailureInformation.setRefRadius(null); destTblFailureInformation.setRefRadius(null);
} }
if( sourceDto.getPublicationTextId() != null ) { if( sourceDto.getExpectedReasonId() != null ) {
destTblFailureInformation.setRefExpectedReason( expectedReasonRepository destTblFailureInformation.setRefExpectedReason( expectedReasonRepository
.findByUuid(sourceDto.getPublicationTextId()) .findByUuid(sourceDto.getExpectedReasonId())
.orElseThrow(() -> new NotFoundException("publicationText.uuid.not.existing"))); .orElseThrow(() -> new NotFoundException("expected.reason.uuid.not.existing")));
} }
else { else {
destTblFailureInformation.setRefExpectedReason(null); destTblFailureInformation.setRefExpectedReason(null);
......
...@@ -312,7 +312,7 @@ INSERT INTO public.tbl_failure_information(UUID, VERSION_NUMBER, FK_REF_FAILURE_ ...@@ -312,7 +312,7 @@ INSERT INTO public.tbl_failure_information(UUID, VERSION_NUMBER, FK_REF_FAILURE_
VALUES ('6432a9c9-0384-44af-9bb8-34f2878d7b49',1, 1, 1, 'Stromausfall Murr', 'Es gibt einen Stromausfall im Bereich Murr/Westbezirk', 'Rolf Rudis', 'I', 1, 1, 1, 'NS', null, '2021-01-19 00:00:00', '2021-01-22 00:00:00', '2021-01-22 12:00:00', 'Stromausfall durch Bagger', 'Der Bagger grub zu tief', '71711', 'Murr', 'Westbezirk', 'Ferdinand-Porsche-Straße', '2', '52863a', 'Trafo 1', '124,2323', 2, 9.247952, 48.955700, 'Link - extenes System', 'veröffentlicht', 'Freitext für die Veröffentlichung: Defekt an Trafostation', 1, '2020-01-22 15:32:15', 'schmidth', '2020-01-24 08:02:44', 'meyers'); VALUES ('6432a9c9-0384-44af-9bb8-34f2878d7b49',1, 1, 1, 'Stromausfall Murr', 'Es gibt einen Stromausfall im Bereich Murr/Westbezirk', 'Rolf Rudis', 'I', 1, 1, 1, 'NS', null, '2021-01-19 00:00:00', '2021-01-22 00:00:00', '2021-01-22 12:00:00', 'Stromausfall durch Bagger', 'Der Bagger grub zu tief', '71711', 'Murr', 'Westbezirk', 'Ferdinand-Porsche-Straße', '2', '52863a', 'Trafo 1', '124,2323', 2, 9.247952, 48.955700, 'Link - extenes System', 'veröffentlicht', 'Freitext für die Veröffentlichung: Defekt an Trafostation', 1, '2020-01-22 15:32:15', 'schmidth', '2020-01-24 08:02:44', 'meyers');
INSERT INTO public.tbl_failure_information(UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, PROBABLE_REASON, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER) INSERT INTO public.tbl_failure_information(UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, PROBABLE_REASON, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
VALUES ('37aef635-d0d4-4c47-ac25-c0d16c29e35c', 1,3, 2, 'Gasleck Oldenburg', 'Es gibt ein Gasleck in Oldenburg', 'Bernd Britzel', 'E', 2, 2, 3, null, 'HD', '2021-05-19 00:00:00', '2021-05-22 00:00:00', '2021-05-22 12:00:00', 'Leck in Gasleitung', 'HD betroffen', '26133', 'Oldenburg', null, 'Cloppenburger Str.', '302', '1234863-b234', 'ertf', '124,2323', 4, 8.210150, 53.111820, 'Link - extenes System', 'nicht veröffentlicht', 'Freitext: Eine Gasleitung wurde beschädigt', 4, '2020-02-03 15:15:15', 'schulzek', '2020-02-24 20:08:41', 'muellert'); VALUES ('37aef635-d0d4-4c47-ac25-c0d16c29e35c', 1,2, 2, 'Gasleck Oldenburg', 'Es gibt ein Gasleck in Oldenburg', 'Bernd Britzel', 'E', 2, 2, 3, null, 'HD', '2021-05-19 00:00:00', '2021-05-22 00:00:00', '2021-05-22 12:00:00', 'Leck in Gasleitung', 'HD betroffen', '26133', 'Oldenburg', null, 'Cloppenburger Str.', '302', '1234863-b234', 'ertf', '124,2323', 4, 8.210150, 53.111820, 'Link - extenes System', 'nicht veröffentlicht', 'Freitext: Eine Gasleitung wurde beschädigt', 4, '2020-02-03 15:15:15', 'schulzek', '2020-02-24 20:08:41', 'muellert');
-- --------------------------------------------- -- ---------------------------------------------
-- TABLE TBL_IMPORT_DATA -- TABLE TBL_IMPORT_DATA
......
...@@ -51,7 +51,7 @@ public class ExpectedReasonControllerTest { ...@@ -51,7 +51,7 @@ public class ExpectedReasonControllerTest {
List<ExpectedReasonDto> expectedReasonDtoList = MockDataHelper.mockExpectedReasonDtoList(); List<ExpectedReasonDto> expectedReasonDtoList = MockDataHelper.mockExpectedReasonDtoList();
when(expectedReasonService.getExpectedReasons()).thenReturn(expectedReasonDtoList); when(expectedReasonService.getExpectedReasons()).thenReturn(expectedReasonDtoList);
mockMvc.perform(get("/publication-texts")) mockMvc.perform(get("/expected-reasons"))
.andExpect(status().is2xxSuccessful()) .andExpect(status().is2xxSuccessful())
.andExpect(content().contentType(MediaType.APPLICATION_JSON)); .andExpect(content().contentType(MediaType.APPLICATION_JSON));
} }
......
...@@ -138,8 +138,8 @@ public class FailureInformationControllerTest { ...@@ -138,8 +138,8 @@ public class FailureInformationControllerTest {
.andExpect(jsonPath("$.latitude", is(failureInfoDto.getLatitude().doubleValue()))) .andExpect(jsonPath("$.latitude", is(failureInfoDto.getLatitude().doubleValue())))
.andExpect(jsonPath("$.publicationStatus", is(failureInfoDto.getPublicationStatus()))) .andExpect(jsonPath("$.publicationStatus", is(failureInfoDto.getPublicationStatus())))
.andExpect(jsonPath("$.publicationFreetext", is(failureInfoDto.getPublicationFreetext()))) .andExpect(jsonPath("$.publicationFreetext", is(failureInfoDto.getPublicationFreetext())))
.andExpect(jsonPath("$.expectedReasonId", is(failureInfoDto.getPublicationTextId().toString()))) .andExpect(jsonPath("$.expectedReasonId", is(failureInfoDto.getExpectedReasonId().toString())))
.andExpect(jsonPath("$.publicationText", is(failureInfoDto.getPublicationText()))) .andExpect(jsonPath("$.expectedReasonText", is(failureInfoDto.getExpectedReasonText())))
.andExpect(jsonPath("$.failureClassificationId", is(failureInfoDto.getFailureClassificationId().toString()))) .andExpect(jsonPath("$.failureClassificationId", is(failureInfoDto.getFailureClassificationId().toString())))
.andExpect(jsonPath("$.failureClassification", is(failureInfoDto.getFailureClassification()))) .andExpect(jsonPath("$.failureClassification", is(failureInfoDto.getFailureClassification())))
.andExpect(jsonPath("$.failureTypeId", is(failureInfoDto.getFailureTypeId().toString()))) .andExpect(jsonPath("$.failureTypeId", is(failureInfoDto.getFailureTypeId().toString())))
......
...@@ -36,7 +36,7 @@ package org.eclipse.openk.gridfailureinformation.service; ...@@ -36,7 +36,7 @@ package org.eclipse.openk.gridfailureinformation.service;
@ContextConfiguration(classes = {TestConfiguration.class}) @ContextConfiguration(classes = {TestConfiguration.class})
public class ExpectedReasonServiceTest { public class ExpectedReasonServiceTest {
@Qualifier("myPublicationTextService") @Qualifier("myExpectedReasonService")
@Autowired @Autowired
private ExpectedReasonService expectedReasonService; private ExpectedReasonService expectedReasonService;
...@@ -47,10 +47,10 @@ public class ExpectedReasonServiceTest { ...@@ -47,10 +47,10 @@ public class ExpectedReasonServiceTest {
public void shouldGetRadiiProperly() { public void shouldGetRadiiProperly() {
List<RefExpectedReason> mockRefExpectedReasonList = MockDataHelper.mockRefExpectedReasonList(); List<RefExpectedReason> mockRefExpectedReasonList = MockDataHelper.mockRefExpectedReasonList();
when(expectedReasonRepository.findAll()).thenReturn(mockRefExpectedReasonList); when(expectedReasonRepository.findAll()).thenReturn(mockRefExpectedReasonList);
List<ExpectedReasonDto> listRefPublicationText = expectedReasonService.getExpectedReasons(); List<ExpectedReasonDto> expectedReasons = expectedReasonService.getExpectedReasons();
assertEquals(listRefPublicationText.size(), mockRefExpectedReasonList.size()); assertEquals(expectedReasons.size(), mockRefExpectedReasonList.size());
assertEquals(listRefPublicationText.size(), 2); assertEquals(2, expectedReasons.size());
assertEquals(listRefPublicationText.get(1).getUuid(), mockRefExpectedReasonList.get(1).getUuid()); assertEquals(expectedReasons.get(1).getUuid(), mockRefExpectedReasonList.get(1).getUuid());
} }
} }
...@@ -117,7 +117,7 @@ public class FailureInformationServiceTest { ...@@ -117,7 +117,7 @@ public class FailureInformationServiceTest {
FailureInformationDto savedDto = failureInformationService.updateFailureInfo(fiDto); FailureInformationDto savedDto = failureInformationService.updateFailureInfo(fiDto);
assertEquals(savedDto.getVersionNumber(), 6L); assertEquals(6L, savedDto.getVersionNumber());
assertEquals(fiTbl.getResponsibility(), savedDto.getResponsibility()); assertEquals(fiTbl.getResponsibility(), savedDto.getResponsibility());
assertEquals(fiTbl.getInternExtern(), savedDto.getInternExtern()); assertEquals(fiTbl.getInternExtern(), savedDto.getInternExtern());
assertEquals(fiTbl.getVoltageLevel(), savedDto.getVoltageLevel()); assertEquals(fiTbl.getVoltageLevel(), savedDto.getVoltageLevel());
...@@ -149,8 +149,8 @@ public class FailureInformationServiceTest { ...@@ -149,8 +149,8 @@ public class FailureInformationServiceTest {
assertEquals(fiTbl.getRefBranch().getUuid(), savedDto.getBranchId()); assertEquals(fiTbl.getRefBranch().getUuid(), savedDto.getBranchId());
assertEquals(fiTbl.getRefBranch().getName(), savedDto.getBranch()); assertEquals(fiTbl.getRefBranch().getName(), savedDto.getBranch());
assertEquals(fiTbl.getRefBranch().getColorCode(), savedDto.getBranchColorCode()); assertEquals(fiTbl.getRefBranch().getColorCode(), savedDto.getBranchColorCode());
assertEquals(fiTbl.getRefExpectedReason().getUuid(), savedDto.getPublicationTextId()); assertEquals(fiTbl.getRefExpectedReason().getUuid(), savedDto.getExpectedReasonId());
assertEquals(fiTbl.getRefExpectedReason().getText(), savedDto.getPublicationText()); assertEquals(fiTbl.getRefExpectedReason().getText(), savedDto.getExpectedReasonText());
} }
...@@ -163,7 +163,7 @@ public class FailureInformationServiceTest { ...@@ -163,7 +163,7 @@ public class FailureInformationServiceTest {
fiDto.setStatusExternId(null); fiDto.setStatusExternId(null);
fiDto.setStatusInternId(null); fiDto.setStatusInternId(null);
fiDto.setRadiusId(null); fiDto.setRadiusId(null);
fiDto.setPublicationTextId(null); fiDto.setExpectedReasonId(null);
TblFailureInformation fiTbl = MockDataHelper.mockTblFailureInformation(); TblFailureInformation fiTbl = MockDataHelper.mockTblFailureInformation();
fiTbl.setRefBranch(null); fiTbl.setRefBranch(null);
...@@ -365,7 +365,7 @@ public class FailureInformationServiceTest { ...@@ -365,7 +365,7 @@ public class FailureInformationServiceTest {
@Test @Test
public void shouldNotUpdateFailureInformation_Exception_PublicationTextNotFound() { public void shouldNotUpdateFailureInformation_Exception_ExpectedReasonNotFound() {
FailureInformationDto fiDto = MockDataHelper.mockFailureInformationDto(); FailureInformationDto fiDto = MockDataHelper.mockFailureInformationDto();
TblFailureInformation fiTbl = MockDataHelper.mockTblFailureInformation(); TblFailureInformation fiTbl = MockDataHelper.mockTblFailureInformation();
RefFailureClassification refFailureClassification = MockDataHelper.mockRefFailureClassification(); RefFailureClassification refFailureClassification = MockDataHelper.mockRefFailureClassification();
...@@ -380,7 +380,7 @@ public class FailureInformationServiceTest { ...@@ -380,7 +380,7 @@ public class FailureInformationServiceTest {
when(failureTypeRepository.findByUuid(any(UUID.class))).thenReturn(Optional.empty()); when(failureTypeRepository.findByUuid(any(UUID.class))).thenReturn(Optional.empty());
when(statusRepository.findByUuid(any(UUID.class))).thenReturn(Optional.of(refStatus)); when(statusRepository.findByUuid(any(UUID.class))).thenReturn(Optional.of(refStatus));
when(radiusRepository.findByUuid(any(UUID.class))).thenReturn(Optional.of(refRadius)); when(radiusRepository.findByUuid(any(UUID.class))).thenReturn(Optional.of(refRadius));
//publicationText cannot be found //ExpectedReason cannot be found
when(failureInformationRepository.save(any(TblFailureInformation.class))) when(failureInformationRepository.save(any(TblFailureInformation.class)))
.then((Answer<TblFailureInformation>) invocation -> { .then((Answer<TblFailureInformation>) invocation -> {
...@@ -453,8 +453,8 @@ public class FailureInformationServiceTest { ...@@ -453,8 +453,8 @@ public class FailureInformationServiceTest {
assertEquals(refBranch.getColorCode(), savedDto.getBranchColorCode()); assertEquals(refBranch.getColorCode(), savedDto.getBranchColorCode());
assertEquals(refRadius.getUuid(), savedDto.getRadiusId()); assertEquals(refRadius.getUuid(), savedDto.getRadiusId());
assertEquals(refRadius.getRadius(), savedDto.getRadius()); assertEquals(refRadius.getRadius(), savedDto.getRadius());
assertEquals(refExpectedReason.getUuid(), savedDto.getPublicationTextId()); assertEquals(refExpectedReason.getUuid(), savedDto.getExpectedReasonId());
assertEquals(refExpectedReason.getText(), savedDto.getPublicationText()); assertEquals(refExpectedReason.getText(), savedDto.getExpectedReasonText());
} }
} }
...@@ -73,8 +73,8 @@ public class MockDataHelper { ...@@ -73,8 +73,8 @@ public class MockDataHelper {
dto.setPublicationStatus("veröffentlicht"); dto.setPublicationStatus("veröffentlicht");
dto.setPublicationFreetext("Kabel aus Steckdose gerissen"); dto.setPublicationFreetext("Kabel aus Steckdose gerissen");
dto.setPublicationTextId(UUID.randomUUID()); dto.setExpectedReasonId(UUID.randomUUID());
dto.setPublicationText("Kabelfehler Niederspannung"); dto.setExpectedReasonText("Kabelfehler Niederspannung");
dto.setFailureClassificationId(UUID.randomUUID()); dto.setFailureClassificationId(UUID.randomUUID());
dto.setFailureClassification("FailClazz"); dto.setFailureClassification("FailClazz");
...@@ -489,8 +489,8 @@ public class MockDataHelper { ...@@ -489,8 +489,8 @@ public class MockDataHelper {
dto.setPublicationStatus(" nicht veröffentlicht"); dto.setPublicationStatus(" nicht veröffentlicht");
dto.setPublicationFreetext("Leitung abgerissen"); dto.setPublicationFreetext("Leitung abgerissen");
dto.setPublicationTextId(UUID.randomUUID()); dto.setExpectedReasonId(UUID.randomUUID());
dto.setPublicationText("Kabelfehler Hochspannung"); dto.setExpectedReasonText("Kabelfehler Hochspannung");
dto.setFailureClassificationId(UUID.randomUUID()); dto.setFailureClassificationId(UUID.randomUUID());
dto.setFailureClassification("FailClazz"); dto.setFailureClassification("FailClazz");
...@@ -541,8 +541,8 @@ public class MockDataHelper { ...@@ -541,8 +541,8 @@ public class MockDataHelper {
dto.setPublicationStatus("veröffentlicht"); dto.setPublicationStatus("veröffentlicht");
dto.setPublicationFreetext("Kabel durchgebrochen"); dto.setPublicationFreetext("Kabel durchgebrochen");
dto.setPublicationTextId(UUID.randomUUID()); dto.setExpectedReasonId(UUID.randomUUID());
dto.setPublicationText("Kabelfehler Mittelspannung"); dto.setExpectedReasonText("Kabelfehler Mittelspannung");
dto.setFailureClassificationId(UUID.randomUUID()); dto.setFailureClassificationId(UUID.randomUUID());
dto.setFailureClassification("FailClazz"); dto.setFailureClassification("FailClazz");
...@@ -634,7 +634,7 @@ public class MockDataHelper { ...@@ -634,7 +634,7 @@ public class MockDataHelper {
} }
public static ExpectedReasonDto mockPublicationTextDto() { public static ExpectedReasonDto mockExpectedReasonDto() {
ExpectedReasonDto expectedReasonDto1 = new ExpectedReasonDto(); ExpectedReasonDto expectedReasonDto1 = new ExpectedReasonDto();
expectedReasonDto1.setUuid(UUID.fromString("cd22ff10-6cde-11ea-bc55-0242ac130003")); expectedReasonDto1.setUuid(UUID.fromString("cd22ff10-6cde-11ea-bc55-0242ac130003"));
...@@ -644,7 +644,7 @@ public class MockDataHelper { ...@@ -644,7 +644,7 @@ public class MockDataHelper {
return expectedReasonDto1; return expectedReasonDto1;
} }
public static ExpectedReasonDto mockPublicationTextDto2() { public static ExpectedReasonDto mockExpectedReasonDto2() {
ExpectedReasonDto expectedReasonDto2 = new ExpectedReasonDto(); ExpectedReasonDto expectedReasonDto2 = new ExpectedReasonDto();
expectedReasonDto2.setUuid(UUID.fromString("cd23015e-6cde-11ea-bc55-0242ac130003")); expectedReasonDto2.setUuid(UUID.fromString("cd23015e-6cde-11ea-bc55-0242ac130003"));
...@@ -655,8 +655,8 @@ public class MockDataHelper { ...@@ -655,8 +655,8 @@ public class MockDataHelper {
} }
public static List<ExpectedReasonDto> mockExpectedReasonDtoList() { public static List<ExpectedReasonDto> mockExpectedReasonDtoList() {
ExpectedReasonDto expectedReasonDto1 = mockPublicationTextDto(); ExpectedReasonDto expectedReasonDto1 = mockExpectedReasonDto();
ExpectedReasonDto expectedReasonDto2 = mockPublicationTextDto2(); ExpectedReasonDto expectedReasonDto2 = mockExpectedReasonDto2();
List<ExpectedReasonDto> expectedReasonDtoList = new ArrayList<>(); List<ExpectedReasonDto> expectedReasonDtoList = new ArrayList<>();
expectedReasonDtoList.add(expectedReasonDto1); expectedReasonDtoList.add(expectedReasonDto1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment