Search in sources :

Example 21 with Workspace

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

the class SecurityConfigServiceTest method setUp.

@Before
public void setUp() throws TransactionService.TransactionExecutionException {
    when(transactionService.required(any(Supplier.class))).then(invocationOnMock -> ((Supplier) invocationOnMock.getArgument(0)).get());
    stack = new Stack();
    stack.setId(123L);
    stack.setWorkspace(new Workspace());
}
Also used : Supplier(java.util.function.Supplier) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) Before(org.junit.Before)

Example 22 with Workspace

use of com.sequenceiq.cloudbreak.workspace.model.Workspace 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);
}
Also used : Tenant(com.sequenceiq.cloudbreak.workspace.model.Tenant) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) Before(org.junit.Before)

Example 23 with Workspace

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

the class MeteringAzureMetadataPatchServiceTest method createStack.

private Stack createStack() {
    Stack stack = new Stack();
    stack.setId(1L);
    stack.setType(StackType.WORKLOAD);
    stack.setCloudPlatform(CloudPlatform.AZURE.name());
    stack.setResourceCrn("crn:cdp:datahub:us-west-1:accountId:cluster:name");
    Cluster cluster = new Cluster();
    cluster.setId(1L);
    Workspace workspace = new Workspace();
    workspace.setId(1L);
    stack.setWorkspace(workspace);
    stack.setCluster(cluster);
    InstanceGroup instanceGroup = createInstanceGroup();
    instanceGroup.setInstanceMetaData(Set.of(createInstanceMetaData()));
    stack.setInstanceGroups(Set.of(instanceGroup));
    return stack;
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)

Example 24 with Workspace

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

the class DatalakeServiceTest method testGetDatalakeCrnHasResult.

@Test
public void testGetDatalakeCrnHasResult() {
    StackV4Request source = new StackV4Request();
    Workspace workspace = new Workspace();
    source.setSharedService(new SharedServiceV4Request());
    source.getSharedService().setDatalakeName("name");
    Stack output = new Stack();
    output.setResourceCrn("resultCrn");
    when(stackService.findStackByNameOrCrnAndWorkspaceId(any(), any())).thenReturn(Optional.of(output));
    String res = underTest.getDatalakeCrn(source, workspace);
    Assertions.assertTrue("resultCrn".equals(res));
}
Also used : StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) SharedServiceV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.sharedservice.SharedServiceV4Request) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test)

Example 25 with Workspace

use of com.sequenceiq.cloudbreak.workspace.model.Workspace 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;
}
Also used : Tenant(com.sequenceiq.cloudbreak.workspace.model.Tenant) User(com.sequenceiq.cloudbreak.workspace.model.User) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) 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