diff --git a/.gitignore b/.gitignore
index 1d4dbd4..81a0a8f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,28 @@
-.idea/
build
target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+# https://github.com/takari/maven-wrapper#usage-without-binary-jar
+.mvn/wrapper/maven-wrapper.jar
+
+# Eclipse m2e generated files
+# Eclipse Core
+.project
+# JDT-specific (Eclipse Java Development Tools)
+.classpath
+
+# IntelliJ
+.idea/
*.iml
+
+# VS Code
+.vscode
+
+# macOS
+.DS_Store
diff --git a/pom.xml b/pom.xml
index c02fa22..1ad5088 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,7 +46,7 @@
com.amazonaws
aws-java-sdk-secretsmanager
- 1.12.262
+ 1.12.264
org.testng
@@ -114,6 +114,7 @@
+
validate
validate
@@ -133,6 +134,7 @@
+
analyze-compile
compile
diff --git a/src/main/java/com/amazonaws/secretsmanager/caching/cache/SecretCacheObject.java b/src/main/java/com/amazonaws/secretsmanager/caching/cache/SecretCacheObject.java
index f3d1937..f50abb5 100644
--- a/src/main/java/com/amazonaws/secretsmanager/caching/cache/SecretCacheObject.java
+++ b/src/main/java/com/amazonaws/secretsmanager/caching/cache/SecretCacheObject.java
@@ -125,7 +125,7 @@ public SecretCacheObject(final String secretId,
public abstract int hashCode();
public abstract String toString();
- protected T updateUserAgent(T request) {
+ protected U updateUserAgent(U request) {
request.getRequestClientOptions().appendUserAgent(VersionInfo.USER_AGENT);
return request;
}
diff --git a/src/test/java/com/amazonaws/secretsmanager/caching/SecretCacheTest.java b/src/test/java/com/amazonaws/secretsmanager/caching/SecretCacheTest.java
index 5dab58c..24b3f54 100644
--- a/src/test/java/com/amazonaws/secretsmanager/caching/SecretCacheTest.java
+++ b/src/test/java/com/amazonaws/secretsmanager/caching/SecretCacheTest.java
@@ -68,6 +68,7 @@ private static void repeat(int number, IntConsumer c) {
public void exceptionSecretCacheTest() {
SecretCache sc = new SecretCache();
sc.getSecretString("");
+ sc.close();
}
@Test(expectedExceptions = {SdkClientException.class})
@@ -87,9 +88,11 @@ public void secretCacheConstructorTest() {
SecretCache sc2 = null;
try {
sc1 = new SecretCache((SecretCacheConfiguration)null);
+ sc1.close();
} catch (Exception e) {}
try {
sc2 = new SecretCache((AWSSecretsManagerClientBuilder)null);
+ sc2.close();
} catch (Exception e) {}
}
@@ -150,6 +153,7 @@ public Object get(final Object o) {
repeat(10, n -> Assert.assertEquals(sc.getSecretBinary(""),
ByteBuffer.wrap(secret.getBytes())));
Assert.assertEquals(hook.getCount(), 2);
+ sc.close();
}
@Test
@@ -172,6 +176,7 @@ public void secretCacheNullStagesTest() {
repeat(10, n -> Assert.assertEquals(sc.getSecretBinary(""),
ByteBuffer.wrap(secret.getBytes())));
+ sc.close();
}
@Test
@@ -198,6 +203,7 @@ public void basicSecretCacheRefreshNowTest() throws Throwable {
repeat(10, n -> Assert.assertEquals(sc.getSecretString(""), secret));
Mockito.verify(asm, Mockito.times(2)).describeSecret(Mockito.any());
Mockito.verify(asm, Mockito.times(1)).getSecretValue(Mockito.any());
+ sc.close();
}
@Test
@@ -221,6 +227,7 @@ public void basicSecretCacheByteBufferTest() {
repeat(10, n -> Assert.assertEquals(sc.getSecretBinary(""),
ByteBuffer.wrap(secret.getBytes())));
+ sc.close();
}
@Test
@@ -242,6 +249,7 @@ public void basicSecretCacheMultipleTest() {
// Verify that multiple requests did not call the API
Mockito.verify(asm, Mockito.times(2)).describeSecret(Mockito.any());
Mockito.verify(asm, Mockito.times(2)).getSecretValue(Mockito.any());
+ sc.close();
}
@Test
@@ -312,30 +320,30 @@ public void basicSecretCacheTestNoVersions() {
// Verify that multiple requests did not call the API
Mockito.verify(asm, Mockito.times(1)).describeSecret(Mockito.any());
Mockito.verify(asm, Mockito.times(0)).getSecretValue(Mockito.any());
+ sc.close();
}
@Test(expectedExceptions = {RuntimeException.class})
public void basicSecretCacheExceptionTest() {
- final String secret = "basicSecretCacheExceptionTest";
Mockito.when(asm.describeSecret(Mockito.any())).thenThrow(new RuntimeException());
SecretCache sc = new SecretCache(asm);
sc.getSecretString("");
+ sc.close();
}
@Test
public void basicSecretCacheExceptionRefreshNowTest() throws Throwable {
- final String secret = "basicSecretCacheExceptionTest";
Mockito.when(asm.describeSecret(Mockito.any())).thenThrow(new RuntimeException());
SecretCache sc = new SecretCache(asm);
Assert.assertFalse(sc.refreshNow(""));
Mockito.verify(asm, Mockito.times(1)).describeSecret(Mockito.any());
Assert.assertFalse(sc.refreshNow(""));
Mockito.verify(asm, Mockito.times(2)).describeSecret(Mockito.any());
+ sc.close();
}
@Test
public void basicSecretCacheExceptionRetryTest() throws Throwable {
- final String secret = "basicSecretCacheExceptionTest";
final int retryCount = 10;
Mockito.when(asm.describeSecret(Mockito.any())).thenThrow(new RuntimeException());
SecretCache sc = new SecretCache(asm);
@@ -357,22 +365,23 @@ public void basicSecretCacheExceptionRetryTest() throws Throwable {
} catch (RuntimeException ex) {}
// The api call should have been retried after the delay.
Mockito.verify(asm, Mockito.times(2)).describeSecret(Mockito.any());
+ sc.close();
}
@Test
public void basicSecretCacheNullTest() {
- final String secret = "basicSecretCacheNullTest";
Mockito.when(asm.describeSecret(Mockito.any())).thenReturn(null);
SecretCache sc = new SecretCache(asm);
Assert.assertNull(sc.getSecretString(""));
+ sc.close();
}
@Test
public void basicSecretCacheNullStagesTest() {
- final String secret = "basicSecretCacheNullStagesTest";
Mockito.when(describeSecretResult.getVersionIdsToStages()).thenReturn(null);
SecretCache sc = new SecretCache(asm);
Assert.assertNull(sc.getSecretString(""));
+ sc.close();
}
@Test
@@ -390,6 +399,7 @@ public void basicSecretCacheVersionWithNullStageTest() {
// Verify that multiple requests did not call the API
Mockito.verify(asm, Mockito.times(1)).describeSecret(Mockito.any());
Mockito.verify(asm, Mockito.times(0)).getSecretValue(Mockito.any());
+ sc.close();
}
}