Skip to content

Commit

Permalink
AB#1011 Add locationName to ReportDto
Browse files Browse the repository at this point in the history
  • Loading branch information
gjvoosten committed Jan 7, 2025
1 parent cbef6c6 commit 207a791
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
10 changes: 10 additions & 0 deletions src/main/java/mil/dds/anet/beans/mart/ReportDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class ReportDto {
private Instant engagementDate;
private String intent;
private String locationUuid;
private String locationName;
private String reportText;

private String customFields;
Expand Down Expand Up @@ -136,6 +137,14 @@ public void setLocationUuid(String locationUuid) {
this.locationUuid = locationUuid;
}

public String getLocationName() {
return locationName;
}

public void setLocationName(String locationName) {
this.locationName = locationName;
}

public String getReportText() {
return reportText;
}
Expand Down Expand Up @@ -175,4 +184,5 @@ public String getRank() {
public void setRank(String rank) {
this.rank = rank;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ private Report processReportInfo(ReportDto martReport, StringBuilder errors) {
// Validate report location, it not valid finish
final Location location = locationDao.getByUuid(martReport.getLocationUuid());
if (location == null) {
errors.append("Can not find report location: ").append(martReport.getLocationUuid());
errors.append("Can not find report location: ").append(martReport.getLocationName());
.append("' with uuid: ")
.append(martReport.getLocationUuid());
return null;
}

Expand Down
9 changes: 5 additions & 4 deletions src/test/java/mil/dds/anet/test/TestData.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static TaskInput createTaskInput(String shortName, String longName, Strin
}

public static ReportDto createGoodMartReport() {
ReportDto reportDto = new ReportDto();
final ReportDto reportDto = new ReportDto();
// User Info
reportDto.setUuid(UUID.randomUUID().toString());
reportDto.setOrganizationUuid("9a35caa7-a095-4963-ac7b-b784fde4d583");
Expand All @@ -120,7 +120,7 @@ public static ReportDto createGoodMartReport() {
"{\"attitude\":\"Positive\", \"contacts\":\"Contacts\", \"remarks\":\"Remarks\", \"rcAssessment\":\"rcAssessment\"}");

// Tasks
Map<String, String> tasks = new HashMap<>();
final Map<String, String> tasks = new HashMap<>();
tasks.put("19364d81-3203-483d-a6bf-461d58888c76", "Intelligence");
tasks.put("does not exist", "does not exist");
reportDto.setTasks(tasks);
Expand All @@ -129,16 +129,17 @@ public static ReportDto createGoodMartReport() {
}

public static ReportDto createMartReportWrongOrganization() {
ReportDto reportDto = new ReportDto();
final ReportDto reportDto = new ReportDto();
reportDto.setOrganizationUuid("does not exist");
reportDto.setOrganizationName("does not exist");
return reportDto;
}

public static ReportDto createMartReportWrongLocation() {
ReportDto reportDto = new ReportDto();
final ReportDto reportDto = new ReportDto();
reportDto.setOrganizationUuid("9a35caa7-a095-4963-ac7b-b784fde4d583");
reportDto.setLocationUuid("does not exist");
reportDto.setLocationName("does not exist");
return reportDto;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ void testWorker() {
List<MartImportedReport> martImportedReports = martImportedReportDao.getAll();

assertThat(martImportedReports.stream()
.filter(martImportedReport -> !martImportedReport.isSuccess() && martImportedReport
.getErrors().equals("Can not find report location: does not exist")))
.filter(
martImportedReport -> !martImportedReport.isSuccess() && martImportedReport.getErrors()
.equals("Can not find report location: 'does not exist' with uuid: does not exist"))
.hasSize(1);

assertThat(martImportedReports.stream()
Expand Down

0 comments on commit 207a791

Please sign in to comment.