Search in sources :

Example 1 with GetRoleResult

use of com.amazonaws.services.identitymanagement.model.GetRoleResult in project cloudbreak by hortonworks.

the class AwsIamServiceTest method validRole.

@Test
public void validRole() {
    String roleArn = "account/validRole";
    Role expectedRole = new Role().withArn(roleArn);
    GetRoleResult getRoleResult = mock(GetRoleResult.class);
    when(getRoleResult.getRole()).thenReturn(expectedRole);
    when(iam.getRole(any(GetRoleRequest.class))).thenReturn(getRoleResult);
    ValidationResultBuilder validationRequestBuilder = new ValidationResultBuilder();
    Role role = awsIamService.getRole(iam, roleArn, validationRequestBuilder);
    assertThat(role.getArn()).isEqualTo(roleArn);
    assertThat(validationRequestBuilder.build().hasError()).isFalse();
}
Also used : Role(com.amazonaws.services.identitymanagement.model.Role) ValidationResultBuilder(com.sequenceiq.cloudbreak.validation.ValidationResult.ValidationResultBuilder) GetRoleRequest(com.amazonaws.services.identitymanagement.model.GetRoleRequest) GetRoleResult(com.amazonaws.services.identitymanagement.model.GetRoleResult) Test(org.junit.jupiter.api.Test)

Aggregations

GetRoleRequest (com.amazonaws.services.identitymanagement.model.GetRoleRequest)1 GetRoleResult (com.amazonaws.services.identitymanagement.model.GetRoleResult)1 Role (com.amazonaws.services.identitymanagement.model.Role)1 ValidationResultBuilder (com.sequenceiq.cloudbreak.validation.ValidationResult.ValidationResultBuilder)1 Test (org.junit.jupiter.api.Test)1