From 3e88f955302de0ae5c38bfbb0633f87e30a1d8ad Mon Sep 17 00:00:00 2001 From: Russ Poetker Date: Wed, 26 Jun 2024 13:24:13 -0400 Subject: [PATCH] Remove K from user role enum And add null test to ingest validation --- .../pass/support/grant/data/GrantIngestUserRole.java | 6 +----- .../pass/support/grant/GrantLoaderLoadFileIT.java | 10 +++++++++- pass-grant-loader/src/test/resources/test-load.csv | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/pass-grant-loader/src/main/java/org/eclipse/pass/support/grant/data/GrantIngestUserRole.java b/pass-grant-loader/src/main/java/org/eclipse/pass/support/grant/data/GrantIngestUserRole.java index 8b747fc5..7b91d4eb 100644 --- a/pass-grant-loader/src/main/java/org/eclipse/pass/support/grant/data/GrantIngestUserRole.java +++ b/pass-grant-loader/src/main/java/org/eclipse/pass/support/grant/data/GrantIngestUserRole.java @@ -26,9 +26,5 @@ public enum GrantIngestUserRole { /** * Co-PI */ - C, - /** - * K - */ - K + C } diff --git a/pass-grant-loader/src/test/java/org/eclipse/pass/support/grant/GrantLoaderLoadFileIT.java b/pass-grant-loader/src/test/java/org/eclipse/pass/support/grant/GrantLoaderLoadFileIT.java index 075b4c2c..d60233d2 100644 --- a/pass-grant-loader/src/test/java/org/eclipse/pass/support/grant/GrantLoaderLoadFileIT.java +++ b/pass-grant-loader/src/test/java/org/eclipse/pass/support/grant/GrantLoaderLoadFileIT.java @@ -249,7 +249,15 @@ private void verifyInvalidGrants(List ingestRecordErrors) throws IOExcep assertEquals(0, resultGrant4.getTotal()); assertTrue(ingestRecordErrors.stream().anyMatch(message -> message.matches(".*GrantIngestRecord.*grantNumber=777777.*\\sError Message: " + - "Invalid Pi Role: PI. Valid \\[P, C, K]"))); + "Invalid Pi Role: PI. Valid \\[P, C]"))); + + grantSelector.setFilter(RSQL.equals("localKey", "johnshopkins.edu:grant:888888")); + PassClientResult resultGrant8 = passClient.selectObjects(grantSelector); + // null pi role, skips row + assertEquals(0, resultGrant8.getTotal()); + assertTrue(ingestRecordErrors.stream().anyMatch(message -> + message.matches(".*GrantIngestRecord.*grantNumber=888888.*\\sError Message: " + + "Required value missing for piRole"))); } } diff --git a/pass-grant-loader/src/test/resources/test-load.csv b/pass-grant-loader/src/test/resources/test-load.csv index 9d603731..37a63b67 100644 --- a/pass-grant-loader/src/test/resources/test-load.csv +++ b/pass-grant-loader/src/test/resources/test-load.csv @@ -14,4 +14,5 @@ GRANT_NUMBER,GRANT_TITLE,AWARD_NUMBER,AWARD_STATUS,AWARD_DATE,AWARD_START,AWARD_ 444444,Test Grant 4 - invalid award date,423454,active,10-01-2021,2021-05-01,2026-04-30,NATIONAL INSTITUTES OF HEALTH,300865,NATIONAL INSTITUTES OF HEALTH,300865,UserOneFn,UserOneMn,UserOneLn,userone@jhu.edu,,123456,P,2023-02-01 555555,Test Grant 5 - missing required funder,423454,active,2021-10-01,2021-05-01,2026-04-30,,,,,UserOneFn,UserOneMn,UserOneLn,userone@jhu.edu,,123456,P,2023-02-01 666666,Test Grant 6 - invalid award status,423454,foobar,2021-10-01,2021-05-01,2026-04-30,NATIONAL INSTITUTES OF HEALTH,300865,NATIONAL INSTITUTES OF HEALTH,300865,UserOneFn,UserOneMn,UserOneLn,userone@jhu.edu,,123456,P,2023-02-01 -777777,Test Grant 7 - invalid pi role,423454,active,2021-10-01,2021-05-01,2026-04-30,NATIONAL INSTITUTES OF HEALTH,300865,NATIONAL INSTITUTES OF HEALTH,300865,UserOneFn,UserOneMn,UserOneLn,userone@jhu.edu,,123456,PI,2023-02-01 \ No newline at end of file +777777,Test Grant 7 - invalid pi role,423454,active,2021-10-01,2021-05-01,2026-04-30,NATIONAL INSTITUTES OF HEALTH,300865,NATIONAL INSTITUTES OF HEALTH,300865,UserOneFn,UserOneMn,UserOneLn,userone@jhu.edu,,123456,PI,2023-02-01 +888888,Test Grant 8 - null pi role,423454,active,2021-10-01,2021-05-01,2026-04-30,NATIONAL INSTITUTES OF HEALTH,300865,NATIONAL INSTITUTES OF HEALTH,300865,UserOneFn,UserOneMn,UserOneLn,userone@jhu.edu,,123456,,2023-02-01 \ No newline at end of file