Skip to content

Commit

Permalink
Merge branch 'main' into use_dns_for_s3_storage
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennehomer committed Nov 26, 2024
2 parents 1752e52 + 5ec9e75 commit f2c70ea
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public List<CaseInfos> getCases() {
}

private CaseInfos getCaseInfos(Path file) {
Objects.requireNonNull(file);
try {
return createInfos(file, UUID.fromString(file.getParent().getFileName().toString()));
} catch (Exception e) {
Expand All @@ -131,6 +132,10 @@ public String getCaseName(UUID caseUuid) {
@Override
public CaseInfos getCaseInfos(UUID caseUuid) {
Path file = getCaseFile(caseUuid);
if (file == null) {
LOGGER.error("The directory with the following uuid doesn't exist: {}", caseUuid);
return null;
}
return getCaseInfos(file);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ private List<S3Object> getCaseS3Objects(UUID caseUuid) {

@Override
public CaseInfos getCaseInfos(UUID caseUuid) {
if (!caseExists(caseUuid)) {
LOGGER.error("The directory with the following uuid doesn't exist: {}", caseUuid);
return null;
}
return new CaseInfos(caseUuid, getCaseName(caseUuid), getFormat(caseUuid));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,15 @@ void test() throws Exception {
.andExpect(status().isOk());
}

@Test
void testGetMetadataOfNonExistingCase() throws Exception {
MvcResult mvcResult = mvc.perform(get("/v1/cases/metadata?ids=" + UUID.randomUUID()))
.andExpect(status().isOk())
.andReturn();
String response = mvcResult.getResponse().getContentAsString();
assertEquals("[]", response);
}

@Test
void testDuplicateNonIndexedCase() throws Exception {
// create the storage dir
Expand Down

0 comments on commit f2c70ea

Please sign in to comment.