use of com.sequenceiq.environment.environment.domain.Environment in project cloudbreak by hortonworks.
the class EnvironmentExperienceDeletionActionTest method testForceDeleteWitExperienceConnectorNonArgumentErrorShouldNotThrow.
@Test
void testForceDeleteWitExperienceConnectorNonArgumentErrorShouldNotThrow() {
doThrow(new IllegalStateException()).when(mockExperienceConnectorService).deleteConnectedExperiences(any());
underTest.execute(new Environment(), FORCE_DELETE);
verify(mockExperiencePollingFailureResolver, never()).getMessageForFailure(any());
}
use of com.sequenceiq.environment.environment.domain.Environment in project cloudbreak by hortonworks.
the class EnvironmentExperienceDeletionActionTest method testExecuteWhenPollingResultWasNotSuccessfulButNoExceptionHasGivenInThePollingResultPairThenExperienceOperationFailedExceptionShouldCome.
@Test
void testExecuteWhenPollingResultWasNotSuccessfulButNoExceptionHasGivenInThePollingResultPairThenExperienceOperationFailedExceptionShouldCome() {
ExtendedPollingResult extendedPollingResult = new ExtendedPollingResult.ExtendedPollingResultBuilder().failure().build();
when(mockExperiencePollingService.pollWithTimeout(any(ExperienceDeletionRetrievalTask.class), any(ExperiencePollerObject.class), eq(Long.valueOf(EXPERIENCE_RETRYING_INTERVAL_IN_MILLISECONDS)), eq(EXPERIENCE_RETRYING_COUNT), eq(1))).thenReturn(extendedPollingResult);
ExperienceOperationFailedException expectedException = assertThrows(ExperienceOperationFailedException.class, () -> underTest.execute(new Environment(), NO_FORCE_DELETE));
assertNotNull(expectedException);
assertEquals(FAILURE_BASIC_MSG, expectedException.getMessage());
verify(mockExperiencePollingFailureResolver, never()).getMessageForFailure(any());
}
use of com.sequenceiq.environment.environment.domain.Environment in project cloudbreak by hortonworks.
the class EnvironmentExperienceDeletionActionTest method testExecuteWhenPollingResultWasGotBackWithOtherThanExitThenReCheckShouldNotHappen.
@Test
void testExecuteWhenPollingResultWasGotBackWithOtherThanExitThenReCheckShouldNotHappen() {
ExtendedPollingResult extendedPollingResult = new ExtendedPollingResult.ExtendedPollingResultBuilder().failure().build();
when(mockExperiencePollingService.pollWithTimeout(any(ExperienceDeletionRetrievalTask.class), any(ExperiencePollerObject.class), eq(Long.valueOf(EXPERIENCE_RETRYING_INTERVAL_IN_MILLISECONDS)), eq(EXPERIENCE_RETRYING_COUNT), eq(1))).thenReturn(extendedPollingResult);
assertThrows(ExperienceOperationFailedException.class, () -> underTest.execute(new Environment(), NO_FORCE_DELETE));
verify(mockExperienceConnectorService, never()).getConnectedExperienceCount(any(EnvironmentExperienceDto.class));
}
use of com.sequenceiq.environment.environment.domain.Environment in project cloudbreak by hortonworks.
the class EnvironmentExperienceDeletionActionTest method testExecuteShouldInvokeDeleteConnectedExperiences.
@Test
void testExecuteShouldInvokeDeleteConnectedExperiences() {
ExtendedPollingResult extendedPollingResult = new ExtendedPollingResult.ExtendedPollingResultBuilder().success().build();
when(mockExperiencePollingService.pollWithTimeout(any(ExperienceDeletionRetrievalTask.class), any(ExperiencePollerObject.class), eq(Long.valueOf(EXPERIENCE_RETRYING_INTERVAL_IN_MILLISECONDS)), eq(EXPERIENCE_RETRYING_COUNT), eq(1))).thenReturn(extendedPollingResult);
underTest.execute(new Environment(), NO_FORCE_DELETE);
verify(mockExperienceConnectorService, times(ONCE)).deleteConnectedExperiences(any());
verify(mockExperienceConnectorService, times(ONCE)).deleteConnectedExperiences(any(EnvironmentExperienceDto.class));
}
use of com.sequenceiq.environment.environment.domain.Environment in project cloudbreak by hortonworks.
the class EnvironmentInitHandlerTest method getEnvironment.
private Environment getEnvironment() {
Environment environment = new Environment();
environment.setId(ENV_ID);
environment.setResourceCrn(CRN);
environment.setCreator(CREATOR);
Region region = new Region();
region.setName(REGION);
environment.setRegions(Set.of(region));
environment.setLocationDisplayName(LOCATION_DISPLAY_NAME);
environment.setLocation(LOCATION);
environment.setAccountId(ACCOUNT_ID);
BaseNetwork baseNetwork = new AwsNetwork();
baseNetwork.setRegistrationType(RegistrationType.EXISTING);
environment.setNetwork(baseNetwork);
environment.setCloudPlatform(CloudPlatform.AWS.name());
environment.setCredential(new Credential());
return environment;
}
Aggregations