Search in sources :

Example 21 with StackV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response 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 22 with StackV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response 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 23 with StackV4Response

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

the class DatalakeServiceTest method testAddSharedServiceResponseWhenDatalakeCrnIsNotNullAndDatalakeIsMissing.

@Test
public void testAddSharedServiceResponseWhenDatalakeCrnIsNotNullAndDatalakeIsMissing() {
    lenient().when(stackService.getResourceBasicViewByResourceCrn(anyString())).thenReturn(Optional.empty());
    Stack source = new Stack();
    source.setDatalakeCrn("crn");
    StackV4Response x = new StackV4Response();
    underTest.addSharedServiceResponse(source, x);
    verify(stackService, times(1)).getResourceBasicViewByResourceCrn("crn");
    assertNull(x.getSharedService().getSharedClusterId());
    assertNull(x.getSharedService().getSharedClusterName());
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test)

Example 24 with StackV4Response

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

the class DatalakeServiceTest method testAddSharedServiceResponseWhenDatalakeCrnIsNull.

@Test
public void testAddSharedServiceResponseWhenDatalakeCrnIsNull() {
    Stack source = new Stack();
    source.setDatalakeCrn(null);
    StackV4Response x = new StackV4Response();
    underTest.addSharedServiceResponse(source, x);
    verify(stackService, never()).getByCrnOrElseNull("crn");
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test)

Example 25 with StackV4Response

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

the class DatahubPollerProviderTest method testStartDistroXPoller.

@ParameterizedTest
@MethodSource("distroxStartStatuses")
void testStartDistroXPoller(Status s1Status, Status c1Status, Status s2Status, Status c2Status, AttemptState attemptState, String message, List<String> remaining) throws Exception {
    List<String> pollingCrn = new ArrayList<>();
    pollingCrn.add("crn1");
    pollingCrn.add("crn2");
    StackV4Response stack1 = getStackV4Response(s1Status, c1Status, "crn1");
    StackV4Response stack2 = getStackV4Response(s2Status, c2Status, "crn2");
    Mockito.when(datahubService.getByCrn("crn1", Collections.emptySet())).thenReturn(stack1);
    Mockito.when(datahubService.getByCrn("crn2", Collections.emptySet())).thenReturn(stack2);
    AttemptResult<Void> result = underTest.startDatahubClustersPoller(pollingCrn, ENV_ID).process();
    assertEquals(attemptState, result.getState());
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) ArrayList(java.util.ArrayList) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)101 Test (org.junit.jupiter.api.Test)26 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)22 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)19 ClusterV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response)14 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)13 Test (org.junit.Test)12 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)11 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)8 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)8 MockedTestContext (com.sequenceiq.it.cloudbreak.context.MockedTestContext)7 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)7 DistroXTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto)7 ArrayList (java.util.ArrayList)7 Test (org.testng.annotations.Test)7 InstanceGroupV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response)6 TagsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.tags.TagsV4Response)6 TransactionExecutionException (com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionExecutionException)6 TransactionRuntimeExecutionException (com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException)6 BaseDiagnosticsCollectionRequest (com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest)6