Search in sources :

Example 1 with DatalakeResizeRecoveryFlowChainStartEvent

use of com.sequenceiq.datalake.flow.detach.event.DatalakeResizeRecoveryFlowChainStartEvent in project cloudbreak by hortonworks.

the class DatalakeResizeRecoveryFlowEventChainTest method chainCreationTestAllEvents.

@Test
public void chainCreationTestAllEvents() {
    SdxCluster oldCluster = new SdxCluster();
    oldCluster.setId(OLD_CLUSTER_SDX_ID);
    oldCluster.setDetached(true);
    SdxCluster newCluster = new SdxCluster();
    newCluster.setId(NEW_CLUSTER_SDX_ID);
    DatalakeResizeRecoveryFlowChainStartEvent event = new DatalakeResizeRecoveryFlowChainStartEvent(oldCluster, newCluster, USER_CRN);
    FlowTriggerEventQueue flowTriggerEventQueue = factory.createFlowTriggerEventQueue(event);
    assertEquals(4, flowTriggerEventQueue.getQueue().size());
    Queue<Selectable> flowQueue = flowTriggerEventQueue.getQueue();
    checkEventIsDetach(flowQueue.remove());
    checkEventIsDeletion(flowQueue.remove());
    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 2 with DatalakeResizeRecoveryFlowChainStartEvent

use of com.sequenceiq.datalake.flow.detach.event.DatalakeResizeRecoveryFlowChainStartEvent in project cloudbreak by hortonworks.

the class SdxReactorFlowManager method triggerSdxResizeRecovery.

public FlowIdentifier triggerSdxResizeRecovery(SdxCluster oldSdxCluster, SdxCluster newSdxCluster) {
    LOGGER.info("Triggering recovery for failed SDX resize with original cluster: {} and resized cluster: {}", oldSdxCluster, newSdxCluster);
    String userId = ThreadBasedUserCrnProvider.getUserCrn();
    return notify(SDX_RESIZE_RECOVERY_FLOW_CHAIN_START_EVENT, new DatalakeResizeRecoveryFlowChainStartEvent(oldSdxCluster, newSdxCluster, userId), oldSdxCluster.getClusterName());
}
Also used : DatalakeResizeRecoveryFlowChainStartEvent(com.sequenceiq.datalake.flow.detach.event.DatalakeResizeRecoveryFlowChainStartEvent)

Example 3 with DatalakeResizeRecoveryFlowChainStartEvent

use of com.sequenceiq.datalake.flow.detach.event.DatalakeResizeRecoveryFlowChainStartEvent 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 4 with DatalakeResizeRecoveryFlowChainStartEvent

use of com.sequenceiq.datalake.flow.detach.event.DatalakeResizeRecoveryFlowChainStartEvent 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)

Example 5 with DatalakeResizeRecoveryFlowChainStartEvent

use of com.sequenceiq.datalake.flow.detach.event.DatalakeResizeRecoveryFlowChainStartEvent in project cloudbreak by hortonworks.

the class DatalakeResizeRecoveryFlowEventChainTest method chainCreationTestNewDLAlreadyDeleted.

@Test
public void chainCreationTestNewDLAlreadyDeleted() {
    SdxCluster oldCluster = new SdxCluster();
    oldCluster.setId(OLD_CLUSTER_SDX_ID);
    oldCluster.setDetached(true);
    SdxCluster newCluster = new SdxCluster();
    newCluster.setDeleted(1L);
    DatalakeResizeRecoveryFlowChainStartEvent event = new DatalakeResizeRecoveryFlowChainStartEvent(oldCluster, newCluster, 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)

Aggregations

DatalakeResizeRecoveryFlowChainStartEvent (com.sequenceiq.datalake.flow.detach.event.DatalakeResizeRecoveryFlowChainStartEvent)5 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)4 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)4 FlowTriggerEventQueue (com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue)4 Test (org.junit.jupiter.api.Test)4