Search in sources :

Example 1 with UpgradeCcmStackEvent

use of com.sequenceiq.datalake.flow.upgrade.ccm.event.UpgradeCcmStackEvent in project cloudbreak by hortonworks.

the class UpgradeCcmActionsTest method stackUpgradeHappyPath.

@Test
void stackUpgradeHappyPath() {
    actionPayload = new UpgradeCcmStackEvent(ACTION_PAYLOAD_SELECTOR, SDX_ID, USER_ID);
    setupContextWithPayload();
    testUpgradeActionHappyPath(underTest::upgradeCcmStack);
    UpgradeCcmStackRequest payload = (UpgradeCcmStackRequest) payloadArgumentCaptor.getValue();
    assertThat(selectorArgumentCaptor.getValue()).isEqualTo(UpgradeCcmStackRequest.class.getSimpleName());
    assertThat(payload.getResourceId()).isEqualTo(SDX_ID);
    assertThat(payload.getUserId()).isEqualTo(USER_ID);
}
Also used : UpgradeCcmStackRequest(com.sequenceiq.datalake.flow.upgrade.ccm.event.UpgradeCcmStackRequest) UpgradeCcmStackEvent(com.sequenceiq.datalake.flow.upgrade.ccm.event.UpgradeCcmStackEvent) Test(org.junit.jupiter.api.Test)

Example 2 with UpgradeCcmStackEvent

use of com.sequenceiq.datalake.flow.upgrade.ccm.event.UpgradeCcmStackEvent in project cloudbreak by hortonworks.

the class SdxReactorFlowManager method triggerCcmUpgradeFlow.

public FlowIdentifier triggerCcmUpgradeFlow(SdxCluster cluster) {
    LOGGER.info("Trigger CCM Upgrade on Datalake for: {}", cluster);
    String initiatorUserCrn = ThreadBasedUserCrnProvider.getUserCrn();
    UpgradeCcmStackEvent event = new UpgradeCcmStackEvent(UPGRADE_CCM_UPGRADE_STACK_EVENT.event(), cluster.getId(), initiatorUserCrn);
    return notify(event.selector(), event, cluster.getClusterName());
}
Also used : UpgradeCcmStackEvent(com.sequenceiq.datalake.flow.upgrade.ccm.event.UpgradeCcmStackEvent)

Example 3 with UpgradeCcmStackEvent

use of com.sequenceiq.datalake.flow.upgrade.ccm.event.UpgradeCcmStackEvent in project cloudbreak by hortonworks.

the class UpgradeCcmActions method upgradeCcmStack.

@Bean(name = "UPGRADE_CCM_UPGRADE_STACK_STATE")
public Action<?, ?> upgradeCcmStack() {
    return new AbstractUpgradeCcmSdxAction<>(UpgradeCcmStackEvent.class) {

        @Override
        protected void doExecute(SdxContext context, UpgradeCcmStackEvent payload, Map<Object, Object> variables) {
            LOGGER.info("Execute CCM upgrade stack flow for SDX: {}", payload.getResourceId());
            UpgradeCcmStackRequest request = UpgradeCcmStackRequest.from(context);
            sendEvent(context, request);
        }

        @Override
        protected Object getFailurePayload(UpgradeCcmStackEvent payload, Optional<SdxContext> flowContext, Exception ex) {
            return UpgradeCcmFailedEvent.from(payload, ex);
        }
    };
}
Also used : Optional(java.util.Optional) UpgradeCcmStackRequest(com.sequenceiq.datalake.flow.upgrade.ccm.event.UpgradeCcmStackRequest) Map(java.util.Map) UpgradeCcmStackEvent(com.sequenceiq.datalake.flow.upgrade.ccm.event.UpgradeCcmStackEvent) SdxContext(com.sequenceiq.datalake.flow.SdxContext) Bean(org.springframework.context.annotation.Bean)

Aggregations

UpgradeCcmStackEvent (com.sequenceiq.datalake.flow.upgrade.ccm.event.UpgradeCcmStackEvent)3 UpgradeCcmStackRequest (com.sequenceiq.datalake.flow.upgrade.ccm.event.UpgradeCcmStackRequest)2 SdxContext (com.sequenceiq.datalake.flow.SdxContext)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Test (org.junit.jupiter.api.Test)1 Bean (org.springframework.context.annotation.Bean)1