use of com.sequenceiq.cloudbreak.domain.view.StackApiView in project cloudbreak by hortonworks.
the class StackApiViewServiceTest method testCanChangeCredentialWithNullStatus.
@Test
public void testCanChangeCredentialWithNullStatus() {
StackApiView stackApiView = new StackApiView();
stackApiView.setStackStatus(null);
boolean result = stackApiViewService.canChangeCredential(stackApiView);
assertFalse(result);
}
use of com.sequenceiq.cloudbreak.domain.view.StackApiView 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);
}
use of com.sequenceiq.cloudbreak.domain.view.StackApiView 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);
}
use of com.sequenceiq.cloudbreak.domain.view.StackApiView in project cloudbreak by hortonworks.
the class StackOperations method getForInternalCrn.
public StackViewV4Response getForInternalCrn(NameOrCrn nameOrCrn, StackType stackType) {
LOGGER.info("Validate stack against internal user.");
StackApiView stackApiView = stackApiViewService.retrieveStackByCrnAndType(nameOrCrn.getCrn(), stackType);
LOGGER.info("Query Stack (view) successfully finished with crn {}", nameOrCrn.getCrn());
StackViewV4Response stackViewV4Response = stackApiViewToStackViewV4ResponseConverter.convert(stackApiView);
LOGGER.info("Adding environment name to the response.");
environmentServiceDecorator.prepareEnvironment(stackViewV4Response);
return stackViewV4Response;
}
use of com.sequenceiq.cloudbreak.domain.view.StackApiView 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;
}
Aggregations