Search in sources :

Example 1 with PutSecretValueResult

use of com.amazonaws.services.secretsmanager.model.PutSecretValueResult in project fernet-java8 by l0s.

the class MemoryOverwritingRequestHandlerTest method verifyAfterErrorClearsSecret.

@Test
public void verifyAfterErrorClearsSecret() {
    // given
    final ByteBuffer secretBinary = ByteBuffer.wrap(new byte[] { 1, 1, 2, 3, 5, 8 });
    assertTrue(Arrays.equals(secretBinary.array(), new byte[] { 1, 1, 2, 3, 5, 8 }));
    final PutSecretValueRequest originalRequest = new PutSecretValueRequest();
    originalRequest.setSecretBinary(secretBinary);
    final Request<PutSecretValueRequest> request = new DefaultRequest<PutSecretValueRequest>(originalRequest, "AWSSecretsManager");
    final PutSecretValueResult result = mock(PutSecretValueResult.class);
    final HttpResponse httpResponse = mock(HttpResponse.class);
    final Response<PutSecretValueResult> response = new Response<PutSecretValueResult>(result, httpResponse);
    // when
    handler.afterError(request, response, new Exception());
    // then
    assertFalse(Arrays.equals(secretBinary.array(), new byte[] { 1, 1, 2, 3, 5, 8 }));
}
Also used : HttpResponse(com.amazonaws.http.HttpResponse) Response(com.amazonaws.Response) PutSecretValueRequest(com.amazonaws.services.secretsmanager.model.PutSecretValueRequest) DefaultRequest(com.amazonaws.DefaultRequest) HttpResponse(com.amazonaws.http.HttpResponse) ByteBuffer(java.nio.ByteBuffer) PutSecretValueResult(com.amazonaws.services.secretsmanager.model.PutSecretValueResult) Test(org.junit.Test)

Example 2 with PutSecretValueResult

use of com.amazonaws.services.secretsmanager.model.PutSecretValueResult in project fernet-java8 by l0s.

the class MemoryOverwritingRequestHandlerTest method verifyAfterResponseClearsSecret.

@Test
public void verifyAfterResponseClearsSecret() {
    // given
    final ByteBuffer secretBinary = ByteBuffer.wrap(new byte[] { 1, 1, 2, 3, 5, 8 });
    assertTrue(Arrays.equals(secretBinary.array(), new byte[] { 1, 1, 2, 3, 5, 8 }));
    final PutSecretValueRequest originalRequest = new PutSecretValueRequest();
    originalRequest.setSecretBinary(secretBinary);
    final Request<PutSecretValueRequest> request = new DefaultRequest<PutSecretValueRequest>(originalRequest, "AWSSecretsManager");
    final PutSecretValueResult result = mock(PutSecretValueResult.class);
    final HttpResponse httpResponse = mock(HttpResponse.class);
    final Response<PutSecretValueResult> response = new Response<PutSecretValueResult>(result, httpResponse);
    // when
    handler.afterResponse(request, response);
    // then
    assertFalse(Arrays.equals(secretBinary.array(), new byte[] { 1, 1, 2, 3, 5, 8 }));
}
Also used : HttpResponse(com.amazonaws.http.HttpResponse) Response(com.amazonaws.Response) PutSecretValueRequest(com.amazonaws.services.secretsmanager.model.PutSecretValueRequest) DefaultRequest(com.amazonaws.DefaultRequest) HttpResponse(com.amazonaws.http.HttpResponse) ByteBuffer(java.nio.ByteBuffer) PutSecretValueResult(com.amazonaws.services.secretsmanager.model.PutSecretValueResult) Test(org.junit.Test)

Aggregations

DefaultRequest (com.amazonaws.DefaultRequest)2 Response (com.amazonaws.Response)2 HttpResponse (com.amazonaws.http.HttpResponse)2 PutSecretValueRequest (com.amazonaws.services.secretsmanager.model.PutSecretValueRequest)2 PutSecretValueResult (com.amazonaws.services.secretsmanager.model.PutSecretValueResult)2 ByteBuffer (java.nio.ByteBuffer)2 Test (org.junit.Test)2