use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response in project cloudbreak by hortonworks.
the class UpgradePreconditionServiceTest method createStackResponse.
private StackViewV4Response createStackResponse(Status stackStatus, String stackName, String stackCrn) {
StackViewV4Response dataHubStack = new StackViewV4Response();
dataHubStack.setStatus(stackStatus);
dataHubStack.setName(stackName);
dataHubStack.setCrn(stackCrn);
return dataHubStack;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response in project cloudbreak by hortonworks.
the class UpgradeServiceTest method upgradeAllowedWhenConnectedDataHubStackAndClusterStoppedOrDeleted.
@Test
public void upgradeAllowedWhenConnectedDataHubStackAndClusterStoppedOrDeleted() throws CloudbreakImageNotFoundException, CloudbreakImageCatalogException {
Stack stack = getStack();
Image image = getImage("id-1");
setUpMocks(stack, image, true, "id-1", "id-2");
Result<Map<HostGroupName, Set<InstanceMetaData>>, RepairValidation> repairStartResult = Result.success(new HashMap<>());
when(clusterRepairService.repairWithDryRun(1L)).thenReturn(repairStartResult);
StackViewV4Response datahubStack1 = new StackViewV4Response();
datahubStack1.setStatus(Status.STOPPED);
ClusterViewV4Response datahubCluster1 = new ClusterViewV4Response();
datahubCluster1.setStatus(Status.STOPPED);
datahubStack1.setCluster(datahubCluster1);
StackViewV4Response datahubStack2 = new StackViewV4Response();
datahubStack2.setStatus(Status.DELETE_COMPLETED);
ClusterViewV4Response datahubCluster2 = new ClusterViewV4Response();
datahubCluster2.setStatus(Status.DELETE_COMPLETED);
datahubStack2.setCluster(datahubCluster2);
StackViewV4Response datahubStack3 = new StackViewV4Response();
datahubStack3.setStatus(Status.STOPPED);
when(distroXV1Endpoint.list(any(), anyString())).thenReturn(new StackViewV4Responses(Set.of(datahubStack1, datahubStack2, datahubStack3)));
when(stackService.getByNameOrCrnInWorkspace(eq(ofName), eq(WORKSPACE_ID))).thenReturn(stack);
UpgradeOptionV4Response result = underTest.getOsUpgradeOptionByStackNameOrCrn(WORKSPACE_ID, ofName, user);
verify(clusterRepairService).repairWithDryRun(eq(stack.getId()));
verify(distroXV1Endpoint).list(eq(null), eq("env-crn"));
verify(componentConfigProviderService).getImage(1L);
verify(imageService).determineImageFromCatalog(eq(WORKSPACE_ID), captor.capture(), eq("aws"), eq("AWS"), eq(stack.getCluster().getBlueprint()), eq(false), eq(false), eq(user), any());
assertThat(result.getUpgrade().getImageName()).isEqualTo("id-2");
assertThat(result.getReason()).isEqualTo(null);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response in project cloudbreak by hortonworks.
the class DatahubPollerServiceTest method testStopAttachedDatahubWhenDatahubIsAvailable.
@Test
void testStopAttachedDatahubWhenDatahubIsAvailable() {
StackViewV4Response stackView = getStackView(Status.AVAILABLE);
when(datahubService.list(ENV_CRN)).thenReturn(new StackViewV4Responses(Set.of(stackView)));
when(datahubService.getByCrn(anyString(), anySet())).thenReturn(getStack(Status.AVAILABLE), getStack(Status.AVAILABLE), getStack(Status.STOPPED));
underTest.stopAttachedDatahubClusters(ENV_ID, ENV_CRN);
verify(datahubService, times(1)).putStopByCrns(eq(ENV_CRN), anyList());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response in project cloudbreak by hortonworks.
the class DatahubPollerServiceTest method testStartAttachedDatahubWhenDatahubIsStopped.
@Test
void testStartAttachedDatahubWhenDatahubIsStopped() {
StackViewV4Response stackView = getStackView(Status.STOPPED);
when(datahubService.list(ENV_CRN)).thenReturn(new StackViewV4Responses(Set.of(stackView)));
when(datahubService.getByCrn(anyString(), anySet())).thenReturn(getStack(Status.STOPPED), getStack(Status.STOPPED), getStack(Status.AVAILABLE));
underTest.startAttachedDatahubClusters(ENV_ID, ENV_CRN);
verify(datahubService, times(1)).putStartByCrns(eq(ENV_CRN), anyList());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response 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;
}
Aggregations