Change getByName methods to return only the current credential value, and add getByNameWithHistory methods.
This commit is contained in:
@@ -67,15 +67,25 @@ public interface CredHubOperations {
|
||||
|
||||
/**
|
||||
* Retrieve a credential using its name, as passed to a write request.
|
||||
* A collection of all stored values for the named credential will be returned,
|
||||
* including historical values.
|
||||
* Only the current credential value will be returned.
|
||||
*
|
||||
* @param name the name of the credential; must not be {@literal null}
|
||||
* @param credentialType the type of credential expected to be returned
|
||||
* @param <T> the credential implementation type
|
||||
* @return the details of the retrieved credential, including history
|
||||
* @return the details of the retrieved credential
|
||||
*/
|
||||
<T> List<CredentialDetails<T>> getByName(final String name, Class<T> credentialType);
|
||||
<T> CredentialDetails<T> getByName(final String name, Class<T> credentialType);
|
||||
|
||||
/**
|
||||
* Retrieve a credential using its name, as passed to a write request.
|
||||
* Only the current credential value will be returned.
|
||||
*
|
||||
* @param name the name of the credential; must not be {@literal null}
|
||||
* @param credentialType the type of credential expected to be returned
|
||||
* @param <T> the credential implementation type
|
||||
* @return the details of the retrieved credential
|
||||
*/
|
||||
<T> CredentialDetails<T> getByName(final CredentialName name, Class<T> credentialType);
|
||||
|
||||
/**
|
||||
* Retrieve a credential using its name, as passed to a write request.
|
||||
@@ -87,7 +97,19 @@ public interface CredHubOperations {
|
||||
* @param <T> the credential implementation type
|
||||
* @return the details of the retrieved credential, including history
|
||||
*/
|
||||
<T> List<CredentialDetails<T>> getByName(final CredentialName name, Class<T> credentialType);
|
||||
<T> List<CredentialDetails<T>> getByNameWithHistory(String name, Class<T> credentialType);
|
||||
|
||||
/**
|
||||
* Retrieve a credential using its name, as passed to a write request.
|
||||
* A collection of all stored values for the named credential will be returned,
|
||||
* including historical values.
|
||||
*
|
||||
* @param name the name of the credential; must not be {@literal null}
|
||||
* @param credentialType the type of credential expected to be returned
|
||||
* @param <T> the credential implementation type
|
||||
* @return the details of the retrieved credential, including history
|
||||
*/
|
||||
<T> List<CredentialDetails<T>> getByNameWithHistory(CredentialName name, Class<T> credentialType);
|
||||
|
||||
/**
|
||||
* Find a credential using a full or partial name.
|
||||
|
||||
@@ -50,12 +50,11 @@ public class CredHubTemplate implements CredHubOperations {
|
||||
static final String BASE_URL_PATH = "/api/v1/data";
|
||||
static final String ID_URL_PATH = BASE_URL_PATH + "/{id}";
|
||||
static final String NAME_URL_QUERY = BASE_URL_PATH + "?name={name}";
|
||||
static final String NAME_URL_QUERY_CURRENT = NAME_URL_QUERY + "¤t=true";
|
||||
static final String NAME_LIKE_URL_QUERY = BASE_URL_PATH + "?name-like={name}";
|
||||
static final String PATH_URL_QUERY = BASE_URL_PATH + "?path={path}";
|
||||
static final String INTERPOLATE_URL_PATH = "/api/v1/interpolate";
|
||||
|
||||
static final String VCAP_SERVICES_KEY = "VCAP_SERVICES";
|
||||
|
||||
private final RestTemplate restTemplate;
|
||||
|
||||
/**
|
||||
@@ -92,7 +91,6 @@ public class CredHubTemplate implements CredHubOperations {
|
||||
public <T> CredentialDetails<T> write(final CredentialRequest<T> credentialRequest) {
|
||||
Assert.notNull(credentialRequest, "credentialRequest must not be null");
|
||||
|
||||
Class<T> credentialType = (Class<T>) credentialRequest.getValue().getClass();
|
||||
final ParameterizedTypeReference<CredentialDetails<T>> ref =
|
||||
new ParameterizedTypeReference<CredentialDetails<T>>() {};
|
||||
|
||||
@@ -115,7 +113,6 @@ public class CredHubTemplate implements CredHubOperations {
|
||||
public <T, P> CredentialDetails<T> generate(final ParametersRequest<P> parametersRequest) {
|
||||
Assert.notNull(parametersRequest, "generateRequest must not be null");
|
||||
|
||||
Class<T> credentialType = (Class<T>) parametersRequest.getParameters().getClass();
|
||||
final ParameterizedTypeReference<CredentialDetails<T>> ref =
|
||||
new ParameterizedTypeReference<CredentialDetails<T>>() {};
|
||||
|
||||
@@ -155,7 +152,35 @@ public class CredHubTemplate implements CredHubOperations {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> List<CredentialDetails<T>> getByName(final String name, Class<T> credentialType) {
|
||||
public <T> CredentialDetails<T> getByName(final String name, Class<T> credentialType) {
|
||||
Assert.notNull(name, "credential name must not be null");
|
||||
Assert.notNull(credentialType, "credential type must not be null");
|
||||
|
||||
final ParameterizedTypeReference<CredentialDetails<T>> ref =
|
||||
new ParameterizedTypeReference<CredentialDetails<T>>() {};
|
||||
|
||||
return doWithRest(new RestOperationsCallback<CredentialDetails<T>>() {
|
||||
@Override
|
||||
public CredentialDetails<T> doWithRestOperations(RestOperations restOperations) {
|
||||
ResponseEntity<CredentialDetails<T>> response =
|
||||
restOperations.exchange(NAME_URL_QUERY_CURRENT, GET, null, ref, name);
|
||||
|
||||
throwExceptionOnError(response);
|
||||
|
||||
return response.getBody();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> CredentialDetails<T> getByName(final CredentialName name, Class<T> credentialType) {
|
||||
Assert.notNull(name, "credential name must not be null");
|
||||
|
||||
return getByName(name.getName(), credentialType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> List<CredentialDetails<T>> getByNameWithHistory(final String name, Class<T> credentialType) {
|
||||
Assert.notNull(name, "credential name must not be null");
|
||||
Assert.notNull(credentialType, "credential type must not be null");
|
||||
|
||||
@@ -176,10 +201,10 @@ public class CredHubTemplate implements CredHubOperations {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> List<CredentialDetails<T>> getByName(final CredentialName name, Class<T> credentialType) {
|
||||
public <T> List<CredentialDetails<T>> getByNameWithHistory(final CredentialName name, Class<T> credentialType) {
|
||||
Assert.notNull(name, "credential name must not be null");
|
||||
|
||||
return getByName(name.getName(), credentialType);
|
||||
return getByNameWithHistory(name.getName(), credentialType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -95,14 +95,26 @@ public class CredHubTemplateDetailCertificateUnitTests
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithString(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<CertificateCredential>> expectedResponse) {
|
||||
verifyGetByNameWithString(expectedResponse);
|
||||
public void getByNameWithString(@FromDataPoints("detail-responses")
|
||||
ResponseEntity<CredentialDetails<CertificateCredential>> expectedResponse) {
|
||||
verifyGetByNameUsingString(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithCredentialName(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<CertificateCredential>> expectedResponse) {
|
||||
verifyGetByNameWithCredentialName(expectedResponse);
|
||||
public void getByNameWithCredentialName(@FromDataPoints("detail-responses")
|
||||
ResponseEntity<CredentialDetails<CertificateCredential>> expectedResponse) {
|
||||
verifyGetByNameUsingCredentialName(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithHistoryUsingString(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<CertificateCredential>> expectedResponse) {
|
||||
verifyGetByNameWithHistoryUsingString(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithHistoryUsingCredentialName(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<CertificateCredential>> expectedResponse) {
|
||||
verifyGetByNameWithHistoryUsingCredentialName(expectedResponse);
|
||||
}
|
||||
}
|
||||
@@ -78,14 +78,26 @@ public class CredHubTemplateDetailJsonUnitTests
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithString(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<JsonCredential>> expectedResponse) {
|
||||
verifyGetByNameWithString(expectedResponse);
|
||||
public void getByNameUsingString(@FromDataPoints("detail-responses")
|
||||
ResponseEntity<CredentialDetails<JsonCredential>> expectedResponse) {
|
||||
verifyGetByNameUsingString(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithCredentialName(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<JsonCredential>> expectedResponse) {
|
||||
verifyGetByNameWithCredentialName(expectedResponse);
|
||||
public void getByNameUsingCredentialName(@FromDataPoints("detail-responses")
|
||||
ResponseEntity<CredentialDetails<JsonCredential>> expectedResponse) {
|
||||
verifyGetByNameUsingCredentialName(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithHistoryUsingString(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<JsonCredential>> expectedResponse) {
|
||||
verifyGetByNameWithHistoryUsingString(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithHistoryUsingCredentialName(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<JsonCredential>> expectedResponse) {
|
||||
verifyGetByNameWithHistoryUsingCredentialName(expectedResponse);
|
||||
}
|
||||
}
|
||||
@@ -91,14 +91,26 @@ public class CredHubTemplateDetailPasswordUnitTests
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithString(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<PasswordCredential>> expectedResponse) {
|
||||
verifyGetByNameWithString(expectedResponse);
|
||||
public void getByNameUsingString(@FromDataPoints("detail-responses")
|
||||
ResponseEntity<CredentialDetails<PasswordCredential>> expectedResponse) {
|
||||
verifyGetByNameUsingString(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithCredentialName(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<PasswordCredential>> expectedResponse) {
|
||||
verifyGetByNameWithCredentialName(expectedResponse);
|
||||
public void getByNameUsingCredentialName(@FromDataPoints("detail-responses")
|
||||
ResponseEntity<CredentialDetails<PasswordCredential>> expectedResponse) {
|
||||
verifyGetByNameUsingCredentialName(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithHistoryUsingString(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<PasswordCredential>> expectedResponse) {
|
||||
verifyGetByNameWithHistoryUsingString(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithHistoryUsingCredentialName(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<PasswordCredential>> expectedResponse) {
|
||||
verifyGetByNameWithHistoryUsingCredentialName(expectedResponse);
|
||||
}
|
||||
}
|
||||
@@ -92,14 +92,26 @@ public class CredHubTemplateDetailRsaUnitTests
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithString(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<RsaCredential>> expectedResponse) {
|
||||
verifyGetByNameWithString(expectedResponse);
|
||||
public void getByNameUsingString(@FromDataPoints("detail-responses")
|
||||
ResponseEntity<CredentialDetails<RsaCredential>> expectedResponse) {
|
||||
verifyGetByNameUsingString(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithCredentialName(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<RsaCredential>> expectedResponse) {
|
||||
verifyGetByNameWithCredentialName(expectedResponse);
|
||||
public void getByNameUsingCredentialName(@FromDataPoints("detail-responses")
|
||||
ResponseEntity<CredentialDetails<RsaCredential>> expectedResponse) {
|
||||
verifyGetByNameUsingCredentialName(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithHistoryUsingString(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<RsaCredential>> expectedResponse) {
|
||||
verifyGetByNameWithHistoryUsingString(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithHistoryUsingCredentialName(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<RsaCredential>> expectedResponse) {
|
||||
verifyGetByNameWithHistoryUsingCredentialName(expectedResponse);
|
||||
}
|
||||
}
|
||||
@@ -92,14 +92,26 @@ public class CredHubTemplateDetailSshUnitTests
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithString(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<SshCredential>> expectedResponse) {
|
||||
verifyGetByNameWithString(expectedResponse);
|
||||
public void getByNameUsingString(@FromDataPoints("detail-responses")
|
||||
ResponseEntity<CredentialDetails<SshCredential>> expectedResponse) {
|
||||
verifyGetByNameUsingString(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithCredentialName(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<SshCredential>> expectedResponse) {
|
||||
verifyGetByNameWithCredentialName(expectedResponse);
|
||||
public void getByNameUsingCredentialName(@FromDataPoints("detail-responses")
|
||||
ResponseEntity<CredentialDetails<SshCredential>> expectedResponse) {
|
||||
verifyGetByNameUsingCredentialName(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithHistoryUsingString(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<SshCredential>> expectedResponse) {
|
||||
verifyGetByNameWithHistoryUsingString(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithHistoryUsingCredentialName(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<SshCredential>> expectedResponse) {
|
||||
verifyGetByNameWithHistoryUsingCredentialName(expectedResponse);
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,7 @@ import static org.mockito.Mockito.when;
|
||||
import static org.springframework.credhub.core.CredHubTemplate.BASE_URL_PATH;
|
||||
import static org.springframework.credhub.core.CredHubTemplate.ID_URL_PATH;
|
||||
import static org.springframework.credhub.core.CredHubTemplate.NAME_URL_QUERY;
|
||||
import static org.springframework.credhub.core.CredHubTemplate.NAME_URL_QUERY_CURRENT;
|
||||
import static org.springframework.http.HttpMethod.GET;
|
||||
import static org.springframework.http.HttpMethod.POST;
|
||||
import static org.springframework.http.HttpMethod.PUT;
|
||||
@@ -125,6 +126,7 @@ public abstract class CredHubTemplateDetailUnitTestsBase<T, P> extends CredHubTe
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
void verifyGetById(ResponseEntity<CredentialDetails<T>> expectedResponse) {
|
||||
when(restTemplate.exchange(eq(ID_URL_PATH), eq(GET), isNull(HttpEntity.class),
|
||||
isA(ParameterizedTypeReference.class), eq(CREDENTIAL_ID)))
|
||||
@@ -147,8 +149,9 @@ public abstract class CredHubTemplateDetailUnitTestsBase<T, P> extends CredHubTe
|
||||
}
|
||||
}
|
||||
|
||||
void verifyGetByNameWithString(ResponseEntity<CredentialDetailsData<T>> expectedResponse) {
|
||||
when(restTemplate.exchange(eq(NAME_URL_QUERY), eq(GET), isNull(HttpEntity.class),
|
||||
@SuppressWarnings("deprecation")
|
||||
void verifyGetByNameUsingString(ResponseEntity<CredentialDetails<T>> expectedResponse) {
|
||||
when(restTemplate.exchange(eq(NAME_URL_QUERY_CURRENT), eq(GET), isNull(HttpEntity.class),
|
||||
isA(ParameterizedTypeReference.class), eq(NAME.getName())))
|
||||
.thenReturn(expectedResponse);
|
||||
|
||||
@@ -163,15 +166,16 @@ public abstract class CredHubTemplateDetailUnitTestsBase<T, P> extends CredHubTe
|
||||
}
|
||||
}
|
||||
else {
|
||||
List<CredentialDetails<T>> response = credHubTemplate
|
||||
CredentialDetails<T> response = credHubTemplate
|
||||
.getByName(NAME.getName(), getType());
|
||||
|
||||
assertResponseContainsExpectedCredentials(expectedResponse, response);
|
||||
}
|
||||
}
|
||||
|
||||
void verifyGetByNameWithCredentialName(ResponseEntity<CredentialDetailsData<T>> expectedResponse) {
|
||||
when(restTemplate.exchange(eq(NAME_URL_QUERY), eq(GET), isNull(HttpEntity.class),
|
||||
@SuppressWarnings("deprecation")
|
||||
void verifyGetByNameUsingCredentialName(ResponseEntity<CredentialDetails<T>> expectedResponse) {
|
||||
when(restTemplate.exchange(eq(NAME_URL_QUERY_CURRENT), eq(GET), isNull(HttpEntity.class),
|
||||
isA(ParameterizedTypeReference.class), eq(NAME.getName())))
|
||||
.thenReturn(expectedResponse);
|
||||
|
||||
@@ -186,7 +190,53 @@ public abstract class CredHubTemplateDetailUnitTestsBase<T, P> extends CredHubTe
|
||||
}
|
||||
}
|
||||
else {
|
||||
List<CredentialDetails<T>> response = credHubTemplate.getByName(NAME, getType());
|
||||
CredentialDetails<T> response = credHubTemplate.getByName(NAME, getType());
|
||||
|
||||
assertResponseContainsExpectedCredentials(expectedResponse, response);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
void verifyGetByNameWithHistoryUsingString(ResponseEntity<CredentialDetailsData<T>> expectedResponse) {
|
||||
when(restTemplate.exchange(eq(NAME_URL_QUERY), eq(GET), isNull(HttpEntity.class),
|
||||
isA(ParameterizedTypeReference.class), eq(NAME.getName())))
|
||||
.thenReturn(expectedResponse);
|
||||
|
||||
if (!expectedResponse.getStatusCode().equals(OK)) {
|
||||
try {
|
||||
credHubTemplate.getByNameWithHistory(NAME.getName(), String.class);
|
||||
fail("Exception should have been thrown");
|
||||
}
|
||||
catch (CredHubException e) {
|
||||
assertThat(e.getMessage(),
|
||||
containsString(expectedResponse.getStatusCode().toString()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
List<CredentialDetails<T>> response = credHubTemplate.getByNameWithHistory(NAME.getName(), getType());
|
||||
|
||||
assertResponseContainsExpectedCredentials(expectedResponse, response);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
void verifyGetByNameWithHistoryUsingCredentialName(ResponseEntity<CredentialDetailsData<T>> expectedResponse) {
|
||||
when(restTemplate.exchange(eq(NAME_URL_QUERY), eq(GET), isNull(HttpEntity.class),
|
||||
isA(ParameterizedTypeReference.class), eq(NAME.getName())))
|
||||
.thenReturn(expectedResponse);
|
||||
|
||||
if (!expectedResponse.getStatusCode().equals(OK)) {
|
||||
try {
|
||||
credHubTemplate.getByNameWithHistory(NAME, String.class);
|
||||
fail("Exception should have been thrown");
|
||||
}
|
||||
catch (CredHubException e) {
|
||||
assertThat(e.getMessage(),
|
||||
containsString(expectedResponse.getStatusCode().toString()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
List<CredentialDetails<T>> response = credHubTemplate.getByNameWithHistory(NAME, getType());
|
||||
|
||||
assertResponseContainsExpectedCredentials(expectedResponse, response);
|
||||
}
|
||||
|
||||
@@ -73,14 +73,26 @@ public class CredHubTemplateDetailUserUnitTests
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithString(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<UserCredential>> expectedResponse) {
|
||||
verifyGetByNameWithString(expectedResponse);
|
||||
public void getByNameUsingString(@FromDataPoints("detail-responses")
|
||||
ResponseEntity<CredentialDetails<UserCredential>> expectedResponse) {
|
||||
verifyGetByNameUsingString(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithCredentialName(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<UserCredential>> expectedResponse) {
|
||||
verifyGetByNameWithCredentialName(expectedResponse);
|
||||
public void getByNameUsingCredentialName(@FromDataPoints("detail-responses")
|
||||
ResponseEntity<CredentialDetails<UserCredential>> expectedResponse) {
|
||||
verifyGetByNameUsingCredentialName(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithHistoryUsingString(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<UserCredential>> expectedResponse) {
|
||||
verifyGetByNameWithHistoryUsingString(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithHistoryUsingCredentialName(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<UserCredential>> expectedResponse) {
|
||||
verifyGetByNameWithHistoryUsingCredentialName(expectedResponse);
|
||||
}
|
||||
}
|
||||
@@ -74,14 +74,26 @@ public class CredHubTemplateDetailValueUnitTests
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithString(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<ValueCredential>> expectedResponse) {
|
||||
verifyGetByNameWithString(expectedResponse);
|
||||
public void getByNameUsingString(@FromDataPoints("detail-responses")
|
||||
ResponseEntity<CredentialDetails<ValueCredential>> expectedResponse) {
|
||||
verifyGetByNameUsingString(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithCredentialName(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<ValueCredential>> expectedResponse) {
|
||||
verifyGetByNameWithCredentialName(expectedResponse);
|
||||
public void getByNameUsingCredentialName(@FromDataPoints("detail-responses")
|
||||
ResponseEntity<CredentialDetails<ValueCredential>> expectedResponse) {
|
||||
verifyGetByNameUsingCredentialName(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithHistoryUsingString(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<ValueCredential>> expectedResponse) {
|
||||
verifyGetByNameWithHistoryUsingString(expectedResponse);
|
||||
}
|
||||
|
||||
@Theory
|
||||
public void getByNameWithHistoryUsingCredentialName(@FromDataPoints("data-responses")
|
||||
ResponseEntity<CredentialDetailsData<ValueCredential>> expectedResponse) {
|
||||
verifyGetByNameWithHistoryUsingCredentialName(expectedResponse);
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,5 @@
|
||||
applications:
|
||||
- name: spring-credhub-demo
|
||||
memory: 1G
|
||||
path: build/libs/spring-credhub-demo-1.0.0.BUILD-SNAPSHOT.jar
|
||||
path: build/libs/spring-credhub-demo.jar
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ public class CredHubDemoController {
|
||||
|
||||
private void getCredentialsByName(CredentialName name, Results results) {
|
||||
try {
|
||||
List<CredentialDetails<JsonCredential>> retrievedDetails =
|
||||
CredentialDetails<JsonCredential> retrievedDetails =
|
||||
credHubTemplate.getByName(name, JsonCredential.class);
|
||||
saveResults(results, "Successfully retrieved credentials by name: ", retrievedDetails);
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user