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 {
@Mapping(source = "refBranch.colorCode", target = "branchColorCode"),
@Mapping(source = "refRadius.uuid", target = "radiusId"),
@Mapping(source = "refRadius.radius", target = "radius"),
@Mapping(source = "refPublicationText.uuid", target = "publicationTextId"),
@Mapping(source = "refPublicationText.text", target = "publicationText")
@Mapping(source = "refExpectedReason.uuid", target = "expectedReasonId"),
@Mapping(source = "refExpectedReason.text", target = "expectedReasonText")
})
FailureInformationDto toFailureInformationDto(TblFailureInformation tblFailureInformation);
......@@ -56,8 +56,8 @@ public interface FailureInformationMapper {
@Mapping(target = "refBranch.colorCode", source = "branchColorCode"),
@Mapping(target = "refRadius.uuid", source = "radiusId"),
@Mapping(target = "refRadius.radius", source = "radius"),
@Mapping(target = "refPublicationText.uuid", source = "publicationTextId"),
@Mapping(target = "refPublicationText.text", source = "publicationText")
@Mapping(target = "refExpectedReason.uuid", source = "expectedReasonId"),
@Mapping(target = "refExpectedReason.text", source = "expectedReasonText")
})
TblFailureInformation toTblFailureInformation(FailureInformationDto failureInformationDto);
......
......@@ -154,10 +154,10 @@ public class FailureInformationService {
destTblFailureInformation.setRefRadius(null);
}
if( sourceDto.getPublicationTextId() != null ) {
if( sourceDto.getExpectedReasonId() != null ) {
destTblFailureInformation.setRefExpectedReason( expectedReasonRepository
.findByUuid(sourceDto.getPublicationTextId())
.orElseThrow(() -> new NotFoundException("publicationText.uuid.not.existing")));
.findByUuid(sourceDto.getExpectedReasonId())
.orElseThrow(() -> new NotFoundException("expected.reason.uuid.not.existing")));
}
else {
destTblFailureInformation.setRefExpectedReason(null);
......
......@@ -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');
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
......
......@@ -51,7 +51,7 @@ public class ExpectedReasonControllerTest {
List<ExpectedReasonDto> expectedReasonDtoList = MockDataHelper.mockExpectedReasonDtoList();
when(expectedReasonService.getExpectedReasons()).thenReturn(expectedReasonDtoList);
mockMvc.perform(get("/publication-texts"))
mockMvc.perform(get("/expected-reasons"))
.andExpect(status().is2xxSuccessful())
.andExpect(content().contentType(MediaType.APPLICATION_JSON));
}
......
......@@ -138,8 +138,8 @@ public class FailureInformationControllerTest {
.andExpect(jsonPath("$.latitude", is(failureInfoDto.getLatitude().doubleValue())))
.andExpect(jsonPath("$.publicationStatus", is(failureInfoDto.getPublicationStatus())))
.andExpect(jsonPath("$.publicationFreetext", is(failureInfoDto.getPublicationFreetext())))
.andExpect(jsonPath("$.expectedReasonId", is(failureInfoDto.getPublicationTextId().toString())))
.andExpect(jsonPath("$.publicationText", is(failureInfoDto.getPublicationText())))
.andExpect(jsonPath("$.expectedReasonId", is(failureInfoDto.getExpectedReasonId().toString())))
.andExpect(jsonPath("$.expectedReasonText", is(failureInfoDto.getExpectedReasonText())))
.andExpect(jsonPath("$.failureClassificationId", is(failureInfoDto.getFailureClassificationId().toString())))
.andExpect(jsonPath("$.failureClassification", is(failureInfoDto.getFailureClassification())))
.andExpect(jsonPath("$.failureTypeId", is(failureInfoDto.getFailureTypeId().toString())))
......
......@@ -36,7 +36,7 @@ package org.eclipse.openk.gridfailureinformation.service;
@ContextConfiguration(classes = {TestConfiguration.class})
public class ExpectedReasonServiceTest {
@Qualifier("myPublicationTextService")
@Qualifier("myExpectedReasonService")
@Autowired
private ExpectedReasonService expectedReasonService;
......@@ -47,10 +47,10 @@ public class ExpectedReasonServiceTest {
public void shouldGetRadiiProperly() {
List<RefExpectedReason> mockRefExpectedReasonList = MockDataHelper.mockRefExpectedReasonList();
when(expectedReasonRepository.findAll()).thenReturn(mockRefExpectedReasonList);
List<ExpectedReasonDto> listRefPublicationText = expectedReasonService.getExpectedReasons();
List<ExpectedReasonDto> expectedReasons = expectedReasonService.getExpectedReasons();
assertEquals(listRefPublicationText.size(), mockRefExpectedReasonList.size());
assertEquals(listRefPublicationText.size(), 2);
assertEquals(listRefPublicationText.get(1).getUuid(), mockRefExpectedReasonList.get(1).getUuid());
assertEquals(expectedReasons.size(), mockRefExpectedReasonList.size());
assertEquals(2, expectedReasons.size());
assertEquals(expectedReasons.get(1).getUuid(), mockRefExpectedReasonList.get(1).getUuid());
}
}
......@@ -117,7 +117,7 @@ public class FailureInformationServiceTest {
FailureInformationDto savedDto = failureInformationService.updateFailureInfo(fiDto);
assertEquals(savedDto.getVersionNumber(), 6L);
assertEquals(6L, savedDto.getVersionNumber());
assertEquals(fiTbl.getResponsibility(), savedDto.getResponsibility());
assertEquals(fiTbl.getInternExtern(), savedDto.getInternExtern());
assertEquals(fiTbl.getVoltageLevel(), savedDto.getVoltageLevel());
......@@ -149,8 +149,8 @@ public class FailureInformationServiceTest {
assertEquals(fiTbl.getRefBranch().getUuid(), savedDto.getBranchId());
assertEquals(fiTbl.getRefBranch().getName(), savedDto.getBranch());
assertEquals(fiTbl.getRefBranch().getColorCode(), savedDto.getBranchColorCode());
assertEquals(fiTbl.getRefExpectedReason().getUuid(), savedDto.getPublicationTextId());
assertEquals(fiTbl.getRefExpectedReason().getText(), savedDto.getPublicationText());
assertEquals(fiTbl.getRefExpectedReason().getUuid(), savedDto.getExpectedReasonId());
assertEquals(fiTbl.getRefExpectedReason().getText(), savedDto.getExpectedReasonText());
}
......@@ -163,7 +163,7 @@ public class FailureInformationServiceTest {
fiDto.setStatusExternId(null);
fiDto.setStatusInternId(null);
fiDto.setRadiusId(null);
fiDto.setPublicationTextId(null);
fiDto.setExpectedReasonId(null);
TblFailureInformation fiTbl = MockDataHelper.mockTblFailureInformation();
fiTbl.setRefBranch(null);
......@@ -365,7 +365,7 @@ public class FailureInformationServiceTest {
@Test
public void shouldNotUpdateFailureInformation_Exception_PublicationTextNotFound() {
public void shouldNotUpdateFailureInformation_Exception_ExpectedReasonNotFound() {
FailureInformationDto fiDto = MockDataHelper.mockFailureInformationDto();
TblFailureInformation fiTbl = MockDataHelper.mockTblFailureInformation();
RefFailureClassification refFailureClassification = MockDataHelper.mockRefFailureClassification();
......@@ -380,7 +380,7 @@ public class FailureInformationServiceTest {
when(failureTypeRepository.findByUuid(any(UUID.class))).thenReturn(Optional.empty());
when(statusRepository.findByUuid(any(UUID.class))).thenReturn(Optional.of(refStatus));
when(radiusRepository.findByUuid(any(UUID.class))).thenReturn(Optional.of(refRadius));
//publicationText cannot be found
//ExpectedReason cannot be found
when(failureInformationRepository.save(any(TblFailureInformation.class)))
.then((Answer<TblFailureInformation>) invocation -> {
......@@ -453,8 +453,8 @@ public class FailureInformationServiceTest {
assertEquals(refBranch.getColorCode(), savedDto.getBranchColorCode());
assertEquals(refRadius.getUuid(), savedDto.getRadiusId());
assertEquals(refRadius.getRadius(), savedDto.getRadius());
assertEquals(refExpectedReason.getUuid(), savedDto.getPublicationTextId());
assertEquals(refExpectedReason.getText(), savedDto.getPublicationText());
assertEquals(refExpectedReason.getUuid(), savedDto.getExpectedReasonId());
assertEquals(refExpectedReason.getText(), savedDto.getExpectedReasonText());
}
}
......@@ -73,8 +73,8 @@ public class MockDataHelper {
dto.setPublicationStatus("veröffentlicht");
dto.setPublicationFreetext("Kabel aus Steckdose gerissen");
dto.setPublicationTextId(UUID.randomUUID());
dto.setPublicationText("Kabelfehler Niederspannung");
dto.setExpectedReasonId(UUID.randomUUID());
dto.setExpectedReasonText("Kabelfehler Niederspannung");
dto.setFailureClassificationId(UUID.randomUUID());
dto.setFailureClassification("FailClazz");
......@@ -489,8 +489,8 @@ public class MockDataHelper {
dto.setPublicationStatus(" nicht veröffentlicht");
dto.setPublicationFreetext("Leitung abgerissen");
dto.setPublicationTextId(UUID.randomUUID());
dto.setPublicationText("Kabelfehler Hochspannung");
dto.setExpectedReasonId(UUID.randomUUID());
dto.setExpectedReasonText("Kabelfehler Hochspannung");
dto.setFailureClassificationId(UUID.randomUUID());
dto.setFailureClassification("FailClazz");
......@@ -541,8 +541,8 @@ public class MockDataHelper {
dto.setPublicationStatus("veröffentlicht");
dto.setPublicationFreetext("Kabel durchgebrochen");
dto.setPublicationTextId(UUID.randomUUID());
dto.setPublicationText("Kabelfehler Mittelspannung");
dto.setExpectedReasonId(UUID.randomUUID());
dto.setExpectedReasonText("Kabelfehler Mittelspannung");
dto.setFailureClassificationId(UUID.randomUUID());
dto.setFailureClassification("FailClazz");
......@@ -634,7 +634,7 @@ public class MockDataHelper {
}
public static ExpectedReasonDto mockPublicationTextDto() {
public static ExpectedReasonDto mockExpectedReasonDto() {
ExpectedReasonDto expectedReasonDto1 = new ExpectedReasonDto();
expectedReasonDto1.setUuid(UUID.fromString("cd22ff10-6cde-11ea-bc55-0242ac130003"));
......@@ -644,7 +644,7 @@ public class MockDataHelper {
return expectedReasonDto1;
}
public static ExpectedReasonDto mockPublicationTextDto2() {
public static ExpectedReasonDto mockExpectedReasonDto2() {
ExpectedReasonDto expectedReasonDto2 = new ExpectedReasonDto();
expectedReasonDto2.setUuid(UUID.fromString("cd23015e-6cde-11ea-bc55-0242ac130003"));
......@@ -655,8 +655,8 @@ public class MockDataHelper {
}
public static List<ExpectedReasonDto> mockExpectedReasonDtoList() {
ExpectedReasonDto expectedReasonDto1 = mockPublicationTextDto();
ExpectedReasonDto expectedReasonDto2 = mockPublicationTextDto2();
ExpectedReasonDto expectedReasonDto1 = mockExpectedReasonDto();
ExpectedReasonDto expectedReasonDto2 = mockExpectedReasonDto2();
List<ExpectedReasonDto> expectedReasonDtoList = new ArrayList<>();
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