Skip to content

Commit

Permalink
Changed file name prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
smirnovaae committed Mar 18, 2024
1 parent 716a5d6 commit 7589d87
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class AttributionDataShareConstants {
public static final String TEST_ENDPOINT = "http://127.0.0.1:8001";
public static final Region S3_REGION = Region.US_EAST_1;
public static final String FILE_PATH = "/tmp/";
public static final String REQ_FILE_NAME = "P#EFT.ON.AB2D.NGD.REQ.";
public static final String REQ_FILE_NAME = "#EFT.ON.AB2D.NGD.REQ.";
public static final String REQ_FILE_NAME_PATTERN = "'D'yyMMdd.'T'HHmmsss";
public static final String FIRST_LINE = "HDR_BENEDATAREQ";
public static final String LAST_LINE = "TLR_BENEDATAREQ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public void handleRequest(InputStream inputStream, OutputStream outputStream, Co
logger.log("AttributionDataShare Lambda is started");

String currentDate = new SimpleDateFormat(REQ_FILE_NAME_PATTERN).format(new Date());
String fileName = REQ_FILE_NAME + currentDate;
var prefix = (System.getenv(BUCKET_NAME_PROP).contains("prod")) ? "P" : "T";
String fileName = prefix + REQ_FILE_NAME + currentDate;
String fileFullPath = FILE_PATH + fileName;
var parameterStore = AttributionParameterStore.getParameterStore();
AttributionDataShareHelper helper = helperInit(fileName, fileFullPath, logger);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class OptOutConstants {
public static final String EFFECTIVE_DATE_PATTERN = "yyyyMMdd";
public static final int EFFECTIVE_DATE_LENGTH = 8;
public static final String LINE_SEPARATOR = System.getProperty("line.separator");
public static final String CONF_FILE_NAME = "P#EFT.ON.AB2D.NGD.CONF.";
public static final String CONF_FILE_NAME = "#EFT.ON.AB2D.NGD.CONF.";
public static final String CONF_FILE_NAME_PATTERN = "'D'yyMMdd.'T'HHmmsss";
public static final String UPDATE_STATEMENT = "UPDATE public.coverage\n" +
"SET opt_out_flag = ?, effective_date = current_timestamp\n" +
Expand Down
3 changes: 2 additions & 1 deletion optout/src/main/java/gov/cms/ab2d/optout/OptOutS3.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public void deleteFileFromS3() {

public String getOutFileName() {
//bfdeft01/ab2d/in/testing.txt
var name = CONF_FILE_NAME
var prefix = (bfdBucket.contains("prod")) ? "P" : "T";
var name = prefix + CONF_FILE_NAME
+ new SimpleDateFormat(CONF_FILE_NAME_PATTERN).format(new Date());

String[] path = fileName.split("in");
Expand Down
2 changes: 1 addition & 1 deletion optout/src/test/java/gov/cms/ab2d/optout/OptOutS3Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ void deleteFileFromS3Test() {
void getOutFileName() {
OPT_OUT_S3 = new OptOutS3(S3_CLIENT, TEST_BUCKET_PATH + "/in/" + TEST_FILE_NAME, TEST_BFD_BUCKET_NAME, mock(LambdaLogger.class));
var outFileName = OPT_OUT_S3.getOutFileName();
Assertions.assertTrue(outFileName.startsWith(TEST_BUCKET_PATH + "/out/" + CONF_FILE_NAME));
Assertions.assertTrue(outFileName.startsWith(TEST_BUCKET_PATH + "/out/T" + CONF_FILE_NAME));
}
}

0 comments on commit 7589d87

Please sign in to comment.