Search in sources :

Example 1 with StackStatusView

use of com.sequenceiq.cloudbreak.domain.view.StackStatusView in project cloudbreak by hortonworks.

the class DistroXServiceTest method createDlStackView.

private StackView createDlStackView(Status status) throws IllegalAccessException {
    StackView stack = new StackView();
    stack.setType(StackType.DATALAKE);
    StackStatusView stackStatusView = new StackStatusView();
    stackStatusView.setStatus(status);
    FieldUtils.writeField(stack, "stackStatus", stackStatusView, true);
    return stack;
}
Also used : StackStatusView(com.sequenceiq.cloudbreak.domain.view.StackStatusView) StackView(com.sequenceiq.cloudbreak.domain.view.StackView)

Example 2 with StackStatusView

use of com.sequenceiq.cloudbreak.domain.view.StackStatusView in project cloudbreak by hortonworks.

the class StackApiViewServiceTest method testCanChangeCredentialWithStatusIsNotAvailable.

@Test
public void testCanChangeCredentialWithStatusIsNotAvailable() {
    StackApiView stackApiView = new StackApiView();
    StackStatusView stackStatusView = Mockito.mock(StackStatusView.class);
    when(stackStatusView.getStatus()).thenReturn(Status.CREATE_IN_PROGRESS);
    stackApiView.setStackStatus(stackStatusView);
    boolean result = stackApiViewService.canChangeCredential(stackApiView);
    assertFalse(result);
}
Also used : StackApiView(com.sequenceiq.cloudbreak.domain.view.StackApiView) StackStatusView(com.sequenceiq.cloudbreak.domain.view.StackStatusView) Test(org.junit.Test)

Example 3 with StackStatusView

use of com.sequenceiq.cloudbreak.domain.view.StackStatusView in project cloudbreak by hortonworks.

the class StackApiViewServiceTest method testCanChangeCredentialWithOngoingFlowOperation.

@Test
public void testCanChangeCredentialWithOngoingFlowOperation() {
    Long stackId = 1L;
    StackApiView stackApiView = new StackApiView();
    stackApiView.setId(stackId);
    StackStatusView stackStatusView = Mockito.mock(StackStatusView.class);
    when(stackStatusView.getStatus()).thenReturn(Status.AVAILABLE);
    stackApiView.setStackStatus(stackStatusView);
    when(flowLogService.isOtherNonTerminationFlowRunning(stackId)).thenReturn(true);
    boolean result = stackApiViewService.canChangeCredential(stackApiView);
    assertFalse(result);
}
Also used : StackApiView(com.sequenceiq.cloudbreak.domain.view.StackApiView) StackStatusView(com.sequenceiq.cloudbreak.domain.view.StackStatusView) Test(org.junit.Test)

Example 4 with StackStatusView

use of com.sequenceiq.cloudbreak.domain.view.StackStatusView in project cloudbreak by hortonworks.

the class StackListItemToStackApiViewConverter method convert.

public StackApiView convert(StackListItem item, Map<Long, Integer> stackInstanceCounts, List<HostGroupView> hostGroupViews) {
    StackApiView response = new StackApiView();
    response.setId(item.getId());
    response.setResourceCrn(item.getResourceCrn());
    response.setName(item.getName());
    response.setCloudPlatform(item.getCloudPlatform());
    response.setPlatformVariant(item.getPlatformVariant());
    response.setCreated(item.getCreated());
    StackStatusView stackStatusView = new StackStatusView();
    stackStatusView.setStatus(item.getStackStatus());
    response.setStackStatus(stackStatusView);
    response.setCluster(getClusterApiView(item, hostGroupViews));
    response.setNodeCount(stackInstanceCounts.get(item.getId()));
    response.setTunnel(item.getTunnel());
    response.setEnvironmentCrn(item.getEnvironmentCrn());
    response.setType(item.getType());
    response.setDatalakeCrn(item.getDatalakeCrn());
    response.setUserView(getUserView(item));
    response.setTerminated(item.getTerminated());
    response.setStackVersion(item.getStackVersion());
    response.getCluster().setStack(response);
    return response;
}
Also used : StackApiView(com.sequenceiq.cloudbreak.domain.view.StackApiView) StackStatusView(com.sequenceiq.cloudbreak.domain.view.StackStatusView)

Example 5 with StackStatusView

use of com.sequenceiq.cloudbreak.domain.view.StackStatusView in project cloudbreak by hortonworks.

the class StackStartStopServiceTest method stackViewWithStatus.

private static StackView stackViewWithStatus(Status status) {
    StackStatusView stackStatusView = new StackStatusView();
    stackStatusView.setStatus(status);
    return new StackView(10L, "stackview", "platform", stackStatusView);
}
Also used : StackStatusView(com.sequenceiq.cloudbreak.domain.view.StackStatusView) StackView(com.sequenceiq.cloudbreak.domain.view.StackView)

Aggregations

StackStatusView (com.sequenceiq.cloudbreak.domain.view.StackStatusView)7 StackApiView (com.sequenceiq.cloudbreak.domain.view.StackApiView)4 StackView (com.sequenceiq.cloudbreak.domain.view.StackView)3 Test (org.junit.Test)3 ClusterView (com.sequenceiq.cloudbreak.domain.view.ClusterView)1