use of com.sequenceiq.flow.core.AbstractAction in project cloudbreak by hortonworks.
the class DatalakeRestoreActionsTest method testRestoreWithNoFlowChain.
@Test
public void testRestoreWithNoFlowChain() throws Exception {
when(sdxBackupRestoreService.triggerDatalakeRestore(eq(OLD_SDX_ID), any(), any(), eq(USER_CRN))).thenReturn(new DatalakeRestoreStatusResponse(BACKUP_ID, RESTORE_ID, State.STARTED, Optional.empty()));
DatalakeTriggerRestoreEvent event = new DatalakeTriggerRestoreEvent(DATALAKE_TRIGGER_RESTORE_EVENT.event(), OLD_SDX_ID, DATALAKE_NAME, USER_CRN, null, BACKUP_LOCATION, null, DatalakeRestoreFailureReason.RESTORE_ON_RESIZE);
AbstractAction action = (AbstractAction) underTest.triggerDatalakeRestore();
initActionPrivateFields(action);
AbstractActionTestSupport testSupport = new AbstractActionTestSupport(action);
SdxContext context = SdxContext.from(new FlowParameters(FLOW_ID, FLOW_ID, null), event);
testSupport.doExecute(context, event, new HashMap());
ArgumentCaptor<DatalakeDatabaseRestoreStartEvent> captor = ArgumentCaptor.forClass(DatalakeDatabaseRestoreStartEvent.class);
verify(reactorEventFactory, times(1)).createEvent(any(), captor.capture());
DatalakeDatabaseRestoreStartEvent captorValue = captor.getValue();
Assertions.assertEquals(OLD_SDX_ID, captorValue.getResourceId());
}
use of com.sequenceiq.flow.core.AbstractAction in project cloudbreak by hortonworks.
the class DatahubRefreshActionsTest method testStartTriggersCall.
@Test
public void testStartTriggersCall() throws Exception {
DatahubRefreshStartEvent event = new DatahubRefreshStartEvent(SDX_ID, SDX_NAME, USER_CRN);
AbstractAction action = (AbstractAction) underTest.startDatahubRefreshAction();
initActionPrivateFields(action);
AbstractActionTestSupport testSupport = new AbstractActionTestSupport(action);
SdxContext context = SdxContext.from(new FlowParameters(FLOW_ID, USER_CRN, null), event);
testSupport.doExecute(context, event, new HashMap());
ArgumentCaptor<DatahubRefreshStartEvent> captor = ArgumentCaptor.forClass(DatahubRefreshStartEvent.class);
verify(reactorEventFactory, times(1)).createEvent(any(), captor.capture());
DatahubRefreshStartEvent captorValue = captor.getValue();
Assertions.assertEquals(SDX_NAME, captorValue.getSdxName());
}
use of com.sequenceiq.flow.core.AbstractAction in project cloudbreak by hortonworks.
the class EnvDeleteActionsTest method configureAction.
private Action<?, ?> configureAction(Supplier<Action<?, ?>> actionSupplier) {
Action<?, ?> action = actionSupplier.get();
assertThat(action).isNotNull();
setActionPrivateFields(action);
AbstractAction abstractAction = (AbstractAction) action;
abstractAction.setFailureEvent(failureEvent);
return action;
}
use of com.sequenceiq.flow.core.AbstractAction in project cloudbreak by hortonworks.
the class UpgradeCcmActionsTest method configureAction.
private Action<?, ?> configureAction(Supplier<Action<?, ?>> actionSupplier) {
Action<?, ?> action = actionSupplier.get();
assertThat(action).isNotNull();
setActionPrivateFields(action);
AbstractAction abstractAction = (AbstractAction) action;
abstractAction.setFailureEvent(failureEvent);
return action;
}
use of com.sequenceiq.flow.core.AbstractAction in project cloudbreak by hortonworks.
the class EnvCreationActionsTest method configureAction.
private Action<?, ?> configureAction(Supplier<Action<?, ?>> actionSupplier) {
Action<?, ?> action = actionSupplier.get();
assertThat(action).isNotNull();
setActionPrivateFields(action);
AbstractAction abstractAction = (AbstractAction) action;
abstractAction.setFailureEvent(failureEvent);
return action;
}
Aggregations