Search in sources :

Example 6 with StackImageUpdateTriggerEvent

use of com.sequenceiq.cloudbreak.core.flow2.event.StackImageUpdateTriggerEvent in project cloudbreak by hortonworks.

the class UpgradeDistroxFlowEventChainFactoryTest method assertImageUpdateEvent.

private void assertImageUpdateEvent(FlowTriggerEventQueue flowChainQueue) {
    Selectable imageUpdateEvent = flowChainQueue.getQueue().remove();
    assertEquals(STACK_IMAGE_UPDATE_TRIGGER_EVENT, imageUpdateEvent.selector());
    assertEquals(STACK_ID, imageUpdateEvent.getResourceId());
    assertTrue(imageUpdateEvent instanceof StackImageUpdateTriggerEvent);
    StackImageUpdateTriggerEvent event = (StackImageUpdateTriggerEvent) imageUpdateEvent;
    assertEquals(imageChangeDto.getImageId(), event.getNewImageId());
    assertEquals(imageChangeDto.getImageCatalogName(), event.getImageCatalogName());
    assertEquals(imageChangeDto.getImageCatalogUrl(), event.getImageCatalogUrl());
}
Also used : Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) StackImageUpdateTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.StackImageUpdateTriggerEvent)

Example 7 with StackImageUpdateTriggerEvent

use of com.sequenceiq.cloudbreak.core.flow2.event.StackImageUpdateTriggerEvent in project cloudbreak by hortonworks.

the class UpgradeDistroxFlowEventChainFactory method createFlowTriggerEventQueue.

@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(DistroXUpgradeTriggerEvent event) {
    LOGGER.debug("Creating flow trigger event queue for distrox upgrade with event {}", event);
    Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
    createUpgradeValidationEvent(event).ifPresent(flowEventChain::add);
    flowEventChain.add(new StackEvent(SaltUpdateEvent.SALT_UPDATE_EVENT.event(), event.getResourceId(), event.accepted()));
    flowEventChain.add(new ClusterUpgradeTriggerEvent(CLUSTER_UPGRADE_INIT_EVENT.event(), event.getResourceId(), event.accepted(), event.getImageChangeDto().getImageId()));
    flowEventChain.add(new StackImageUpdateTriggerEvent(FlowChainTriggers.STACK_IMAGE_UPDATE_TRIGGER_EVENT, event.getImageChangeDto()));
    if (event.isReplaceVms()) {
        Map<String, List<String>> nodeMap = getReplaceableInstancesByHostgroup(event);
        flowEventChain.add(new ClusterRepairTriggerEvent(FlowChainTriggers.CLUSTER_REPAIR_TRIGGER_EVENT, event.getResourceId(), nodeMap, true, event.getTriggeredStackVariant()));
    }
    return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
Also used : ClusterRepairTriggerEvent(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterRepairTriggerEvent) StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) ClusterUpgradeTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.ClusterUpgradeTriggerEvent) FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) StackImageUpdateTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.StackImageUpdateTriggerEvent)

Aggregations

StackImageUpdateTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.StackImageUpdateTriggerEvent)7 StackEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackEvent)4 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)3 ImageUpdateEvent (com.sequenceiq.cloudbreak.reactor.api.event.stack.ImageUpdateEvent)3 Test (org.junit.Test)3 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)2 ResourceEvent (com.sequenceiq.cloudbreak.event.ResourceEvent)2 StackFailureEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackFailureEvent)2 FlowEvent (com.sequenceiq.flow.core.FlowEvent)2 FlowTriggerEventQueue (com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue)2 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)2 Event (reactor.bus.Event)2 Acceptable (com.sequenceiq.cloudbreak.common.event.Acceptable)1 ClusterUpgradeTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.ClusterUpgradeTriggerEvent)1 StackSyncTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.StackSyncTriggerEvent)1 StackContext (com.sequenceiq.cloudbreak.core.flow2.stack.StackContext)1 ClusterRepairTriggerEvent (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterRepairTriggerEvent)1 OperationException (com.sequenceiq.cloudbreak.service.OperationException)1 ImageChangeDto (com.sequenceiq.cloudbreak.service.image.ImageChangeDto)1 StatedImage (com.sequenceiq.cloudbreak.service.image.StatedImage)1