Search in sources :

Example 1 with Workspace

use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.

the class WorkspaceConfigurationFilterTest method createWorkspace.

private Workspace createWorkspace() {
    Workspace workspace = new Workspace();
    workspace.setId(1L);
    return workspace;
}
Also used : Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace)

Example 2 with Workspace

use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.

the class ClusterDecoratorTest method testAutoTlsSettingByParentEnvironmentCloudPlatform.

@Test
void testAutoTlsSettingByParentEnvironmentCloudPlatform() {
    Cluster expectedClusterInstance = new Cluster();
    Blueprint blueprint = getBlueprint();
    when(sharedServiceConfigProvider.configureCluster(any(Cluster.class), any(User.class), any(Workspace.class))).thenReturn(expectedClusterInstance);
    ArgumentCaptor<Platform> platformArgumentCaptor = ArgumentCaptor.forClass(Platform.class);
    when(cloudPlatformConnectors.get(platformArgumentCaptor.capture(), any())).thenReturn(connector);
    when(embeddedDatabaseService.isEmbeddedDatabaseOnAttachedDiskEnabled(stack, expectedClusterInstance)).thenReturn(false);
    String platform = CloudPlatform.YARN.name();
    underTest.decorate(expectedClusterInstance, createClusterV4Request(), blueprint, user, new Workspace(), stack, platform);
    assertEquals(platform, platformArgumentCaptor.getValue().value());
}
Also used : User(com.sequenceiq.cloudbreak.workspace.model.User) CloudPlatform(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform) Platform(com.sequenceiq.cloudbreak.cloud.model.Platform) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with Workspace

use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.

the class InstanceGroupV4RequestToHostGroupConverter method convert.

public HostGroup convert(InstanceGroupV4Request source) {
    HostGroup hostGroup = new HostGroup();
    hostGroup.setName(source.getName().toLowerCase());
    hostGroup.setRecoveryMode(source.getRecoveryMode());
    Set<String> recipeNames = source.getRecipeNames();
    if (!CollectionUtils.isEmpty(recipeNames)) {
        CloudbreakUser cloudbreakUser = restRequestThreadLocalService.getCloudbreakUser();
        User user = userService.getOrCreate(cloudbreakUser);
        Workspace workspace = workspaceService.get(restRequestThreadLocalService.getRequestedWorkspaceId(), user);
        hostGroup.setRecipes(recipeService.getRecipesByNamesForWorkspace(workspace, recipeNames));
    }
    return hostGroup;
}
Also used : User(com.sequenceiq.cloudbreak.workspace.model.User) CloudbreakUser(com.sequenceiq.cloudbreak.common.user.CloudbreakUser) HostGroup(com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup) CloudbreakUser(com.sequenceiq.cloudbreak.common.user.CloudbreakUser) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace)

Example 4 with Workspace

use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.

the class BlueprintService method updateDefaultBlueprintCollection.

public void updateDefaultBlueprintCollection(Long workspaceId) {
    User user = getLoggedInUser();
    Workspace workspace = getWorkspaceService().get(workspaceId, user);
    updateDefaultBlueprintCollection(workspace);
}
Also used : User(com.sequenceiq.cloudbreak.workspace.model.User) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace)

Example 5 with Workspace

use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.

the class BlueprintService method getAllAvailableViewInWorkspaceAndFilterBySdxReady.

public Set<BlueprintView> getAllAvailableViewInWorkspaceAndFilterBySdxReady(Long workspaceId, Boolean withSdx) {
    User user = getLoggedInUser();
    Workspace workspace = getWorkspaceService().get(workspaceId, user);
    updateDefaultBlueprintCollection(workspace);
    Set<BlueprintView> allByNotDeletedInWorkspace = blueprintViewRepository.findAllByNotDeletedInWorkspace(workspaceId);
    allByNotDeletedInWorkspace = allByNotDeletedInWorkspace.stream().filter(b -> blueprintListFilters.isDistroXDisplayed(b)).collect(Collectors.toSet());
    if (withSdx) {
        return allByNotDeletedInWorkspace;
    }
    return allByNotDeletedInWorkspace.stream().filter(it -> !blueprintListFilters.isDatalakeBlueprint(it)).collect(Collectors.toSet());
}
Also used : LoggerFactory(org.slf4j.LoggerFactory) ClusterService(com.sequenceiq.cloudbreak.service.cluster.ClusterService) StringUtils(org.apache.commons.lang3.StringUtils) ThreadBasedUserCrnProvider(com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider) TransactionService(com.sequenceiq.cloudbreak.common.service.TransactionService) CdpResourceType(com.sequenceiq.common.api.type.CdpResourceType) Pair(org.apache.commons.lang3.tuple.Pair) Map(java.util.Map) AuthorizationResourceType(com.sequenceiq.authorization.resource.AuthorizationResourceType) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) NotFoundException(com.sequenceiq.cloudbreak.common.exception.NotFoundException) EnumSet(java.util.EnumSet) CloudResourceAdvisor(com.sequenceiq.cloudbreak.service.stack.CloudResourceAdvisor) ConstraintViolationException(org.hibernate.exception.ConstraintViolationException) FieldError(org.springframework.validation.FieldError) WorkspaceResourceRepository(com.sequenceiq.cloudbreak.workspace.repository.workspace.WorkspaceResourceRepository) Collection(java.util.Collection) BlueprintView(com.sequenceiq.cloudbreak.domain.view.BlueprintView) Set(java.util.Set) DELETE_COMPLETED(com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status.DELETE_COMPLETED) NotNull(javax.validation.constraints.NotNull) Crn(com.sequenceiq.cloudbreak.auth.crn.Crn) Collectors(java.util.stream.Collectors) DEFAULT(com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus.DEFAULT) SERVICE_MANAGED(com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus.SERVICE_MANAGED) List(java.util.List) CmCloudStorageConfigProvider(com.sequenceiq.cloudbreak.cmtemplate.cloudstorage.CmCloudStorageConfigProvider) MapBindingResult(org.springframework.validation.MapBindingResult) MDCUtils(com.sequenceiq.cloudbreak.logger.MDCUtils) ConfigQueryEntry(com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntry) Optional(java.util.Optional) HueWorkaroundValidatorService(com.sequenceiq.cloudbreak.validation.HueWorkaroundValidatorService) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) BlueprintStatusView(com.sequenceiq.cloudbreak.domain.projection.BlueprintStatusView) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) PlatformRecommendation(com.sequenceiq.cloudbreak.cloud.model.PlatformRecommendation) ResourceStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus) ScaleRecommendation(com.sequenceiq.cloudbreak.cloud.model.ScaleRecommendation) BlueprintRepository(com.sequenceiq.cloudbreak.repository.BlueprintRepository) OwnerAssignmentService(com.sequenceiq.authorization.service.OwnerAssignmentService) MDCBuilder(com.sequenceiq.cloudbreak.logger.MDCBuilder) HashMap(java.util.HashMap) CompositeAuthResourcePropertyProvider(com.sequenceiq.authorization.service.CompositeAuthResourcePropertyProvider) BlueprintViewRepository(com.sequenceiq.cloudbreak.repository.BlueprintViewRepository) USER_MANAGED(com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus.USER_MANAGED) HashSet(java.util.HashSet) Inject(javax.inject.Inject) CrnResourceDescriptor(com.sequenceiq.cloudbreak.auth.crn.CrnResourceDescriptor) HueRoles(com.sequenceiq.cloudbreak.cmtemplate.configproviders.hue.HueRoles) ObjectUtils(org.apache.commons.lang3.ObjectUtils) Service(org.springframework.stereotype.Service) FileSystemConfigQueryObject(com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject) Builder(com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject.Builder) CentralBlueprintParameterQueryService(com.sequenceiq.cloudbreak.cmtemplate.CentralBlueprintParameterQueryService) NotFoundException.notFound(com.sequenceiq.cloudbreak.common.exception.NotFoundException.notFound) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Logger(org.slf4j.Logger) AutoscaleRecommendation(com.sequenceiq.cloudbreak.cloud.model.AutoscaleRecommendation) BlueprintLoaderService(com.sequenceiq.cloudbreak.init.blueprint.BlueprintLoaderService) DEFAULT_DELETED(com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus.DEFAULT_DELETED) RegionAwareCrnGenerator(com.sequenceiq.cloudbreak.auth.crn.RegionAwareCrnGenerator) CompactView(com.sequenceiq.cloudbreak.domain.view.CompactView) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) NameOrCrn(com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn) ClusterTemplateViewService(com.sequenceiq.cloudbreak.service.template.ClusterTemplateViewService) User(com.sequenceiq.cloudbreak.workspace.model.User) BlueprintUtils(com.sequenceiq.cloudbreak.cmtemplate.utils.BlueprintUtils) StackType(com.sequenceiq.cloudbreak.api.endpoint.v4.common.StackType) AbstractWorkspaceAwareResourceService(com.sequenceiq.cloudbreak.service.AbstractWorkspaceAwareResourceService) User(com.sequenceiq.cloudbreak.workspace.model.User) BlueprintView(com.sequenceiq.cloudbreak.domain.view.BlueprintView) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace)

Aggregations

Workspace (com.sequenceiq.cloudbreak.workspace.model.Workspace)75 User (com.sequenceiq.cloudbreak.workspace.model.User)26 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)24 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)18 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)17 Tenant (com.sequenceiq.cloudbreak.workspace.model.Tenant)12 CloudbreakUser (com.sequenceiq.cloudbreak.common.user.CloudbreakUser)9 Test (org.junit.jupiter.api.Test)9 HashMap (java.util.HashMap)8 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)7 Before (org.junit.Before)7 Test (org.junit.Test)5 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)5 StackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)4 Json (com.sequenceiq.cloudbreak.common.json.Json)4 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)4 StackStatus (com.sequenceiq.cloudbreak.domain.stack.StackStatus)4 ClusterTemplate (com.sequenceiq.cloudbreak.domain.stack.cluster.ClusterTemplate)4 HashSet (java.util.HashSet)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)4