Search in sources :

Example 16 with Tenant

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

the class StackValidatorTest method entitlementMock.

private void entitlementMock(Stack stack, boolean enabled) {
    Tenant tenant = new Tenant();
    tenant.setName("tenant1");
    User user = new User();
    user.setTenant(tenant);
    stack.setCreator(user);
    when(entitlementService.awsNativeEnabled(anyString())).thenReturn(enabled);
}
Also used : Tenant(com.sequenceiq.cloudbreak.workspace.model.Tenant) User(com.sequenceiq.cloudbreak.workspace.model.User)

Example 17 with Tenant

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

the class CloudResourceAdvisorTest method createBlueprint.

private Blueprint createBlueprint() {
    Blueprint blueprint = new Blueprint();
    Workspace workspace = new Workspace();
    Tenant tenant = new Tenant();
    tenant.setName("tenant");
    workspace.setTenant(tenant);
    blueprint.setWorkspace(workspace);
    blueprint.setBlueprintText("{\"Blueprints\":{123:2}}");
    return blueprint;
}
Also used : Tenant(com.sequenceiq.cloudbreak.workspace.model.Tenant) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace)

Example 18 with Tenant

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

the class ScheduledLifetimeCheckerTest method testValidateWhenClusterExceededByRunningTimeMoreThanTTL.

@Test
public void testValidateWhenClusterExceededByRunningTimeMoreThanTTL() {
    StackTtlViewImpl stack = new StackTtlViewImpl();
    stack.setId(STACK_ID);
    long startTimeMillis = 0;
    stack.setCreationFinished(startTimeMillis);
    Workspace workspace = new Workspace();
    Tenant tenant = new Tenant();
    tenant.setName("tenant");
    workspace.setTenant(tenant);
    workspace.setName("workspace");
    stack.setWorkspace(workspace);
    int ttlMillis = 1;
    StackStatus stackStatus = new StackStatus();
    stackStatus.setStatus(Status.AVAILABLE);
    stack.setStatus(stackStatus);
    when(stackService.getAllAlive()).thenReturn(Collections.singletonList(stack));
    when(stackService.getTtlValueForStack(anyLong())).thenReturn(Optional.of(Duration.ofMillis(ttlMillis)));
    when(clock.getCurrentTimeMillis()).thenReturn(startTimeMillis + ttlMillis + 1);
    underTest.validate();
    verify(flowManager, times(1)).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