Search in sources :

Example 1 with Stack

use of com.sequenceiq.cloudbreak.domain.stack.Stack in project cloudbreak by hortonworks.

the class StackOperations method updateNameAndCrn.

public void updateNameAndCrn(@NotNull NameOrCrn nameOrCrn, Long workspaceId, String newName, String newCrn) {
    Stack stack = stackService.getByNameOrCrnInWorkspace(nameOrCrn, workspaceId);
    stackUpdateService.updateNameAndCrn(stack, newName, newCrn);
}
Also used : Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 2 with Stack

use of com.sequenceiq.cloudbreak.domain.stack.Stack in project cloudbreak by hortonworks.

the class StackOperationService method start.

@VisibleForTesting
FlowIdentifier start(Stack stack, Cluster cluster, boolean updateCluster) {
    FlowIdentifier flowIdentifier = FlowIdentifier.notTriggered();
    environmentService.checkEnvironmentStatus(stack, EnvironmentStatus.startable());
    dataLakeStatusCheckerService.validateRunningState(stack);
    if (stack.isAvailable()) {
        eventService.fireCloudbreakEvent(stack.getId(), AVAILABLE.name(), STACK_START_IGNORED);
    } else if (stack.isReadyForStart() || stack.isStartFailed()) {
        Stack startStack = stackUpdater.updateStackStatus(stack.getId(), DetailedStackStatus.START_REQUESTED);
        flowIdentifier = flowManager.triggerStackStart(stack.getId());
        if (updateCluster && cluster != null) {
            clusterOperationService.updateStatus(startStack, StatusRequest.STARTED);
        }
    } else {
        throw NotAllowedStatusUpdate.stack(stack).to(DetailedStackStatus.START_REQUESTED).badRequest();
    }
    return flowIdentifier;
}
Also used : FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 3 with Stack

use of com.sequenceiq.cloudbreak.domain.stack.Stack in project cloudbreak by hortonworks.

the class ParcelSizeServiceTest method testGetAllParcelSizeShouldThrowExceptionWhenTheParcelSizeIsZero.

@Test(expected = CloudbreakException.class)
public void testGetAllParcelSizeShouldThrowExceptionWhenTheParcelSizeIsZero() throws CloudbreakException {
    Stack stack = new Stack();
    Set<String> parcelUrls = createParcelUrls();
    when(parcelUrlProvider.getRequiredParcelsFromImage(targetImage, stack)).thenReturn(parcelUrls);
    when(request.head()).thenReturn(response);
    when(response.getHeaderString("Content-Length")).thenReturn("0");
    underTest.getRequiredFreeSpace(targetImage, stack);
    verify(restClientFactory).getOrCreateDefault();
    verify(parcelUrlProvider).getRequiredParcelsFromImage(targetImage, stack);
    verify(paywallCredentialPopulator).populateWebTarget(any(), eq(webTarget));
}
Also used : Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.Test)

Example 4 with Stack

use of com.sequenceiq.cloudbreak.domain.stack.Stack in project cloudbreak by hortonworks.

the class ClusterUpgradeHandler method getRemoteDataContext.

private Optional<String> getRemoteDataContext(Stack stack) {
    Optional<String> remoteDataContext = Optional.empty();
    if (!stack.isDatalake() && StringUtils.isNotEmpty(stack.getDatalakeCrn())) {
        Stack datalake = stackService.getByCrn(stack.getDatalakeCrn());
        LOGGER.info("Fetch the Remote Data Context from {} to update the Data Hub", stack.getName());
        ClusterApi datalakeConnector = clusterApiConnectors.getConnector(datalake);
        remoteDataContext = Optional.of(datalakeConnector.getSdxContext());
    }
    return remoteDataContext;
}
Also used : ClusterApi(com.sequenceiq.cloudbreak.cluster.api.ClusterApi) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 5 with Stack

use of com.sequenceiq.cloudbreak.domain.stack.Stack in project cloudbreak by hortonworks.

the class RecipeEngineTest method testUploadUpscaleRecipesWithoutRecipe.

@Test
public void testUploadUpscaleRecipesWithoutRecipe() throws CloudbreakException {
    // GIVEN
    HostGroup hostGroup = new HostGroup();
    hostGroup.setName("worker");
    // WHEN
    recipeEngine.uploadUpscaleRecipes(stack(), Set.of(hostGroup), hostGroups());
    // THEN
    verify(orchestratorRecipeExecutor, times(0)).uploadRecipes(any(Stack.class), anyMap());
    verify(recipeTemplateService, times(0)).updateAllGeneratedRecipes(anySet(), anyMap());
}
Also used : HostGroup(com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test)

Aggregations

Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1041 Test (org.junit.jupiter.api.Test)326 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)255 Test (org.junit.Test)208 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)158 Map (java.util.Map)114 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)113 InstanceGroup (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)112 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)111 List (java.util.List)101 Set (java.util.Set)101 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)100 Collectors (java.util.stream.Collectors)84 Optional (java.util.Optional)83 HashSet (java.util.HashSet)82 Inject (javax.inject.Inject)80 Logger (org.slf4j.Logger)78 LoggerFactory (org.slf4j.LoggerFactory)78 DetailedStackStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus)69 StackStatus (com.sequenceiq.cloudbreak.domain.stack.StackStatus)67