From a4f2e2024c28b34b3f4b0fbd49d88692236ecdd0 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sat, 27 Apr 2024 17:17:04 +0200 Subject: [PATCH] remove deprecated get...TimeString() methods from model classes --- CHANGELOG.md | 6 ++++ pom.xml | 2 +- .../response/embedded/SecretMetadata.java | 26 ----------------- .../model/response/embedded/TokenData.java | 28 ------------------- .../response/embedded/VersionMetadata.java | 26 ----------------- .../response/MetaSecretResponseTest.java | 4 --- .../model/response/MetadataResponseTest.java | 4 --- .../response/SecretVersionResponseTest.java | 2 -- .../model/response/TokenResponseTest.java | 2 -- 9 files changed, 7 insertions(+), 93 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aaea9b0..a333a7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## unreleased + +### Removal +* Remove deprecated `get...TimeString()` on model classes + + ## 1.2.0 (2023-12-11) ### Deprecations diff --git a/pom.xml b/pom.xml index a388894..02d9bb5 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ de.stklcode.jvault jvault-connector - 1.2.1-SNAPSHOT + 1.3.0-SNAPSHOT jar diff --git a/src/main/java/de/stklcode/jvault/connector/model/response/embedded/SecretMetadata.java b/src/main/java/de/stklcode/jvault/connector/model/response/embedded/SecretMetadata.java index 99a1ee2..ebc01d9 100644 --- a/src/main/java/de/stklcode/jvault/connector/model/response/embedded/SecretMetadata.java +++ b/src/main/java/de/stklcode/jvault/connector/model/response/embedded/SecretMetadata.java @@ -57,19 +57,6 @@ public final class SecretMetadata implements Serializable { @JsonProperty("versions") private Map versions; - /** - * @return Time of secret creation as raw string representation. - * @deprecated Method left for backwards compatibility only. Use {@link #getCreatedTime()} instead. - */ - @Deprecated(since = "1.2", forRemoval = true) - public String getCreatedTimeString() { - if (createdTime != null) { - return TIME_FORMAT.format(createdTime); - } - - return null; - } - /** * @return Time of secret creation. */ @@ -98,19 +85,6 @@ public Integer getOldestVersion() { return oldestVersion; } - /** - * @return Time of secret update as raw string representation. - * @deprecated Method left for backwards compatibility only. Use {@link #getUpdatedTime()} instead. - */ - @Deprecated(since = "1.2", forRemoval = true) - public String getUpdatedTimeString() { - if (updatedTime != null) { - return TIME_FORMAT.format(updatedTime); - } - - return null; - } - /** * @return Time of secret update. */ diff --git a/src/main/java/de/stklcode/jvault/connector/model/response/embedded/TokenData.java b/src/main/java/de/stklcode/jvault/connector/model/response/embedded/TokenData.java index b522f6b..a69923a 100644 --- a/src/main/java/de/stklcode/jvault/connector/model/response/embedded/TokenData.java +++ b/src/main/java/de/stklcode/jvault/connector/model/response/embedded/TokenData.java @@ -127,20 +127,6 @@ public String getEntityId() { return entityId; } - /** - * @return Expire time as raw string value - * @since 0.9 - * @deprecated Method left for backwards compatibility only. Use {@link #getExpireTime()} instead. - */ - @Deprecated(since = "1.2", forRemoval = true) - public String getExpireTimeString() { - if (expireTime != null) { - return TIME_FORMAT.format(expireTime); - } - - return null; - } - /** * @return Expire time (parsed) * @since 0.9 @@ -164,20 +150,6 @@ public String getId() { return id; } - /** - * @return Issue time as raw string value - * @since 0.9 - * @deprecated Method left for backwards compatibility only. Use {@link #getIssueTime()} instead. - */ - @Deprecated(since = "1.2", forRemoval = true) - public String getIssueTimeString() { - if (issueTime != null) { - return TIME_FORMAT.format(issueTime); - } - - return null; - } - /** * @return Expire time (parsed) * @since 0.9 diff --git a/src/main/java/de/stklcode/jvault/connector/model/response/embedded/VersionMetadata.java b/src/main/java/de/stklcode/jvault/connector/model/response/embedded/VersionMetadata.java index 49aa0c2..8b7d45f 100644 --- a/src/main/java/de/stklcode/jvault/connector/model/response/embedded/VersionMetadata.java +++ b/src/main/java/de/stklcode/jvault/connector/model/response/embedded/VersionMetadata.java @@ -50,19 +50,6 @@ public final class VersionMetadata implements Serializable { @JsonProperty("version") private Integer version; - /** - * @return Time of secret creation as raw string representation. - * @deprecated Method left for backwards compatibility only. Use {@link #getCreatedTime()} instead. - */ - @Deprecated(since = "1.2", forRemoval = true) - public String getCreatedTimeString() { - if (createdTime != null) { - return TIME_FORMAT.format(createdTime); - } - - return null; - } - /** * @return Time of secret creation. */ @@ -70,19 +57,6 @@ public ZonedDateTime getCreatedTime() { return createdTime; } - /** - * @return Time for secret deletion as raw string representation. - * @deprecated Method left for backwards compatibility only. Use {@link #getDeletionTime()} instead. - */ - @Deprecated(since = "1.2", forRemoval = true) - public String getDeletionTimeString() { - if (deletionTime != null) { - return TIME_FORMAT.format(deletionTime); - } - - return null; - } - /** * @return Time for secret deletion. */ diff --git a/src/test/java/de/stklcode/jvault/connector/model/response/MetaSecretResponseTest.java b/src/test/java/de/stklcode/jvault/connector/model/response/MetaSecretResponseTest.java index b3e8194..d39f30f 100644 --- a/src/test/java/de/stklcode/jvault/connector/model/response/MetaSecretResponseTest.java +++ b/src/test/java/de/stklcode/jvault/connector/model/response/MetaSecretResponseTest.java @@ -107,9 +107,7 @@ void jsonRoundtrip() { ); assertSecretData(res); assertNotNull(res.getMetadata(), "SecretResponse does not contain metadata"); - assertEquals(SECRET_META_CREATED, res.getMetadata().getCreatedTimeString(), "Incorrect creation date string"); assertNotNull(res.getMetadata().getCreatedTime(), "Creation date parsing failed"); - assertNull(res.getMetadata().getDeletionTimeString(), "Incorrect deletion date string"); assertNull(res.getMetadata().getDeletionTime(), "Incorrect deletion date"); assertFalse(res.getMetadata().isDestroyed(), "Secret destroyed when not expected"); assertEquals(1, res.getMetadata().getVersion(), "Incorrect secret version"); @@ -121,9 +119,7 @@ void jsonRoundtrip() { ); assertSecretData(res); assertNotNull(res.getMetadata(), "SecretResponse does not contain metadata"); - assertEquals(SECRET_META_CREATED, res.getMetadata().getCreatedTimeString(), "Incorrect creation date string"); assertNotNull(res.getMetadata().getCreatedTime(), "Creation date parsing failed"); - assertEquals(SECRET_META_DELETED, res.getMetadata().getDeletionTimeString(), "Incorrect deletion date string"); assertNotNull(res.getMetadata().getDeletionTime(), "Incorrect deletion date"); assertTrue(res.getMetadata().isDestroyed(), "Secret destroyed when not expected"); assertEquals(2, res.getMetadata().getVersion(), "Incorrect secret version"); diff --git a/src/test/java/de/stklcode/jvault/connector/model/response/MetadataResponseTest.java b/src/test/java/de/stklcode/jvault/connector/model/response/MetadataResponseTest.java index 932ac0d..6f53c0b 100644 --- a/src/test/java/de/stklcode/jvault/connector/model/response/MetadataResponseTest.java +++ b/src/test/java/de/stklcode/jvault/connector/model/response/MetadataResponseTest.java @@ -88,18 +88,14 @@ void jsonRoundtrip() { ); assertNotNull(res, "Parsed response is NULL"); assertNotNull(res.getMetadata(), "Parsed metadata is NULL"); - assertEquals(V1_TIME, res.getMetadata().getCreatedTimeString(), "Incorrect created time"); assertNotNull(res.getMetadata().getCreatedTime(), "Parting created time failed"); assertEquals(CURRENT_VERSION, res.getMetadata().getCurrentVersion(), "Incorrect current version"); assertEquals(MAX_VERSIONS, res.getMetadata().getMaxVersions(), "Incorrect max versions"); assertEquals(OLDEST_VERSION, res.getMetadata().getOldestVersion(), "Incorrect oldest version"); - assertEquals(V3_TIME, res.getMetadata().getUpdatedTimeString(), "Incorrect updated time"); assertNotNull(res.getMetadata().getUpdatedTime(), "Parting updated time failed"); assertEquals(3, res.getMetadata().getVersions().size(), "Incorrect number of versions"); - assertEquals(V2_TIME, res.getMetadata().getVersions().get(1).getDeletionTimeString(), "Incorrect version 1 delete time"); assertNotNull(res.getMetadata().getVersions().get(1).getDeletionTime(), "Parsing version delete time failed"); assertTrue(res.getMetadata().getVersions().get(1).isDestroyed(), "Incorrect version 1 destroyed state"); - assertEquals(V2_TIME, res.getMetadata().getVersions().get(2).getCreatedTimeString(), "Incorrect version 2 created time"); assertNotNull(res.getMetadata().getVersions().get(2).getCreatedTime(), "Parsing version created failed"); assertFalse(res.getMetadata().getVersions().get(3).isDestroyed(), "Incorrect version 3 destroyed state"); } diff --git a/src/test/java/de/stklcode/jvault/connector/model/response/SecretVersionResponseTest.java b/src/test/java/de/stklcode/jvault/connector/model/response/SecretVersionResponseTest.java index 9835edf..84eb329 100644 --- a/src/test/java/de/stklcode/jvault/connector/model/response/SecretVersionResponseTest.java +++ b/src/test/java/de/stklcode/jvault/connector/model/response/SecretVersionResponseTest.java @@ -67,8 +67,6 @@ void jsonRoundtrip() { ); assertNotNull(res, "Parsed response is NULL"); assertNotNull(res.getMetadata(), "Parsed metadata is NULL"); - assertEquals(CREATION_TIME, res.getMetadata().getCreatedTimeString(), "Incorrect created time"); - assertEquals(DELETION_TIME, res.getMetadata().getDeletionTimeString(), "Incorrect deletion time"); assertFalse(res.getMetadata().isDestroyed(), "Incorrect destroyed state"); assertEquals(VERSION, res.getMetadata().getVersion(), "Incorrect version"); } diff --git a/src/test/java/de/stklcode/jvault/connector/model/response/TokenResponseTest.java b/src/test/java/de/stklcode/jvault/connector/model/response/TokenResponseTest.java index 32eede6..06d8ab0 100644 --- a/src/test/java/de/stklcode/jvault/connector/model/response/TokenResponseTest.java +++ b/src/test/java/de/stklcode/jvault/connector/model/response/TokenResponseTest.java @@ -133,11 +133,9 @@ void jsonRoundtrip() { assertEquals(TOKEN_TTL, data.getCreationTtl(), "Incorrect token creation TTL"); assertEquals(TOKEN_DISPLAY_NAME, data.getName(), "Incorrect token display name"); assertEquals(TOKEN_ENTITY_ID, data.getEntityId(), "Incorrect token entity ID"); - assertEquals(TOKEN_EXPIRE_TIME, data.getExpireTimeString(), "Incorrect token expire time"); assertEquals(ZonedDateTime.parse(TOKEN_EXPIRE_TIME), data.getExpireTime(), "Incorrect parsed token expire time"); assertEquals(TOKEN_EXPLICIT_MAX_TTL, data.getExplicitMaxTtl(), "Incorrect token explicit max TTL"); assertEquals(TOKEN_ID, data.getId(), "Incorrect token ID"); - assertEquals(TOKEN_ISSUE_TIME, data.getIssueTimeString(), "Incorrect token issue time"); assertEquals(ZonedDateTime.parse(TOKEN_ISSUE_TIME), data.getIssueTime(), "Incorrect parsed token issue time"); assertEquals(Map.of(TOKEN_META_KEY, TOKEN_META_VALUE), data.getMeta(), "Incorrect token metadata"); assertEquals(TOKEN_NUM_USES, data.getNumUses(), "Incorrect token number of uses");