Search in sources :

Example 11 with EnvironmentStatus

use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentStatus in project cloudbreak by hortonworks.

the class SdxServiceTest method testCreateButEnvInFailedPhase.

@ParameterizedTest
@MethodSource("failedParamProvider")
void testCreateButEnvInFailedPhase(EnvironmentStatus environmentStatus) {
    SdxClusterRequest sdxClusterRequest = createSdxClusterRequest(null, MEDIUM_DUTY_HA);
    DetailedEnvironmentResponse detailedEnvironmentResponse = new DetailedEnvironmentResponse();
    detailedEnvironmentResponse.setName(sdxClusterRequest.getEnvironment());
    detailedEnvironmentResponse.setCloudPlatform(CloudPlatform.AWS.name());
    detailedEnvironmentResponse.setCrn(getCrn());
    detailedEnvironmentResponse.setEnvironmentStatus(environmentStatus);
    when(environmentClientService.getByName(anyString())).thenReturn(detailedEnvironmentResponse);
    BadRequestException badRequestException = assertThrows(BadRequestException.class, () -> ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.createSdx(USER_CRN, CLUSTER_NAME, sdxClusterRequest, null)), "BadRequestException should thrown");
    assertEquals("The environment is in failed phase. Please fix the environment or create a new one first!", badRequestException.getMessage());
}
Also used : SdxClusterRequest(com.sequenceiq.sdx.api.model.SdxClusterRequest) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 12 with EnvironmentStatus

use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentStatus in project cloudbreak by hortonworks.

the class EnvironmentServiceTest method getDetailedEnvironmentResponseWithStatus.

private DetailedEnvironmentResponse getDetailedEnvironmentResponseWithStatus(EnvironmentStatus status) {
    DetailedEnvironmentResponse env = new DetailedEnvironmentResponse();
    env.setName("ENV");
    env.setCloudPlatform("aws");
    env.setEnvironmentStatus(status);
    return env;
}
Also used : DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)

Aggregations

DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)11 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)6 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)6 MethodSource (org.junit.jupiter.params.provider.MethodSource)6 EnvironmentStatus (com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentStatus)3 SdxClusterRequest (com.sequenceiq.sdx.api.model.SdxClusterRequest)3 SdxClusterResizeRequest (com.sequenceiq.sdx.api.model.SdxClusterResizeRequest)3 Test (org.junit.jupiter.api.Test)2 Status (com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status)1 StackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)1 StackViewV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response)1 CloudbreakClient (com.sequenceiq.cloudbreak.client.CloudbreakClient)1 DistroXV1Request (com.sequenceiq.distrox.api.v1.distrox.model.DistroXV1Request)1 EnvironmentBaseResponse (com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentBaseResponse)1 EnvironmentClient (com.sequenceiq.environment.client.EnvironmentClient)1 WaitResult (com.sequenceiq.it.cloudbreak.util.WaitResult)1 SdxClusterResponse (com.sequenceiq.sdx.api.model.SdxClusterResponse)1 SdxClusterStatusResponse (com.sequenceiq.sdx.api.model.SdxClusterStatusResponse)1 SdxClient (com.sequenceiq.sdx.client.SdxClient)1