Search in sources :

Example 31 with Workspace

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

the class UserService method createTenantDefaultWorkspace.

private void createTenantDefaultWorkspace(Tenant tenant) {
    Workspace workspace = new Workspace();
    workspace.setTenant(tenant);
    workspace.setName(tenant.getName());
    workspace.setStatus(WorkspaceStatus.ACTIVE);
    workspaceService.create(workspace);
}
Also used : Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace)

Example 32 with Workspace

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

the class TestUtil method workspace.

public static Workspace workspace(Long id, String name) {
    Workspace workspace = new Workspace();
    workspace.setStatus(WorkspaceStatus.ACTIVE);
    workspace.setName(name);
    workspace.setId(id);
    return workspace;
}
Also used : Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace)

Example 33 with Workspace

use of com.sequenceiq.cloudbreak.workspace.model.Workspace 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;
}
Also used : CloudbreakUser(com.sequenceiq.cloudbreak.common.user.CloudbreakUser) User(com.sequenceiq.cloudbreak.workspace.model.User) Tenant(com.sequenceiq.cloudbreak.workspace.model.Tenant) SecurityConfig(com.sequenceiq.cloudbreak.domain.SecurityConfig) StackStatus(com.sequenceiq.cloudbreak.domain.stack.StackStatus) DetailedStackStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 34 with Workspace

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

the class TestUtil method recipes.

public static Set<Recipe> recipes(int count) {
    Set<Recipe> recipes = new HashSet<>();
    for (int i = 0; i < count; i++) {
        Recipe recipe = new Recipe();
        recipe.setDescription("description");
        recipe.setId((long) (i + 1));
        recipe.setName("recipe-" + (i + 1));
        recipe.setContent("base64Content");
        recipe.setRecipeType(RecipeType.POST_CLUSTER_INSTALL);
        Workspace workspace = new Workspace();
        workspace.setId(1L);
        workspace.setName("Top Secret FBI");
        recipe.setWorkspace(workspace);
        recipe.setCreator("someCreator");
        recipe.setResourceCrn("someCrn");
        recipes.add(recipe);
    }
    return recipes;
}
Also used : Recipe(com.sequenceiq.cloudbreak.domain.Recipe) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) HashSet(java.util.HashSet) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace)

Example 35 with Workspace

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

the class TestUtil method cluster.

public static Cluster cluster(Blueprint blueprint, Stack stack, Long id) {
    Cluster cluster = new Cluster();
    cluster.setClusterManagerIp("50.51.52.100");
    cluster.setStack(stack);
    cluster.setId(id);
    cluster.setName("dummyCluster");
    cluster.setClusterManagerIp("10.0.0.1");
    cluster.setBlueprint(blueprint);
    cluster.setUpSince(new Date().getTime());
    cluster.setUserName("admin");
    cluster.setPassword("admin");
    Gateway gateway = new Gateway();
    setGatewayTopology(gateway, "cb");
    cluster.setGateway(gateway);
    RDSConfig rdsConfig = new RDSConfig();
    rdsConfig.setId(generateUniqueId());
    Set<RDSConfig> rdsConfigs = new HashSet<>();
    rdsConfigs.add(rdsConfig);
    cluster.setRdsConfigs(rdsConfigs);
    cluster.setHostGroups(hostGroups(cluster));
    cluster.setConfigStrategy(ConfigStrategy.ALWAYS_APPLY_DONT_OVERRIDE_CUSTOM_VALUES);
    Map<String, String> map = new HashMap<>();
    try {
        cluster.setAttributes(new Json(map).getValue());
    } catch (IllegalArgumentException ignored) {
    }
    Workspace workspace = new Workspace();
    workspace.setName("org 1");
    workspace.setId(1L);
    cluster.setWorkspace(workspace);
    cluster.setDatabaseServerCrn("databaseCRN");
    return cluster;
}
Also used : HashMap(java.util.HashMap) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Json(com.sequenceiq.cloudbreak.common.json.Json) Date(java.util.Date) HashSet(java.util.HashSet) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace)

Aggregations

Workspace (com.sequenceiq.cloudbreak.workspace.model.Workspace)75 User (com.sequenceiq.cloudbreak.workspace.model.User)26 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)24 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)18 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)17 Tenant (com.sequenceiq.cloudbreak.workspace.model.Tenant)12 CloudbreakUser (com.sequenceiq.cloudbreak.common.user.CloudbreakUser)9 Test (org.junit.jupiter.api.Test)9 HashMap (java.util.HashMap)8 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)7 Before (org.junit.Before)7 Test (org.junit.Test)5 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)5 StackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)4 Json (com.sequenceiq.cloudbreak.common.json.Json)4 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)4 StackStatus (com.sequenceiq.cloudbreak.domain.stack.StackStatus)4 ClusterTemplate (com.sequenceiq.cloudbreak.domain.stack.cluster.ClusterTemplate)4 HashSet (java.util.HashSet)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)4