use of com.sequenceiq.cloudbreak.common.event.Selectable in project cloudbreak by hortonworks.
the class ClusterRepairFlowEventChainFactoryTest method testAddAwsNativeMigrationIfNeedWhenNotUpgrade.
@Test
public void testAddAwsNativeMigrationIfNeedWhenNotUpgrade() {
Queue<Selectable> flowTriggers = new ConcurrentLinkedDeque<>();
String groupName = "groupName";
boolean upgrade = false;
String variant = "variant";
underTest.addAwsNativeEventMigrationIfNeed(flowTriggers, STACK_ID, groupName, upgrade, variant);
Assertions.assertTrue(flowTriggers.isEmpty());
}
use of com.sequenceiq.cloudbreak.common.event.Selectable in project cloudbreak by hortonworks.
the class UpgradeDistroxFlowEventChainFactoryTest method assertUpdateValidationEvent.
private void assertUpdateValidationEvent(FlowTriggerEventQueue flowChainQueue) {
Selectable upgradeValidationEvent = flowChainQueue.getQueue().remove();
assertEquals(START_CLUSTER_UPGRADE_VALIDATION_INIT_EVENT.event(), upgradeValidationEvent.selector());
assertEquals(STACK_ID, upgradeValidationEvent.getResourceId());
assertTrue(upgradeValidationEvent instanceof ClusterUpgradeValidationTriggerEvent);
assertEquals(imageChangeDto.getImageId(), ((ClusterUpgradeValidationTriggerEvent) upgradeValidationEvent).getImageId());
}
use of com.sequenceiq.cloudbreak.common.event.Selectable in project cloudbreak by hortonworks.
the class CmSyncHandlerTest method testAcceptWhenSuccess.
@Test
void testAcceptWhenSuccess() {
Set<String> candidateImageUuids = Set.of(IMAGE_UUID_1);
HandlerEvent<CmSyncRequest> event = getCmSyncRequestHandlerEvent(candidateImageUuids);
Stack stack = new Stack();
when(stackService.getByIdWithListsInTransaction(STACK_ID)).thenReturn(stack);
Set<Image> foundImages = Set.of(mock(Image.class));
when(cmSyncImageCollectorService.collectImages(USER_CRN, stack, candidateImageUuids)).thenReturn(foundImages);
CmSyncOperationStatus cmSyncOperationStatus = CmSyncOperationStatus.builder().withSuccess("").build();
CmSyncOperationSummary cmSyncOperationSummary = new CmSyncOperationSummary(cmSyncOperationStatus);
when(cmSyncerService.syncFromCmToDb(stack, foundImages)).thenReturn(cmSyncOperationSummary);
Selectable result = underTest.doAccept(event);
assertEquals("CMSYNCRESULT", result.selector());
verify(stackService).getByIdWithListsInTransaction(STACK_ID);
verify(cmSyncImageCollectorService).collectImages(USER_CRN, stack, candidateImageUuids);
verify(cmSyncerService).syncFromCmToDb(stack, foundImages);
}
use of com.sequenceiq.cloudbreak.common.event.Selectable in project cloudbreak by hortonworks.
the class ClusterUpgradeDiskSpaceValidationHandlerTest method testHandlerToRetrieveTheImageFromTheCurrentImageCatalog.
@Test
public void testHandlerToRetrieveTheImageFromTheCurrentImageCatalog() {
when(stackService.getByIdWithListsInTransaction(STACK_ID)).thenReturn(stack);
Selectable nextFlowStepSelector = underTest.doAccept(createEvent());
assertEquals(FINISH_CLUSTER_UPGRADE_DISK_SPACE_VALIDATION_EVENT.name(), nextFlowStepSelector.selector());
verify(stackService).getByIdWithListsInTransaction(STACK_ID);
verify(diskSpaceValidationService).validateFreeSpaceForUpgrade(stack, REQUIRED_FREE_SPACE);
}
use of com.sequenceiq.cloudbreak.common.event.Selectable in project cloudbreak by hortonworks.
the class ClusterUpgradeExistingUpgradeCommandValidationHandlerTest method testUpgradeCommandNotActiveNotSuccessfulRetryableAndEmptyactiveRuntimeParcelVersionThenValidationShouldPass.
@Test
public void testUpgradeCommandNotActiveNotSuccessfulRetryableAndEmptyactiveRuntimeParcelVersionThenValidationShouldPass() {
ClusterManagerCommand command = new ClusterManagerCommand();
command.setActive(false);
command.setSuccess(false);
command.setRetryable(true);
when(clusterStatusService.findCommand(stack, ClusterCommandType.UPGRADE_CLUSTER)).thenReturn(Optional.of(command));
Map<String, String> parcelNameToVersionMap = Map.of();
when(connector.gatherInstalledParcels(STACK_NAME)).thenReturn(parcelNameToVersionMap);
Selectable nextFlowStepSelector = underTest.doAccept(getHandlerEvent());
assertEquals(FINISH_CLUSTER_UPGRADE_EXISTING_UPGRADE_COMMAND_VALIDATION_EVENT.selector(), nextFlowStepSelector.selector());
}
Aggregations