use of com.sequenceiq.flow.api.model.FlowIdentifier in project cloudbreak by hortonworks.
the class StackScalePostAction method action.
@Override
public StackTestDto action(TestContext testContext, StackTestDto testDto, CloudbreakClient client) throws Exception {
Log.when(LOGGER, String.format("Stack scale request on: %s. Hostgroup: %s, desiredCount: %d", testDto.getName(), request.getGroup(), request.getDesiredCount()));
Log.whenJson(LOGGER, " Stack scale request: ", testDto.getRequest());
FlowIdentifier flowIdentifier = client.getDefaultClient().stackV4Endpoint().putScaling(client.getWorkspaceId(), testDto.getName(), request, testContext.getActingUserCrn().getAccountId());
testDto.setFlow("Stack scale", flowIdentifier);
StackV4Response stackV4Response = client.getDefaultClient().stackV4Endpoint().get(client.getWorkspaceId(), testDto.getName(), new HashSet<>(), testContext.getActingUserCrn().getAccountId());
testDto.setResponse(stackV4Response);
Log.whenJson(LOGGER, " Stack scale response: ", stackV4Response);
LOGGER.info("Hardware info for stack after upscale: {}", stackV4Response.getHardwareInfoGroups());
return testDto;
}
use of com.sequenceiq.flow.api.model.FlowIdentifier in project cloudbreak by hortonworks.
the class SdxRetryAction method action.
@Override
public SdxInternalTestDto action(TestContext testContext, SdxInternalTestDto testDto, SdxClient sdxClient) throws Exception {
FlowIdentifier flowIdentifier = sdxClient.getDefaultClient().sdxEndpoint().retryByCrn(testDto.getCrn());
testDto.setFlow("Retry", flowIdentifier);
return testDto;
}
use of com.sequenceiq.flow.api.model.FlowIdentifier in project cloudbreak by hortonworks.
the class UpgradeCcmOnDatalakeHandlerTest method testAcceptWhenUpgradeSkipped.
@Test
void testAcceptWhenUpgradeSkipped() {
SdxCcmUpgradeResponse response = new SdxCcmUpgradeResponse(CcmUpgradeResponseType.SKIP, new FlowIdentifier(FlowType.FLOW, "flowId"), "reason", "datalakeCrn");
when(sdxService.upgradeCcm(TEST_ENV_CRN)).thenReturn(response);
underTest.accept(mockEnvironmentDtoEvent);
verify(sdxUpgradeCcmPollerService, never()).waitForUpgradeCcm(any(), any());
UpgradeCcmEvent capturedUpgradeCcmEvent = (UpgradeCcmEvent) baseNamedFlowEvent.getValue();
assertThat(capturedUpgradeCcmEvent.getResourceName()).isEqualTo(TEST_ENV_NAME);
assertThat(capturedUpgradeCcmEvent.getResourceId()).isEqualTo(TEST_ENV_ID);
assertThat(capturedUpgradeCcmEvent.getResourceCrn()).isEqualTo(TEST_ENV_CRN);
assertThat(capturedUpgradeCcmEvent.selector()).isEqualTo("UPGRADE_CCM_DATAHUB_EVENT");
}
use of com.sequenceiq.flow.api.model.FlowIdentifier in project cloudbreak by hortonworks.
the class UpgradeCcmOnDatalakeHandlerTest method testAcceptWhenUpgradeTriggered.
@Test
void testAcceptWhenUpgradeTriggered() {
SdxCcmUpgradeResponse response = new SdxCcmUpgradeResponse(CcmUpgradeResponseType.TRIGGERED, new FlowIdentifier(FlowType.FLOW, "flowId"), "reason", "datalakeCrn");
when(sdxService.upgradeCcm(TEST_ENV_CRN)).thenReturn(response);
underTest.accept(mockEnvironmentDtoEvent);
verify(sdxUpgradeCcmPollerService).waitForUpgradeCcm(TEST_ENV_ID, "datalakeCrn");
UpgradeCcmEvent capturedUpgradeCcmEvent = (UpgradeCcmEvent) baseNamedFlowEvent.getValue();
assertThat(capturedUpgradeCcmEvent.getResourceName()).isEqualTo(TEST_ENV_NAME);
assertThat(capturedUpgradeCcmEvent.getResourceId()).isEqualTo(TEST_ENV_ID);
assertThat(capturedUpgradeCcmEvent.getResourceCrn()).isEqualTo(TEST_ENV_CRN);
assertThat(capturedUpgradeCcmEvent.selector()).isEqualTo("UPGRADE_CCM_DATAHUB_EVENT");
}
use of com.sequenceiq.flow.api.model.FlowIdentifier in project cloudbreak by hortonworks.
the class FreeIpaScalingServiceTest method testUpscaleIfValidationPassesAndOperationRunningThenSucceed.
@Test
public void testUpscaleIfValidationPassesAndOperationRunningThenSucceed() {
Stack stack = mock(Stack.class);
Set<InstanceMetaData> allInstances = createValidImSet();
Operation operation = createOperation(true);
when(stack.getAccountId()).thenReturn(ACCOUNT_ID);
when(stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(ENV_CRN, ACCOUNT_ID)).thenReturn(stack);
when(operationService.startOperation(ACCOUNT_ID, OperationType.UPSCALE, List.of(ENV_CRN), List.of())).thenReturn(operation);
when(stack.getNotDeletedInstanceMetaDataSet()).thenReturn(allInstances);
FlowIdentifier flowIdentifier = new FlowIdentifier(FlowType.FLOW, POLLABLE_ID);
when(flowManager.notify(anyString(), any())).thenReturn(flowIdentifier);
UpscaleRequest request = createUpscaleRequest();
UpscaleResponse response = underTest.upscale(ACCOUNT_ID, request);
assertEquals(response.getOperationId(), OPERATION_ID);
assertEquals(response.getOriginalAvailabilityType(), AvailabilityType.TWO_NODE_BASED);
assertEquals(response.getTargetAvailabilityType(), AvailabilityType.HA);
assertEquals(response.getFlowIdentifier(), flowIdentifier);
}
Aggregations