use of com.sequenceiq.environment.environment.EnvironmentStatus in project cloudbreak by hortonworks.
the class EnvironmentSyncServiceTest method testGetStatusByFreeipa.
@ParameterizedTest(name = "{0}")
@MethodSource("getStatusByFreeipaParams")
void testGetStatusByFreeipa(String testName, DescribeFreeIpaResponse freeIpaResponse, EnvironmentStatus expected) {
Environment environment = new Environment();
environment.setAccountId("cloudera");
environment.setResourceCrn("crn");
when(freeIpaService.internalDescribe(environment.getResourceCrn(), "cloudera")).thenReturn(Optional.of(freeIpaResponse));
EnvironmentStatus actual = underTest.getStatusByFreeipa(environment);
Assertions.assertEquals(expected, actual);
}
use of com.sequenceiq.environment.environment.EnvironmentStatus in project cloudbreak by hortonworks.
the class EnvironmentSyncServiceTest method testGetStatusByFreeipaWhenFreeipaAttachedButNotFound.
@Test
void testGetStatusByFreeipaWhenFreeipaAttachedButNotFound() {
Environment environment = new Environment();
environment.setResourceCrn("crn");
environment.setCreateFreeIpa(true);
when(freeIpaService.internalDescribe(environment.getResourceCrn(), "cloudera")).thenReturn(Optional.empty());
EnvironmentStatus actual = underTest.getStatusByFreeipa(environment);
Assertions.assertEquals(EnvironmentStatus.FREEIPA_DELETED_ON_PROVIDER_SIDE, actual);
}
use of com.sequenceiq.environment.environment.EnvironmentStatus in project cloudbreak by hortonworks.
the class EnvironmentStructuredFlowEventFactory method getReason.
private String getReason(Environment environment) {
EnvironmentStatus status = environment.getStatus();
String reason = environment.getStatusReason();
if (StringUtils.isEmpty(reason)) {
reason = status.getResponseStatus().getDescription();
}
return reason;
}
use of com.sequenceiq.environment.environment.EnvironmentStatus in project cloudbreak by hortonworks.
the class EnvStopActions method stopDatalake.
@Bean(name = "STOP_DATALAKE_STATE")
public Action<?, ?> stopDatalake() {
return new AbstractEnvStopAction<>(EnvStopEvent.class) {
@Override
protected void doExecute(CommonContext context, EnvStopEvent payload, Map<Object, Object> variables) {
EnvironmentStatus environmentStatus = EnvironmentStatus.STOP_DATALAKE_STARTED;
ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_STOP_DATALAKE_STARTED;
EnvStopState envStopState = EnvStopState.STOP_DATALAKE_STATE;
EnvironmentDto envDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, environmentStatus, resourceEvent, envStopState);
sendEvent(context, EnvStopHandlerSelectors.STOP_DATALAKE_HANDLER_EVENT.selector(), envDto);
}
};
}
use of com.sequenceiq.environment.environment.EnvironmentStatus in project cloudbreak by hortonworks.
the class EnvStartActions method startFreeipa.
@Bean(name = "START_FREEIPA_STATE")
public Action<?, ?> startFreeipa() {
return new AbstractEnvStartAction<>(EnvStartEvent.class) {
@Override
protected void doExecute(CommonContext context, EnvStartEvent payload, Map<Object, Object> variables) {
EnvironmentStatus environmentStatus = EnvironmentStatus.START_FREEIPA_STARTED;
ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_START_FREEIPA_STARTED;
EnvStartState envStartState = EnvStartState.START_FREEIPA_STATE;
EnvironmentDto envDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, environmentStatus, resourceEvent, envStartState);
EnvironmentStartDto environmentStartDto = EnvironmentStartDto.builder().withDataHubStart(payload.getDataHubStartAction()).withEnvironmentDto(envDto).withId(envDto.getId()).build();
sendEvent(context, EnvStartHandlerSelectors.START_FREEIPA_HANDLER_EVENT.selector(), environmentStartDto);
}
};
}
Aggregations