diff --git a/attribution-data-file-share/src/main/java/gov/cms/ab2d/attributionDataShare/AttributionDataShareHelper.java b/attribution-data-file-share/src/main/java/gov/cms/ab2d/attributionDataShare/AttributionDataShareHelper.java index c584ea7..8a273fc 100644 --- a/attribution-data-file-share/src/main/java/gov/cms/ab2d/attributionDataShare/AttributionDataShareHelper.java +++ b/attribution-data-file-share/src/main/java/gov/cms/ab2d/attributionDataShare/AttributionDataShareHelper.java @@ -40,7 +40,7 @@ void copyDataToFile(Connection connection) { writer.newLine(); long records = 0; while (rs.next()) { - var line = getResponseLine(rs.getString(1), rs.getTimestamp(2), rs.getBoolean(3)); + var line = getResponseLine(rs.getString(1), rs.getDate(2), rs.getBoolean(3)); writer.write(line); writer.newLine(); records++; @@ -54,7 +54,7 @@ void copyDataToFile(Connection connection) { } } - String getResponseLine(String currentMbi, Timestamp effectiveDate, Boolean optOutFlag) { + String getResponseLine(String currentMbi, Date effectiveDate, Boolean optOutFlag) { var result = new StringBuilder(); result.append(currentMbi); // Adding spaces to the end of a string to achieve the required position index diff --git a/attribution-data-file-share/src/test/java/gov/cms/ab2d/attributionDataShare/AttributionDataShareTest.java b/attribution-data-file-share/src/test/java/gov/cms/ab2d/attributionDataShare/AttributionDataShareTest.java index 638c467..27f630e 100644 --- a/attribution-data-file-share/src/test/java/gov/cms/ab2d/attributionDataShare/AttributionDataShareTest.java +++ b/attribution-data-file-share/src/test/java/gov/cms/ab2d/attributionDataShare/AttributionDataShareTest.java @@ -19,11 +19,8 @@ import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; -import java.sql.Timestamp; import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Date; -import java.util.Scanner; +import java.util.*; import static gov.cms.ab2d.attributionDataShare.AttributionDataShareConstants.*; import static gov.cms.ab2d.attributionDataShare.AttributionDataShareHelper.getExecuteQuery; @@ -43,7 +40,7 @@ public class AttributionDataShareTest { String FILE_FULL_PATH = FILE_PATH + FILE_NAME; String MBI_1 = "DUMMY000001"; String MBI_2 = "DUMMY000002"; - Timestamp DATE = Timestamp.valueOf("2024-02-26 00:00:00"); + Date DATE = new GregorianCalendar(2024, Calendar.FEBRUARY, 26).getTime(); AttributionDataShareHelper helper; @BeforeEach @@ -57,7 +54,7 @@ void copyDataToFileTest() throws IOException, SQLException { var stmt = mock(Statement.class); var rs = new MockResultSet(""); rs.addColumn("mbi", Arrays.asList(MBI_1, MBI_2)); - rs.addColumn("effective_date", Arrays.asList(DATE, null)); + rs.addColumn("effective_date", Arrays.asList("2024-02-26", null)); rs.addColumn("opt_out_flag", Arrays.asList(true, null)); when(connection.createStatement()).thenReturn(stmt); diff --git a/optout/src/main/java/gov/cms/ab2d/optout/OptOutConstants.java b/optout/src/main/java/gov/cms/ab2d/optout/OptOutConstants.java index 47890b6..176a214 100644 --- a/optout/src/main/java/gov/cms/ab2d/optout/OptOutConstants.java +++ b/optout/src/main/java/gov/cms/ab2d/optout/OptOutConstants.java @@ -22,7 +22,7 @@ public class OptOutConstants { 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.current_mbi\n" + - "SET opt_out_flag = ?, effective_date = current_timestamp\n" + + "SET opt_out_flag = ?, effective_date = current_date\n" + "WHERE mbi = ?"; private OptOutConstants() { diff --git a/optout/src/main/java/gov/cms/ab2d/optout/OptOutS3.java b/optout/src/main/java/gov/cms/ab2d/optout/OptOutS3.java index 211c0e3..fe6721a 100644 --- a/optout/src/main/java/gov/cms/ab2d/optout/OptOutS3.java +++ b/optout/src/main/java/gov/cms/ab2d/optout/OptOutS3.java @@ -69,7 +69,6 @@ public String createResponseOptOutFile(String responseContent) { .build(); s3Client.putObject(objectRequest, RequestBody.fromString(responseContent)); - logger.log("Response file done"); return key; } catch (AmazonS3Exception ex) { var errorMessage = "Response OptOut file cannot be created. "; @@ -86,7 +85,6 @@ public void deleteFileFromS3() { .build(); s3Client.deleteObject(request); - logger.log("delete file done"); } catch (SdkClientException ex) { logger.log(ex.getMessage()); } diff --git a/optout/src/test/resources/optOutDummy.txt b/optout/src/test/resources/optOutDummy.txt index 1201b89..1bec770 100644 --- a/optout/src/test/resources/optOutDummy.txt +++ b/optout/src/test/resources/optOutDummy.txt @@ -1,9 +1,9 @@ HDR_BENEDATARSP20240123 -1S00E00JG37N +1S00E00JG37Y 7SP1D00AA00N 2SY1D00AA00Y 7SF9C00AA00N -6SF9C00AA00N +7SF6F00AA00N DUMMY000006Y DUMMY000007N TRL_BENEDATARSP202401230000000007 \ No newline at end of file