Search in sources :

Example 1 with MaintenanceModeValidationTriggerEvent

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

the class MaintenanceModeValidationActions method fetchStackRepo.

@Bean(name = "FETCH_STACK_REPO_STATE")
public AbstractMaintenanceModeValidationAction<?> fetchStackRepo() {
    return new AbstractMaintenanceModeValidationAction<>(MaintenanceModeValidationTriggerEvent.class) {

        @Override
        protected void doExecute(StackContext context, MaintenanceModeValidationTriggerEvent payload, Map<Object, Object> variables) {
            maintenanceModeValidationService.setUpValidationFlow(context.getStack().getId());
            String stackRepo = maintenanceModeValidationService.fetchStackRepository(context.getStack().getId());
            putWarnings(variables, new ArrayList<>());
            variables.put(STACK_REPO, stackRepo);
            sendEvent(context, new StackEvent(FETCH_STACK_REPO_INFO_FINISHED_EVENT.event(), context.getStack().getId()));
        }
    };
}
Also used : MaintenanceModeValidationTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.MaintenanceModeValidationTriggerEvent) StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) StackContext(com.sequenceiq.cloudbreak.core.flow2.stack.StackContext) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Example 2 with MaintenanceModeValidationTriggerEvent

use of com.sequenceiq.cloudbreak.core.flow2.event.MaintenanceModeValidationTriggerEvent 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());
}
Also used : MaintenanceModeValidationTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.MaintenanceModeValidationTriggerEvent) Acceptable(com.sequenceiq.cloudbreak.common.event.Acceptable) Test(org.junit.Test)

Example 3 with MaintenanceModeValidationTriggerEvent

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

the class ClusterMaintenanceModeFlowEventChainFactory method createFlowTriggerEventQueue.

@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(MaintenanceModeValidationTriggerEvent event) {
    Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
    flowEventChain.add(new StackSyncTriggerEvent(StackSyncEvent.STACK_SYNC_EVENT.event(), event.getResourceId(), true, event.accepted()));
    flowEventChain.add(new StackEvent(CLUSTER_SYNC_EVENT.event(), event.getResourceId()));
    flowEventChain.add(new MaintenanceModeValidationTriggerEvent(MaintenanceModeValidationEvent.START_VALIDATION_FLOW_EVENT.event(), event.getResourceId()));
    return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
Also used : MaintenanceModeValidationTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.MaintenanceModeValidationTriggerEvent) StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) StackSyncTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.StackSyncTriggerEvent) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue)

Aggregations

MaintenanceModeValidationTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.MaintenanceModeValidationTriggerEvent)3 StackEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackEvent)2 Acceptable (com.sequenceiq.cloudbreak.common.event.Acceptable)1 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)1 StackSyncTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.StackSyncTriggerEvent)1 StackContext (com.sequenceiq.cloudbreak.core.flow2.stack.StackContext)1 FlowTriggerEventQueue (com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue)1 Map (java.util.Map)1 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)1 Test (org.junit.Test)1 Bean (org.springframework.context.annotation.Bean)1