Search in sources :

Example 26 with Workspace

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

the class ServiceEndpointCollectorTest method clusterkWithOrchestrator.

private Cluster clusterkWithOrchestrator(String orchestratorType) {
    Cluster cluster = new Cluster();
    Stack stack = new Stack();
    Orchestrator orchestrator = new Orchestrator();
    orchestrator.setType(orchestratorType);
    Gateway gateway = new Gateway();
    gateway.setPath(GATEWAY_PATH);
    stack.setOrchestrator(orchestrator);
    cluster.setStack(stack);
    cluster.setGateway(gateway);
    Blueprint blueprint = new Blueprint();
    Workspace workspace = new Workspace();
    Tenant tenant = new Tenant();
    tenant.setName("tenant");
    workspace.setTenant(tenant);
    cluster.setWorkspace(workspace);
    try {
        String testBlueprint = FileReaderUtils.readFileFromClasspath("/test/defaults/blueprints/hdp26-data-science-spark2-text.bp");
        blueprint.setBlueprintText(testBlueprint);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    cluster.setBlueprint(blueprint);
    return cluster;
}
Also used : Tenant(com.sequenceiq.cloudbreak.workspace.model.Tenant) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) IOException(java.io.IOException) Orchestrator(com.sequenceiq.cloudbreak.domain.Orchestrator) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace)

Example 27 with Workspace

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

the class ClusterDecoratorTest method testDecorateIfMethodCalledThenSharedServiceConfigProviderShouldBeCalledOnceToConfigureTheCluster.

@Test
void testDecorateIfMethodCalledThenSharedServiceConfigProviderShouldBeCalledOnceToConfigureTheCluster() {
    Cluster expectedClusterInstance = new Cluster();
    Blueprint blueprint = getBlueprint();
    when(sharedServiceConfigProvider.configureCluster(any(Cluster.class), any(User.class), any(Workspace.class))).thenReturn(expectedClusterInstance);
    when(embeddedDatabaseService.isEmbeddedDatabaseOnAttachedDiskEnabled(stack, expectedClusterInstance)).thenReturn(false);
    Cluster result = underTest.decorate(expectedClusterInstance, createClusterV4Request(), blueprint, user, new Workspace(), stack);
    assertEquals(expectedClusterInstance, result);
    verify(sharedServiceConfigProvider, times(1)).configureCluster(any(Cluster.class), any(User.class), any(Workspace.class));
}
Also used : User(com.sequenceiq.cloudbreak.workspace.model.User) 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)

Example 28 with Workspace

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

the class ScheduledLifetimeCheckerTest method testValidateWhenClusterNotExceededByTTLMoreThanRunningTime.

@Test
public void testValidateWhenClusterNotExceededByTTLMoreThanRunningTime() {
    StackTtlViewImpl stack = new StackTtlViewImpl();
    stack.setId(STACK_ID);
    Workspace workspace = new Workspace();
    Tenant tenant = new Tenant();
    tenant.setName("tenant");
    workspace.setTenant(tenant);
    workspace.setName("workspace");
    stack.setWorkspace(workspace);
    StackStatus stackStatus = new StackStatus();
    stackStatus.setStatus(Status.AVAILABLE);
    stack.setStatus(stackStatus);
    when(stackService.getAllAlive()).thenReturn(Collections.singletonList(stack));
    underTest.validate();
    verify(flowManager, times(0)).triggerTermination(stack.getId());
}
Also used : Tenant(com.sequenceiq.cloudbreak.workspace.model.Tenant) StackStatus(com.sequenceiq.cloudbreak.domain.stack.StackStatus) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) Test(org.junit.Test)

Example 29 with Workspace

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

the class ImageServiceTest method getImageCatalog.

private ImageCatalog getImageCatalog() {
    ImageCatalog imageCatalog = new ImageCatalog();
    imageCatalog.setImageCatalogUrl(CUSTOM_IMAGE_CATALOG_URL);
    imageCatalog.setName("default");
    Workspace ws = new Workspace();
    ws.setId(ORG_ID);
    imageCatalog.setWorkspace(ws);
    imageCatalog.setCreator("someone");
    imageCatalog.setResourceCrn("someCrn");
    return imageCatalog;
}
Also used : ImageCatalog(com.sequenceiq.cloudbreak.domain.ImageCatalog) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace)

Example 30 with Workspace

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

the class StackOperations method post.

public StackV4Response post(Long workspaceId, CloudbreakUser cloudbreakUser, @Valid StackV4Request request, boolean distroxRequest) {
    LOGGER.info("Post for Stack in workspace {}.", workspaceId);
    User user = userService.getOrCreate(cloudbreakUser);
    LOGGER.info("Cloudbreak user for the requested stack is {}.", cloudbreakUser);
    Workspace workspace = workspaceService.get(workspaceId, user);
    StackV4Response stackV4Response = stackCommonService.createInWorkspace(request, user, workspace, distroxRequest);
    LOGGER.info("Adding environment name and credential to the response.");
    environmentServiceDecorator.prepareEnvironmentAndCredentialName(stackV4Response);
    LOGGER.info("Adding SDX CRN and name to the response.");
    sdxServiceDecorator.prepareSdxAttributes(stackV4Response);
    return stackV4Response;
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) CloudbreakUser(com.sequenceiq.cloudbreak.common.user.CloudbreakUser) User(com.sequenceiq.cloudbreak.workspace.model.User) 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