diff --git a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/AzureBlobFileFetcher.java b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/AzureBlobFileFetcher.java index 4d9a3a478..d6d950916 100644 --- a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/AzureBlobFileFetcher.java +++ b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/AzureBlobFileFetcher.java @@ -47,12 +47,25 @@ public static FileFetcher getInstance() { return INSTANCE; } + // TODO - we need to modify the guts to only grab the golden or automated path @Override public List fetchFiles() { + String files_path = System.getenv("LOCAL_FILE_PATH"); + if (files_path == null || files_path.isEmpty()) { + throw new IllegalArgumentException("Environment variable LOCAL_FILE_PATH is not set"); + } + List relevantFiles = new ArrayList<>(); LocalDate today = LocalDate.now(TIME_ZONE); - String pathPrefix = AzureBlobHelper.buildDatePathPrefix(today); + String datePrefix = AzureBlobHelper.buildDatePathPrefix(today); + + // TODO - update base on AzureBlobOrganizer + String pathPrefix = datePrefix + "Automated/"; + if (files_path.contains("GoldenCopy")) { + pathPrefix += datePrefix + "GoldenCopy/"; + } + ListBlobsOptions options = new ListBlobsOptions().setPrefix(pathPrefix); for (BlobItem blobItem : blobContainerClient.listBlobs(options, null)) { BlobClient blobClient = blobContainerClient.getBlobClient(blobItem.getName()); diff --git a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/AzureBlobOrganizer.java b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/AzureBlobOrganizer.java index 3a7345216..11a0be79e 100644 --- a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/AzureBlobOrganizer.java +++ b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/AzureBlobOrganizer.java @@ -47,14 +47,17 @@ public void organizeAndCleanupBlobsByDate(int retentionDays, ZoneId timeZone) { } // TODO - separate the content by golden or automated so it can be distinguished - // when its pulled down - // modify destinationName to be test folder specific - // possibly read blob and modify parseAndMapMessageByControlId or use its parts to - // get a different MSH header like getIdentifier + // when its pulled down and modify destinationName to be test folder specific // possibly use a different receiver and filter on that + String testTypeAndSourceName = "Automated/" + sourceName; + if (sourceBlob.getBlobName().contains("golden")) { + testTypeAndSourceName = "GoldenCopy/" + sourceName; + } + String destinationName = - AzureBlobHelper.createDateBasedPath(sourceCreationDate, sourceName); + AzureBlobHelper.createDateBasedPath( + sourceCreationDate, testTypeAndSourceName); BlobClient destinationBlob = blobContainerClient.getBlobClient(destinationName); destinationBlob