Search in sources :

Example 1 with StackV4Endpoint

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.StackV4Endpoint in project cloudbreak by hortonworks.

the class SdxCcmUpgradeServiceTest method testInitAndWaitForStackUpgrade.

@Test
void testInitAndWaitForStackUpgrade() {
    when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
    when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn:altus:iam:us-west-1:altus:user:__internal__actor__");
    FlowIdentifier flowId = new FlowIdentifier(FlowType.FLOW, "pollableId");
    StackCcmUpgradeV4Response upgradeResponse = new StackCcmUpgradeV4Response(flowId);
    when(stackV4Endpoint.upgradeCcmByCrnInternal(eq(0L), eq(STACK_CRN), any())).thenReturn(upgradeResponse);
    PollingConfig pc = new PollingConfig(1L, TimeUnit.HOURS, 1L, TimeUnit.HOURS);
    SdxCluster sdx = getSdxCluster();
    underTest.initAndWaitForStackUpgrade(sdx, pc);
    verify(stackV4Endpoint).upgradeCcmByCrnInternal(any(), eq(STACK_CRN), any());
    verify(cloudbreakPoller).pollCcmUpgradeUntilAvailable(sdx, pc);
}
Also used : StackCcmUpgradeV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.StackCcmUpgradeV4Response) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier) PollingConfig(com.sequenceiq.datalake.service.sdx.PollingConfig) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with StackV4Endpoint

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.StackV4Endpoint in project cloudbreak by hortonworks.

the class StackRequestAction method action.

@Override
public StackTestDto action(TestContext testContext, StackTestDto testDto, CloudbreakClient client) throws Exception {
    Log.when(LOGGER, " Stack get cli skeleton:" + testDto.getName());
    StackV4Request request = client.getDefaultClient().stackV4Endpoint().getRequestfromName(client.getWorkspaceId(), testDto.getName(), testContext.getActingUserCrn().getAccountId());
    testDto.setRequest(request);
    Log.whenJson(LOGGER, " get cli skeleton was successfully:\n", testDto.getRequest());
    return testDto;
}
Also used : StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)

Example 3 with StackV4Endpoint

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.StackV4Endpoint 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;
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier)

Example 4 with StackV4Endpoint

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.StackV4Endpoint in project cloudbreak by hortonworks.

the class StackCreateAction method action.

@Override
public StackTestDto action(TestContext testContext, StackTestDto testDto, CloudbreakClient client) throws Exception {
    Log.whenJson(LOGGER, " Stack create request: ", testDto.getRequest());
    StackV4Response response = client.getDefaultClient().stackV4Endpoint().post(client.getWorkspaceId(), testDto.getRequest(), testContext.getActingUserCrn().getAccountId());
    testDto.setResponse(response);
    testDto.setFlow("Stack create", response.getFlowIdentifier());
    Log.whenJson(LOGGER, " Stack create response ", response);
    return testDto;
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)

Example 5 with StackV4Endpoint

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.StackV4Endpoint in project cloudbreak by hortonworks.

the class ProvisionerServiceTest method startForcedStackDeletionStackFound.

@Test
void startForcedStackDeletionStackFound() {
    long clusterId = CLUSTER_ID.incrementAndGet();
    SdxCluster sdxCluster = generateValidSdxCluster(clusterId);
    when(sdxService.getById(clusterId)).thenReturn(sdxCluster);
    StackV4Response stackV4Response = new StackV4Response();
    stackV4Response.setStatus(Status.CREATE_FAILED);
    when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn:cdp:datahub:us-west-1:altus:user:__internal__actor__");
    when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
    underTest.startStackDeletion(clusterId, true);
    verify(stackV4Endpoint).deleteInternal(eq(0L), eq(null), eq(true), nullable(String.class));
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)8 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)7 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)4 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)3 ClusterV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response)2 NotFoundException (javax.ws.rs.NotFoundException)2 StackV4Endpoint (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.StackV4Endpoint)1 StackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)1 GeneratedBlueprintV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.GeneratedBlueprintV4Response)1 StackStatusV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackStatusV4Response)1 StackViewV4Responses (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Responses)1 AttachRecipeV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.recipe.AttachRecipeV4Response)1 RecoveryV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.recovery.RecoveryV4Response)1 StackCcmUpgradeV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.StackCcmUpgradeV4Response)1 CloudbreakClient (com.sequenceiq.cloudbreak.client.CloudbreakClient)1 PollingConfig (com.sequenceiq.datalake.service.sdx.PollingConfig)1 EnvironmentView (com.sequenceiq.environment.environment.domain.EnvironmentView)1 PollingConfig (com.sequenceiq.environment.util.PollingConfig)1 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1