use of com.sequenceiq.environment.api.v1.credential.model.parameters.azure.AzureCredentialResponseParameters in project cloudbreak by hortonworks.
the class CredentialServiceTest method testAzureCredential.
@Test
public void testAzureCredential() {
CredentialResponse credentialResponse = new CredentialResponse();
credentialResponse.setCrn(CRN);
credentialResponse.setName(NAME);
credentialResponse.setAttributes(secretResponse);
AzureCredentialResponseParameters azureResponse = new AzureCredentialResponseParameters();
azureResponse.setSubscriptionId(SUBSCRIPTION_ID);
credentialResponse.setAzure(azureResponse);
when(credentialEndpoint.getByEnvironmentCrn(ENVIRONMENT_CRN)).thenReturn(credentialResponse);
Credential credential = underTest.getCredentialByEnvCrn(ENVIRONMENT_CRN);
assertEquals(CRN, credential.getCrn());
assertEquals(NAME, credential.getName());
assertEquals(ATTRIBUTES, credential.getAttributes());
assertTrue(credential.getAzure().isPresent());
assertEquals(SUBSCRIPTION_ID, credential.getAzure().get().getSubscriptionId());
}
use of com.sequenceiq.environment.api.v1.credential.model.parameters.azure.AzureCredentialResponseParameters in project cloudbreak by hortonworks.
the class AzureCredentialV1ParametersToAzureCredentialAttributesConverter method convert.
public AzureCredentialResponseParameters convert(AzureCredentialAttributes source) {
AzureCredentialResponseParameters response = new AzureCredentialResponseParameters();
doIfNotNull(source.getCodeGrantFlowBased(), param -> response.setRoleBased(getRoleBased(param)));
doIfNotNull(source.getAppBased(), param -> response.setAccessKey(param.getAccessKey()));
doIfNotNull(source.getCodeGrantFlowBased(), param -> response.setAccessKey(param.getAccessKey()));
response.setSubscriptionId(source.getSubscriptionId());
response.setTenantId(source.getTenantId());
return response;
}
Aggregations