diff --git a/src/test/java/edu/unc/lib/boxc/migration/cdm/ListProjectsCommandIT.java b/src/test/java/edu/unc/lib/boxc/migration/cdm/ListProjectsCommandIT.java index be2c754e..83e96c20 100644 --- a/src/test/java/edu/unc/lib/boxc/migration/cdm/ListProjectsCommandIT.java +++ b/src/test/java/edu/unc/lib/boxc/migration/cdm/ListProjectsCommandIT.java @@ -36,7 +36,7 @@ public void listProjectsTest() throws Exception { "list_projects" }; executeExpectSuccess(args); - assertOutputContains("\"" + ListProjectsService.PROJECT_PATH + "\" : \"" + baseDir + "\""); + assertOutputContains("\"" + ListProjectsService.PROJECT_PATH + "\" : \"" + Path.of(baseDir + "/" + PROJECT_ID) + "\""); assertOutputContains("\"" + ListProjectsService.STATUS + "\" : \"initialized\""); assertOutputContains("\"" + ListProjectsService.ALLOWED_ACTIONS + "\" : [ ]"); assertOutputContains("\"name\" : \"" + PROJECT_ID + "\""); @@ -53,7 +53,10 @@ public void listMultipleProjectsTest() throws Exception { "list_projects" }; executeExpectSuccess(args); - assertOutputContains("\"" + ListProjectsService.PROJECT_PATH + "\" : \"" + baseDir + "\""); + assertOutputContains("\"" + ListProjectsService.PROJECT_PATH + "\" : \"" + + Path.of(baseDir + "/" + PROJECT_ID) + "\""); + assertOutputContains("\"" + ListProjectsService.PROJECT_PATH + "\" : \"" + + Path.of(baseDir + "/" + PROJECT_ID_2) + "\""); assertOutputContains("\""+ ListProjectsService.STATUS + "\" : \"initialized\""); assertOutputContains("\"" + ListProjectsService.ALLOWED_ACTIONS + "\" : [ ]"); assertOutputContains("\"name\" : \"" + PROJECT_ID + "\""); 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 6001c684..86edccd2 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 @@ -86,7 +86,8 @@ public void allowedActionTest() throws Exception { writeSourceFilesCsv(mappingBody("test,," + Path.of("test.tif") + ",")); JsonNode list = service.listProjects(tmpFolder); - assertEquals(tmpFolder.toString(), list.findValue(ListProjectsService.PROJECT_PATH).asText()); + assertEquals(Path.of(tmpFolder + "/" + PROJECT_NAME).toString(), + list.findValue(ListProjectsService.PROJECT_PATH).asText()); assertEquals("sources_mapped", list.findValue(ListProjectsService.STATUS).asText()); assertEquals(jsonArray(Arrays.asList("crop_color_bars")), list.findValue(ListProjectsService.ALLOWED_ACTIONS)); assertEquals(PROJECT_NAME, list.findValue("name").asText()); @@ -96,7 +97,8 @@ public void allowedActionTest() throws Exception { public void listProjectsInitializedTest() throws Exception { JsonNode list = service.listProjects(tmpFolder); - assertEquals(tmpFolder.toString(), list.findValue(ListProjectsService.PROJECT_PATH).asText()); + assertEquals(Path.of(tmpFolder + "/" + PROJECT_NAME).toString(), + list.findValue(ListProjectsService.PROJECT_PATH).asText()); assertEquals("initialized", list.findValue(ListProjectsService.STATUS).asText()); assertEquals(jsonArray(Arrays.asList()), list.findValue(ListProjectsService.ALLOWED_ACTIONS)); assertEquals(PROJECT_NAME, list.findValue("name").asText()); @@ -108,7 +110,8 @@ public void listProjectsIndexedTest() throws Exception { ProjectPropertiesSerialization.write(project); JsonNode list = service.listProjects(tmpFolder); - assertEquals(tmpFolder.toString(), list.findValue(ListProjectsService.PROJECT_PATH).asText()); + assertEquals(Path.of(tmpFolder + "/" + PROJECT_NAME).toString(), + list.findValue(ListProjectsService.PROJECT_PATH).asText()); assertEquals("indexed", list.findValue(ListProjectsService.STATUS).asText()); assertEquals(jsonArray(Arrays.asList()), list.findValue(ListProjectsService.ALLOWED_ACTIONS)); assertEquals(PROJECT_NAME, list.findValue("name").asText()); @@ -120,7 +123,8 @@ public void listProjectsSourcesMappedTest() throws Exception { ProjectPropertiesSerialization.write(project); JsonNode list = service.listProjects(tmpFolder); - assertEquals(tmpFolder.toString(), list.findValue(ListProjectsService.PROJECT_PATH).asText()); + assertEquals(Path.of(tmpFolder + "/" + PROJECT_NAME).toString(), + list.findValue(ListProjectsService.PROJECT_PATH).asText()); assertEquals("sources_mapped", list.findValue(ListProjectsService.STATUS).asText()); assertEquals(jsonArray(Arrays.asList()), list.findValue(ListProjectsService.ALLOWED_ACTIONS)); assertEquals(PROJECT_NAME, list.findValue("name").asText()); @@ -133,7 +137,8 @@ public void listProjectsSipsGeneratedTest() throws Exception { ProjectPropertiesSerialization.write(project); JsonNode list = service.listProjects(tmpFolder); - assertEquals(tmpFolder.toString(), list.findValue(ListProjectsService.PROJECT_PATH).asText()); + assertEquals(Path.of(tmpFolder + "/" + PROJECT_NAME).toString(), + list.findValue(ListProjectsService.PROJECT_PATH).asText()); assertEquals("sips_generated", list.findValue(ListProjectsService.STATUS).asText()); assertEquals(jsonArray(Arrays.asList()), list.findValue(ListProjectsService.ALLOWED_ACTIONS)); assertEquals(PROJECT_NAME, list.findValue("name").asText()); @@ -146,7 +151,8 @@ public void listProjectsSipsSubmittedTest() throws Exception { ProjectPropertiesSerialization.write(project); JsonNode list = service.listProjects(tmpFolder); - assertEquals(tmpFolder.toString(), list.findValue(ListProjectsService.PROJECT_PATH).asText()); + assertEquals(Path.of(tmpFolder + "/" + PROJECT_NAME).toString(), + list.findValue(ListProjectsService.PROJECT_PATH).asText()); assertEquals("ingested", list.findValue(ListProjectsService.STATUS).asText()); assertEquals(jsonArray(Arrays.asList()), list.findValue(ListProjectsService.ALLOWED_ACTIONS)); assertEquals(PROJECT_NAME, list.findValue("name").asText()); @@ -166,7 +172,8 @@ public void listProjectsMultipleProjectsTest() throws Exception { JsonNode list = service.listProjects(tmpFolder); - assertEquals(tmpFolder.toString(), list.findValue(ListProjectsService.PROJECT_PATH).asText()); + assertTrue(list.findValues(ListProjectsService.PROJECT_PATH).toString().contains(tmpFolder + "/" + PROJECT_NAME_2)); + assertTrue(list.findValues(ListProjectsService.PROJECT_PATH).toString().contains(tmpFolder + "/" + PROJECT_NAME)); assertTrue(list.findValues(ListProjectsService.STATUS).toString().contains("initialized")); assertTrue(list.findValues(ListProjectsService.STATUS).toString().contains("ingested")); assertEquals(jsonArray(Arrays.asList()), list.findValue(ListProjectsService.ALLOWED_ACTIONS));