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