use of com.sequenceiq.cloudbreak.workspace.model.Tenant in project cloudbreak by hortonworks.
the class TestUtil method stack.
public static Stack stack(Status stackStatus, Credential credential) {
User user = new User();
user.setUserId("horton@hortonworks.com");
user.setUserCrn("testCrn");
user.setUserName("Alma ur");
Workspace workspace = new Workspace();
workspace.setId(1L);
Tenant tenant = new Tenant();
tenant.setName("testtenant");
workspace.setTenant(tenant);
Stack stack = new Stack();
stack.setCreator(user);
stack.setWorkspace(workspace);
stack.setStackStatus(new StackStatus(stack, stackStatus, "statusReason", DetailedStackStatus.UNKNOWN));
stack.setName("simplestack");
stack.setId(1L);
stack.setInstanceGroups(generateGcpInstanceGroups(3));
stack.setRegion("region");
stack.setCreated(123L);
stack.setCloudPlatform(credential.cloudPlatform());
stack.setOrchestrator(orchestrator());
stack.setEnvironmentCrn("envCrn");
stack.setResourceCrn("crn:cdp:cloudbreak:us-west-1:someone:stack:12345");
switch(credential.cloudPlatform()) {
case AWS:
stack.setInstanceGroups(generateAwsInstanceGroups(3));
break;
case GCP:
stack.setInstanceGroups(generateGcpInstanceGroups(3));
break;
default:
break;
}
stack.setSecurityConfig(new SecurityConfig());
return stack;
}
use of com.sequenceiq.cloudbreak.workspace.model.Tenant in project cloudbreak by hortonworks.
the class ClouderaManagerSetupServiceTest method testStack.
private Stack testStack() {
Stack stack = new Stack();
User user = new User();
user.setUserId("1");
user.setId(1L);
user.setUserName("testJoska");
user.setUserCrn("joska::crn");
user.setTenant(new Tenant());
stack.setCreator(user);
stack.setGatewayPort(1);
stack.setCluster(testCluster());
stack.setType(StackType.DATALAKE);
stack.setResourceCrn("crn:cdp:datahub:us-west-1:accountId:cluster:name");
return stack;
}
use of com.sequenceiq.cloudbreak.workspace.model.Tenant in project cloudbreak by hortonworks.
the class UserService method createUser.
private User createUser(CloudbreakUser cloudbreakUser) {
try {
return transactionService.requiresNew(() -> {
User user = new User();
user.setUserId(cloudbreakUser.getUserId());
user.setUserName(cloudbreakUser.getUsername());
user.setUserCrn(cloudbreakUser.getUserCrn());
Tenant tenant = tenantService.findByName(cloudbreakUser.getTenant()).orElse(null);
if (tenant == null) {
tenant = new Tenant();
tenant.setName(cloudbreakUser.getTenant());
tenant = tenantService.save(tenant);
createTenantDefaultWorkspace(tenant);
}
user.setTenant(tenant);
return userRepository.save(user);
});
} catch (TransactionExecutionException e) {
throw new TransactionRuntimeExecutionException(e);
}
}
use of com.sequenceiq.cloudbreak.workspace.model.Tenant in project cloudbreak by hortonworks.
the class OpdbServiceEndpointCollectorTest method createClusterWithComponents.
private Cluster createClusterWithComponents(GatewayType gatewayType) {
Cluster cluster = clusterWithOrchestrator("ANY");
GatewayTopology topology1 = gatewayTopology("proxy");
topology1.setGateway(cluster.getGateway());
cluster.getGateway().setTopologies(Collections.singleton(topology1));
cluster.getGateway().setGatewayType(gatewayType);
Workspace workspace = new Workspace();
Tenant tenant = new Tenant();
tenant.setName("tenant");
workspace.setTenant(tenant);
cluster.setWorkspace(workspace);
return cluster;
}
use of com.sequenceiq.cloudbreak.workspace.model.Tenant in project cloudbreak by hortonworks.
the class ServiceEndpointCollectorTest method mockBlueprintTextProcessor.
private void mockBlueprintTextProcessor() {
Blueprint blueprint = new Blueprint();
blueprint.setBlueprintText("{\"Blueprints\":{}}");
Workspace workspace = new Workspace();
Tenant tenant = new Tenant();
tenant.setName("tenant");
workspace.setTenant(tenant);
blueprint.setWorkspace(workspace);
when(blueprintService.getByNameForWorkspaceId(any(), anyLong())).thenReturn(blueprint);
CmTemplateProcessor cmTemplateProcessor = mock(CmTemplateProcessor.class);
when(cmTemplateProcessorFactory.get(any())).thenReturn(cmTemplateProcessor);
}
Aggregations