diff --git a/api/src/main/java/gov/cms/ab2d/api/controller/common/ApiText.java b/api/src/main/java/gov/cms/ab2d/api/controller/common/ApiText.java index aacdfadc4..6df20f5ff 100644 --- a/api/src/main/java/gov/cms/ab2d/api/controller/common/ApiText.java +++ b/api/src/main/java/gov/cms/ab2d/api/controller/common/ApiText.java @@ -10,7 +10,7 @@ public class ApiText { public static final String BULK_RESPONSE = "Absolute URL of an endpoint for subsequent status requests (polling location)"; public static final String RUNNING_JOBIDS = "URLs of currently running jobs. To cancel one of those jobs, invoke the Status DELETE call."; public static final String BULK_SINCE = "Beginning time of query. Returns all records \"since\" this time. At this time, it must be after " + SINCE_EARLIEST_DATE; - public static final String BULK_SINCE_DEFAULT = " If no value is provided, it will default to the last time a successful job was requested if it exists. This rule is NOT applied to sandbox contract matching Z0***."; + public static final String BULK_SINCE_DEFAULT = " If no value is provided, it will default to the last time a successful job was requested if it exists. The earliest accepted date is 2020-02-13T00:00:00.000-05:00"; public static final String BULK_RESPONSE_LONG = "Absolute URL of an endpoint for subsequent status requests (polling location)"; public static final String EXPORT_STARTED = "Export request has started"; public static final String MAX_JOBS = "Too many jobs are currently running. Either wait for currently running jobs to finish or cancel some/all of those jobs."; diff --git a/e2e-test/src/test/java/gov/cms/ab2d/e2etest/TestRunner.java b/e2e-test/src/test/java/gov/cms/ab2d/e2etest/TestRunner.java index 4f65ce420..5c6ab5d75 100644 --- a/e2e-test/src/test/java/gov/cms/ab2d/e2etest/TestRunner.java +++ b/e2e-test/src/test/java/gov/cms/ab2d/e2etest/TestRunner.java @@ -109,10 +109,6 @@ class TestRunner { private final Set acceptableIdStrings = Set.of("carrier", "dme", "hha", "hospice", "inpatient", "outpatient", "snf"); - // Define default test contract - private String testContractV1 = "Z0000"; - private String testContractV2 = "Z0000"; - // Get all methods annotated with @Test and run them. This will only be called from TestLaucher when running against // an external environment, the regular tests that run as part of a build will be called like they normally would // during a build. @@ -120,7 +116,7 @@ public void runTests(String testContract) throws InvocationTargetException, Ille if (testContract != null && !testContract.isEmpty()) { log.info("Running test with contract: " + testContract); } - final Class annotation = Test.class; + final Class annotation = Test.class; final Class klass = this.getClass(); final List allMethods = new ArrayList<>(Arrays.asList(klass.getDeclaredMethods())); for (final Method method : allMethods) { @@ -253,7 +249,7 @@ private HttpResponse pollForStatusResponse(String statusUrl) throws Inte List xProgressList = statusResponse.headers().map().get("x-progress"); if (xProgressList != null && !xProgressList.isEmpty()) { String xProgress = xProgressList.iterator().next(); - int xProgressValue = Integer.valueOf(xProgress.substring(0, xProgress.indexOf('%'))); + int xProgressValue = Integer.parseInt(xProgress.substring(0, xProgress.indexOf('%'))); if (xProgressValue > 0 && xProgressValue < 100) { statusesBetween0And100.add(xProgressValue); } @@ -403,25 +399,23 @@ private void checkMetadata(OffsetDateTime since, JSONObject jsonObject) throws J private void checkEOBExtensions(JSONObject jsonObject, FhirVersion version) throws JSONException { switch (version) { - case STU3: - checkEOBExtensionsSTU3(jsonObject); - break; - case R4: - checkEOBExtensionsR4(jsonObject); - break; - default: - break; + case STU3 -> checkEOBExtensionsSTU3(jsonObject); + case R4 -> checkEOBExtensionsR4(jsonObject); + default -> { + } } } private void checkEOBExtensionsSTU3(JSONObject jsonObject) throws JSONException { - final JSONArray extensions = jsonObject.getJSONArray("extension"); assertNotNull(extensions); - assertEquals(1, extensions.length()); - // Assume first extension is MBI object - JSONObject idObj = extensions.getJSONObject(0); + List possibleNumberOfExtensions = Arrays.asList(11, 21, 22, 23 ,24); + + assertTrue(possibleNumberOfExtensions.contains(extensions.length())) ; + + // Assume last extension is MBI object + JSONObject idObj = extensions.getJSONObject(extensions.length()-1); assertNotNull(idObj); // Unwrap identifier @@ -475,11 +469,10 @@ private boolean validFields(JSONObject jsonObject) { if (!allowedFields.contains(val)) { if (disallowedFields.contains(val)) { log.info("********** API outputted invalid field '" + val + "'"); - return false; } else { log.info("********** API outputted unknown field '" + val + "'"); - return false; } + return false; } } catch (JSONException e) { e.printStackTrace(); @@ -511,7 +504,7 @@ private Pair performStatusRequests(List contentLocati List retryAfterList = statusResponse.headers().map().get("retry-after"); assertEquals(retryAfterList.iterator().next(), String.valueOf(DELAY)); List xProgressList = statusResponse.headers().map().get("x-progress"); - assertTrue(xProgressList.iterator().next().matches("\\d+\\% complete")); + assertTrue(xProgressList.iterator().next().matches("\\d+% complete")); HttpResponse retryStatusResponse = apiClient.statusRequest(contentLocationList.iterator().next()); @@ -625,6 +618,7 @@ void testClientCannotDownloadOtherClientsJob(FhirVersion version, String contrac APIClient secondAPIClient = createSecondClient(); + assertNotNull(downloadDetails); HttpResponse downloadResponse = secondAPIClient.fileDownloadRequest(downloadDetails.getFirst()); assertEquals(403, downloadResponse.statusCode()); } @@ -819,7 +813,10 @@ void testHealthEndPoint() throws IOException, InterruptedException { * @return the stream of arguments */ private Stream getVersionAndContract() { + // Define default test contract + String testContractV1 = "Z0000"; if (v2Enabled()) { + String testContractV2 = "Z0000"; return Stream.of(arguments(STU3, testContractV1), arguments(R4, testContractV2)); } else { return Stream.of(arguments(STU3, testContractV1)); @@ -841,9 +838,6 @@ static Stream getVersion() { private static boolean v2Enabled() { String v2Enabled = System.getenv("AB2D_V2_ENABLED"); - if (v2Enabled != null && v2Enabled.equalsIgnoreCase("true")) { - return true; - } - return false; + return v2Enabled != null && v2Enabled.equalsIgnoreCase("true"); } } diff --git a/pom.xml b/pom.xml index eb99e1ddc..82ec766bf 100644 --- a/pom.xml +++ b/pom.xml @@ -44,10 +44,10 @@ 1.11.8 - 2.0.9 + 2.0.10 1.1.11 - 1.2.11 - 1.8.5 + 1.2.12 + 1.8.7 1.1.9 1.1.4 diff --git a/settings.xml b/settings.xml index c1edd64bf..dc3433717 100644 --- a/settings.xml +++ b/settings.xml @@ -22,14 +22,14 @@ false central - ab2d-maven-cache - ${repository_url}/ab2d-maven-repo/ + ab2d-maven-virtual + ${repository_url}/ab2d-maven-virtual snapshots - ab2d-maven - ${repository_url}/ab2d-main/ + ab2d-maven-virtual + ${repository_url}/ab2d-maven-virtual @@ -38,14 +38,14 @@ false central - ab2d-maven-cache - ${repository_url}/ab2d-maven-repo + ab2d-maven-virtual + ${repository_url}/ab2d-maven-virtual snapshots - ab2d-maven - ${repository_url}/ab2d-main + ab2d-maven-virtual + ${repository_url}/ab2d-maven-virtual artifactory