use of com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterResponse in project cloudbreak by hortonworks.
the class DistroXAutoScaleClusterV1EndpointTest method testUpdateAutoscaleConfigByClusterCrnForTimeAlerts.
@Test
public void testUpdateAutoscaleConfigByClusterCrnForTimeAlerts() {
List<TimeAlertRequest> timeAlertRequests = getTimeAlertRequests(2, List.of("compute", "compute"));
DistroXAutoscaleClusterRequest distroXAutoscaleClusterRequest = new DistroXAutoscaleClusterRequest();
distroXAutoscaleClusterRequest.setTimeAlertRequests(timeAlertRequests);
distroXAutoscaleClusterRequest.setEnableAutoscaling(true);
DistroXAutoscaleClusterResponse xAutoscaleClusterResponse = distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterCrn(TEST_CLUSTER_CRN, distroXAutoscaleClusterRequest);
assertEquals("Retrieved Alerts Size Should Match", 2, xAutoscaleClusterResponse.getTimeAlerts().size());
assertTrue("Autoscaling should be enabled", xAutoscaleClusterResponse.isAutoscalingEnabled());
xAutoscaleClusterResponse.getTimeAlerts().stream().forEach(this::validateTimeAlertResponse);
}
use of com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterResponse in project cloudbreak by hortonworks.
the class DistroXAutoScaleClusterV1EndpointTest method testEnableAutoscaleForClusterCrn.
@Test
public void testEnableAutoscaleForClusterCrn() {
DistroXAutoscaleClusterResponse xAutoscaleClusterResponse = distroXAutoScaleClusterV1Endpoint.enableAutoscaleForClusterCrn(TEST_CLUSTER_CRN, AutoscaleClusterState.enable());
assertTrue("Autoscaling should be enabled", xAutoscaleClusterResponse.isAutoscalingEnabled());
xAutoscaleClusterResponse = distroXAutoScaleClusterV1Endpoint.enableAutoscaleForClusterCrn(TEST_CLUSTER_CRN, AutoscaleClusterState.disable());
assertFalse("Autoscaling should be disabled", xAutoscaleClusterResponse.isAutoscalingEnabled());
xAutoscaleClusterResponse = distroXAutoScaleClusterV1Endpoint.enableAutoscaleForClusterCrn(TEST_CLUSTER_CRN, AutoscaleClusterState.enable());
assertTrue("Autoscaling should be enabled", xAutoscaleClusterResponse.isAutoscalingEnabled());
}
use of com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterResponse in project cloudbreak by hortonworks.
the class DistroXAutoScaleClusterV1EndpointTest method testUpdateAutoscaleConfigByClusterNameForTimeAlerts.
@Test
public void testUpdateAutoscaleConfigByClusterNameForTimeAlerts() {
List<TimeAlertRequest> timeAlertRequests = getTimeAlertRequests(2, List.of("compute", "compute"));
DistroXAutoscaleClusterRequest distroXAutoscaleClusterRequest = new DistroXAutoscaleClusterRequest();
distroXAutoscaleClusterRequest.setTimeAlertRequests(timeAlertRequests);
distroXAutoscaleClusterRequest.setEnableAutoscaling(true);
DistroXAutoscaleClusterResponse xAutoscaleClusterResponse = distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterName(TEST_CLUSTER_NAME, distroXAutoscaleClusterRequest);
assertEquals("Retrieved Alerts Size Should Match", 2, xAutoscaleClusterResponse.getTimeAlerts().size());
assertTrue("Autoscaling should be enabled", xAutoscaleClusterResponse.isAutoscalingEnabled());
xAutoscaleClusterResponse.getTimeAlerts().stream().forEach(this::validateTimeAlertResponse);
}
use of com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterResponse in project cloudbreak by hortonworks.
the class DistroXAutoScaleClusterV1EndpointTest method testUpdateAutoscaleConfigByClusterCrnForLoadAlerts.
@Test
public void testUpdateAutoscaleConfigByClusterCrnForLoadAlerts() {
List<LoadAlertRequest> loadAlertRequests = getLoadAlertRequests(1, List.of("compute"));
DistroXAutoscaleClusterRequest distroXAutoscaleClusterRequest = new DistroXAutoscaleClusterRequest();
distroXAutoscaleClusterRequest.setLoadAlertRequests(loadAlertRequests);
distroXAutoscaleClusterRequest.setEnableAutoscaling(true);
DistroXAutoscaleClusterResponse xAutoscaleClusterResponse = distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterCrn(TEST_CLUSTER_CRN, distroXAutoscaleClusterRequest);
assertEquals("Retrieved Alerts Size Should Match", 1, xAutoscaleClusterResponse.getLoadAlerts().size());
assertTrue("Autoscaling should be enabled", xAutoscaleClusterResponse.isAutoscalingEnabled());
xAutoscaleClusterResponse.getLoadAlerts().stream().forEach(this::validateLoadAlertResponse);
}
Aggregations