use of com.sequenceiq.cloudbreak.cloud.model.CloudCredential in project cloudbreak by hortonworks.
the class AwsMetaDataCollectorTest method authenticatedContext.
private AuthenticatedContext authenticatedContext() {
Location location = Location.location(Region.region("region"), AvailabilityZone.availabilityZone("az"));
CloudContext cloudContext = new CloudContext(5L, "name", "platform", "owner", "variant", location);
CloudCredential cc = new CloudCredential(1L, null, null);
return new AuthenticatedContext(cloudContext, cc);
}
use of com.sequenceiq.cloudbreak.cloud.model.CloudCredential 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.CloudCredential 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());
}
use of com.sequenceiq.cloudbreak.cloud.model.CloudCredential in project cloudbreak by hortonworks.
the class AwsTagPreparationServiceTest method authenticatedContext.
private AuthenticatedContext authenticatedContext() {
CloudContext cloudContext = new CloudContext(1L, "testname", "AWS", "owner");
CloudCredential cloudCredential = new CloudCredential(1L, "credentialname");
return new AuthenticatedContext(cloudContext, cloudCredential);
}
use of com.sequenceiq.cloudbreak.cloud.model.CloudCredential in project cloudbreak by hortonworks.
the class CloudFormationTemplateBuilderTest method authenticatedContext.
private AuthenticatedContext authenticatedContext() {
Location location = Location.location(Region.region("region"), AvailabilityZone.availabilityZone("az"));
CloudContext cloudContext = new CloudContext(5L, "name", "platform", "owner", "variant", location);
CloudCredential cc = new CloudCredential(1L, null);
return new AuthenticatedContext(cloudContext, cc);
}
Aggregations