From a19697083e6891053a6dbef174baf7e48374c5e6 Mon Sep 17 00:00:00 2001 From: tsande16 Date: Mon, 8 Jul 2024 16:06:13 -0400 Subject: [PATCH] Refactor NihmsSubmissionEtlITBase to include title, doi, and issue --- .../nihms/NihmsSubmissionEtlITBase.java | 4 ++++ .../nihms/TransformAndLoadCompliantIT.java | 4 ---- .../nihms/TransformAndLoadInProcessIT.java | 3 --- .../nihms/TransformAndLoadNonCompliantIT.java | 4 ---- .../nihms/entrez/EntrezPmidLookupTest.java | 22 ++----------------- .../src/test/resources/pmidrecord.json | 3 +-- 6 files changed, 7 insertions(+), 33 deletions(-) diff --git a/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/NihmsSubmissionEtlITBase.java b/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/NihmsSubmissionEtlITBase.java index 850e28f4a..72b14d434 100644 --- a/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/NihmsSubmissionEtlITBase.java +++ b/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/NihmsSubmissionEtlITBase.java @@ -72,6 +72,10 @@ @Testcontainers @DirtiesContext public abstract class NihmsSubmissionEtlITBase { + //including high ascii to test for ascii handling + protected final String title = "Article A ε4"; + protected final String doi = "10.1000/a.abcd.1234"; + protected final String issue = "3"; static { MavenXpp3Reader reader = new MavenXpp3Reader(); diff --git a/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/TransformAndLoadCompliantIT.java b/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/TransformAndLoadCompliantIT.java index 85f4331dc..3eab90345 100644 --- a/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/TransformAndLoadCompliantIT.java +++ b/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/TransformAndLoadCompliantIT.java @@ -51,10 +51,6 @@ */ public class TransformAndLoadCompliantIT extends NihmsSubmissionEtlITBase { private final String pmcid1 = "PMC12345678"; - private final String title = "Article A"; - private final String doi = "10.1000/a.abcd.1234"; - private final String issue = "3"; - protected String pmid1; protected String awardNumber1; protected String nihmsId1; diff --git a/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/TransformAndLoadInProcessIT.java b/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/TransformAndLoadInProcessIT.java index 0f6f481e0..d737da326 100644 --- a/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/TransformAndLoadInProcessIT.java +++ b/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/TransformAndLoadInProcessIT.java @@ -47,9 +47,6 @@ */ public class TransformAndLoadInProcessIT extends NihmsSubmissionEtlITBase { private final String nihmsId1 = "NIHMS987654321"; - private final String title = "Article A"; - private final String doi = "10.1000/a.abcd.1234"; - private final String issue = "3"; /** * Tests when the publication is completely new and is an in-process diff --git a/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/TransformAndLoadNonCompliantIT.java b/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/TransformAndLoadNonCompliantIT.java index dfb06f790..941726cb1 100644 --- a/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/TransformAndLoadNonCompliantIT.java +++ b/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/TransformAndLoadNonCompliantIT.java @@ -51,10 +51,6 @@ @ExtendWith(MockitoExtension.class) public class TransformAndLoadNonCompliantIT extends NihmsSubmissionEtlITBase { private final String nihmsId1 = "NIHMS987654321"; - private final String title = "Article A"; - private final String doi = "10.1000/a.abcd.1234"; - private final String issue = "3"; - /** * Tests when the publication is completely new and is non-compliant diff --git a/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/entrez/EntrezPmidLookupTest.java b/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/entrez/EntrezPmidLookupTest.java index 8835a7ab3..9d137bac9 100644 --- a/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/entrez/EntrezPmidLookupTest.java +++ b/pass-nihms-loader/nihms-data-transform-load/src/test/java/org/eclipse/pass/loader/nihms/entrez/EntrezPmidLookupTest.java @@ -89,25 +89,7 @@ public void testGetPubMedRecord() throws IOException { PubMedEntrezRecord record = pmidLookup.retrievePubMedRecord(pmid); assertEquals("10.1000/a.abcd.1234", record.getDoi()); + //test to ensure that it can handle high ascii characters + assertEquals("Article A ε4", record.getTitle()); } - - @Test - public void testGetPubMedRecordWithHighAsciiChars() throws IOException { - String entrez = IOUtils.toString(getClass().getClassLoader(). - getResourceAsStream("pmid_record_ascii.json"), StandardCharsets.UTF_8); - - String pmid = "11111111"; - - stubFor(get(urlPathEqualTo("/entrez/eutils/esummary.fcgi")) - .withQueryParam("db", WireMock.equalTo("pubmed")) - .withQueryParam("retmode", WireMock.equalTo("json")) - .withQueryParam("rettype", WireMock.equalTo("abstract")) - .withQueryParam("id", WireMock.equalTo(pmid)) - .willReturn(aResponse().withStatus(200).withBody(entrez))); - - PubMedEntrezRecord record = pmidLookup.retrievePubMedRecord(pmid); - assertEquals("10.1002/acn3.333", record.getDoi()); - assertEquals("Age-dependent effects of APOE ε4 in preclinical Alzheimer's disease.", record.getTitle()); - } - } diff --git a/pass-nihms-loader/nihms-data-transform-load/src/test/resources/pmidrecord.json b/pass-nihms-loader/nihms-data-transform-load/src/test/resources/pmidrecord.json index 7fd2192ca..0498226ca 100644 --- a/pass-nihms-loader/nihms-data-transform-load/src/test/resources/pmidrecord.json +++ b/pass-nihms-loader/nihms-data-transform-load/src/test/resources/pmidrecord.json @@ -16,8 +16,7 @@ } ], "lastauthor": "Fuchsia A", - "title": "Article A", - "sorttitle": "Article A", + "title": "Article A ε4", "volume": "140", "issue": "3", "pages": "111-113",