Search in sources :

Example 1 with Tenant

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

the class UserServiceTest method createTenant.

private Tenant createTenant() {
    Tenant tenant = new Tenant();
    tenant.setName("tenantName");
    tenant.setWorkspaces(Sets.newHashSet(createWorkspace()));
    return tenant;
}
Also used : Tenant(com.sequenceiq.cloudbreak.workspace.model.Tenant)

Example 2 with Tenant

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

the class RdsConfigServiceTest method setUp.

@Before
public void setUp() {
    initMocks(this);
    defaultWorkspace = new Workspace();
    defaultWorkspace.setName("HortonWorkspace");
    defaultWorkspace.setId(1L);
    defaultWorkspace.setStatus(WorkspaceStatus.ACTIVE);
    defaultWorkspace.setDescription("This is a real Horton defaultWorkspace!");
    defaultWorkspace.setTenant(new Tenant());
    testRdsConfig = new RDSConfig();
    testRdsConfig.setId(1L);
    testRdsConfig.setName(TEST_RDS_CONFIG_NAME);
    doNothing().when(rdsConfigRepository).delete(any());
    when(userService.getOrCreate(any())).thenReturn(user);
    when(legacyRestRequestThreadLocalService.getCloudbreakUser()).thenReturn(cloudbreakUser);
    when(workspaceService.get(anyLong(), any())).thenReturn(defaultWorkspace);
}
Also used : Tenant(com.sequenceiq.cloudbreak.workspace.model.Tenant) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) Before(org.junit.Before)

Example 3 with Tenant

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

the class ClusterUpgradeAvailabilityServiceTest method createStack.

private Stack createStack(StackStatus stackStatus, StackType stackType) {
    Cluster cluster = new Cluster();
    cluster.setId(1L);
    Stack stack = new Stack();
    stack.setId(2L);
    stack.setCloudPlatform(CLOUD_PLATFORM);
    stack.setStackStatus(stackStatus);
    stack.setCluster(cluster);
    stack.setType(stackType);
    stack.setRegion(REGION);
    stack.setResourceCrn("crn:cdp:datahub:us-west-1:" + ACCOUNT_ID + ":cluster:cluster");
    Tenant t = new Tenant();
    t.setName(ACCOUNT_ID);
    User creator = new User();
    creator.setTenant(t);
    stack.setCreator(creator);
    Workspace workspace = new Workspace();
    workspace.setId(WORKSPACE_ID);
    stack.setWorkspace(workspace);
    return stack;
}
Also used : Tenant(com.sequenceiq.cloudbreak.workspace.model.Tenant) User(com.sequenceiq.cloudbreak.workspace.model.User) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace)

Example 4 with Tenant

use of com.sequenceiq.cloudbreak.workspace.model.Tenant 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 5 with Tenant

use of com.sequenceiq.cloudbreak.workspace.model.Tenant 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)

Aggregations

Tenant (com.sequenceiq.cloudbreak.workspace.model.Tenant)18 Workspace (com.sequenceiq.cloudbreak.workspace.model.Workspace)12 User (com.sequenceiq.cloudbreak.workspace.model.User)8 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)7 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)5 CloudbreakUser (com.sequenceiq.cloudbreak.common.user.CloudbreakUser)3 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)3 StackStatus (com.sequenceiq.cloudbreak.domain.stack.StackStatus)3 Before (org.junit.Before)3 GatewayTopology (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology)2 Test (org.junit.Test)2 DetailedStackStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus)1 NameOrCrn (com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn)1 CrnUser (com.sequenceiq.cloudbreak.auth.CrnUser)1 CloudCredential (com.sequenceiq.cloudbreak.cloud.model.CloudCredential)1 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)1 Json (com.sequenceiq.cloudbreak.common.json.Json)1 TransactionExecutionException (com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionExecutionException)1 TransactionRuntimeExecutionException (com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException)1 StackImageUpdateTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.StackImageUpdateTriggerEvent)1