Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
krwong committed Aug 29, 2024
1 parent 0c2e900 commit 9aa94e2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "\"");
Expand All @@ -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 + "\"");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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));
Expand Down

0 comments on commit 9aa94e2

Please sign in to comment.