Skip to content

Commit 3605742

Browse files
authored
Feature/ab2d 1211 e2e opt out (#269)
Add an e2e test for opt out that will check to see if a user that has opted out remains in the data download. Add environment variables for connecting to AWS and update the BFD hash so that it will be able to work with the BFD sandbox we are connecting to.
1 parent da87fce commit 3605742

File tree

5 files changed

+104
-45
lines changed

5 files changed

+104
-45
lines changed

.travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ env:
55
- DOCKER_COMPOSE_VERSION: 1.24.1
66
- secure: n1NNXk+OkWTys5pLxwH+o1m0LT53HYBMxJz0negjampyLjPg0xPhdnGqdFITejHQ/fUYDdAFfkoJ/2sX2EZppya8B+X8YovqfxVms2F18e3/3zQhutmw3vxFgVuy/Lp5NkzQYDVoggzQOPNLfSJrCCSIo2FVdaKNjLnjCx3V1IFPq2HzFuUoFNliOpgiox6PICgg0HSysifRjhZygnSnlS0t7yTs5F3hipmPyQOhdyos/f7ut0x0ugW6cENDL8Bk+nR2znXzLqsdC6Y/+xjrpOubTdhQQyOHGTgdsHFTYSgfqBgTNiMzh8OorKfHs1gALnGjUtd4zzJg7lXqnHCkAM8RlFGg1aq7AMxLvuNYz+q84xNIfAxdpRjU2xukdMFke0+c2wR4x2eJHit691wMcezoaiJ5py7D3slmsdhEzyWLNOd86fWPpbebS7S18/p9kOwFpvS73YhGPKD/8M7ot/k78ota/2prBRih94RknXYnDj49HGLLzJu5UbXwf/juLdJK4t3ItapsmHef7hoZnrsPt9Nj0ZkWDI1ePVremFfQWbNGBPwIh/mQ4P+V44FAn3gkAjyPkklgC9slpfqZ254djsfejmMCc2QZTqVzJ1lMxrjxU0K1leVQNnvJFDafWgfVTIguhlgeLW7CC1IXB8bp3aJTp0GnbwikExVPOWs=
77
- secure: XHSp3OzOdu54rD01RuYmOTsgwby7N4cc2GaUyUar3CfogvqBZBlD0rE1Ntu4msq6MhCxJxAaPy0ef7rIGz4ikVscyyvV2BJj5d+8Or1ILBNky9KCgHexe0+U5ZqGfeKwOu9NpfOChYZXhhpxemheXhGkkP4odaXt4VuYeCRv2oLgT0Vjr+D/rsQ3eP7dfqqc/7mKhLdZbrFUeEQe5anXfdswVyHBJeDb5Cm3YcqHK3cCk9kxoKazKUmadBSFS5vNSUuIl21t5T1Y7wTgLnZHvNMdZFHw0e2ziTYNCy4HGaoBk7CLdXWJob2mPwNNz2EBDnezRVjwlwWr534YN+AvlwIgtuKjOAGjhfGibKLUn4TOzmxEAI79gHtp03DHY7r2gtsFLhhor2chtownEx9EO0AB4X/ER2+JKVlm6d6PNQNFsI501ANfotKEnOlfINfVaUdRMCZiB2pds/qQUXHK5xXChVKNofb7JZjY856Ckt9hv8hcGLTGlnm55DiXFUKZ6xpLFiQdUZT89gDA1P0f8c1wpL8cI05mloF1Fkv2fsPG/FBjd0ug3iI/ZrUimOrg33Eg+Df1Q159Cf3ci00wHwfdVVwEMN69TRner+Gc0Zj2fIRRcOumezfE+3cWbLfLhtkOT515Y+PsEZewQMEhe8FGbQW8cZKiGLDwe/nMFgo=
8+
- secure: AUnRb6K9675dTJKL8arl7NpNAAxQZniqgNHBL+8IysNu015t/hAHtIqe33ENclc9SebdaHHHZkNdeCNQ+4AehOUwaeooJjDQXJeF7xglp+jQ6wYEZlO+yVuvKciTT6nTQ0mx/O9pneI22xENYHN8z0tKhiuJl7jgJXg/oNspUw1QDlaGyHTbH0crA5qZPcsTsK6Xy/ytv4lK7oKBScU1EwimUlFOhMNeTRh3k+csCA5Jhw0blbpQyp3wM2PmG0Xn7zJ+R2p6m26xERAOxVFaUSmKKIxedu8uG1SXpI/+7MPypCI0peVai38qiRurUVU3dGd+9U7KnHEGCw1tmYmTafOmyO8tYgx1xuD6PsSYz9BLEnTPSvFb47QfskwNk8gDwoxY3t2rieaCsyYReP0VOdYMW5WlBEkUmfGQa37ghPSDdL0K5+sTQSSF7o21PpDFS8rPIYNn2WxrdsnI/xahzO58Y64mxYhV4TcwkKkbqyPeKEEsplMjLsOWIZF2a0qE8FQgosJsZQOq15Aii43ICoKa0iyW2esIzwZbzWEj0bAyyBo/g23dgPZTyi35LC9pJOsO/JxRBpsZEwhRlDLl+sgYCPvApkTRDRZwRZLP1uzLotr+M4DHmODMjO4hvK1E9qJ/fmvOuTBfaW4XLi/cgvuFw9DTsz77V+npZDZR/Q4=
9+
- secure: SnaFCT0mJK1/ePgrhKzQuYgYHLY7ZAQvLA0aiUO3cEOvSeB//jU7t3091Zch0vJH/h/qSR/FU+rbbMSeu8JcIPVsNnh4OSMslQGtDwBwB89CbCwidhk0hOVm/j1ExJmrhtZZ8kerF3Ka/m1ax8n1ztJVvg4lhw7fvXcHy3ujQCsLUYvefNLhUIU8gq2awpULxEybXgoTtkL9AzutiZcTbwhbAbBELM/IIFkGe8bZ2Vlao0xIgFX17wGj65/mpX04ThsdAgHF5A6e+oTu51KGD5JN4l9B8nTVVp3soFEDn0ajW4pDQlBvReZcw/Uda82nrtqpN1+gQ8fBODB1bVDLCpNtZhzZIZJsxcY5BvGVTLTVzNrYJCmB5R/lxzpjJpc9cdqBipWyDxuNHgjafZvnU0e/0dnMh22IDe0AIshed53RuV2010K2vnUdhweV6iuDnncuVy8gUjohzF1YaHnW/CMZMZrOt/NSXSrt9FcK/fuzhiynq0rpJ/315hAjI9CjCEPtBLLzwoh++rTlbJGfAY26S9Q3++iMnXALUZC+lzQvmeEZvTKjbKNTBeVxFIOj2gL4Y9oWIUAs6ukqhcORlwVEQVza73a6uXwUm5Y8c03Yez/W5UchElJx02qdejRUlQxP9GmEdYpSBoSScNBLrz7/QFERsCsDKSG+icuVZ08=
810
dist: bionic
911
language: java
1012
jdk:
@@ -13,6 +15,8 @@ cache:
1315
directories:
1416
- "$HOME/.m2"
1517
before_install:
18+
- openssl aes-256-cbc -K $encrypted_cb979db88957_key -iv $encrypted_cb979db88957_iv
19+
-in bfd_sbx_hash_pepper.enc -out bfd_sbx_hash_pepper -d
1620
- mkdir -p /opt/ab2d
1721
- openssl aes-256-cbc -K $encrypted_27e3c48779c8_key -iv $encrypted_27e3c48779c8_iv
1822
-in ab2d_dev_keystore.enc -out /opt/ab2d/ab2d_dev_keystore -d
@@ -32,6 +36,9 @@ before_install:
3236
- export OKTA_CLIENT_PASSWORD=HHduWG6LogIvDIQuWgp3Zlo9OYMValTtH5OBcuHw
3337
- export SECONDARY_USER_OKTA_CLIENT_ID=0oa2t0lc65ErV8OmY297
3438
- export SECONDARY_USER_OKTA_CLIENT_PASSWORD=1Bl3HGO6eglkXUDtjVjto3L-3C0offzTMk2qlz9r
39+
- export AB2D_OPT_OUT_JOB_SCHEDULE='*/15 * * * * ?'
40+
- export AB2D_HICN_HASH_PEPPER=`cat bfd_sbx_hash_pepper`
41+
- export AB2D_HICN_HASH_ITER=1000
3542
install: true
3643
before_script:
3744
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64

bfd_sbx_hash_pepper.enc

528 Bytes
Binary file not shown.

docker-compose.yml

+5
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ services:
5252
- AB2D_BFD_KEYSTORE_LOCATION=${AB2D_BFD_KEYSTORE_LOCATION}
5353
- NEW_RELIC_LICENSE_KEY="${NEW_RELIC_LICENSE_KEY}"
5454
- NEW_RELIC_APP_NAME="${NEW_RELIC_APP_NAME}"
55+
- AB2D_OPT_OUT_JOB_SCHEDULE=${AB2D_OPT_OUT_JOB_SCHEDULE}
56+
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
57+
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
58+
- AB2D_HICN_HASH_PEPPER=${AB2D_HICN_HASH_PEPPER}
59+
- AB2D_HICN_HASH_ITER=${AB2D_HICN_HASH_ITER}
5560
depends_on:
5661
- db
5762
volumes:

e2e-test/src/test/java/gov/cms/ab2d/e2etest/TestRunner.java

+89-44
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
import org.json.JSONException;
1212
import org.json.JSONObject;
1313
import org.junit.Assert;
14+
import org.junit.jupiter.api.MethodOrderer;
15+
import org.junit.jupiter.api.Order;
1416
import org.junit.jupiter.api.Test;
1517
import org.junit.jupiter.api.TestInstance;
18+
import org.junit.jupiter.api.TestMethodOrder;
1619
import org.junit.jupiter.api.extension.ExtendWith;
1720
import org.springframework.data.util.Pair;
1821
import org.testcontainers.containers.DockerComposeContainer;
@@ -38,6 +41,7 @@
3841
import java.time.OffsetDateTime;
3942
import java.time.temporal.ChronoUnit;
4043
import java.util.*;
44+
import java.util.stream.Collectors;
4145
import java.util.zip.GZIPInputStream;
4246
import java.util.zip.ZipEntry;
4347
import java.util.zip.ZipInputStream;
@@ -47,7 +51,6 @@
4751
import static gov.cms.ab2d.e2etest.APIClient.PATIENT_EXPORT_PATH;
4852
import static java.time.format.DateTimeFormatter.ISO_DATE_TIME;
4953
import static java.time.temporal.ChronoUnit.SECONDS;
50-
import static org.hamcrest.Matchers.greaterThan;
5154
import static org.hamcrest.Matchers.matchesPattern;
5255

5356
// Unit tests here can be run from the IDE and will use LOCAL as the default, they can also be run from the TestLauncher
@@ -56,6 +59,7 @@
5659
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
5760
@ExtendWith(TestRunnerParameterResolver.class)
5861
@Slf4j
62+
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
5963
public class TestRunner {
6064
private static final String FHIR_TYPE = "application/fhir+ndjson";
6165

@@ -214,48 +218,62 @@ private Pair<String, JSONArray> verifyJsonFromStatusResponse(HttpResponse<String
214218
return Pair.of(url, extension);
215219
}
216220

217-
private void verifyJsonFromfileDownload(String fileContent, JSONArray extension, OffsetDateTime since) throws JSONException {
221+
private void verifyJsonFromfileDownload(String fileContent, JSONArray extension, OffsetDateTime since, String optOut) throws JSONException {
218222
// Some of the data that is returned will be variable and will change from request to request, so not every
219223
// JSON object can be verified
220-
final JSONObject fileJson = new JSONObject(fileContent);
221-
Assert.assertTrue(validFields(fileJson));
222-
Assert.assertEquals("ExplanationOfBenefit", fileJson.getString("resourceType"));
223-
Assert.assertEquals(0, fileJson.getInt("precedence"));
224-
String idString = fileJson.getString("id");
225-
226-
boolean found = false;
227-
for(String acceptableIdString : acceptableIdStrings) {
228-
if(idString.startsWith(acceptableIdString)) {
229-
found = true;
230-
break;
224+
String[] jsonLines = fileContent.split("\n");
225+
for (String str : jsonLines) {
226+
if (str.isEmpty()) {
227+
continue;
231228
}
232-
}
233229

234-
if(!found) {
235-
Assert.fail("No acceptable ID string was found, received " + idString);
236-
}
230+
JSONObject jsonObject = new JSONObject(str);
231+
232+
Assert.assertTrue(validFields(jsonObject));
233+
Assert.assertEquals("ExplanationOfBenefit", jsonObject.getString("resourceType"));
234+
Assert.assertEquals(0, jsonObject.getInt("precedence"));
235+
String idString = jsonObject.getString("id");
236+
237+
boolean found = false;
238+
for (String acceptableIdString : acceptableIdStrings) {
239+
if (idString.startsWith(acceptableIdString)) {
240+
found = true;
241+
break;
242+
}
243+
}
244+
245+
if (!found) {
246+
Assert.fail("No acceptable ID string was found, received " + idString);
247+
}
248+
249+
final JSONObject patientJson = jsonObject.getJSONObject("patient");
250+
String referenceString = patientJson.getString("reference");
251+
Assert.assertTrue(referenceString.startsWith("Patient"));
252+
253+
String patientId = referenceString.substring(referenceString.indexOf('-') + 1);
254+
if(optOut != null && patientId.equals(optOut)) {
255+
Assert.fail("Patient ID opted out, but showed up in the download");
256+
}
237257

238-
final JSONObject patientJson = fileJson.getJSONObject("patient");
239-
String referenceString = patientJson.getString("reference");
240-
Assert.assertTrue(referenceString.startsWith("Patient"));
241-
final JSONObject typeJson = fileJson.getJSONObject("type");
242-
Assert.assertNotNull(typeJson);
243-
final JSONArray codingJson = typeJson.getJSONArray("coding");
244-
Assert.assertNotNull(codingJson);
245-
Assert.assertTrue(codingJson.length() >= 4);
246-
final JSONArray identifierJson = fileJson.getJSONArray("identifier");
247-
Assert.assertNotNull(identifierJson);
248-
Assert.assertEquals(2, identifierJson.length());
249-
final JSONArray diagnosisJson = fileJson.getJSONArray("diagnosis");
250-
Assert.assertNotNull(diagnosisJson);
251-
final JSONArray itemJson = fileJson.getJSONArray("item");
252-
Assert.assertNotNull(itemJson);
253-
254-
final JSONObject metaJson = fileJson.getJSONObject("meta");
255-
final String lastUpdated = metaJson.getString("lastUpdated");
256-
Instant lastUpdatedInstant = Instant.parse(lastUpdated);
257-
if(since != null) {
258-
Assert.assertTrue(lastUpdatedInstant.isAfter(since.toInstant()));
258+
final JSONObject typeJson = jsonObject.getJSONObject("type");
259+
Assert.assertNotNull(typeJson);
260+
final JSONArray codingJson = typeJson.getJSONArray("coding");
261+
Assert.assertNotNull(codingJson);
262+
Assert.assertTrue(codingJson.length() >= 4);
263+
final JSONArray identifierJson = jsonObject.getJSONArray("identifier");
264+
Assert.assertNotNull(identifierJson);
265+
Assert.assertEquals(2, identifierJson.length());
266+
final JSONArray diagnosisJson = jsonObject.getJSONArray("diagnosis");
267+
Assert.assertNotNull(diagnosisJson);
268+
final JSONArray itemJson = jsonObject.getJSONArray("item");
269+
Assert.assertNotNull(itemJson);
270+
271+
final JSONObject metaJson = jsonObject.getJSONObject("meta");
272+
final String lastUpdated = metaJson.getString("lastUpdated");
273+
Instant lastUpdatedInstant = Instant.parse(lastUpdated);
274+
if (since != null) {
275+
Assert.assertTrue(lastUpdatedInstant.isAfter(since.toInstant()));
276+
}
259277
}
260278

261279
JSONObject checkSumObject = extension.getJSONObject(0);
@@ -308,7 +326,7 @@ private boolean validFields(JSONObject jsonObject) {
308326
return true;
309327
}
310328

311-
private void downloadFile(Pair<String, JSONArray> downloadDetails, OffsetDateTime since) throws IOException, InterruptedException, JSONException {
329+
private void downloadFile(Pair<String, JSONArray> downloadDetails, OffsetDateTime since, String optOut) throws IOException, InterruptedException, JSONException {
312330
HttpResponse<InputStream> downloadResponse = apiClient.fileDownloadRequest(downloadDetails.getFirst());
313331

314332
Assert.assertEquals(200, downloadResponse.statusCode());
@@ -320,7 +338,7 @@ private void downloadFile(Pair<String, JSONArray> downloadDetails, OffsetDateTim
320338
downloadString = IOUtils.toString(gzipInputStream, Charset.defaultCharset());
321339
}
322340

323-
verifyJsonFromfileDownload(downloadString, downloadDetails.getSecond(), since);
341+
verifyJsonFromfileDownload(downloadString, downloadDetails.getSecond(), since, optOut);
324342
}
325343

326344
private void downloadZipFile(String url, JSONArray extension, OffsetDateTime since) throws IOException, InterruptedException, JSONException {
@@ -333,7 +351,7 @@ private void downloadZipFile(String url, JSONArray extension, OffsetDateTime sin
333351
zipIn.closeEntry();
334352
entry = zipIn.getNextEntry();
335353
}
336-
verifyJsonFromfileDownload(downloadString.toString(), extension, since);
354+
verifyJsonFromfileDownload(downloadString.toString(), extension, since, null);
337355
}
338356

339357
public static String extractZipFileData(ZipEntry entry, ZipInputStream zipIn) throws IOException {
@@ -376,16 +394,18 @@ private Pair<String, JSONArray> performStatusRequests(List<String> contentLocati
376394
}
377395

378396
@Test
397+
@Order(1)
379398
public void runSystemWideExport() throws IOException, InterruptedException, JSONException {
380399
HttpResponse<String> exportResponse = apiClient.exportRequest(FHIR_TYPE, null);
381400
Assert.assertEquals(202, exportResponse.statusCode());
382401
List<String> contentLocationList = exportResponse.headers().map().get("content-location");
383402

384403
Pair<String, JSONArray> downloadDetails = performStatusRequests(contentLocationList, false, "S0000");
385-
downloadFile(downloadDetails, null);
404+
downloadFile(downloadDetails, null, null);
386405
}
387406

388407
@Test
408+
@Order(2)
389409
public void runSystemWideExportSince() throws IOException, InterruptedException, JSONException {
390410
HttpResponse<String> exportResponse = apiClient.exportRequest(FHIR_TYPE, earliest);
391411
System.out.println(earliest);
@@ -394,11 +414,12 @@ public void runSystemWideExportSince() throws IOException, InterruptedException,
394414

395415
Pair<String, JSONArray> downloadDetails = performStatusRequests(contentLocationList, false, "S0000");
396416
if (downloadDetails != null) {
397-
downloadFile(downloadDetails, earliest);
417+
downloadFile(downloadDetails, earliest, null);
398418
}
399419
}
400420

401421
@Test
422+
@Order(3)
402423
public void runErrorSince() throws IOException, InterruptedException {
403424
OffsetDateTime timeBeforeEarliest = earliest.minus(1, ChronoUnit.MINUTES);
404425
HttpResponse<String> exportResponse = apiClient.exportRequest(FHIR_TYPE, timeBeforeEarliest);
@@ -410,30 +431,34 @@ public void runErrorSince() throws IOException, InterruptedException {
410431
}
411432

412433
@Test
434+
@Order(4)
413435
public void runSystemWideZipExport() throws IOException, InterruptedException, JSONException {
414436
HttpResponse<String> exportResponse = apiClient.exportRequest(ZIPFORMAT, null);
415437
Assert.assertEquals(400, exportResponse.statusCode());
416438
}
417439

418440
@Test
441+
@Order(5)
419442
public void runContractNumberExport() throws IOException, InterruptedException, JSONException {
420443
String contractNumber = "S0000";
421444
HttpResponse<String> exportResponse = apiClient.exportByContractRequest(contractNumber, FHIR_TYPE, null);
422445
Assert.assertEquals(202, exportResponse.statusCode());
423446
List<String> contentLocationList = exportResponse.headers().map().get("content-location");
424447

425448
Pair<String, JSONArray> downloadDetails = performStatusRequests(contentLocationList, true, contractNumber);
426-
downloadFile(downloadDetails, null);
449+
downloadFile(downloadDetails, null, null);
427450
}
428451

429452
@Test
453+
@Order(6)
430454
void runContractNumberZipExport() throws IOException, InterruptedException, JSONException {
431455
String contractNumber = "S0000";
432456
HttpResponse<String> exportResponse = apiClient.exportByContractRequest(contractNumber, ZIPFORMAT, null);
433457
Assert.assertEquals(400, exportResponse.statusCode());
434458
}
435459

436460
@Test
461+
@Order(7)
437462
public void testDelete() throws IOException, InterruptedException {
438463
HttpResponse<String> exportResponse = apiClient.exportRequest(FHIR_TYPE, null);
439464

@@ -447,6 +472,7 @@ public void testDelete() throws IOException, InterruptedException {
447472
}
448473

449474
@Test
475+
@Order(8)
450476
public void testUserCannotDownloadOtherUsersJob() throws IOException, InterruptedException, JSONException {
451477
String contractNumber = "S0000";
452478
HttpResponse<String> exportResponse = apiClient.exportByContractRequest(contractNumber, FHIR_TYPE, null);
@@ -462,6 +488,7 @@ public void testUserCannotDownloadOtherUsersJob() throws IOException, Interrupte
462488
}
463489

464490
@Test
491+
@Order(9)
465492
public void testUserCannotDeleteOtherUsersJob() throws IOException, InterruptedException, JSONException {
466493
HttpResponse<String> exportResponse = apiClient.exportRequest(FHIR_TYPE, null);
467494

@@ -481,6 +508,7 @@ public void testUserCannotDeleteOtherUsersJob() throws IOException, InterruptedE
481508
}
482509

483510
@Test
511+
@Order(10)
484512
public void testUserCannotCheckStatusOtherUsersJob() throws IOException, InterruptedException, JSONException {
485513
HttpResponse<String> exportResponse = apiClient.exportRequest(FHIR_TYPE, null);
486514

@@ -508,6 +536,7 @@ private APIClient createSecondUserClient() throws InterruptedException, JSONExce
508536
}
509537

510538
@Test
539+
@Order(11)
511540
public void testUserCannotMakeRequestWithoutToken() throws IOException, InterruptedException {
512541
HttpRequest exportRequest = HttpRequest.newBuilder()
513542
.uri(URI.create(AB2D_API_URL + PATIENT_EXPORT_PATH))
@@ -522,6 +551,7 @@ public void testUserCannotMakeRequestWithoutToken() throws IOException, Interrup
522551
}
523552

524553
@Test
554+
@Order(12)
525555
public void testUserCannotMakeRequestWithSelfSignedToken() throws IOException, InterruptedException, JSONException {
526556
String clientSecret = "wefikjweglkhjwelgkjweglkwegwegewg";
527557
SecretKey sharedSecret = Keys.hmacShaKeyFor(clientSecret.getBytes(StandardCharsets.UTF_8));
@@ -558,6 +588,7 @@ public void testUserCannotMakeRequestWithSelfSignedToken() throws IOException, I
558588
}
559589

560590
@Test
591+
@Order(13)
561592
public void testBadQueryParameterResource() throws IOException, InterruptedException {
562593
var params = new HashMap<>(){{
563594
put("_type", "BadParam");
@@ -568,6 +599,7 @@ public void testBadQueryParameterResource() throws IOException, InterruptedExcep
568599
}
569600

570601
@Test
602+
@Order(14)
571603
public void testBadQueryParameterOutputFormat() throws IOException, InterruptedException {
572604
var params = new HashMap<>(){{
573605
put("_outputFormat", "BadParam");
@@ -578,9 +610,22 @@ public void testBadQueryParameterOutputFormat() throws IOException, InterruptedE
578610
}
579611

580612
@Test
613+
@Order(15)
581614
public void testHealthEndPoint() throws IOException, InterruptedException {
582615
HttpResponse<String> healthCheckResponse = apiClient.healthCheck();
583616

584617
Assert.assertEquals(200, healthCheckResponse.statusCode());
585618
}
619+
620+
@Test
621+
@Order(16)
622+
public void testOptOut() throws IOException, InterruptedException, JSONException {
623+
HttpResponse<String> exportResponse = apiClient.exportRequest(FHIR_TYPE, null);
624+
625+
Assert.assertEquals(202, exportResponse.statusCode());
626+
List<String> contentLocationList = exportResponse.headers().map().get("content-location");
627+
628+
Pair<String, JSONArray> downloadDetails = performStatusRequests(contentLocationList, false, "S0000");
629+
downloadFile(downloadDetails, null, "19990000002906");
630+
}
586631
}

optout/src/main/resources/application.optout.properties

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ spring.quartz.properties.org.quartz.jobStore.driverDelegateClass=org.quartz.impl
1919
spring.quartz.properties.org.quartz.jobStore.acquireTriggersWithinLock=true
2020

2121
# Every hour at minute 0, second 0 ------------------------------------------------------------ CRON SCHEDULE
22-
cron.schedule=0 0 * * * ?
22+
cron.schedule=${AB2D_OPT_OUT_JOB_SCHEDULE:#{'0 0 * * * ?'}}
2323

2424
s3.region=${AB2D_S3_REGION:us-east-1}
2525
s3.bucket=${AB2D_S3_OPTOUT_BUCKET:ab2d-optout-data-dev}
2626

2727

28+
29+

0 commit comments

Comments
 (0)