use of com.sequenceiq.cloudbreak.cloud.model.CloudAccessConfigs in project cloudbreak by hortonworks.
the class AwsPlatformResourcesTest method collectAccessConfigsWhenUserGetServiceExceptionToGetInfoThenItShouldReturnEmptyList.
@Test
public void collectAccessConfigsWhenUserGetServiceExceptionToGetInfoThenItShouldReturnEmptyList() throws Exception {
BadRequestException badRequestException = new BadRequestException("BadRequestException problem.");
when(awsClient.createAmazonIdentityManagement(any(AwsCredentialView.class))).thenReturn(amazonCFClient);
when(amazonCFClient.listInstanceProfiles()).thenThrow(badRequestException);
thrown.expect(CloudConnectorException.class);
thrown.expectMessage("Could not get instance profile roles from Amazon: BadRequestException problem.");
CloudAccessConfigs cloudAccessConfigs = underTest.accessConfigs(new CloudCredential(1L, "aws-credential"), region("London"), new HashMap<>());
Assert.assertEquals(0, cloudAccessConfigs.getCloudAccessConfigs().size());
}
use of com.sequenceiq.cloudbreak.cloud.model.CloudAccessConfigs in project cloudbreak by hortonworks.
the class AwsPlatformResourcesTest method collectAccessConfigsWhenUserGetAmazonExceptionToGetInfoThenItShouldReturnEmptyList.
@Test
public void collectAccessConfigsWhenUserGetAmazonExceptionToGetInfoThenItShouldReturnEmptyList() throws Exception {
AmazonServiceException amazonServiceException = new AmazonServiceException("Amazon problem.");
amazonServiceException.setStatusCode(404);
amazonServiceException.setErrorMessage("Amazon problem.");
when(awsClient.createAmazonIdentityManagement(any(AwsCredentialView.class))).thenReturn(amazonCFClient);
when(amazonCFClient.listInstanceProfiles()).thenThrow(amazonServiceException);
thrown.expect(CloudConnectorException.class);
thrown.expectMessage("Could not get instance profile roles from Amazon: Amazon problem.");
CloudAccessConfigs cloudAccessConfigs = underTest.accessConfigs(new CloudCredential(1L, "aws-credential"), region("London"), new HashMap<>());
Assert.assertEquals(0, cloudAccessConfigs.getCloudAccessConfigs().size());
}
Aggregations