Skip to content

Commit

Permalink
Remove K from user role enum
Browse files Browse the repository at this point in the history
And add null test to ingest validation
  • Loading branch information
rpoet-jh committed Jul 9, 2024
1 parent 7d3476c commit 6748bb9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,5 @@ public enum GrantIngestUserRole {
/**
* Co-PI
*/
C,
/**
* K
*/
K
C
}
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,15 @@ private void verifyInvalidGrants(List<String> 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<Grant> 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")));
}

}
3 changes: 2 additions & 1 deletion pass-grant-loader/src/test/resources/test-load.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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,[email protected],,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,[email protected],,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,[email protected],,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,[email protected],,123456,PI,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,[email protected],,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,[email protected],,123456,,2023-02-01

0 comments on commit 6748bb9

Please sign in to comment.