use of com.sequenceiq.cloudbreak.core.flow2.service.ReactorNotifier in project cloudbreak by hortonworks.
the class ReactorFlowManagerTest method testTriggerUpscaleWithoutClusterEvent.
@Test
public void testTriggerUpscaleWithoutClusterEvent() {
InstanceGroupAdjustmentV4Request instanceGroupAdjustment = new InstanceGroupAdjustmentV4Request();
instanceGroupAdjustment.setInstanceGroup("ig");
instanceGroupAdjustment.setScalingAdjustment(3);
when(stackService.getPlatformVariantByStackId(STACK_ID)).thenReturn(cloudPlatformVariant);
when(cloudPlatformVariant.getVariant()).thenReturn(Variant.variant("AWS"));
underTest.triggerStackUpscale(stack.getId(), instanceGroupAdjustment, false);
ArgumentCaptor<Acceptable> captor = ArgumentCaptor.forClass(Acceptable.class);
verify(reactorNotifier, times(1)).notify(eq(stack.getId()), eq(FlowChainTriggers.FULL_UPSCALE_TRIGGER_EVENT), captor.capture());
StackAndClusterUpscaleTriggerEvent event = (StackAndClusterUpscaleTriggerEvent) captor.getValue();
assertEquals(FlowChainTriggers.FULL_UPSCALE_TRIGGER_EVENT, event.selector());
assertEquals(stack.getId(), event.getResourceId());
assertEquals(instanceGroupAdjustment.getInstanceGroup(), event.getHostGroupsWithAdjustment().keySet().stream().findFirst().get());
assertEquals(instanceGroupAdjustment.getScalingAdjustment(), event.getHostGroupsWithAdjustment().values().stream().findFirst().get());
assertEquals(ScalingType.UPSCALE_ONLY_STACK, event.getScalingType());
}
use of com.sequenceiq.cloudbreak.core.flow2.service.ReactorNotifier in project cloudbreak by hortonworks.
the class ReactorFlowManagerTest method testTriggerDatabaseBackupFlowchain.
@Test
public void testTriggerDatabaseBackupFlowchain() {
long stackId = 1L;
String backupId = UUID.randomUUID().toString();
underTest.triggerDatalakeDatabaseBackup(stackId, BACKUP_LOCATION, backupId, true);
ArgumentCaptor<Acceptable> captor = ArgumentCaptor.forClass(Acceptable.class);
verify(reactorNotifier).notify(eq(stackId), eq(FlowChainTriggers.DATALAKE_DATABASE_BACKUP_CHAIN_TRIGGER_EVENT), captor.capture());
DatabaseBackupTriggerEvent event = (DatabaseBackupTriggerEvent) captor.getValue();
assertEquals(stack.getId(), event.getResourceId());
assertEquals(backupId, event.getBackupId());
assertEquals(BACKUP_LOCATION, event.getBackupLocation());
assertEquals(FlowChainTriggers.DATALAKE_DATABASE_BACKUP_CHAIN_TRIGGER_EVENT, event.selector());
}
use of com.sequenceiq.cloudbreak.core.flow2.service.ReactorNotifier in project cloudbreak by hortonworks.
the class ReactorFlowManagerTest method testTriggerMaintenanceModeValidationFlow.
@Test
public void testTriggerMaintenanceModeValidationFlow() {
long stackId = 1L;
underTest.triggerMaintenanceModeValidationFlow(stackId);
ArgumentCaptor<Acceptable> captor = ArgumentCaptor.forClass(Acceptable.class);
verify(reactorNotifier).notify(eq(stackId), eq(FlowChainTriggers.CLUSTER_MAINTENANCE_MODE_VALIDATION_TRIGGER_EVENT), captor.capture());
MaintenanceModeValidationTriggerEvent event = (MaintenanceModeValidationTriggerEvent) captor.getValue();
assertEquals(stack.getId(), event.getResourceId());
assertEquals(FlowChainTriggers.CLUSTER_MAINTENANCE_MODE_VALIDATION_TRIGGER_EVENT, event.selector());
}
use of com.sequenceiq.cloudbreak.core.flow2.service.ReactorNotifier in project cloudbreak by hortonworks.
the class ReactorFlowManagerTest method testTriggerStackImageUpdate.
@Test
public void testTriggerStackImageUpdate() {
long stackId = 1L;
String imageID = "imageID";
String imageCatalogName = "imageCatalogName";
String imageCatalogUrl = "imageCatalogUrl";
underTest.triggerStackImageUpdate(new ImageChangeDto(stackId, imageID, imageCatalogName, imageCatalogUrl));
ArgumentCaptor<Acceptable> captor = ArgumentCaptor.forClass(Acceptable.class);
verify(reactorNotifier).notify(eq(stackId), eq(FlowChainTriggers.STACK_IMAGE_UPDATE_TRIGGER_EVENT), captor.capture());
StackImageUpdateTriggerEvent event = (StackImageUpdateTriggerEvent) captor.getValue();
assertEquals(FlowChainTriggers.STACK_IMAGE_UPDATE_TRIGGER_EVENT, event.selector());
assertEquals(stack.getId(), event.getResourceId());
assertEquals(imageCatalogName, event.getImageCatalogName());
assertEquals(imageID, event.getNewImageId());
assertEquals(imageCatalogUrl, event.getImageCatalogUrl());
}
use of com.sequenceiq.cloudbreak.core.flow2.service.ReactorNotifier in project cloudbreak by hortonworks.
the class ReactorFlowManagerTest method testTriggerUpscaleWithClusterEvent.
@Test
public void testTriggerUpscaleWithClusterEvent() {
InstanceGroupAdjustmentV4Request instanceGroupAdjustment = new InstanceGroupAdjustmentV4Request();
instanceGroupAdjustment.setInstanceGroup("ig");
instanceGroupAdjustment.setScalingAdjustment(3);
when(stackService.getPlatformVariantByStackId(STACK_ID)).thenReturn(cloudPlatformVariant);
when(cloudPlatformVariant.getVariant()).thenReturn(Variant.variant("AWS"));
underTest.triggerStackUpscale(stack.getId(), instanceGroupAdjustment, true);
ArgumentCaptor<Acceptable> captor = ArgumentCaptor.forClass(Acceptable.class);
verify(reactorNotifier, times(1)).notify(eq(stack.getId()), eq(FlowChainTriggers.FULL_UPSCALE_TRIGGER_EVENT), captor.capture());
StackAndClusterUpscaleTriggerEvent event = (StackAndClusterUpscaleTriggerEvent) captor.getValue();
assertEquals(FlowChainTriggers.FULL_UPSCALE_TRIGGER_EVENT, event.selector());
assertEquals(stack.getId(), event.getResourceId());
assertEquals(instanceGroupAdjustment.getInstanceGroup(), event.getHostGroupsWithAdjustment().keySet().stream().findFirst().get());
assertEquals(instanceGroupAdjustment.getScalingAdjustment(), event.getHostGroupsWithAdjustment().values().stream().findFirst().get());
assertEquals(ScalingType.UPSCALE_TOGETHER, event.getScalingType());
}
Aggregations