Search in sources :

Example 6 with DistroXAutoscaleClusterRequest

use of com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterRequest in project cloudbreak by hortonworks.

the class DistroXAutoScaleClusterV1EndpointTest method testEnableStopStartScalingViaConfigUpdateWithPreExistingTimeAlerts.

@Test(expected = BadRequestException.class)
public void testEnableStopStartScalingViaConfigUpdateWithPreExistingTimeAlerts() {
    DistroXAutoscaleClusterRequest distroXAutoscaleClusterRequest = new DistroXAutoscaleClusterRequest();
    distroXAutoscaleClusterRequest.setEnableAutoscaling(true);
    List<TimeAlertRequest> timeAlertRequests = getTimeAlertRequests(2, List.of("compute", "compute"));
    distroXAutoscaleClusterRequest.setTimeAlertRequests(timeAlertRequests);
    distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterCrn(TEST_CLUSTER_CRN, distroXAutoscaleClusterRequest);
    distroXAutoscaleClusterRequest.setTimeAlertRequests(null);
    distroXAutoscaleClusterRequest.setUseStopStartMechanism(true);
    distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterCrn(TEST_CLUSTER_CRN, distroXAutoscaleClusterRequest);
}
Also used : TimeAlertRequest(com.sequenceiq.periscope.api.model.TimeAlertRequest) DistroXAutoscaleClusterRequest(com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterRequest) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 7 with DistroXAutoscaleClusterRequest

use of com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterRequest in project cloudbreak by hortonworks.

the class DistroXAutoScaleClusterV1EndpointTest method testEnableStopStartScalingViaStateUpdateWithPreExistingTimeAlerts.

@Test(expected = BadRequestException.class)
public void testEnableStopStartScalingViaStateUpdateWithPreExistingTimeAlerts() {
    DistroXAutoscaleClusterRequest distroXAutoscaleClusterRequest = new DistroXAutoscaleClusterRequest();
    distroXAutoscaleClusterRequest.setEnableAutoscaling(true);
    List<TimeAlertRequest> timeAlertRequests = getTimeAlertRequests(2, List.of("compute", "compute"));
    distroXAutoscaleClusterRequest.setTimeAlertRequests(timeAlertRequests);
    distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterCrn(TEST_CLUSTER_CRN, distroXAutoscaleClusterRequest);
    distroXAutoScaleClusterV1Endpoint.enableAutoscaleForClusterCrn(TEST_CLUSTER_CRN, AutoscaleClusterState.enableStopStart());
}
Also used : TimeAlertRequest(com.sequenceiq.periscope.api.model.TimeAlertRequest) DistroXAutoscaleClusterRequest(com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterRequest) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 8 with DistroXAutoscaleClusterRequest

use of com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterRequest in project cloudbreak by hortonworks.

the class DistroXAutoScaleClusterV1EndpointTest method testUpdateAutoscaleConfigWithTimeAlertsAndStopStartEnabled.

@Test(expected = BadRequestException.class)
public void testUpdateAutoscaleConfigWithTimeAlertsAndStopStartEnabled() {
    List<TimeAlertRequest> timeAlertRequests = getTimeAlertRequests(2, List.of("compute", "compute"));
    DistroXAutoscaleClusterRequest distroXAutoscaleClusterRequest = new DistroXAutoscaleClusterRequest();
    distroXAutoscaleClusterRequest.setTimeAlertRequests(timeAlertRequests);
    distroXAutoscaleClusterRequest.setEnableAutoscaling(true);
    distroXAutoscaleClusterRequest.setUseStopStartMechanism(true);
    distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterName(TEST_CLUSTER_NAME, distroXAutoscaleClusterRequest);
}
Also used : TimeAlertRequest(com.sequenceiq.periscope.api.model.TimeAlertRequest) DistroXAutoscaleClusterRequest(com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterRequest) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 9 with DistroXAutoscaleClusterRequest

use of com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterRequest in project cloudbreak by hortonworks.

the class DistroXAutoScaleClusterV1EndpointTest method testUpdateAutoscaleConfigByClusterCrnForMultipleLoadAlertsAndHostGroups.

@Test(expected = BadRequestException.class)
public void testUpdateAutoscaleConfigByClusterCrnForMultipleLoadAlertsAndHostGroups() {
    List<LoadAlertRequest> loadAlertRequests = getLoadAlertRequests(2, List.of("group1", "group2"));
    DistroXAutoscaleClusterRequest distroXAutoscaleClusterRequest = new DistroXAutoscaleClusterRequest();
    distroXAutoscaleClusterRequest.setLoadAlertRequests(loadAlertRequests);
    distroXAutoscaleClusterRequest.setEnableAutoscaling(true);
    distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterCrn(TEST_CLUSTER_CRN, distroXAutoscaleClusterRequest);
}
Also used : LoadAlertRequest(com.sequenceiq.periscope.api.model.LoadAlertRequest) DistroXAutoscaleClusterRequest(com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterRequest) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 10 with DistroXAutoscaleClusterRequest

use of com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterRequest in project cloudbreak by hortonworks.

the class DistroXAutoScaleClusterV1EndpointTest method testCreateTimeAlertWithPreExistingStopStartLoadAlert.

@Test(expected = BadRequestException.class)
public void testCreateTimeAlertWithPreExistingStopStartLoadAlert() {
    DistroXAutoscaleClusterRequest autoscaleRequest = new DistroXAutoscaleClusterRequest();
    List<LoadAlertRequest> loadAlertRequests = getLoadAlertRequests(1, List.of("compute"));
    autoscaleRequest.setLoadAlertRequests(loadAlertRequests);
    autoscaleRequest.setUseStopStartMechanism(true);
    autoscaleRequest.setEnableAutoscaling(true);
    distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterName(TEST_CLUSTER_NAME, autoscaleRequest);
    List<TimeAlertRequest> timeAlertRequests = getTimeAlertRequests(2, List.of("compute", "compute"));
    autoscaleRequest.setTimeAlertRequests(timeAlertRequests);
    autoscaleRequest.setLoadAlertRequests(null);
    autoscaleRequest.setUseStopStartMechanism(null);
    distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterName(TEST_CLUSTER_NAME, autoscaleRequest);
}
Also used : TimeAlertRequest(com.sequenceiq.periscope.api.model.TimeAlertRequest) LoadAlertRequest(com.sequenceiq.periscope.api.model.LoadAlertRequest) DistroXAutoscaleClusterRequest(com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterRequest) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Aggregations

DistroXAutoscaleClusterRequest (com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterRequest)29 Test (org.junit.Test)28 TimeAlertRequest (com.sequenceiq.periscope.api.model.TimeAlertRequest)17 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)16 LoadAlertRequest (com.sequenceiq.periscope.api.model.LoadAlertRequest)11 ScalingPolicyRequest (com.sequenceiq.periscope.api.model.ScalingPolicyRequest)11 DistroXAutoscaleClusterResponse (com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterResponse)8 ArrayList (java.util.ArrayList)8 AutoscaleRecommendationV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.connector.responses.AutoscaleRecommendationV4Response)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)4 LoadAlertConfigurationRequest (com.sequenceiq.periscope.api.model.LoadAlertConfigurationRequest)3 TimeAlert (com.sequenceiq.periscope.domain.TimeAlert)1