diff --git a/src/main/java/edu/unc/lib/boxc/migration/cdm/services/ListProjectsService.java b/src/main/java/edu/unc/lib/boxc/migration/cdm/services/ListProjectsService.java index 6e86b18e..7b7c5bec 100644 --- a/src/main/java/edu/unc/lib/boxc/migration/cdm/services/ListProjectsService.java +++ b/src/main/java/edu/unc/lib/boxc/migration/cdm/services/ListProjectsService.java @@ -37,12 +37,8 @@ public class ListProjectsService { public static final String PROJECT_PATH = "projectPath"; public static final String STATUS = "status"; public static final String ALLOWED_ACTIONS = "allowedActions"; - private static final Set IMAGE_FORMATS = new HashSet<>(); - // accepted file types are listed in imageFormats below - static { - IMAGE_FORMATS.addAll(Arrays.asList("tif", "tiff", "jpeg", "jpg", "png", "gif", "pict", "bmp", - "psd", "jp2", "nef", "crw", "cr2", "dng", "raf")); - } + private static final Set IMAGE_FORMATS = new HashSet<>(Arrays.asList("tif", "tiff", "jpeg", "jpg", "png", + "gif", "pict", "bmp", "psd", "jp2", "nef", "crw", "cr2", "dng", "raf")); /** * List projects in given directory @@ -65,14 +61,14 @@ public JsonNode listProjects(Path directory) throws Exception { Path projectPath = directory.toAbsolutePath(); String projectStatus = status(project); - List allowedActions = allowedActions(project); + String allowedActions = mapper.writeValueAsString(allowedActions(project)); JsonNode projectProperties = mapper.readTree(project.getProjectPropertiesPath().toFile()); // add project info to JSON ObjectNode objectNode = mapper.createObjectNode(); objectNode.put(PROJECT_PATH, projectPath.toString()); objectNode.put(STATUS, projectStatus); - objectNode.put(ALLOWED_ACTIONS, String.valueOf(allowedActions)); + objectNode.put(ALLOWED_ACTIONS, allowedActions); objectNode.set("projectProperties", projectProperties); arrayNode.add(objectNode); } diff --git a/src/test/java/edu/unc/lib/boxc/migration/cdm/services/ListProjectsServiceTest.java b/src/test/java/edu/unc/lib/boxc/migration/cdm/services/ListProjectsServiceTest.java index b3636c8e..b34c6c4d 100644 --- a/src/test/java/edu/unc/lib/boxc/migration/cdm/services/ListProjectsServiceTest.java +++ b/src/test/java/edu/unc/lib/boxc/migration/cdm/services/ListProjectsServiceTest.java @@ -17,6 +17,8 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.time.Instant; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -84,7 +86,7 @@ public void allowedActionTest() throws Exception { assertEquals(tmpFolder.toString(), list.findValue(ListProjectsService.PROJECT_PATH).asText()); assertEquals("sources_mapped", list.findValue(ListProjectsService.STATUS).asText()); - assertEquals("[crop_color_bars]", list.findValue(ListProjectsService.ALLOWED_ACTIONS).asText()); + assertEquals("[\"crop_color_bars\"]", list.findValue(ListProjectsService.ALLOWED_ACTIONS).asText()); assertEquals(PROJECT_NAME, list.findValue("name").asText()); }