use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class CloudStorageValidatorTest method validateCloudStorageSkipLocationBaseWhenLoggingIsNotConfigured.
@Test
public void validateCloudStorageSkipLocationBaseWhenLoggingIsNotConfigured() {
when(credentialService.getByCrnForAccountId(anyString(), anyString(), any(), anyBoolean())).thenReturn(new Credential());
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
EnvironmentCloudStorageValidationRequest request = new EnvironmentCloudStorageValidationRequest();
request.setCredentialCrn("credential");
ArgumentCaptor<ObjectStorageValidateRequest> requestCaptor = ArgumentCaptor.forClass(ObjectStorageValidateRequest.class);
when(cloudProviderServicesV4Endpoint.validateObjectStorage(requestCaptor.capture())).thenReturn(ObjectStorageValidateResponse.builder().withStatus(ResponseStatus.OK).build());
ObjectStorageValidateResponse response = underTest.validateCloudStorage("1234", request);
assertEquals(ResponseStatus.OK, response.getStatus());
assertNull(response.getError());
assertNull(requestCaptor.getValue().getLogsLocationBase());
}
use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class NoSqlTableCreationModeDeterminerServiceTest method determineCreationModeExisting.
@Test
void determineCreationModeExisting() {
NoSqlTableMetadataResponse metadataResponse = NoSqlTableMetadataResponse.builder().withId("id").withStatus(ResponseStatus.OK).withTableStatus("ACTIVE").build();
when(noSql.getNoSqlTableMetaData(any())).thenReturn(metadataResponse);
Credential credential = new Credential();
credential.setCloudPlatform("platform");
S3GuardTableCreation mode = underTest.determineCreationMode(LocationAwareCredential.builder().withLocation("location").withCredential(credential).build(), "tablename");
assertEquals(S3GuardTableCreation.USE_EXISTING, mode);
}
use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class AzureEnvironmentSecurityGroupValidatorTest method getCredential.
private Credential getCredential() {
Credential credential = new Credential();
credential.setName("azure-credential");
return credential;
}
use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class EnvironmentModificationServiceTest method changeCredentialByEnvironmentName.
@Test
void changeCredentialByEnvironmentName() {
String credentialName = "credentialName";
final Credential value = new Credential();
EnvironmentChangeCredentialDto environmentChangeDto = EnvironmentChangeCredentialDto.EnvironmentChangeCredentialDtoBuilder.anEnvironmentChangeCredentialDto().withCredentialName(credentialName).build();
when(environmentService.findByNameAndAccountIdAndArchivedIsFalse(eq(ENVIRONMENT_NAME), eq(ACCOUNT_ID))).thenReturn(Optional.of(new Environment()));
when(credentialService.getByNameForAccountId(eq(credentialName), eq(ACCOUNT_ID), eq(ENVIRONMENT))).thenReturn(value);
environmentModificationServiceUnderTest.changeCredentialByEnvironmentName(ACCOUNT_ID, ENVIRONMENT_NAME, environmentChangeDto);
ArgumentCaptor<Environment> environmentArgumentCaptor = ArgumentCaptor.forClass(Environment.class);
verify(environmentService).save(environmentArgumentCaptor.capture());
assertEquals(value, environmentArgumentCaptor.getValue().getCredential());
}
use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class EnvironmentResourceServiceTest method getCredentialFromRequest.
@Test
void getCredentialFromRequest() {
Credential value = new Credential();
when(credentialService.getByNameForAccountId(eq(ENVIRONMENT_NAME), eq(ACCOUNT_ID), any())).thenReturn(value);
assertEquals(value, environmentResourceServiceUnderTest.getCredentialFromRequest(request, ACCOUNT_ID));
}
Aggregations