Skip to content

Commit ca8842a

Browse files
author
=
committed
fixing unit tests
1 parent 1b86a1c commit ca8842a

24 files changed

Lines changed: 181 additions & 210 deletions

File tree

sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/ExternalMessageDto.java

Lines changed: 0 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -976,177 +976,4 @@ public ExternalMessageDto setSurveyResponseData(ExternalSurveyResponseData surve
976976
this.surveyResponseData = surveyResponseData;
977977
return this;
978978
}
979-
980-
@Override
981-
public boolean equals(Object o) {
982-
if (o == null || getClass() != o.getClass())
983-
return false;
984-
if (!super.equals(o))
985-
return false;
986-
ExternalMessageDto that = (ExternalMessageDto) o;
987-
return automaticProcessingPossible == that.automaticProcessingPossible
988-
&& type == that.type
989-
&& disease == that.disease
990-
&& Objects.equals(diseaseVariant, that.diseaseVariant)
991-
&& Objects.equals(diseaseVariantDetails, that.diseaseVariantDetails)
992-
&& Objects.equals(messageDateTime, that.messageDateTime)
993-
&& caseClassification == that.caseClassification
994-
&& Objects.equals(caseReportDate, that.caseReportDate)
995-
&& Objects.equals(caseSymptoms, that.caseSymptoms)
996-
&& Objects.equals(reporterName, that.reporterName)
997-
&& Objects.equals(reporterExternalIds, that.reporterExternalIds)
998-
&& Objects.equals(reporterPostalCode, that.reporterPostalCode)
999-
&& Objects.equals(reporterCity, that.reporterCity)
1000-
&& Objects.equals(personFirstName, that.personFirstName)
1001-
&& Objects.equals(personLastName, that.personLastName)
1002-
&& Objects.equals(personExternalId, that.personExternalId)
1003-
&& Objects.equals(personNationalHealthId, that.personNationalHealthId)
1004-
&& personSex == that.personSex
1005-
&& personPresentCondition == that.personPresentCondition
1006-
&& Objects.equals(personBirthDateDD, that.personBirthDateDD)
1007-
&& Objects.equals(personBirthDateMM, that.personBirthDateMM)
1008-
&& Objects.equals(personBirthDateYYYY, that.personBirthDateYYYY)
1009-
&& Objects.equals(personPostalCode, that.personPostalCode)
1010-
&& Objects.equals(personCity, that.personCity)
1011-
&& Objects.equals(personStreet, that.personStreet)
1012-
&& Objects.equals(personHouseNumber, that.personHouseNumber)
1013-
&& Objects.equals(personCountry, that.personCountry)
1014-
&& Objects.equals(personFacility, that.personFacility)
1015-
&& Objects.equals(personPhone, that.personPhone)
1016-
&& personPhoneNumberType == that.personPhoneNumberType
1017-
&& Objects.equals(personEmail, that.personEmail)
1018-
&& Objects.equals(personGuardianFirstName, that.personGuardianFirstName)
1019-
&& Objects.equals(personGuardianLastName, that.personGuardianLastName)
1020-
&& Objects.equals(personGuardianRelationship, that.personGuardianRelationship)
1021-
&& Objects.equals(personGuardianPhone, that.personGuardianPhone)
1022-
&& Objects.equals(personGuardianEmail, that.personGuardianEmail)
1023-
&& Objects.equals(personOccupation, that.personOccupation)
1024-
&& treatmentStarted == that.treatmentStarted
1025-
&& Objects.equals(treatmentNotApplicable, that.treatmentNotApplicable)
1026-
&& Objects.equals(treatmentStartedDate, that.treatmentStartedDate)
1027-
&& Objects.equals(diagnosticDate, that.diagnosticDate)
1028-
&& Objects.equals(deceasedDate, that.deceasedDate)
1029-
&& Objects.equals(sampleReports, that.sampleReports)
1030-
&& Objects.equals(surveillanceReport, that.surveillanceReport)
1031-
&& Objects.equals(externalMessageDetails, that.externalMessageDetails)
1032-
&& Objects.equals(caseComments, that.caseComments)
1033-
&& Objects.equals(reportId, that.reportId)
1034-
&& Objects.equals(reportMessageId, that.reportMessageId)
1035-
&& status == that.status
1036-
&& Objects.equals(assignee, that.assignee)
1037-
&& Objects.equals(reportingUser, that.reportingUser)
1038-
&& Objects.equals(personAdditionalDetails, that.personAdditionalDetails)
1039-
&& vaccinationStatus == that.vaccinationStatus
1040-
&& admittedToHealthFacility == that.admittedToHealthFacility
1041-
&& Objects.equals(hospitalizationFacilityName, that.hospitalizationFacilityName)
1042-
&& Objects.equals(hospitalizationFacilityExternalId, that.hospitalizationFacilityExternalId)
1043-
&& Objects.equals(hospitalizationFacilityDepartment, that.hospitalizationFacilityDepartment)
1044-
&& Objects.equals(hospitalizationAdmissionDate, that.hospitalizationAdmissionDate)
1045-
&& Objects.equals(hospitalizationDischargeDate, that.hospitalizationDischargeDate)
1046-
&& Objects.equals(notifierFirstName, that.notifierFirstName)
1047-
&& Objects.equals(notifierLastName, that.notifierLastName)
1048-
&& Objects.equals(notifierRegistrationNumber, that.notifierRegistrationNumber)
1049-
&& Objects.equals(notifierAddress, that.notifierAddress)
1050-
&& Objects.equals(notifierEmail, that.notifierEmail)
1051-
&& Objects.equals(notifierPhone, that.notifierPhone)
1052-
&& Objects.equals(activitiesAsCase, that.activitiesAsCase)
1053-
&& Objects.equals(exposures, that.exposures)
1054-
&& radiographyCompatibility == that.radiographyCompatibility
1055-
&& Objects.equals(otherDiagnosticCriteria, that.otherDiagnosticCriteria)
1056-
&& tuberculosis == that.tuberculosis
1057-
&& hiv == that.hiv
1058-
&& hivArt == that.hivArt
1059-
&& Objects.equals(tuberculosisInfectionYear, that.tuberculosisInfectionYear)
1060-
&& previousTuberculosisTreatment == that.previousTuberculosisTreatment
1061-
&& complianceWithTreatment == that.complianceWithTreatment
1062-
&& Objects.equals(tuberculosisDirectlyObservedTreatment, that.tuberculosisDirectlyObservedTreatment)
1063-
&& Objects.equals(tuberculosisMdrXdrTuberculosis, that.tuberculosisMdrXdrTuberculosis)
1064-
&& Objects.equals(tuberculosisBeijingLineage, that.tuberculosisBeijingLineage)
1065-
&& Objects.equals(surveyResponseData, that.surveyResponseData);
1066-
}
1067-
1068-
@Override
1069-
public int hashCode() {
1070-
return Objects.hash(
1071-
super.hashCode(),
1072-
type,
1073-
disease,
1074-
diseaseVariant,
1075-
diseaseVariantDetails,
1076-
messageDateTime,
1077-
caseClassification,
1078-
caseReportDate,
1079-
caseSymptoms,
1080-
reporterName,
1081-
reporterExternalIds,
1082-
reporterPostalCode,
1083-
reporterCity,
1084-
personFirstName,
1085-
personLastName,
1086-
personExternalId,
1087-
personNationalHealthId,
1088-
personSex,
1089-
personPresentCondition,
1090-
personBirthDateDD,
1091-
personBirthDateMM,
1092-
personBirthDateYYYY,
1093-
personPostalCode,
1094-
personCity,
1095-
personStreet,
1096-
personHouseNumber,
1097-
personCountry,
1098-
personFacility,
1099-
personPhone,
1100-
personPhoneNumberType,
1101-
personEmail,
1102-
personGuardianFirstName,
1103-
personGuardianLastName,
1104-
personGuardianRelationship,
1105-
personGuardianPhone,
1106-
personGuardianEmail,
1107-
personOccupation,
1108-
treatmentStarted,
1109-
treatmentNotApplicable,
1110-
treatmentStartedDate,
1111-
diagnosticDate,
1112-
deceasedDate,
1113-
sampleReports,
1114-
surveillanceReport,
1115-
externalMessageDetails,
1116-
caseComments,
1117-
reportId,
1118-
reportMessageId,
1119-
status,
1120-
assignee,
1121-
reportingUser,
1122-
automaticProcessingPossible,
1123-
personAdditionalDetails,
1124-
vaccinationStatus,
1125-
admittedToHealthFacility,
1126-
hospitalizationFacilityName,
1127-
hospitalizationFacilityExternalId,
1128-
hospitalizationFacilityDepartment,
1129-
hospitalizationAdmissionDate,
1130-
hospitalizationDischargeDate,
1131-
notifierFirstName,
1132-
notifierLastName,
1133-
notifierRegistrationNumber,
1134-
notifierAddress,
1135-
notifierEmail,
1136-
notifierPhone,
1137-
activitiesAsCase,
1138-
exposures,
1139-
radiographyCompatibility,
1140-
otherDiagnosticCriteria,
1141-
tuberculosis,
1142-
hiv,
1143-
hivArt,
1144-
tuberculosisInfectionYear,
1145-
previousTuberculosisTreatment,
1146-
complianceWithTreatment,
1147-
tuberculosisDirectlyObservedTreatment,
1148-
tuberculosisMdrXdrTuberculosis,
1149-
tuberculosisBeijingLineage,
1150-
surveyResponseData);
1151-
}
1152979
}

sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/ExternalMessageFacade.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ default List<ExternalMessageDto> saveAndProcessSurveyResponses() {
9696
* the corrected field path -> value map to apply
9797
* @return updated ExternalMessageDto after reprocessing
9898
*/
99-
ExternalMessageDto reprocessSurveyResponse(String uuid, Map<String, Object> correctedDictionary);
99+
ExternalMessageDto overwriteSurveyResponse(String uuid, Map<String, Object> correctedDictionary);
100100

101101
/**
102102
* Retrieves display-ready field information (translated names and current case values) for all fields
@@ -106,5 +106,5 @@ default List<ExternalMessageDto> saveAndProcessSurveyResponses() {
106106
* UUID of the external message (must be of type SURVEY_RESPONSE with a processed result)
107107
* @return displayable field info keyed by field path
108108
*/
109-
DisplayablePartialRetrievalResponse retrieveSurveyResponseFieldsForDisplay(String externalMessageUuid);
109+
DisplayablePartialRetrievalResponse fetchSurveyResponseFieldsForDisplay(String externalMessageUuid);
110110
}

sormas-api/src/main/java/de/symeda/sormas/api/patch/partial_retrieval/DisplayablePartialRetrievalResponse.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package de.symeda.sormas.api.patch.partial_retrieval;
22

3+
import de.symeda.sormas.api.audit.AuditedClass;
4+
35
import java.io.Serializable;
46
import java.util.HashMap;
57
import java.util.Map;
68
import java.util.Objects;
79

10+
@AuditedClass
811
public class DisplayablePartialRetrievalResponse implements Serializable {
912

1013
private static final long serialVersionUID = 1L;

sormas-api/src/main/java/de/symeda/sormas/api/survey/alias/PathAliasFacade.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ public interface PathAliasFacade {
1212
* that may (or may not) contain physical paths.
1313
* @return shortened path.
1414
*/
15-
String toAliasPath(String path);
15+
String fetchAliasPath(String path);
1616
}

sormas-backend/src/main/java/de/symeda/sormas/backend/externalmessage/ExternalMessageFacadeEjb.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ public ExternalMessageDto saveAndProcessLabmessage(@Valid ExternalMessageDto lab
314314
}
315315

316316
@Override
317+
@RightsAllowed(UserRight._EXTERNAL_MESSAGE_SURVEY_RESPONSE_VIEW)
317318
public List<ExternalMessageDto> saveAndProcessSurveyResponses(Date since) {
318319

319320
if (since == null) { // TODO: use shorter default range
@@ -817,8 +818,7 @@ public Page<ExternalMessageIndexDto> getIndexPage(
817818
UserRight._SYSTEM,
818819
UserRight._EXTERNAL_MESSAGE_ACCESS,
819820
UserRight._EXTERNAL_MESSAGE_LABORATORY_VIEW,
820-
UserRight._EXTERNAL_MESSAGE_DOCTOR_DECLARATION_VIEW,
821-
UserRight._EXTERNAL_MESSAGE_SURVEY_RESPONSE_VIEW })
821+
UserRight._EXTERNAL_MESSAGE_DOCTOR_DECLARATION_VIEW })
822822
public ExternalMessageFetchResult fetchAndSaveExternalMessages(Date since) {
823823

824824
SystemEventDto currentSync = syncFacadeEjb.startSyncFor(SystemEventType.FETCH_EXTERNAL_MESSAGES);
@@ -975,7 +975,7 @@ public ExternalMessageDto getForSurveillanceReport(SurveillanceReportReferenceDt
975975

976976
@Override
977977
@RightsAllowed(UserRight._EXTERNAL_MESSAGE_SURVEY_RESPONSE_PROCESS)
978-
public ExternalMessageDto reprocessSurveyResponse(String uuid, java.util.Map<String, Object> correctedDictionary) {
978+
public ExternalMessageDto overwriteSurveyResponse(String uuid, java.util.Map<String, Object> correctedDictionary) {
979979
ExternalMessageDto externalMessage = getByUuid(uuid);
980980
ExternalMessageSurveyResponseRequest latestRequest = externalMessage.getSurveyResponseData().getLatest().getRequest();
981981

@@ -1009,8 +1009,8 @@ public ExternalMessageDto reprocessSurveyResponse(String uuid, java.util.Map<Str
10091009
}
10101010

10111011
@Override
1012-
@RightsAllowed(UserRight._EXTERNAL_MESSAGE_SURVEY_RESPONSE_PROCESS)
1013-
public de.symeda.sormas.api.patch.partial_retrieval.DisplayablePartialRetrievalResponse retrieveSurveyResponseFieldsForDisplay(
1012+
@RightsAllowed(UserRight._EXTERNAL_MESSAGE_SURVEY_RESPONSE_VIEW)
1013+
public de.symeda.sormas.api.patch.partial_retrieval.DisplayablePartialRetrievalResponse fetchSurveyResponseFieldsForDisplay(
10141014
String externalMessageUuid) {
10151015

10161016
ExternalMessageDto externalMessage = getByUuid(externalMessageUuid);

sormas-backend/src/main/java/de/symeda/sormas/backend/patch/alias/PathAliasFacadeEjb.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class PathAliasFacadeEjb implements PathAliasFacade {
1313
private PathAliasHelper pathAliasHelper;
1414

1515
@Override
16-
public String toAliasPath(String path) {
16+
public String fetchAliasPath(String path) {
1717
return pathAliasHelper.toAliasPath(path);
1818
}
1919

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package de.symeda.sormas.backend.patch.partial_retrieval;
2+
3+
import de.symeda.sormas.api.patch.partial_retrieval.FieldInfo;
4+
import de.symeda.sormas.api.utils.OrderedRegisterable;
5+
6+
import javax.validation.constraints.NotNull;
7+
import java.util.Set;
8+
9+
public interface SpecificFieldValueRetriever {
10+
11+
FieldInfo getFieldInfo(String fieldName);
12+
13+
/**
14+
* Meant to be implemented by classes implementing this {@link OrderedRegisterable} contract but to be used.
15+
* For usages prefer {@link #supports(String)}.
16+
*
17+
* @return types that are supported by this class.
18+
*/
19+
@NotNull
20+
Set<String> getSupportedFields();
21+
22+
/**
23+
* Specifies if the targetType is supported by this class.
24+
*
25+
* @param targetFieldName
26+
* can be a child class.
27+
* @return true if the class will be able to perform some action with this type.
28+
*/
29+
default boolean supports(@NotNull String targetFieldName) {
30+
return getSupportedFields().contains(targetFieldName);
31+
}
32+
33+
default String toFieldName(String prefix, String fieldName) {
34+
return prefix + '.' + fieldName;
35+
}
36+
}

sormas-backend/src/main/java/de/symeda/sormas/backend/patch/partial_retrieval/impl/EnumToDisplayValueMapperImpl.java renamed to sormas-backend/src/main/java/de/symeda/sormas/backend/patch/partial_retrieval/impl/EnumToDisplayValueMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import de.symeda.sormas.backend.patch.partial_retrieval.TypeToDisplayValueMapper;
99

1010
@ApplicationScoped
11-
public class EnumToDisplayValueMapperImpl implements TypeToDisplayValueMapper {
11+
public class EnumToDisplayValueMapper implements TypeToDisplayValueMapper {
1212

1313
public static final Set<Class<?>> SUPPORTED_TYPES = Set.of(Enum.class);
1414

sormas-backend/src/main/java/de/symeda/sormas/backend/survey/Survey.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public void setEmailTemplate(DocumentTemplate emailTemplate) {
8080
this.emailTemplate = emailTemplate;
8181
}
8282

83-
@Column(nullable = false, length = FieldConstraints.CHARACTER_LIMIT_DEFAULT)
83+
@Column(length = FieldConstraints.CHARACTER_LIMIT_DEFAULT)
8484
public String getExternalId() {
8585
return externalId;
8686
}

sormas-backend/src/main/java/de/symeda/sormas/backend/systemconfiguration/SystemConfigurationValueEjb.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,12 @@ public void validate(@Valid final SystemConfigurationValueDto dto) throws Valida
355355
@PostConstruct
356356
public void loadData() {
357357

358-
LOGGER.info("Loading SystemConfiguration data into cache");
358+
LOGGER.debug("Loading SystemConfiguration data into cache");
359359
configurationValuesByKey.clear();
360360

361361
service.getAll().forEach(value -> configurationValuesByKey.put(value.getKey(), value.getValue()));
362362

363-
LOGGER.info("SystemConfiguration data loaded into cache successfully");
363+
LOGGER.debug("SystemConfiguration data loaded into cache successfully");
364364
}
365365

366366
/**

0 commit comments

Comments
 (0)