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);
}
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;
}
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());
}
Aggregations