Search in sources :

Example 16 with Status

use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status 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 17 with Status

use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status 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 18 with Status

use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status 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 19 with Status

use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status in project cloudbreak by hortonworks.

the class DatahubPollerServiceTest method getStackView.

private StackViewV4Response getStackView(Status status) {
    StackViewV4Response stack = new StackViewV4Response();
    stack.setCrn(STACK_CRN);
    stack.setStatus(status);
    return stack;
}
Also used : StackViewV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response)

Example 20 with Status

use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status in project cloudbreak by hortonworks.

the class DistroXV1RequestToStackV4RequestConverterTest method testStackV4RequestToDistroXV1RequestRegardlessOfTheStateOfTheEnvironment.

@ParameterizedTest
@EnumSource(EnvironmentStatus.class)
void testStackV4RequestToDistroXV1RequestRegardlessOfTheStateOfTheEnvironment(EnvironmentStatus status) {
    StackV4Request source = new StackV4Request();
    source.setName("SomeStack");
    source.setEnvironmentCrn("SomeEnvCrn");
    DetailedEnvironmentResponse env = createAwsEnvironment();
    env.setCrn(source.getEnvironmentCrn());
    env.setEnvironmentStatus(status);
    when(environmentClientService.getByCrn(source.getEnvironmentCrn())).thenReturn(env);
    DistroXV1Request result = assertDoesNotThrow(() -> underTest.convert(source));
    verify(environmentClientService, times(1)).getByCrn(any());
    verify(environmentClientService, times(1)).getByCrn(source.getEnvironmentCrn());
    Assertions.assertEquals(env.getName(), result.getEnvironmentName());
}
Also used : StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) DistroXV1Request(com.sequenceiq.distrox.api.v1.distrox.model.DistroXV1Request) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

DetailedStackStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus)23 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)22 Status (com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status)18 StackStatus (com.sequenceiq.cloudbreak.domain.stack.StackStatus)12 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)10 Logger (org.slf4j.Logger)10 LoggerFactory (org.slf4j.LoggerFactory)10 StackStatusV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackStatusV4Response)9 InstanceStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus)7 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)7 Map (java.util.Map)7 Collectors (java.util.stream.Collectors)7 CloudVmInstanceStatus (com.sequenceiq.cloudbreak.cloud.model.CloudVmInstanceStatus)6 Collection (java.util.Collection)6 List (java.util.List)6 Set (java.util.Set)6 Inject (javax.inject.Inject)6 PollerStoppedException (com.dyngr.exception.PollerStoppedException)5 ClusterV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response)5 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)5