use of com.sequenceiq.environment.environment.dto.EnvironmentDeletionDto in project cloudbreak by hortonworks.
the class EnvClustersDeleteActionsTest method verifyDeleteActionSuccessEvent.
private void verifyDeleteActionSuccessEvent(EnvDeleteHandlerSelectors eventSelector) {
assertThat(selectorArgumentCaptor.getValue()).isEqualTo(eventSelector.selector());
verifyEventFactoryAndHeaders();
Object payload = payloadArgumentCaptor.getValue();
assertThat(payload).isInstanceOf(EnvironmentDeletionDto.class);
EnvironmentDeletionDto environmentDto = (EnvironmentDeletionDto) payload;
assertThat(environmentDto.getEnvironmentDto().getResourceCrn()).isEqualTo(ENVIRONMENT_CRN);
assertThat(environmentDto.getEnvironmentDto().getName()).isEqualTo(ENVIRONMENT_NAME);
assertThat(environmentDto.getEnvironmentDto().getId()).isEqualTo(ENVIRONMENT_ID);
}
use of com.sequenceiq.environment.environment.dto.EnvironmentDeletionDto in project cloudbreak by hortonworks.
the class FreeIpaDeletionHandlerTest method shouldDetachChildEnvironmentIfParentExists.
@Test
public void shouldDetachChildEnvironmentIfParentExists() throws Exception {
EnvironmentDto environmentDto = new EnvironmentDto();
environmentDto.setId(CHILD_ENVIRONMENT_ID);
EnvironmentDeletionDto environmentDeletionDto = EnvironmentDeletionDto.builder().withEnvironmentDto(environmentDto).withForceDelete(true).withId(CHILD_ENVIRONMENT_ID).build();
when(environmentService.findEnvironmentById(CHILD_ENVIRONMENT_ID)).thenReturn(of(anEnvironmentWithParent(CHILD_ENVIRONMENT_ID)));
when(freeIpaService.describe(ENVIRONMENT_CRN)).thenReturn(of(new DescribeFreeIpaResponse()));
victim.accept(new Event<>(environmentDeletionDto));
ArgumentCaptor<DetachChildEnvironmentRequest> detachChildEnvironmentRequestArgumentCaptor = ArgumentCaptor.forClass(DetachChildEnvironmentRequest.class);
verify(freeIpaService).detachChildEnvironment(detachChildEnvironmentRequestArgumentCaptor.capture());
verifyNoMoreInteractions(freeIpaService);
verify(eventSender).sendEvent(any(BaseNamedFlowEvent.class), any(Event.Headers.class));
verify(dnsV1Endpoint).deleteDnsZoneBySubnet(eq(PARENT_ENVIRONMENT_CRN), any());
assertEquals(PARENT_ENVIRONMENT_CRN, detachChildEnvironmentRequestArgumentCaptor.getValue().getParentEnvironmentCrn());
assertEquals(ENVIRONMENT_CRN, detachChildEnvironmentRequestArgumentCaptor.getValue().getChildEnvironmentCrn());
}
use of com.sequenceiq.environment.environment.dto.EnvironmentDeletionDto in project cloudbreak by hortonworks.
the class DataLakeClustersDeleteHandlerTest method setUp.
@BeforeEach
void setUp() {
EnvironmentDto eventDto = EnvironmentDto.builder().withId(ENV_ID).withResourceCrn(RESOURCE_CRN).withName(ENV_NAME).build();
EnvironmentDeletionDto build = EnvironmentDeletionDto.builder().withId(ENV_ID).withForceDelete(false).withEnvironmentDto(eventDto).build();
when(environmentDtoEvent.getData()).thenReturn(build);
when(environmentDtoEvent.getHeaders()).thenReturn(headers);
doAnswer(i -> null).when(eventSender).sendEvent(baseNamedFlowEvent.capture(), any(Event.Headers.class));
}
use of com.sequenceiq.environment.environment.dto.EnvironmentDeletionDto in project cloudbreak by hortonworks.
the class IdBrokerMappingsDeleteHandlerTest method setUp.
@BeforeEach
void setUp() {
environmentDto = createEnvironmentDto();
EnvironmentDeletionDto build = EnvironmentDeletionDto.builder().withId(ENVIRONMENT_ID).withForceDelete(false).withEnvironmentDto(environmentDto).build();
environmentDtoEvent = new Event<>(headers, build);
eventArgumentCaptor = ArgumentCaptor.forClass(BaseNamedFlowEvent.class);
headersArgumentCaptor = ArgumentCaptor.forClass(Event.Headers.class);
}
use of com.sequenceiq.environment.environment.dto.EnvironmentDeletionDto in project cloudbreak by hortonworks.
the class RdbmsDeleteHandlerTest method setUp.
@BeforeEach
void setUp() {
EnvironmentDto eventDto = EnvironmentDto.builder().withId(ENVIRONMENT_ID).withResourceCrn(ENVIRONMENT_CRN).withName(ENVIRONMENT_NAME).withCloudPlatform("AZURE").build();
EnvironmentDeletionDto environmentDeletionDto = EnvironmentDeletionDto.builder().withId(ENVIRONMENT_ID).withForceDelete(false).withEnvironmentDto(eventDto).build();
lenient().when(environmentDtoEvent.getData()).thenReturn(environmentDeletionDto);
lenient().when(environmentDtoEvent.getHeaders()).thenReturn(headers);
lenient().doAnswer(i -> null).when(eventSender).sendEvent(baseNamedFlowEventCaptor.capture(), any(Event.Headers.class));
}
Aggregations