diff options
author | Sai Gandham <sai.gandham@att.com> | 2019-11-06 13:32:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-11-06 13:32:58 +0000 |
commit | 7a105626c48be59154180a90f079c96bbc52b1c7 (patch) | |
tree | fd731ccc649ffcfd40b37955f50c046d8482d79b | |
parent | 82865bf0ee1e3258751542b6af682fcd851fbc71 (diff) | |
parent | 83b93fc82cc39590f1f3aa1e92a53f37cd191416 (diff) |
Merge "Fix Batch Cred Deletes"
3 files changed, 11 insertions, 5 deletions
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java index 49309004..4c14f0fd 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java @@ -316,7 +316,7 @@ public class Cred { } public static void batchDelete(StringBuilder sb, List<String> row) { - Long l = Long.parseLong(row.get(5)); + long l = Long.parseLong(row.get(5)); String date = Chrono.batchFmt.format(new Date(l)); sb.append("DELETE from authz.cred WHERE id='"); sb.append(row.get(1)); @@ -326,9 +326,6 @@ public class Cred { sb.append(" AND expires='"); sb.append(date); sb.append("';\n"); -// sb.append(" AND expires=dateof(maxtimeuuid("); -// sb.append(row.get(5)); -// sb.append("));\n"); } diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java index 087ab952..3d26ce99 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java @@ -94,7 +94,14 @@ public class Remove extends Batch { remove.add(new File(logDir, args()[i])); } } else { - remove.add(new File(logDir,"Delete"+Chrono.dateOnlyStamp()+".csv")); + final String ending = Chrono.dateOnlyStamp()+".csv"; + for (File file : logDir.listFiles(f -> { + String name = f.getName(); + return name.endsWith(ending) && ( + name.startsWith("Delete") || name.startsWith("Clean.")); + })) { + remove.add(file); + }; } for(File f : remove) { diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java index e6c95db8..aa20dfae 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java @@ -63,6 +63,8 @@ public class Chrono { niceUTCDateFmt.setTimeZone(TimeZone.getTimeZone("UTC"));
iso8601Fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
batchFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss+SSSS");
+ // Note: DB and thus Batch conversions should always be in UTC Time
+ batchFmt.setTimeZone(TimeZone.getTimeZone("UTC"));
}
|