Search in sources :

Example 26 with StackV4Response

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

the class DatahubPollerProviderTest method testStopDistroXPoller.

@ParameterizedTest
@MethodSource("distroxStopStatuses")
void testStopDistroXPoller(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.stopDatahubClustersPoller(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)

Example 27 with StackV4Response

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

the class DatahubPollerProviderTest method getStackV4Response.

private StackV4Response getStackV4Response(Status status, Status clusterStatus, String crn) {
    StackV4Response stack1 = new StackV4Response();
    stack1.setStatus(status);
    ClusterV4Response cluster = new ClusterV4Response();
    cluster.setStatus(clusterStatus);
    cluster.setName(crn);
    cluster.setStatusReason("cluster reason");
    stack1.setCluster(cluster);
    stack1.setName(crn);
    stack1.setCrn(crn);
    stack1.setStatusReason("reason");
    return stack1;
}
Also used : ClusterV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)

Example 28 with StackV4Response

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

the class DatahubPollerServiceTest method getStack.

private StackV4Response getStack(Status status) {
    StackV4Response stack = new StackV4Response();
    stack.setStatus(status);
    stack.setCrn(STACK_CRN);
    ClusterV4Response cluster = new ClusterV4Response();
    cluster.setStatus(status);
    stack.setCluster(cluster);
    return stack;
}
Also used : ClusterV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)

Example 29 with StackV4Response

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

the class StackResponseHardwareInfoProviderTest method testProviderEntriesToStackResponseClusterNotNullButFQDNNull.

@Test
public void testProviderEntriesToStackResponseClusterNotNullButFQDNNull() {
    Stack stack = new Stack();
    InstanceMetaData instanceMetaData = new InstanceMetaData();
    stack.setInstanceGroups(getInstanceGroups(instanceMetaData));
    StackV4Response actual = underTest.providerEntriesToStackResponse(stack, new StackV4Response());
    Assert.assertEquals(1L, actual.getHardwareInfoGroups().size());
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.Test)

Example 30 with StackV4Response

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

the class StackOperationsTest method testGetWhenNameOrCrnCrnFilledThenProperGetCalled.

@Test
public void testGetWhenNameOrCrnCrnFilledThenProperGetCalled() {
    StackV4Response expected = stackResponse();
    NameOrCrn nameOrCrn = NameOrCrn.ofCrn(stack.getResourceCrn());
    when(stackCommonService.findStackByNameOrCrnAndWorkspaceId(nameOrCrn, stack.getWorkspace().getId(), STACK_ENTRIES, STACK_TYPE)).thenReturn(expected);
    StackV4Response result = underTest.get(nameOrCrn, stack.getWorkspace().getId(), STACK_ENTRIES, STACK_TYPE);
    assertEquals(expected, result);
    verify(stackCommonService, times(1)).findStackByNameOrCrnAndWorkspaceId(nameOrCrn, stack.getWorkspace().getId(), STACK_ENTRIES, STACK_TYPE);
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) NameOrCrn(com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn) Test(org.junit.Test)

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