Search in sources :

Example 31 with FlowTriggerEventQueue

use of com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue in project cloudbreak by hortonworks.

the class UpgradeDistroxFlowEventChainFactoryTest method testChainQueueForReplaceVms.

@Test
public void testChainQueueForReplaceVms() {
    ReflectionTestUtils.setField(underTest, "upgradeValidationEnabled", true);
    Result<Map<HostGroupName, Set<InstanceMetaData>>, RepairValidation> repairStartResult = Result.success(new HashMap<>());
    when(clusterRepairService.validateRepair(any(), any(), any(), eq(false))).thenReturn(repairStartResult);
    DistroXUpgradeTriggerEvent event = new DistroXUpgradeTriggerEvent(FlowChainTriggers.DISTROX_CLUSTER_UPGRADE_CHAIN_TRIGGER_EVENT, STACK_ID, imageChangeDto, true, true, "variant");
    FlowTriggerEventQueue flowChainQueue = underTest.createFlowTriggerEventQueue(event);
    assertEquals(5, flowChainQueue.getQueue().size());
    assertUpdateValidationEvent(flowChainQueue);
    assertSaltUpdateEvent(flowChainQueue);
    assertUpgradeEvent(flowChainQueue);
    assertImageUpdateEvent(flowChainQueue);
    assertRepairEvent(flowChainQueue);
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) RepairValidation(com.sequenceiq.cloudbreak.service.cluster.model.RepairValidation) FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) DistroXUpgradeTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.DistroXUpgradeTriggerEvent) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.jupiter.api.Test)

Example 32 with FlowTriggerEventQueue

use of com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue in project cloudbreak by hortonworks.

the class DatalakeResizeFlowEventChainTest method chainCreationTest.

@Test
public void chainCreationTest() {
    DatalakeResizeFlowChainStartEvent event = new DatalakeResizeFlowChainStartEvent(sdxCluster.getId(), sdxCluster, USER_CRN, BACKUP_LOCATION, true, true);
    FlowTriggerEventQueue flowTriggerEventQueue = factory.createFlowTriggerEventQueue(event);
    assertEquals(7, flowTriggerEventQueue.getQueue().size());
    assertTriggerBackupEvent(flowTriggerEventQueue);
}
Also used : FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) DatalakeResizeFlowChainStartEvent(com.sequenceiq.datalake.flow.detach.event.DatalakeResizeFlowChainStartEvent) Test(org.junit.Test)

Example 33 with FlowTriggerEventQueue

use of com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue in project cloudbreak by hortonworks.

the class DatalakeResizeFlowEventChainTest method chainCreationWithRazTest.

@Test
public void chainCreationWithRazTest() {
    SdxCluster clusterWithRaz = getValidSdxClusterwithRaz();
    DatalakeResizeFlowChainStartEvent event = new DatalakeResizeFlowChainStartEvent(clusterWithRaz.getId(), clusterWithRaz, USER_CRN, BACKUP_LOCATION, true, true);
    FlowTriggerEventQueue flowTriggerEventQueue = factory.createFlowTriggerEventQueue(event);
    assertEquals(7, flowTriggerEventQueue.getQueue().size());
    assertTriggerBackupEvent(flowTriggerEventQueue);
}
Also used : FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) DatalakeResizeFlowChainStartEvent(com.sequenceiq.datalake.flow.detach.event.DatalakeResizeFlowChainStartEvent) Test(org.junit.Test)

Example 34 with FlowTriggerEventQueue

use of com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue in project cloudbreak by hortonworks.

the class DatalakeResizeRecoveryFlowEventChainTest method chainCreationTestNewDLNull.

@Test
public void chainCreationTestNewDLNull() {
    SdxCluster oldCluster = new SdxCluster();
    oldCluster.setId(OLD_CLUSTER_SDX_ID);
    oldCluster.setDetached(true);
    DatalakeResizeRecoveryFlowChainStartEvent event = new DatalakeResizeRecoveryFlowChainStartEvent(oldCluster, null, USER_CRN);
    FlowTriggerEventQueue flowTriggerEventQueue = factory.createFlowTriggerEventQueue(event);
    assertEquals(2, flowTriggerEventQueue.getQueue().size());
    Queue<Selectable> flowQueue = flowTriggerEventQueue.getQueue();
    checkEventIsDetachRecovery(flowQueue.remove());
    checkEventIsStart(flowQueue.remove());
}
Also used : FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) DatalakeResizeRecoveryFlowChainStartEvent(com.sequenceiq.datalake.flow.detach.event.DatalakeResizeRecoveryFlowChainStartEvent) Test(org.junit.jupiter.api.Test)

Example 35 with FlowTriggerEventQueue

use of com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue in project cloudbreak by hortonworks.

the class DatalakeResizeRecoveryFlowEventChainTest method chainCreationTestNewDLAlreadyDeletedAndOldDLNotDetached.

@Test
public void chainCreationTestNewDLAlreadyDeletedAndOldDLNotDetached() {
    SdxCluster oldCluster = new SdxCluster();
    oldCluster.setId(OLD_CLUSTER_SDX_ID);
    oldCluster.setDetached(false);
    SdxCluster newCluster = new SdxCluster();
    newCluster.setDeleted(1L);
    DatalakeResizeRecoveryFlowChainStartEvent event = new DatalakeResizeRecoveryFlowChainStartEvent(oldCluster, newCluster, USER_CRN);
    FlowTriggerEventQueue flowTriggerEventQueue = factory.createFlowTriggerEventQueue(event);
    assertEquals(1, flowTriggerEventQueue.getQueue().size());
    Queue<Selectable> flowQueue = flowTriggerEventQueue.getQueue();
    checkEventIsStart(flowQueue.remove());
}
Also used : FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) DatalakeResizeRecoveryFlowChainStartEvent(com.sequenceiq.datalake.flow.detach.event.DatalakeResizeRecoveryFlowChainStartEvent) Test(org.junit.jupiter.api.Test)

Aggregations

FlowTriggerEventQueue (com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue)52 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)35 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)26 StackEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackEvent)15 Test (org.junit.Test)10 Test (org.junit.jupiter.api.Test)9 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)8 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)8 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)5 StackView (com.sequenceiq.cloudbreak.domain.view.StackView)4 TerminationEvent (com.sequenceiq.cloudbreak.reactor.api.event.stack.TerminationEvent)4 ClusterTerminationEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.termination.ClusterTerminationEvent)3 StackDownscaleTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.StackDownscaleTriggerEvent)3 StackSyncTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.StackSyncTriggerEvent)3 StackTerminationEvent (com.sequenceiq.cloudbreak.core.flow2.stack.termination.StackTerminationEvent)3 DatalakeResizeRecoveryFlowChainStartEvent (com.sequenceiq.datalake.flow.detach.event.DatalakeResizeRecoveryFlowChainStartEvent)3 CloudPlatformVariant (com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant)2 Payload (com.sequenceiq.cloudbreak.common.event.Payload)2 ClusterAndStackDownscaleTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.ClusterAndStackDownscaleTriggerEvent)2 ClusterDownscaleTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.ClusterDownscaleTriggerEvent)2